NetBox API
POST
circuits_circuit-terminations_create
{{baseUrl}}/circuits/circuit-terminations/
BODY json
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"circuit": 0,
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"id": 0,
"port_speed": 0,
"pp_info": "",
"site": 0,
"term_side": "",
"upstream_speed": 0,
"xconnect_id": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/circuits/circuit-terminations/");
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 \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/circuits/circuit-terminations/" {:content-type :json
:form-params {:cable {:id 0
:label ""
:url ""}
:circuit 0
:connected_endpoint {}
:connected_endpoint_type ""
:connection_status false
:description ""
:id 0
:port_speed 0
:pp_info ""
:site 0
:term_side ""
:upstream_speed 0
:xconnect_id ""}})
require "http/client"
url = "{{baseUrl}}/circuits/circuit-terminations/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\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}}/circuits/circuit-terminations/"),
Content = new StringContent("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\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}}/circuits/circuit-terminations/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/circuits/circuit-terminations/"
payload := strings.NewReader("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\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/circuits/circuit-terminations/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 315
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"circuit": 0,
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"id": 0,
"port_speed": 0,
"pp_info": "",
"site": 0,
"term_side": "",
"upstream_speed": 0,
"xconnect_id": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/circuits/circuit-terminations/")
.setHeader("content-type", "application/json")
.setBody("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/circuits/circuit-terminations/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\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 \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/circuits/circuit-terminations/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/circuits/circuit-terminations/")
.header("content-type", "application/json")
.body("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\n}")
.asString();
const data = JSON.stringify({
cable: {
id: 0,
label: '',
url: ''
},
circuit: 0,
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
id: 0,
port_speed: 0,
pp_info: '',
site: 0,
term_side: '',
upstream_speed: 0,
xconnect_id: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/circuits/circuit-terminations/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/circuits/circuit-terminations/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
circuit: 0,
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
id: 0,
port_speed: 0,
pp_info: '',
site: 0,
term_side: '',
upstream_speed: 0,
xconnect_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/circuits/circuit-terminations/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"circuit":0,"connected_endpoint":{},"connected_endpoint_type":"","connection_status":false,"description":"","id":0,"port_speed":0,"pp_info":"","site":0,"term_side":"","upstream_speed":0,"xconnect_id":""}'
};
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}}/circuits/circuit-terminations/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "circuit": 0,\n "connected_endpoint": {},\n "connected_endpoint_type": "",\n "connection_status": false,\n "description": "",\n "id": 0,\n "port_speed": 0,\n "pp_info": "",\n "site": 0,\n "term_side": "",\n "upstream_speed": 0,\n "xconnect_id": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/circuits/circuit-terminations/")
.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/circuits/circuit-terminations/',
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({
cable: {id: 0, label: '', url: ''},
circuit: 0,
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
id: 0,
port_speed: 0,
pp_info: '',
site: 0,
term_side: '',
upstream_speed: 0,
xconnect_id: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/circuits/circuit-terminations/',
headers: {'content-type': 'application/json'},
body: {
cable: {id: 0, label: '', url: ''},
circuit: 0,
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
id: 0,
port_speed: 0,
pp_info: '',
site: 0,
term_side: '',
upstream_speed: 0,
xconnect_id: ''
},
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}}/circuits/circuit-terminations/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cable: {
id: 0,
label: '',
url: ''
},
circuit: 0,
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
id: 0,
port_speed: 0,
pp_info: '',
site: 0,
term_side: '',
upstream_speed: 0,
xconnect_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/circuits/circuit-terminations/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
circuit: 0,
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
id: 0,
port_speed: 0,
pp_info: '',
site: 0,
term_side: '',
upstream_speed: 0,
xconnect_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/circuits/circuit-terminations/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"circuit":0,"connected_endpoint":{},"connected_endpoint_type":"","connection_status":false,"description":"","id":0,"port_speed":0,"pp_info":"","site":0,"term_side":"","upstream_speed":0,"xconnect_id":""}'
};
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 = @{ @"cable": @{ @"id": @0, @"label": @"", @"url": @"" },
@"circuit": @0,
@"connected_endpoint": @{ },
@"connected_endpoint_type": @"",
@"connection_status": @NO,
@"description": @"",
@"id": @0,
@"port_speed": @0,
@"pp_info": @"",
@"site": @0,
@"term_side": @"",
@"upstream_speed": @0,
@"xconnect_id": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/circuits/circuit-terminations/"]
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}}/circuits/circuit-terminations/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/circuits/circuit-terminations/",
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([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'circuit' => 0,
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'id' => 0,
'port_speed' => 0,
'pp_info' => '',
'site' => 0,
'term_side' => '',
'upstream_speed' => 0,
'xconnect_id' => ''
]),
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}}/circuits/circuit-terminations/', [
'body' => '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"circuit": 0,
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"id": 0,
"port_speed": 0,
"pp_info": "",
"site": 0,
"term_side": "",
"upstream_speed": 0,
"xconnect_id": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/circuits/circuit-terminations/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'circuit' => 0,
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'id' => 0,
'port_speed' => 0,
'pp_info' => '',
'site' => 0,
'term_side' => '',
'upstream_speed' => 0,
'xconnect_id' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'circuit' => 0,
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'id' => 0,
'port_speed' => 0,
'pp_info' => '',
'site' => 0,
'term_side' => '',
'upstream_speed' => 0,
'xconnect_id' => ''
]));
$request->setRequestUrl('{{baseUrl}}/circuits/circuit-terminations/');
$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}}/circuits/circuit-terminations/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"circuit": 0,
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"id": 0,
"port_speed": 0,
"pp_info": "",
"site": 0,
"term_side": "",
"upstream_speed": 0,
"xconnect_id": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/circuits/circuit-terminations/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"circuit": 0,
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"id": 0,
"port_speed": 0,
"pp_info": "",
"site": 0,
"term_side": "",
"upstream_speed": 0,
"xconnect_id": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/circuits/circuit-terminations/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/circuits/circuit-terminations/"
payload = {
"cable": {
"id": 0,
"label": "",
"url": ""
},
"circuit": 0,
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": False,
"description": "",
"id": 0,
"port_speed": 0,
"pp_info": "",
"site": 0,
"term_side": "",
"upstream_speed": 0,
"xconnect_id": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/circuits/circuit-terminations/"
payload <- "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\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}}/circuits/circuit-terminations/")
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 \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\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/circuits/circuit-terminations/') do |req|
req.body = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/circuits/circuit-terminations/";
let payload = json!({
"cable": json!({
"id": 0,
"label": "",
"url": ""
}),
"circuit": 0,
"connected_endpoint": json!({}),
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"id": 0,
"port_speed": 0,
"pp_info": "",
"site": 0,
"term_side": "",
"upstream_speed": 0,
"xconnect_id": ""
});
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}}/circuits/circuit-terminations/ \
--header 'content-type: application/json' \
--data '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"circuit": 0,
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"id": 0,
"port_speed": 0,
"pp_info": "",
"site": 0,
"term_side": "",
"upstream_speed": 0,
"xconnect_id": ""
}'
echo '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"circuit": 0,
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"id": 0,
"port_speed": 0,
"pp_info": "",
"site": 0,
"term_side": "",
"upstream_speed": 0,
"xconnect_id": ""
}' | \
http POST {{baseUrl}}/circuits/circuit-terminations/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "circuit": 0,\n "connected_endpoint": {},\n "connected_endpoint_type": "",\n "connection_status": false,\n "description": "",\n "id": 0,\n "port_speed": 0,\n "pp_info": "",\n "site": 0,\n "term_side": "",\n "upstream_speed": 0,\n "xconnect_id": ""\n}' \
--output-document \
- {{baseUrl}}/circuits/circuit-terminations/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cable": [
"id": 0,
"label": "",
"url": ""
],
"circuit": 0,
"connected_endpoint": [],
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"id": 0,
"port_speed": 0,
"pp_info": "",
"site": 0,
"term_side": "",
"upstream_speed": 0,
"xconnect_id": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/circuits/circuit-terminations/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
circuits_circuit-terminations_delete
{{baseUrl}}/circuits/circuit-terminations/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/circuits/circuit-terminations/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/circuits/circuit-terminations/:id/")
require "http/client"
url = "{{baseUrl}}/circuits/circuit-terminations/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/circuits/circuit-terminations/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/circuits/circuit-terminations/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/circuits/circuit-terminations/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/circuits/circuit-terminations/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/circuits/circuit-terminations/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/circuits/circuit-terminations/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/circuits/circuit-terminations/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/circuits/circuit-terminations/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/circuits/circuit-terminations/:id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/circuits/circuit-terminations/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/circuits/circuit-terminations/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/circuits/circuit-terminations/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/circuits/circuit-terminations/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/circuits/circuit-terminations/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/circuits/circuit-terminations/:id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/circuits/circuit-terminations/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/circuits/circuit-terminations/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/circuits/circuit-terminations/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/circuits/circuit-terminations/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/circuits/circuit-terminations/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/circuits/circuit-terminations/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/circuits/circuit-terminations/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/circuits/circuit-terminations/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/circuits/circuit-terminations/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/circuits/circuit-terminations/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/circuits/circuit-terminations/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/circuits/circuit-terminations/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/circuits/circuit-terminations/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/circuits/circuit-terminations/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/circuits/circuit-terminations/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/circuits/circuit-terminations/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/circuits/circuit-terminations/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/circuits/circuit-terminations/:id/
http DELETE {{baseUrl}}/circuits/circuit-terminations/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/circuits/circuit-terminations/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/circuits/circuit-terminations/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
circuits_circuit-terminations_list
{{baseUrl}}/circuits/circuit-terminations/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/circuits/circuit-terminations/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/circuits/circuit-terminations/")
require "http/client"
url = "{{baseUrl}}/circuits/circuit-terminations/"
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}}/circuits/circuit-terminations/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/circuits/circuit-terminations/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/circuits/circuit-terminations/"
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/circuits/circuit-terminations/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/circuits/circuit-terminations/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/circuits/circuit-terminations/"))
.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}}/circuits/circuit-terminations/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/circuits/circuit-terminations/")
.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}}/circuits/circuit-terminations/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/circuits/circuit-terminations/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/circuits/circuit-terminations/';
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}}/circuits/circuit-terminations/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/circuits/circuit-terminations/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/circuits/circuit-terminations/',
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}}/circuits/circuit-terminations/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/circuits/circuit-terminations/');
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}}/circuits/circuit-terminations/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/circuits/circuit-terminations/';
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}}/circuits/circuit-terminations/"]
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}}/circuits/circuit-terminations/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/circuits/circuit-terminations/",
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}}/circuits/circuit-terminations/');
echo $response->getBody();
setUrl('{{baseUrl}}/circuits/circuit-terminations/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/circuits/circuit-terminations/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/circuits/circuit-terminations/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/circuits/circuit-terminations/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/circuits/circuit-terminations/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/circuits/circuit-terminations/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/circuits/circuit-terminations/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/circuits/circuit-terminations/")
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/circuits/circuit-terminations/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/circuits/circuit-terminations/";
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}}/circuits/circuit-terminations/
http GET {{baseUrl}}/circuits/circuit-terminations/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/circuits/circuit-terminations/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/circuits/circuit-terminations/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
circuits_circuit-terminations_partial_update
{{baseUrl}}/circuits/circuit-terminations/:id/
BODY json
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"circuit": 0,
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"id": 0,
"port_speed": 0,
"pp_info": "",
"site": 0,
"term_side": "",
"upstream_speed": 0,
"xconnect_id": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/circuits/circuit-terminations/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/circuits/circuit-terminations/:id/" {:content-type :json
:form-params {:cable {:id 0
:label ""
:url ""}
:circuit 0
:connected_endpoint {}
:connected_endpoint_type ""
:connection_status false
:description ""
:id 0
:port_speed 0
:pp_info ""
:site 0
:term_side ""
:upstream_speed 0
:xconnect_id ""}})
require "http/client"
url = "{{baseUrl}}/circuits/circuit-terminations/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\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}}/circuits/circuit-terminations/:id/"),
Content = new StringContent("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\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}}/circuits/circuit-terminations/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/circuits/circuit-terminations/:id/"
payload := strings.NewReader("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\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/circuits/circuit-terminations/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 315
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"circuit": 0,
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"id": 0,
"port_speed": 0,
"pp_info": "",
"site": 0,
"term_side": "",
"upstream_speed": 0,
"xconnect_id": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/circuits/circuit-terminations/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/circuits/circuit-terminations/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\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 \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/circuits/circuit-terminations/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/circuits/circuit-terminations/:id/")
.header("content-type", "application/json")
.body("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\n}")
.asString();
const data = JSON.stringify({
cable: {
id: 0,
label: '',
url: ''
},
circuit: 0,
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
id: 0,
port_speed: 0,
pp_info: '',
site: 0,
term_side: '',
upstream_speed: 0,
xconnect_id: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/circuits/circuit-terminations/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/circuits/circuit-terminations/:id/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
circuit: 0,
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
id: 0,
port_speed: 0,
pp_info: '',
site: 0,
term_side: '',
upstream_speed: 0,
xconnect_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/circuits/circuit-terminations/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"circuit":0,"connected_endpoint":{},"connected_endpoint_type":"","connection_status":false,"description":"","id":0,"port_speed":0,"pp_info":"","site":0,"term_side":"","upstream_speed":0,"xconnect_id":""}'
};
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}}/circuits/circuit-terminations/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "circuit": 0,\n "connected_endpoint": {},\n "connected_endpoint_type": "",\n "connection_status": false,\n "description": "",\n "id": 0,\n "port_speed": 0,\n "pp_info": "",\n "site": 0,\n "term_side": "",\n "upstream_speed": 0,\n "xconnect_id": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/circuits/circuit-terminations/:id/")
.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/circuits/circuit-terminations/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
cable: {id: 0, label: '', url: ''},
circuit: 0,
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
id: 0,
port_speed: 0,
pp_info: '',
site: 0,
term_side: '',
upstream_speed: 0,
xconnect_id: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/circuits/circuit-terminations/:id/',
headers: {'content-type': 'application/json'},
body: {
cable: {id: 0, label: '', url: ''},
circuit: 0,
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
id: 0,
port_speed: 0,
pp_info: '',
site: 0,
term_side: '',
upstream_speed: 0,
xconnect_id: ''
},
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}}/circuits/circuit-terminations/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cable: {
id: 0,
label: '',
url: ''
},
circuit: 0,
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
id: 0,
port_speed: 0,
pp_info: '',
site: 0,
term_side: '',
upstream_speed: 0,
xconnect_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/circuits/circuit-terminations/:id/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
circuit: 0,
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
id: 0,
port_speed: 0,
pp_info: '',
site: 0,
term_side: '',
upstream_speed: 0,
xconnect_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/circuits/circuit-terminations/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"circuit":0,"connected_endpoint":{},"connected_endpoint_type":"","connection_status":false,"description":"","id":0,"port_speed":0,"pp_info":"","site":0,"term_side":"","upstream_speed":0,"xconnect_id":""}'
};
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 = @{ @"cable": @{ @"id": @0, @"label": @"", @"url": @"" },
@"circuit": @0,
@"connected_endpoint": @{ },
@"connected_endpoint_type": @"",
@"connection_status": @NO,
@"description": @"",
@"id": @0,
@"port_speed": @0,
@"pp_info": @"",
@"site": @0,
@"term_side": @"",
@"upstream_speed": @0,
@"xconnect_id": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/circuits/circuit-terminations/:id/"]
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}}/circuits/circuit-terminations/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/circuits/circuit-terminations/:id/",
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([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'circuit' => 0,
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'id' => 0,
'port_speed' => 0,
'pp_info' => '',
'site' => 0,
'term_side' => '',
'upstream_speed' => 0,
'xconnect_id' => ''
]),
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}}/circuits/circuit-terminations/:id/', [
'body' => '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"circuit": 0,
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"id": 0,
"port_speed": 0,
"pp_info": "",
"site": 0,
"term_side": "",
"upstream_speed": 0,
"xconnect_id": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/circuits/circuit-terminations/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'circuit' => 0,
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'id' => 0,
'port_speed' => 0,
'pp_info' => '',
'site' => 0,
'term_side' => '',
'upstream_speed' => 0,
'xconnect_id' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'circuit' => 0,
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'id' => 0,
'port_speed' => 0,
'pp_info' => '',
'site' => 0,
'term_side' => '',
'upstream_speed' => 0,
'xconnect_id' => ''
]));
$request->setRequestUrl('{{baseUrl}}/circuits/circuit-terminations/:id/');
$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}}/circuits/circuit-terminations/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"circuit": 0,
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"id": 0,
"port_speed": 0,
"pp_info": "",
"site": 0,
"term_side": "",
"upstream_speed": 0,
"xconnect_id": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/circuits/circuit-terminations/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"circuit": 0,
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"id": 0,
"port_speed": 0,
"pp_info": "",
"site": 0,
"term_side": "",
"upstream_speed": 0,
"xconnect_id": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/circuits/circuit-terminations/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/circuits/circuit-terminations/:id/"
payload = {
"cable": {
"id": 0,
"label": "",
"url": ""
},
"circuit": 0,
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": False,
"description": "",
"id": 0,
"port_speed": 0,
"pp_info": "",
"site": 0,
"term_side": "",
"upstream_speed": 0,
"xconnect_id": ""
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/circuits/circuit-terminations/:id/"
payload <- "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\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}}/circuits/circuit-terminations/:id/")
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 \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\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/circuits/circuit-terminations/:id/') do |req|
req.body = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\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}}/circuits/circuit-terminations/:id/";
let payload = json!({
"cable": json!({
"id": 0,
"label": "",
"url": ""
}),
"circuit": 0,
"connected_endpoint": json!({}),
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"id": 0,
"port_speed": 0,
"pp_info": "",
"site": 0,
"term_side": "",
"upstream_speed": 0,
"xconnect_id": ""
});
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}}/circuits/circuit-terminations/:id/ \
--header 'content-type: application/json' \
--data '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"circuit": 0,
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"id": 0,
"port_speed": 0,
"pp_info": "",
"site": 0,
"term_side": "",
"upstream_speed": 0,
"xconnect_id": ""
}'
echo '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"circuit": 0,
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"id": 0,
"port_speed": 0,
"pp_info": "",
"site": 0,
"term_side": "",
"upstream_speed": 0,
"xconnect_id": ""
}' | \
http PATCH {{baseUrl}}/circuits/circuit-terminations/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "circuit": 0,\n "connected_endpoint": {},\n "connected_endpoint_type": "",\n "connection_status": false,\n "description": "",\n "id": 0,\n "port_speed": 0,\n "pp_info": "",\n "site": 0,\n "term_side": "",\n "upstream_speed": 0,\n "xconnect_id": ""\n}' \
--output-document \
- {{baseUrl}}/circuits/circuit-terminations/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cable": [
"id": 0,
"label": "",
"url": ""
],
"circuit": 0,
"connected_endpoint": [],
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"id": 0,
"port_speed": 0,
"pp_info": "",
"site": 0,
"term_side": "",
"upstream_speed": 0,
"xconnect_id": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/circuits/circuit-terminations/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
circuits_circuit-terminations_read
{{baseUrl}}/circuits/circuit-terminations/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/circuits/circuit-terminations/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/circuits/circuit-terminations/:id/")
require "http/client"
url = "{{baseUrl}}/circuits/circuit-terminations/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/circuits/circuit-terminations/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/circuits/circuit-terminations/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/circuits/circuit-terminations/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/circuits/circuit-terminations/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/circuits/circuit-terminations/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/circuits/circuit-terminations/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/circuits/circuit-terminations/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/circuits/circuit-terminations/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/circuits/circuit-terminations/:id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/circuits/circuit-terminations/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/circuits/circuit-terminations/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/circuits/circuit-terminations/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/circuits/circuit-terminations/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/circuits/circuit-terminations/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/circuits/circuit-terminations/:id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/circuits/circuit-terminations/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/circuits/circuit-terminations/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/circuits/circuit-terminations/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/circuits/circuit-terminations/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/circuits/circuit-terminations/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/circuits/circuit-terminations/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/circuits/circuit-terminations/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/circuits/circuit-terminations/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/circuits/circuit-terminations/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/circuits/circuit-terminations/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/circuits/circuit-terminations/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/circuits/circuit-terminations/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/circuits/circuit-terminations/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/circuits/circuit-terminations/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/circuits/circuit-terminations/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/circuits/circuit-terminations/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/circuits/circuit-terminations/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/circuits/circuit-terminations/:id/
http GET {{baseUrl}}/circuits/circuit-terminations/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/circuits/circuit-terminations/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/circuits/circuit-terminations/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
circuits_circuit-terminations_update
{{baseUrl}}/circuits/circuit-terminations/:id/
BODY json
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"circuit": 0,
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"id": 0,
"port_speed": 0,
"pp_info": "",
"site": 0,
"term_side": "",
"upstream_speed": 0,
"xconnect_id": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/circuits/circuit-terminations/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/circuits/circuit-terminations/:id/" {:content-type :json
:form-params {:cable {:id 0
:label ""
:url ""}
:circuit 0
:connected_endpoint {}
:connected_endpoint_type ""
:connection_status false
:description ""
:id 0
:port_speed 0
:pp_info ""
:site 0
:term_side ""
:upstream_speed 0
:xconnect_id ""}})
require "http/client"
url = "{{baseUrl}}/circuits/circuit-terminations/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\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}}/circuits/circuit-terminations/:id/"),
Content = new StringContent("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\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}}/circuits/circuit-terminations/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/circuits/circuit-terminations/:id/"
payload := strings.NewReader("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\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/circuits/circuit-terminations/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 315
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"circuit": 0,
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"id": 0,
"port_speed": 0,
"pp_info": "",
"site": 0,
"term_side": "",
"upstream_speed": 0,
"xconnect_id": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/circuits/circuit-terminations/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/circuits/circuit-terminations/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\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 \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/circuits/circuit-terminations/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/circuits/circuit-terminations/:id/")
.header("content-type", "application/json")
.body("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\n}")
.asString();
const data = JSON.stringify({
cable: {
id: 0,
label: '',
url: ''
},
circuit: 0,
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
id: 0,
port_speed: 0,
pp_info: '',
site: 0,
term_side: '',
upstream_speed: 0,
xconnect_id: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/circuits/circuit-terminations/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/circuits/circuit-terminations/:id/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
circuit: 0,
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
id: 0,
port_speed: 0,
pp_info: '',
site: 0,
term_side: '',
upstream_speed: 0,
xconnect_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/circuits/circuit-terminations/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"circuit":0,"connected_endpoint":{},"connected_endpoint_type":"","connection_status":false,"description":"","id":0,"port_speed":0,"pp_info":"","site":0,"term_side":"","upstream_speed":0,"xconnect_id":""}'
};
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}}/circuits/circuit-terminations/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "circuit": 0,\n "connected_endpoint": {},\n "connected_endpoint_type": "",\n "connection_status": false,\n "description": "",\n "id": 0,\n "port_speed": 0,\n "pp_info": "",\n "site": 0,\n "term_side": "",\n "upstream_speed": 0,\n "xconnect_id": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/circuits/circuit-terminations/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/circuits/circuit-terminations/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
cable: {id: 0, label: '', url: ''},
circuit: 0,
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
id: 0,
port_speed: 0,
pp_info: '',
site: 0,
term_side: '',
upstream_speed: 0,
xconnect_id: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/circuits/circuit-terminations/:id/',
headers: {'content-type': 'application/json'},
body: {
cable: {id: 0, label: '', url: ''},
circuit: 0,
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
id: 0,
port_speed: 0,
pp_info: '',
site: 0,
term_side: '',
upstream_speed: 0,
xconnect_id: ''
},
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}}/circuits/circuit-terminations/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cable: {
id: 0,
label: '',
url: ''
},
circuit: 0,
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
id: 0,
port_speed: 0,
pp_info: '',
site: 0,
term_side: '',
upstream_speed: 0,
xconnect_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/circuits/circuit-terminations/:id/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
circuit: 0,
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
id: 0,
port_speed: 0,
pp_info: '',
site: 0,
term_side: '',
upstream_speed: 0,
xconnect_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/circuits/circuit-terminations/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"circuit":0,"connected_endpoint":{},"connected_endpoint_type":"","connection_status":false,"description":"","id":0,"port_speed":0,"pp_info":"","site":0,"term_side":"","upstream_speed":0,"xconnect_id":""}'
};
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 = @{ @"cable": @{ @"id": @0, @"label": @"", @"url": @"" },
@"circuit": @0,
@"connected_endpoint": @{ },
@"connected_endpoint_type": @"",
@"connection_status": @NO,
@"description": @"",
@"id": @0,
@"port_speed": @0,
@"pp_info": @"",
@"site": @0,
@"term_side": @"",
@"upstream_speed": @0,
@"xconnect_id": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/circuits/circuit-terminations/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/circuits/circuit-terminations/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/circuits/circuit-terminations/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'circuit' => 0,
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'id' => 0,
'port_speed' => 0,
'pp_info' => '',
'site' => 0,
'term_side' => '',
'upstream_speed' => 0,
'xconnect_id' => ''
]),
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}}/circuits/circuit-terminations/:id/', [
'body' => '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"circuit": 0,
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"id": 0,
"port_speed": 0,
"pp_info": "",
"site": 0,
"term_side": "",
"upstream_speed": 0,
"xconnect_id": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/circuits/circuit-terminations/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'circuit' => 0,
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'id' => 0,
'port_speed' => 0,
'pp_info' => '',
'site' => 0,
'term_side' => '',
'upstream_speed' => 0,
'xconnect_id' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'circuit' => 0,
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'id' => 0,
'port_speed' => 0,
'pp_info' => '',
'site' => 0,
'term_side' => '',
'upstream_speed' => 0,
'xconnect_id' => ''
]));
$request->setRequestUrl('{{baseUrl}}/circuits/circuit-terminations/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/circuits/circuit-terminations/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"circuit": 0,
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"id": 0,
"port_speed": 0,
"pp_info": "",
"site": 0,
"term_side": "",
"upstream_speed": 0,
"xconnect_id": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/circuits/circuit-terminations/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"circuit": 0,
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"id": 0,
"port_speed": 0,
"pp_info": "",
"site": 0,
"term_side": "",
"upstream_speed": 0,
"xconnect_id": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/circuits/circuit-terminations/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/circuits/circuit-terminations/:id/"
payload = {
"cable": {
"id": 0,
"label": "",
"url": ""
},
"circuit": 0,
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": False,
"description": "",
"id": 0,
"port_speed": 0,
"pp_info": "",
"site": 0,
"term_side": "",
"upstream_speed": 0,
"xconnect_id": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/circuits/circuit-terminations/:id/"
payload <- "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\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}}/circuits/circuit-terminations/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\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/circuits/circuit-terminations/:id/') do |req|
req.body = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"circuit\": 0,\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"id\": 0,\n \"port_speed\": 0,\n \"pp_info\": \"\",\n \"site\": 0,\n \"term_side\": \"\",\n \"upstream_speed\": 0,\n \"xconnect_id\": \"\"\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}}/circuits/circuit-terminations/:id/";
let payload = json!({
"cable": json!({
"id": 0,
"label": "",
"url": ""
}),
"circuit": 0,
"connected_endpoint": json!({}),
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"id": 0,
"port_speed": 0,
"pp_info": "",
"site": 0,
"term_side": "",
"upstream_speed": 0,
"xconnect_id": ""
});
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}}/circuits/circuit-terminations/:id/ \
--header 'content-type: application/json' \
--data '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"circuit": 0,
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"id": 0,
"port_speed": 0,
"pp_info": "",
"site": 0,
"term_side": "",
"upstream_speed": 0,
"xconnect_id": ""
}'
echo '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"circuit": 0,
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"id": 0,
"port_speed": 0,
"pp_info": "",
"site": 0,
"term_side": "",
"upstream_speed": 0,
"xconnect_id": ""
}' | \
http PUT {{baseUrl}}/circuits/circuit-terminations/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "circuit": 0,\n "connected_endpoint": {},\n "connected_endpoint_type": "",\n "connection_status": false,\n "description": "",\n "id": 0,\n "port_speed": 0,\n "pp_info": "",\n "site": 0,\n "term_side": "",\n "upstream_speed": 0,\n "xconnect_id": ""\n}' \
--output-document \
- {{baseUrl}}/circuits/circuit-terminations/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cable": [
"id": 0,
"label": "",
"url": ""
],
"circuit": 0,
"connected_endpoint": [],
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"id": 0,
"port_speed": 0,
"pp_info": "",
"site": 0,
"term_side": "",
"upstream_speed": 0,
"xconnect_id": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/circuits/circuit-terminations/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
circuits_circuit-types_create
{{baseUrl}}/circuits/circuit-types/
BODY json
{
"circuit_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/circuits/circuit-types/");
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 \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/circuits/circuit-types/" {:content-type :json
:form-params {:circuit_count 0
:description ""
:id 0
:name ""
:slug ""}})
require "http/client"
url = "{{baseUrl}}/circuits/circuit-types/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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}}/circuits/circuit-types/"),
Content = new StringContent("{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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}}/circuits/circuit-types/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/circuits/circuit-types/"
payload := strings.NewReader("{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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/circuits/circuit-types/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 84
{
"circuit_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/circuits/circuit-types/")
.setHeader("content-type", "application/json")
.setBody("{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/circuits/circuit-types/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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 \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/circuits/circuit-types/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/circuits/circuit-types/")
.header("content-type", "application/json")
.body("{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}")
.asString();
const data = JSON.stringify({
circuit_count: 0,
description: '',
id: 0,
name: '',
slug: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/circuits/circuit-types/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/circuits/circuit-types/',
headers: {'content-type': 'application/json'},
data: {circuit_count: 0, description: '', id: 0, name: '', slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/circuits/circuit-types/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"circuit_count":0,"description":"","id":0,"name":"","slug":""}'
};
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}}/circuits/circuit-types/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "circuit_count": 0,\n "description": "",\n "id": 0,\n "name": "",\n "slug": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/circuits/circuit-types/")
.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/circuits/circuit-types/',
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({circuit_count: 0, description: '', id: 0, name: '', slug: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/circuits/circuit-types/',
headers: {'content-type': 'application/json'},
body: {circuit_count: 0, description: '', id: 0, name: '', slug: ''},
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}}/circuits/circuit-types/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
circuit_count: 0,
description: '',
id: 0,
name: '',
slug: ''
});
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}}/circuits/circuit-types/',
headers: {'content-type': 'application/json'},
data: {circuit_count: 0, description: '', id: 0, name: '', slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/circuits/circuit-types/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"circuit_count":0,"description":"","id":0,"name":"","slug":""}'
};
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 = @{ @"circuit_count": @0,
@"description": @"",
@"id": @0,
@"name": @"",
@"slug": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/circuits/circuit-types/"]
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}}/circuits/circuit-types/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/circuits/circuit-types/",
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([
'circuit_count' => 0,
'description' => '',
'id' => 0,
'name' => '',
'slug' => ''
]),
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}}/circuits/circuit-types/', [
'body' => '{
"circuit_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/circuits/circuit-types/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'circuit_count' => 0,
'description' => '',
'id' => 0,
'name' => '',
'slug' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'circuit_count' => 0,
'description' => '',
'id' => 0,
'name' => '',
'slug' => ''
]));
$request->setRequestUrl('{{baseUrl}}/circuits/circuit-types/');
$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}}/circuits/circuit-types/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"circuit_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/circuits/circuit-types/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"circuit_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/circuits/circuit-types/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/circuits/circuit-types/"
payload = {
"circuit_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/circuits/circuit-types/"
payload <- "{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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}}/circuits/circuit-types/")
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 \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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/circuits/circuit-types/') do |req|
req.body = "{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/circuits/circuit-types/";
let payload = json!({
"circuit_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
});
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}}/circuits/circuit-types/ \
--header 'content-type: application/json' \
--data '{
"circuit_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}'
echo '{
"circuit_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}' | \
http POST {{baseUrl}}/circuits/circuit-types/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "circuit_count": 0,\n "description": "",\n "id": 0,\n "name": "",\n "slug": ""\n}' \
--output-document \
- {{baseUrl}}/circuits/circuit-types/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"circuit_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/circuits/circuit-types/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
circuits_circuit-types_delete
{{baseUrl}}/circuits/circuit-types/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/circuits/circuit-types/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/circuits/circuit-types/:id/")
require "http/client"
url = "{{baseUrl}}/circuits/circuit-types/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/circuits/circuit-types/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/circuits/circuit-types/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/circuits/circuit-types/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/circuits/circuit-types/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/circuits/circuit-types/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/circuits/circuit-types/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/circuits/circuit-types/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/circuits/circuit-types/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/circuits/circuit-types/:id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/circuits/circuit-types/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/circuits/circuit-types/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/circuits/circuit-types/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/circuits/circuit-types/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/circuits/circuit-types/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/circuits/circuit-types/:id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/circuits/circuit-types/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/circuits/circuit-types/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/circuits/circuit-types/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/circuits/circuit-types/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/circuits/circuit-types/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/circuits/circuit-types/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/circuits/circuit-types/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/circuits/circuit-types/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/circuits/circuit-types/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/circuits/circuit-types/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/circuits/circuit-types/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/circuits/circuit-types/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/circuits/circuit-types/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/circuits/circuit-types/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/circuits/circuit-types/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/circuits/circuit-types/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/circuits/circuit-types/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/circuits/circuit-types/:id/
http DELETE {{baseUrl}}/circuits/circuit-types/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/circuits/circuit-types/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/circuits/circuit-types/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
circuits_circuit-types_list
{{baseUrl}}/circuits/circuit-types/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/circuits/circuit-types/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/circuits/circuit-types/")
require "http/client"
url = "{{baseUrl}}/circuits/circuit-types/"
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}}/circuits/circuit-types/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/circuits/circuit-types/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/circuits/circuit-types/"
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/circuits/circuit-types/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/circuits/circuit-types/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/circuits/circuit-types/"))
.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}}/circuits/circuit-types/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/circuits/circuit-types/")
.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}}/circuits/circuit-types/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/circuits/circuit-types/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/circuits/circuit-types/';
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}}/circuits/circuit-types/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/circuits/circuit-types/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/circuits/circuit-types/',
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}}/circuits/circuit-types/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/circuits/circuit-types/');
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}}/circuits/circuit-types/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/circuits/circuit-types/';
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}}/circuits/circuit-types/"]
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}}/circuits/circuit-types/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/circuits/circuit-types/",
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}}/circuits/circuit-types/');
echo $response->getBody();
setUrl('{{baseUrl}}/circuits/circuit-types/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/circuits/circuit-types/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/circuits/circuit-types/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/circuits/circuit-types/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/circuits/circuit-types/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/circuits/circuit-types/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/circuits/circuit-types/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/circuits/circuit-types/")
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/circuits/circuit-types/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/circuits/circuit-types/";
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}}/circuits/circuit-types/
http GET {{baseUrl}}/circuits/circuit-types/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/circuits/circuit-types/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/circuits/circuit-types/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
circuits_circuit-types_partial_update
{{baseUrl}}/circuits/circuit-types/:id/
BODY json
{
"circuit_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/circuits/circuit-types/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/circuits/circuit-types/:id/" {:content-type :json
:form-params {:circuit_count 0
:description ""
:id 0
:name ""
:slug ""}})
require "http/client"
url = "{{baseUrl}}/circuits/circuit-types/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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}}/circuits/circuit-types/:id/"),
Content = new StringContent("{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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}}/circuits/circuit-types/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/circuits/circuit-types/:id/"
payload := strings.NewReader("{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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/circuits/circuit-types/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 84
{
"circuit_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/circuits/circuit-types/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/circuits/circuit-types/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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 \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/circuits/circuit-types/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/circuits/circuit-types/:id/")
.header("content-type", "application/json")
.body("{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}")
.asString();
const data = JSON.stringify({
circuit_count: 0,
description: '',
id: 0,
name: '',
slug: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/circuits/circuit-types/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/circuits/circuit-types/:id/',
headers: {'content-type': 'application/json'},
data: {circuit_count: 0, description: '', id: 0, name: '', slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/circuits/circuit-types/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"circuit_count":0,"description":"","id":0,"name":"","slug":""}'
};
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}}/circuits/circuit-types/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "circuit_count": 0,\n "description": "",\n "id": 0,\n "name": "",\n "slug": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/circuits/circuit-types/:id/")
.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/circuits/circuit-types/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({circuit_count: 0, description: '', id: 0, name: '', slug: ''}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/circuits/circuit-types/:id/',
headers: {'content-type': 'application/json'},
body: {circuit_count: 0, description: '', id: 0, name: '', slug: ''},
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}}/circuits/circuit-types/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
circuit_count: 0,
description: '',
id: 0,
name: '',
slug: ''
});
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}}/circuits/circuit-types/:id/',
headers: {'content-type': 'application/json'},
data: {circuit_count: 0, description: '', id: 0, name: '', slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/circuits/circuit-types/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"circuit_count":0,"description":"","id":0,"name":"","slug":""}'
};
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 = @{ @"circuit_count": @0,
@"description": @"",
@"id": @0,
@"name": @"",
@"slug": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/circuits/circuit-types/:id/"]
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}}/circuits/circuit-types/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/circuits/circuit-types/:id/",
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([
'circuit_count' => 0,
'description' => '',
'id' => 0,
'name' => '',
'slug' => ''
]),
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}}/circuits/circuit-types/:id/', [
'body' => '{
"circuit_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/circuits/circuit-types/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'circuit_count' => 0,
'description' => '',
'id' => 0,
'name' => '',
'slug' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'circuit_count' => 0,
'description' => '',
'id' => 0,
'name' => '',
'slug' => ''
]));
$request->setRequestUrl('{{baseUrl}}/circuits/circuit-types/:id/');
$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}}/circuits/circuit-types/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"circuit_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/circuits/circuit-types/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"circuit_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/circuits/circuit-types/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/circuits/circuit-types/:id/"
payload = {
"circuit_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/circuits/circuit-types/:id/"
payload <- "{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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}}/circuits/circuit-types/:id/")
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 \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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/circuits/circuit-types/:id/') do |req|
req.body = "{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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}}/circuits/circuit-types/:id/";
let payload = json!({
"circuit_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
});
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}}/circuits/circuit-types/:id/ \
--header 'content-type: application/json' \
--data '{
"circuit_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}'
echo '{
"circuit_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}' | \
http PATCH {{baseUrl}}/circuits/circuit-types/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "circuit_count": 0,\n "description": "",\n "id": 0,\n "name": "",\n "slug": ""\n}' \
--output-document \
- {{baseUrl}}/circuits/circuit-types/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"circuit_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/circuits/circuit-types/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
circuits_circuit-types_read
{{baseUrl}}/circuits/circuit-types/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/circuits/circuit-types/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/circuits/circuit-types/:id/")
require "http/client"
url = "{{baseUrl}}/circuits/circuit-types/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/circuits/circuit-types/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/circuits/circuit-types/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/circuits/circuit-types/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/circuits/circuit-types/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/circuits/circuit-types/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/circuits/circuit-types/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/circuits/circuit-types/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/circuits/circuit-types/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/circuits/circuit-types/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/circuits/circuit-types/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/circuits/circuit-types/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/circuits/circuit-types/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/circuits/circuit-types/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/circuits/circuit-types/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/circuits/circuit-types/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/circuits/circuit-types/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/circuits/circuit-types/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/circuits/circuit-types/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/circuits/circuit-types/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/circuits/circuit-types/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/circuits/circuit-types/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/circuits/circuit-types/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/circuits/circuit-types/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/circuits/circuit-types/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/circuits/circuit-types/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/circuits/circuit-types/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/circuits/circuit-types/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/circuits/circuit-types/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/circuits/circuit-types/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/circuits/circuit-types/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/circuits/circuit-types/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/circuits/circuit-types/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/circuits/circuit-types/:id/
http GET {{baseUrl}}/circuits/circuit-types/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/circuits/circuit-types/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/circuits/circuit-types/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
circuits_circuit-types_update
{{baseUrl}}/circuits/circuit-types/:id/
BODY json
{
"circuit_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/circuits/circuit-types/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/circuits/circuit-types/:id/" {:content-type :json
:form-params {:circuit_count 0
:description ""
:id 0
:name ""
:slug ""}})
require "http/client"
url = "{{baseUrl}}/circuits/circuit-types/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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}}/circuits/circuit-types/:id/"),
Content = new StringContent("{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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}}/circuits/circuit-types/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/circuits/circuit-types/:id/"
payload := strings.NewReader("{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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/circuits/circuit-types/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 84
{
"circuit_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/circuits/circuit-types/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/circuits/circuit-types/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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 \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/circuits/circuit-types/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/circuits/circuit-types/:id/")
.header("content-type", "application/json")
.body("{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}")
.asString();
const data = JSON.stringify({
circuit_count: 0,
description: '',
id: 0,
name: '',
slug: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/circuits/circuit-types/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/circuits/circuit-types/:id/',
headers: {'content-type': 'application/json'},
data: {circuit_count: 0, description: '', id: 0, name: '', slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/circuits/circuit-types/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"circuit_count":0,"description":"","id":0,"name":"","slug":""}'
};
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}}/circuits/circuit-types/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "circuit_count": 0,\n "description": "",\n "id": 0,\n "name": "",\n "slug": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/circuits/circuit-types/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/circuits/circuit-types/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({circuit_count: 0, description: '', id: 0, name: '', slug: ''}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/circuits/circuit-types/:id/',
headers: {'content-type': 'application/json'},
body: {circuit_count: 0, description: '', id: 0, name: '', slug: ''},
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}}/circuits/circuit-types/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
circuit_count: 0,
description: '',
id: 0,
name: '',
slug: ''
});
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}}/circuits/circuit-types/:id/',
headers: {'content-type': 'application/json'},
data: {circuit_count: 0, description: '', id: 0, name: '', slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/circuits/circuit-types/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"circuit_count":0,"description":"","id":0,"name":"","slug":""}'
};
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 = @{ @"circuit_count": @0,
@"description": @"",
@"id": @0,
@"name": @"",
@"slug": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/circuits/circuit-types/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/circuits/circuit-types/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/circuits/circuit-types/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'circuit_count' => 0,
'description' => '',
'id' => 0,
'name' => '',
'slug' => ''
]),
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}}/circuits/circuit-types/:id/', [
'body' => '{
"circuit_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/circuits/circuit-types/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'circuit_count' => 0,
'description' => '',
'id' => 0,
'name' => '',
'slug' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'circuit_count' => 0,
'description' => '',
'id' => 0,
'name' => '',
'slug' => ''
]));
$request->setRequestUrl('{{baseUrl}}/circuits/circuit-types/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/circuits/circuit-types/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"circuit_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/circuits/circuit-types/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"circuit_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/circuits/circuit-types/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/circuits/circuit-types/:id/"
payload = {
"circuit_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/circuits/circuit-types/:id/"
payload <- "{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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}}/circuits/circuit-types/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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/circuits/circuit-types/:id/') do |req|
req.body = "{\n \"circuit_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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}}/circuits/circuit-types/:id/";
let payload = json!({
"circuit_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
});
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}}/circuits/circuit-types/:id/ \
--header 'content-type: application/json' \
--data '{
"circuit_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}'
echo '{
"circuit_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}' | \
http PUT {{baseUrl}}/circuits/circuit-types/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "circuit_count": 0,\n "description": "",\n "id": 0,\n "name": "",\n "slug": ""\n}' \
--output-document \
- {{baseUrl}}/circuits/circuit-types/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"circuit_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/circuits/circuit-types/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
circuits_circuits_create
{{baseUrl}}/circuits/circuits/
BODY json
{
"cid": "",
"comments": "",
"commit_rate": 0,
"created": "",
"custom_fields": {},
"description": "",
"id": 0,
"install_date": "",
"last_updated": "",
"provider": 0,
"status": "",
"tags": [],
"tenant": 0,
"termination_a": "",
"termination_z": "",
"type": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/circuits/circuits/");
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 \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/circuits/circuits/" {:content-type :json
:form-params {:cid ""
:comments ""
:commit_rate 0
:created ""
:custom_fields {}
:description ""
:id 0
:install_date ""
:last_updated ""
:provider 0
:status ""
:tags []
:tenant 0
:termination_a ""
:termination_z ""
:type 0}})
require "http/client"
url = "{{baseUrl}}/circuits/circuits/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/circuits/circuits/"),
Content = new StringContent("{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/circuits/circuits/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/circuits/circuits/"
payload := strings.NewReader("{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/circuits/circuits/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 290
{
"cid": "",
"comments": "",
"commit_rate": 0,
"created": "",
"custom_fields": {},
"description": "",
"id": 0,
"install_date": "",
"last_updated": "",
"provider": 0,
"status": "",
"tags": [],
"tenant": 0,
"termination_a": "",
"termination_z": "",
"type": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/circuits/circuits/")
.setHeader("content-type", "application/json")
.setBody("{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/circuits/circuits/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/circuits/circuits/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/circuits/circuits/")
.header("content-type", "application/json")
.body("{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\n}")
.asString();
const data = JSON.stringify({
cid: '',
comments: '',
commit_rate: 0,
created: '',
custom_fields: {},
description: '',
id: 0,
install_date: '',
last_updated: '',
provider: 0,
status: '',
tags: [],
tenant: 0,
termination_a: '',
termination_z: '',
type: 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}}/circuits/circuits/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/circuits/circuits/',
headers: {'content-type': 'application/json'},
data: {
cid: '',
comments: '',
commit_rate: 0,
created: '',
custom_fields: {},
description: '',
id: 0,
install_date: '',
last_updated: '',
provider: 0,
status: '',
tags: [],
tenant: 0,
termination_a: '',
termination_z: '',
type: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/circuits/circuits/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cid":"","comments":"","commit_rate":0,"created":"","custom_fields":{},"description":"","id":0,"install_date":"","last_updated":"","provider":0,"status":"","tags":[],"tenant":0,"termination_a":"","termination_z":"","type":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}}/circuits/circuits/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cid": "",\n "comments": "",\n "commit_rate": 0,\n "created": "",\n "custom_fields": {},\n "description": "",\n "id": 0,\n "install_date": "",\n "last_updated": "",\n "provider": 0,\n "status": "",\n "tags": [],\n "tenant": 0,\n "termination_a": "",\n "termination_z": "",\n "type": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/circuits/circuits/")
.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/circuits/circuits/',
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({
cid: '',
comments: '',
commit_rate: 0,
created: '',
custom_fields: {},
description: '',
id: 0,
install_date: '',
last_updated: '',
provider: 0,
status: '',
tags: [],
tenant: 0,
termination_a: '',
termination_z: '',
type: 0
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/circuits/circuits/',
headers: {'content-type': 'application/json'},
body: {
cid: '',
comments: '',
commit_rate: 0,
created: '',
custom_fields: {},
description: '',
id: 0,
install_date: '',
last_updated: '',
provider: 0,
status: '',
tags: [],
tenant: 0,
termination_a: '',
termination_z: '',
type: 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}}/circuits/circuits/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cid: '',
comments: '',
commit_rate: 0,
created: '',
custom_fields: {},
description: '',
id: 0,
install_date: '',
last_updated: '',
provider: 0,
status: '',
tags: [],
tenant: 0,
termination_a: '',
termination_z: '',
type: 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}}/circuits/circuits/',
headers: {'content-type': 'application/json'},
data: {
cid: '',
comments: '',
commit_rate: 0,
created: '',
custom_fields: {},
description: '',
id: 0,
install_date: '',
last_updated: '',
provider: 0,
status: '',
tags: [],
tenant: 0,
termination_a: '',
termination_z: '',
type: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/circuits/circuits/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cid":"","comments":"","commit_rate":0,"created":"","custom_fields":{},"description":"","id":0,"install_date":"","last_updated":"","provider":0,"status":"","tags":[],"tenant":0,"termination_a":"","termination_z":"","type":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 = @{ @"cid": @"",
@"comments": @"",
@"commit_rate": @0,
@"created": @"",
@"custom_fields": @{ },
@"description": @"",
@"id": @0,
@"install_date": @"",
@"last_updated": @"",
@"provider": @0,
@"status": @"",
@"tags": @[ ],
@"tenant": @0,
@"termination_a": @"",
@"termination_z": @"",
@"type": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/circuits/circuits/"]
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}}/circuits/circuits/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/circuits/circuits/",
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([
'cid' => '',
'comments' => '',
'commit_rate' => 0,
'created' => '',
'custom_fields' => [
],
'description' => '',
'id' => 0,
'install_date' => '',
'last_updated' => '',
'provider' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'termination_a' => '',
'termination_z' => '',
'type' => 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}}/circuits/circuits/', [
'body' => '{
"cid": "",
"comments": "",
"commit_rate": 0,
"created": "",
"custom_fields": {},
"description": "",
"id": 0,
"install_date": "",
"last_updated": "",
"provider": 0,
"status": "",
"tags": [],
"tenant": 0,
"termination_a": "",
"termination_z": "",
"type": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/circuits/circuits/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cid' => '',
'comments' => '',
'commit_rate' => 0,
'created' => '',
'custom_fields' => [
],
'description' => '',
'id' => 0,
'install_date' => '',
'last_updated' => '',
'provider' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'termination_a' => '',
'termination_z' => '',
'type' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cid' => '',
'comments' => '',
'commit_rate' => 0,
'created' => '',
'custom_fields' => [
],
'description' => '',
'id' => 0,
'install_date' => '',
'last_updated' => '',
'provider' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'termination_a' => '',
'termination_z' => '',
'type' => 0
]));
$request->setRequestUrl('{{baseUrl}}/circuits/circuits/');
$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}}/circuits/circuits/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cid": "",
"comments": "",
"commit_rate": 0,
"created": "",
"custom_fields": {},
"description": "",
"id": 0,
"install_date": "",
"last_updated": "",
"provider": 0,
"status": "",
"tags": [],
"tenant": 0,
"termination_a": "",
"termination_z": "",
"type": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/circuits/circuits/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cid": "",
"comments": "",
"commit_rate": 0,
"created": "",
"custom_fields": {},
"description": "",
"id": 0,
"install_date": "",
"last_updated": "",
"provider": 0,
"status": "",
"tags": [],
"tenant": 0,
"termination_a": "",
"termination_z": "",
"type": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/circuits/circuits/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/circuits/circuits/"
payload = {
"cid": "",
"comments": "",
"commit_rate": 0,
"created": "",
"custom_fields": {},
"description": "",
"id": 0,
"install_date": "",
"last_updated": "",
"provider": 0,
"status": "",
"tags": [],
"tenant": 0,
"termination_a": "",
"termination_z": "",
"type": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/circuits/circuits/"
payload <- "{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/circuits/circuits/")
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 \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/circuits/circuits/') do |req|
req.body = "{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/circuits/circuits/";
let payload = json!({
"cid": "",
"comments": "",
"commit_rate": 0,
"created": "",
"custom_fields": json!({}),
"description": "",
"id": 0,
"install_date": "",
"last_updated": "",
"provider": 0,
"status": "",
"tags": (),
"tenant": 0,
"termination_a": "",
"termination_z": "",
"type": 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}}/circuits/circuits/ \
--header 'content-type: application/json' \
--data '{
"cid": "",
"comments": "",
"commit_rate": 0,
"created": "",
"custom_fields": {},
"description": "",
"id": 0,
"install_date": "",
"last_updated": "",
"provider": 0,
"status": "",
"tags": [],
"tenant": 0,
"termination_a": "",
"termination_z": "",
"type": 0
}'
echo '{
"cid": "",
"comments": "",
"commit_rate": 0,
"created": "",
"custom_fields": {},
"description": "",
"id": 0,
"install_date": "",
"last_updated": "",
"provider": 0,
"status": "",
"tags": [],
"tenant": 0,
"termination_a": "",
"termination_z": "",
"type": 0
}' | \
http POST {{baseUrl}}/circuits/circuits/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "cid": "",\n "comments": "",\n "commit_rate": 0,\n "created": "",\n "custom_fields": {},\n "description": "",\n "id": 0,\n "install_date": "",\n "last_updated": "",\n "provider": 0,\n "status": "",\n "tags": [],\n "tenant": 0,\n "termination_a": "",\n "termination_z": "",\n "type": 0\n}' \
--output-document \
- {{baseUrl}}/circuits/circuits/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cid": "",
"comments": "",
"commit_rate": 0,
"created": "",
"custom_fields": [],
"description": "",
"id": 0,
"install_date": "",
"last_updated": "",
"provider": 0,
"status": "",
"tags": [],
"tenant": 0,
"termination_a": "",
"termination_z": "",
"type": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/circuits/circuits/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
circuits_circuits_delete
{{baseUrl}}/circuits/circuits/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/circuits/circuits/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/circuits/circuits/:id/")
require "http/client"
url = "{{baseUrl}}/circuits/circuits/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/circuits/circuits/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/circuits/circuits/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/circuits/circuits/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/circuits/circuits/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/circuits/circuits/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/circuits/circuits/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/circuits/circuits/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/circuits/circuits/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/circuits/circuits/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/circuits/circuits/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/circuits/circuits/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/circuits/circuits/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/circuits/circuits/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/circuits/circuits/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/circuits/circuits/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/circuits/circuits/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/circuits/circuits/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/circuits/circuits/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/circuits/circuits/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/circuits/circuits/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/circuits/circuits/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/circuits/circuits/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/circuits/circuits/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/circuits/circuits/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/circuits/circuits/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/circuits/circuits/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/circuits/circuits/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/circuits/circuits/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/circuits/circuits/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/circuits/circuits/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/circuits/circuits/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/circuits/circuits/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/circuits/circuits/:id/
http DELETE {{baseUrl}}/circuits/circuits/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/circuits/circuits/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/circuits/circuits/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
circuits_circuits_list
{{baseUrl}}/circuits/circuits/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/circuits/circuits/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/circuits/circuits/")
require "http/client"
url = "{{baseUrl}}/circuits/circuits/"
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}}/circuits/circuits/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/circuits/circuits/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/circuits/circuits/"
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/circuits/circuits/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/circuits/circuits/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/circuits/circuits/"))
.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}}/circuits/circuits/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/circuits/circuits/")
.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}}/circuits/circuits/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/circuits/circuits/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/circuits/circuits/';
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}}/circuits/circuits/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/circuits/circuits/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/circuits/circuits/',
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}}/circuits/circuits/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/circuits/circuits/');
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}}/circuits/circuits/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/circuits/circuits/';
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}}/circuits/circuits/"]
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}}/circuits/circuits/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/circuits/circuits/",
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}}/circuits/circuits/');
echo $response->getBody();
setUrl('{{baseUrl}}/circuits/circuits/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/circuits/circuits/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/circuits/circuits/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/circuits/circuits/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/circuits/circuits/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/circuits/circuits/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/circuits/circuits/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/circuits/circuits/")
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/circuits/circuits/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/circuits/circuits/";
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}}/circuits/circuits/
http GET {{baseUrl}}/circuits/circuits/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/circuits/circuits/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/circuits/circuits/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
circuits_circuits_partial_update
{{baseUrl}}/circuits/circuits/:id/
BODY json
{
"cid": "",
"comments": "",
"commit_rate": 0,
"created": "",
"custom_fields": {},
"description": "",
"id": 0,
"install_date": "",
"last_updated": "",
"provider": 0,
"status": "",
"tags": [],
"tenant": 0,
"termination_a": "",
"termination_z": "",
"type": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/circuits/circuits/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/circuits/circuits/:id/" {:content-type :json
:form-params {:cid ""
:comments ""
:commit_rate 0
:created ""
:custom_fields {}
:description ""
:id 0
:install_date ""
:last_updated ""
:provider 0
:status ""
:tags []
:tenant 0
:termination_a ""
:termination_z ""
:type 0}})
require "http/client"
url = "{{baseUrl}}/circuits/circuits/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\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}}/circuits/circuits/:id/"),
Content = new StringContent("{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/circuits/circuits/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/circuits/circuits/:id/"
payload := strings.NewReader("{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\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/circuits/circuits/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 290
{
"cid": "",
"comments": "",
"commit_rate": 0,
"created": "",
"custom_fields": {},
"description": "",
"id": 0,
"install_date": "",
"last_updated": "",
"provider": 0,
"status": "",
"tags": [],
"tenant": 0,
"termination_a": "",
"termination_z": "",
"type": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/circuits/circuits/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/circuits/circuits/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/circuits/circuits/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/circuits/circuits/:id/")
.header("content-type", "application/json")
.body("{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\n}")
.asString();
const data = JSON.stringify({
cid: '',
comments: '',
commit_rate: 0,
created: '',
custom_fields: {},
description: '',
id: 0,
install_date: '',
last_updated: '',
provider: 0,
status: '',
tags: [],
tenant: 0,
termination_a: '',
termination_z: '',
type: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/circuits/circuits/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/circuits/circuits/:id/',
headers: {'content-type': 'application/json'},
data: {
cid: '',
comments: '',
commit_rate: 0,
created: '',
custom_fields: {},
description: '',
id: 0,
install_date: '',
last_updated: '',
provider: 0,
status: '',
tags: [],
tenant: 0,
termination_a: '',
termination_z: '',
type: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/circuits/circuits/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"cid":"","comments":"","commit_rate":0,"created":"","custom_fields":{},"description":"","id":0,"install_date":"","last_updated":"","provider":0,"status":"","tags":[],"tenant":0,"termination_a":"","termination_z":"","type":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}}/circuits/circuits/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cid": "",\n "comments": "",\n "commit_rate": 0,\n "created": "",\n "custom_fields": {},\n "description": "",\n "id": 0,\n "install_date": "",\n "last_updated": "",\n "provider": 0,\n "status": "",\n "tags": [],\n "tenant": 0,\n "termination_a": "",\n "termination_z": "",\n "type": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/circuits/circuits/:id/")
.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/circuits/circuits/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
cid: '',
comments: '',
commit_rate: 0,
created: '',
custom_fields: {},
description: '',
id: 0,
install_date: '',
last_updated: '',
provider: 0,
status: '',
tags: [],
tenant: 0,
termination_a: '',
termination_z: '',
type: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/circuits/circuits/:id/',
headers: {'content-type': 'application/json'},
body: {
cid: '',
comments: '',
commit_rate: 0,
created: '',
custom_fields: {},
description: '',
id: 0,
install_date: '',
last_updated: '',
provider: 0,
status: '',
tags: [],
tenant: 0,
termination_a: '',
termination_z: '',
type: 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('PATCH', '{{baseUrl}}/circuits/circuits/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cid: '',
comments: '',
commit_rate: 0,
created: '',
custom_fields: {},
description: '',
id: 0,
install_date: '',
last_updated: '',
provider: 0,
status: '',
tags: [],
tenant: 0,
termination_a: '',
termination_z: '',
type: 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: 'PATCH',
url: '{{baseUrl}}/circuits/circuits/:id/',
headers: {'content-type': 'application/json'},
data: {
cid: '',
comments: '',
commit_rate: 0,
created: '',
custom_fields: {},
description: '',
id: 0,
install_date: '',
last_updated: '',
provider: 0,
status: '',
tags: [],
tenant: 0,
termination_a: '',
termination_z: '',
type: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/circuits/circuits/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"cid":"","comments":"","commit_rate":0,"created":"","custom_fields":{},"description":"","id":0,"install_date":"","last_updated":"","provider":0,"status":"","tags":[],"tenant":0,"termination_a":"","termination_z":"","type":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 = @{ @"cid": @"",
@"comments": @"",
@"commit_rate": @0,
@"created": @"",
@"custom_fields": @{ },
@"description": @"",
@"id": @0,
@"install_date": @"",
@"last_updated": @"",
@"provider": @0,
@"status": @"",
@"tags": @[ ],
@"tenant": @0,
@"termination_a": @"",
@"termination_z": @"",
@"type": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/circuits/circuits/:id/"]
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}}/circuits/circuits/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/circuits/circuits/:id/",
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([
'cid' => '',
'comments' => '',
'commit_rate' => 0,
'created' => '',
'custom_fields' => [
],
'description' => '',
'id' => 0,
'install_date' => '',
'last_updated' => '',
'provider' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'termination_a' => '',
'termination_z' => '',
'type' => 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('PATCH', '{{baseUrl}}/circuits/circuits/:id/', [
'body' => '{
"cid": "",
"comments": "",
"commit_rate": 0,
"created": "",
"custom_fields": {},
"description": "",
"id": 0,
"install_date": "",
"last_updated": "",
"provider": 0,
"status": "",
"tags": [],
"tenant": 0,
"termination_a": "",
"termination_z": "",
"type": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/circuits/circuits/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cid' => '',
'comments' => '',
'commit_rate' => 0,
'created' => '',
'custom_fields' => [
],
'description' => '',
'id' => 0,
'install_date' => '',
'last_updated' => '',
'provider' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'termination_a' => '',
'termination_z' => '',
'type' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cid' => '',
'comments' => '',
'commit_rate' => 0,
'created' => '',
'custom_fields' => [
],
'description' => '',
'id' => 0,
'install_date' => '',
'last_updated' => '',
'provider' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'termination_a' => '',
'termination_z' => '',
'type' => 0
]));
$request->setRequestUrl('{{baseUrl}}/circuits/circuits/:id/');
$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}}/circuits/circuits/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"cid": "",
"comments": "",
"commit_rate": 0,
"created": "",
"custom_fields": {},
"description": "",
"id": 0,
"install_date": "",
"last_updated": "",
"provider": 0,
"status": "",
"tags": [],
"tenant": 0,
"termination_a": "",
"termination_z": "",
"type": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/circuits/circuits/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"cid": "",
"comments": "",
"commit_rate": 0,
"created": "",
"custom_fields": {},
"description": "",
"id": 0,
"install_date": "",
"last_updated": "",
"provider": 0,
"status": "",
"tags": [],
"tenant": 0,
"termination_a": "",
"termination_z": "",
"type": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/circuits/circuits/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/circuits/circuits/:id/"
payload = {
"cid": "",
"comments": "",
"commit_rate": 0,
"created": "",
"custom_fields": {},
"description": "",
"id": 0,
"install_date": "",
"last_updated": "",
"provider": 0,
"status": "",
"tags": [],
"tenant": 0,
"termination_a": "",
"termination_z": "",
"type": 0
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/circuits/circuits/:id/"
payload <- "{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\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}}/circuits/circuits/:id/")
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 \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/circuits/circuits/:id/') do |req|
req.body = "{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\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}}/circuits/circuits/:id/";
let payload = json!({
"cid": "",
"comments": "",
"commit_rate": 0,
"created": "",
"custom_fields": json!({}),
"description": "",
"id": 0,
"install_date": "",
"last_updated": "",
"provider": 0,
"status": "",
"tags": (),
"tenant": 0,
"termination_a": "",
"termination_z": "",
"type": 0
});
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}}/circuits/circuits/:id/ \
--header 'content-type: application/json' \
--data '{
"cid": "",
"comments": "",
"commit_rate": 0,
"created": "",
"custom_fields": {},
"description": "",
"id": 0,
"install_date": "",
"last_updated": "",
"provider": 0,
"status": "",
"tags": [],
"tenant": 0,
"termination_a": "",
"termination_z": "",
"type": 0
}'
echo '{
"cid": "",
"comments": "",
"commit_rate": 0,
"created": "",
"custom_fields": {},
"description": "",
"id": 0,
"install_date": "",
"last_updated": "",
"provider": 0,
"status": "",
"tags": [],
"tenant": 0,
"termination_a": "",
"termination_z": "",
"type": 0
}' | \
http PATCH {{baseUrl}}/circuits/circuits/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "cid": "",\n "comments": "",\n "commit_rate": 0,\n "created": "",\n "custom_fields": {},\n "description": "",\n "id": 0,\n "install_date": "",\n "last_updated": "",\n "provider": 0,\n "status": "",\n "tags": [],\n "tenant": 0,\n "termination_a": "",\n "termination_z": "",\n "type": 0\n}' \
--output-document \
- {{baseUrl}}/circuits/circuits/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cid": "",
"comments": "",
"commit_rate": 0,
"created": "",
"custom_fields": [],
"description": "",
"id": 0,
"install_date": "",
"last_updated": "",
"provider": 0,
"status": "",
"tags": [],
"tenant": 0,
"termination_a": "",
"termination_z": "",
"type": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/circuits/circuits/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
circuits_circuits_read
{{baseUrl}}/circuits/circuits/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/circuits/circuits/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/circuits/circuits/:id/")
require "http/client"
url = "{{baseUrl}}/circuits/circuits/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/circuits/circuits/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/circuits/circuits/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/circuits/circuits/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/circuits/circuits/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/circuits/circuits/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/circuits/circuits/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/circuits/circuits/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/circuits/circuits/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/circuits/circuits/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/circuits/circuits/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/circuits/circuits/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/circuits/circuits/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/circuits/circuits/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/circuits/circuits/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/circuits/circuits/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/circuits/circuits/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/circuits/circuits/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/circuits/circuits/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/circuits/circuits/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/circuits/circuits/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/circuits/circuits/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/circuits/circuits/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/circuits/circuits/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/circuits/circuits/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/circuits/circuits/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/circuits/circuits/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/circuits/circuits/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/circuits/circuits/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/circuits/circuits/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/circuits/circuits/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/circuits/circuits/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/circuits/circuits/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/circuits/circuits/:id/
http GET {{baseUrl}}/circuits/circuits/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/circuits/circuits/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/circuits/circuits/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
circuits_circuits_update
{{baseUrl}}/circuits/circuits/:id/
BODY json
{
"cid": "",
"comments": "",
"commit_rate": 0,
"created": "",
"custom_fields": {},
"description": "",
"id": 0,
"install_date": "",
"last_updated": "",
"provider": 0,
"status": "",
"tags": [],
"tenant": 0,
"termination_a": "",
"termination_z": "",
"type": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/circuits/circuits/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/circuits/circuits/:id/" {:content-type :json
:form-params {:cid ""
:comments ""
:commit_rate 0
:created ""
:custom_fields {}
:description ""
:id 0
:install_date ""
:last_updated ""
:provider 0
:status ""
:tags []
:tenant 0
:termination_a ""
:termination_z ""
:type 0}})
require "http/client"
url = "{{baseUrl}}/circuits/circuits/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\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}}/circuits/circuits/:id/"),
Content = new StringContent("{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/circuits/circuits/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/circuits/circuits/:id/"
payload := strings.NewReader("{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\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/circuits/circuits/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 290
{
"cid": "",
"comments": "",
"commit_rate": 0,
"created": "",
"custom_fields": {},
"description": "",
"id": 0,
"install_date": "",
"last_updated": "",
"provider": 0,
"status": "",
"tags": [],
"tenant": 0,
"termination_a": "",
"termination_z": "",
"type": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/circuits/circuits/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/circuits/circuits/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/circuits/circuits/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/circuits/circuits/:id/")
.header("content-type", "application/json")
.body("{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\n}")
.asString();
const data = JSON.stringify({
cid: '',
comments: '',
commit_rate: 0,
created: '',
custom_fields: {},
description: '',
id: 0,
install_date: '',
last_updated: '',
provider: 0,
status: '',
tags: [],
tenant: 0,
termination_a: '',
termination_z: '',
type: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/circuits/circuits/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/circuits/circuits/:id/',
headers: {'content-type': 'application/json'},
data: {
cid: '',
comments: '',
commit_rate: 0,
created: '',
custom_fields: {},
description: '',
id: 0,
install_date: '',
last_updated: '',
provider: 0,
status: '',
tags: [],
tenant: 0,
termination_a: '',
termination_z: '',
type: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/circuits/circuits/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"cid":"","comments":"","commit_rate":0,"created":"","custom_fields":{},"description":"","id":0,"install_date":"","last_updated":"","provider":0,"status":"","tags":[],"tenant":0,"termination_a":"","termination_z":"","type":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}}/circuits/circuits/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cid": "",\n "comments": "",\n "commit_rate": 0,\n "created": "",\n "custom_fields": {},\n "description": "",\n "id": 0,\n "install_date": "",\n "last_updated": "",\n "provider": 0,\n "status": "",\n "tags": [],\n "tenant": 0,\n "termination_a": "",\n "termination_z": "",\n "type": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/circuits/circuits/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/circuits/circuits/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
cid: '',
comments: '',
commit_rate: 0,
created: '',
custom_fields: {},
description: '',
id: 0,
install_date: '',
last_updated: '',
provider: 0,
status: '',
tags: [],
tenant: 0,
termination_a: '',
termination_z: '',
type: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/circuits/circuits/:id/',
headers: {'content-type': 'application/json'},
body: {
cid: '',
comments: '',
commit_rate: 0,
created: '',
custom_fields: {},
description: '',
id: 0,
install_date: '',
last_updated: '',
provider: 0,
status: '',
tags: [],
tenant: 0,
termination_a: '',
termination_z: '',
type: 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('PUT', '{{baseUrl}}/circuits/circuits/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cid: '',
comments: '',
commit_rate: 0,
created: '',
custom_fields: {},
description: '',
id: 0,
install_date: '',
last_updated: '',
provider: 0,
status: '',
tags: [],
tenant: 0,
termination_a: '',
termination_z: '',
type: 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: 'PUT',
url: '{{baseUrl}}/circuits/circuits/:id/',
headers: {'content-type': 'application/json'},
data: {
cid: '',
comments: '',
commit_rate: 0,
created: '',
custom_fields: {},
description: '',
id: 0,
install_date: '',
last_updated: '',
provider: 0,
status: '',
tags: [],
tenant: 0,
termination_a: '',
termination_z: '',
type: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/circuits/circuits/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"cid":"","comments":"","commit_rate":0,"created":"","custom_fields":{},"description":"","id":0,"install_date":"","last_updated":"","provider":0,"status":"","tags":[],"tenant":0,"termination_a":"","termination_z":"","type":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 = @{ @"cid": @"",
@"comments": @"",
@"commit_rate": @0,
@"created": @"",
@"custom_fields": @{ },
@"description": @"",
@"id": @0,
@"install_date": @"",
@"last_updated": @"",
@"provider": @0,
@"status": @"",
@"tags": @[ ],
@"tenant": @0,
@"termination_a": @"",
@"termination_z": @"",
@"type": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/circuits/circuits/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/circuits/circuits/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/circuits/circuits/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'cid' => '',
'comments' => '',
'commit_rate' => 0,
'created' => '',
'custom_fields' => [
],
'description' => '',
'id' => 0,
'install_date' => '',
'last_updated' => '',
'provider' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'termination_a' => '',
'termination_z' => '',
'type' => 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('PUT', '{{baseUrl}}/circuits/circuits/:id/', [
'body' => '{
"cid": "",
"comments": "",
"commit_rate": 0,
"created": "",
"custom_fields": {},
"description": "",
"id": 0,
"install_date": "",
"last_updated": "",
"provider": 0,
"status": "",
"tags": [],
"tenant": 0,
"termination_a": "",
"termination_z": "",
"type": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/circuits/circuits/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cid' => '',
'comments' => '',
'commit_rate' => 0,
'created' => '',
'custom_fields' => [
],
'description' => '',
'id' => 0,
'install_date' => '',
'last_updated' => '',
'provider' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'termination_a' => '',
'termination_z' => '',
'type' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cid' => '',
'comments' => '',
'commit_rate' => 0,
'created' => '',
'custom_fields' => [
],
'description' => '',
'id' => 0,
'install_date' => '',
'last_updated' => '',
'provider' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'termination_a' => '',
'termination_z' => '',
'type' => 0
]));
$request->setRequestUrl('{{baseUrl}}/circuits/circuits/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/circuits/circuits/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"cid": "",
"comments": "",
"commit_rate": 0,
"created": "",
"custom_fields": {},
"description": "",
"id": 0,
"install_date": "",
"last_updated": "",
"provider": 0,
"status": "",
"tags": [],
"tenant": 0,
"termination_a": "",
"termination_z": "",
"type": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/circuits/circuits/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"cid": "",
"comments": "",
"commit_rate": 0,
"created": "",
"custom_fields": {},
"description": "",
"id": 0,
"install_date": "",
"last_updated": "",
"provider": 0,
"status": "",
"tags": [],
"tenant": 0,
"termination_a": "",
"termination_z": "",
"type": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/circuits/circuits/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/circuits/circuits/:id/"
payload = {
"cid": "",
"comments": "",
"commit_rate": 0,
"created": "",
"custom_fields": {},
"description": "",
"id": 0,
"install_date": "",
"last_updated": "",
"provider": 0,
"status": "",
"tags": [],
"tenant": 0,
"termination_a": "",
"termination_z": "",
"type": 0
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/circuits/circuits/:id/"
payload <- "{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\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}}/circuits/circuits/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/circuits/circuits/:id/') do |req|
req.body = "{\n \"cid\": \"\",\n \"comments\": \"\",\n \"commit_rate\": 0,\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"id\": 0,\n \"install_date\": \"\",\n \"last_updated\": \"\",\n \"provider\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"termination_a\": \"\",\n \"termination_z\": \"\",\n \"type\": 0\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}}/circuits/circuits/:id/";
let payload = json!({
"cid": "",
"comments": "",
"commit_rate": 0,
"created": "",
"custom_fields": json!({}),
"description": "",
"id": 0,
"install_date": "",
"last_updated": "",
"provider": 0,
"status": "",
"tags": (),
"tenant": 0,
"termination_a": "",
"termination_z": "",
"type": 0
});
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}}/circuits/circuits/:id/ \
--header 'content-type: application/json' \
--data '{
"cid": "",
"comments": "",
"commit_rate": 0,
"created": "",
"custom_fields": {},
"description": "",
"id": 0,
"install_date": "",
"last_updated": "",
"provider": 0,
"status": "",
"tags": [],
"tenant": 0,
"termination_a": "",
"termination_z": "",
"type": 0
}'
echo '{
"cid": "",
"comments": "",
"commit_rate": 0,
"created": "",
"custom_fields": {},
"description": "",
"id": 0,
"install_date": "",
"last_updated": "",
"provider": 0,
"status": "",
"tags": [],
"tenant": 0,
"termination_a": "",
"termination_z": "",
"type": 0
}' | \
http PUT {{baseUrl}}/circuits/circuits/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "cid": "",\n "comments": "",\n "commit_rate": 0,\n "created": "",\n "custom_fields": {},\n "description": "",\n "id": 0,\n "install_date": "",\n "last_updated": "",\n "provider": 0,\n "status": "",\n "tags": [],\n "tenant": 0,\n "termination_a": "",\n "termination_z": "",\n "type": 0\n}' \
--output-document \
- {{baseUrl}}/circuits/circuits/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cid": "",
"comments": "",
"commit_rate": 0,
"created": "",
"custom_fields": [],
"description": "",
"id": 0,
"install_date": "",
"last_updated": "",
"provider": 0,
"status": "",
"tags": [],
"tenant": 0,
"termination_a": "",
"termination_z": "",
"type": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/circuits/circuits/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
circuits_providers_create
{{baseUrl}}/circuits/providers/
BODY json
{
"account": "",
"admin_contact": "",
"asn": 0,
"circuit_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"name": "",
"noc_contact": "",
"portal_url": "",
"slug": "",
"tags": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/circuits/providers/");
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 \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/circuits/providers/" {:content-type :json
:form-params {:account ""
:admin_contact ""
:asn 0
:circuit_count 0
:comments ""
:created ""
:custom_fields {}
:id 0
:last_updated ""
:name ""
:noc_contact ""
:portal_url ""
:slug ""
:tags []}})
require "http/client"
url = "{{baseUrl}}/circuits/providers/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\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}}/circuits/providers/"),
Content = new StringContent("{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\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}}/circuits/providers/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/circuits/providers/"
payload := strings.NewReader("{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\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/circuits/providers/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 250
{
"account": "",
"admin_contact": "",
"asn": 0,
"circuit_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"name": "",
"noc_contact": "",
"portal_url": "",
"slug": "",
"tags": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/circuits/providers/")
.setHeader("content-type", "application/json")
.setBody("{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/circuits/providers/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\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 \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/circuits/providers/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/circuits/providers/")
.header("content-type", "application/json")
.body("{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\n}")
.asString();
const data = JSON.stringify({
account: '',
admin_contact: '',
asn: 0,
circuit_count: 0,
comments: '',
created: '',
custom_fields: {},
id: 0,
last_updated: '',
name: '',
noc_contact: '',
portal_url: '',
slug: '',
tags: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/circuits/providers/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/circuits/providers/',
headers: {'content-type': 'application/json'},
data: {
account: '',
admin_contact: '',
asn: 0,
circuit_count: 0,
comments: '',
created: '',
custom_fields: {},
id: 0,
last_updated: '',
name: '',
noc_contact: '',
portal_url: '',
slug: '',
tags: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/circuits/providers/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"account":"","admin_contact":"","asn":0,"circuit_count":0,"comments":"","created":"","custom_fields":{},"id":0,"last_updated":"","name":"","noc_contact":"","portal_url":"","slug":"","tags":[]}'
};
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}}/circuits/providers/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "account": "",\n "admin_contact": "",\n "asn": 0,\n "circuit_count": 0,\n "comments": "",\n "created": "",\n "custom_fields": {},\n "id": 0,\n "last_updated": "",\n "name": "",\n "noc_contact": "",\n "portal_url": "",\n "slug": "",\n "tags": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/circuits/providers/")
.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/circuits/providers/',
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({
account: '',
admin_contact: '',
asn: 0,
circuit_count: 0,
comments: '',
created: '',
custom_fields: {},
id: 0,
last_updated: '',
name: '',
noc_contact: '',
portal_url: '',
slug: '',
tags: []
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/circuits/providers/',
headers: {'content-type': 'application/json'},
body: {
account: '',
admin_contact: '',
asn: 0,
circuit_count: 0,
comments: '',
created: '',
custom_fields: {},
id: 0,
last_updated: '',
name: '',
noc_contact: '',
portal_url: '',
slug: '',
tags: []
},
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}}/circuits/providers/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
account: '',
admin_contact: '',
asn: 0,
circuit_count: 0,
comments: '',
created: '',
custom_fields: {},
id: 0,
last_updated: '',
name: '',
noc_contact: '',
portal_url: '',
slug: '',
tags: []
});
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}}/circuits/providers/',
headers: {'content-type': 'application/json'},
data: {
account: '',
admin_contact: '',
asn: 0,
circuit_count: 0,
comments: '',
created: '',
custom_fields: {},
id: 0,
last_updated: '',
name: '',
noc_contact: '',
portal_url: '',
slug: '',
tags: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/circuits/providers/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"account":"","admin_contact":"","asn":0,"circuit_count":0,"comments":"","created":"","custom_fields":{},"id":0,"last_updated":"","name":"","noc_contact":"","portal_url":"","slug":"","tags":[]}'
};
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 = @{ @"account": @"",
@"admin_contact": @"",
@"asn": @0,
@"circuit_count": @0,
@"comments": @"",
@"created": @"",
@"custom_fields": @{ },
@"id": @0,
@"last_updated": @"",
@"name": @"",
@"noc_contact": @"",
@"portal_url": @"",
@"slug": @"",
@"tags": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/circuits/providers/"]
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}}/circuits/providers/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/circuits/providers/",
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([
'account' => '',
'admin_contact' => '',
'asn' => 0,
'circuit_count' => 0,
'comments' => '',
'created' => '',
'custom_fields' => [
],
'id' => 0,
'last_updated' => '',
'name' => '',
'noc_contact' => '',
'portal_url' => '',
'slug' => '',
'tags' => [
]
]),
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}}/circuits/providers/', [
'body' => '{
"account": "",
"admin_contact": "",
"asn": 0,
"circuit_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"name": "",
"noc_contact": "",
"portal_url": "",
"slug": "",
"tags": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/circuits/providers/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'account' => '',
'admin_contact' => '',
'asn' => 0,
'circuit_count' => 0,
'comments' => '',
'created' => '',
'custom_fields' => [
],
'id' => 0,
'last_updated' => '',
'name' => '',
'noc_contact' => '',
'portal_url' => '',
'slug' => '',
'tags' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'account' => '',
'admin_contact' => '',
'asn' => 0,
'circuit_count' => 0,
'comments' => '',
'created' => '',
'custom_fields' => [
],
'id' => 0,
'last_updated' => '',
'name' => '',
'noc_contact' => '',
'portal_url' => '',
'slug' => '',
'tags' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/circuits/providers/');
$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}}/circuits/providers/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"account": "",
"admin_contact": "",
"asn": 0,
"circuit_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"name": "",
"noc_contact": "",
"portal_url": "",
"slug": "",
"tags": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/circuits/providers/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"account": "",
"admin_contact": "",
"asn": 0,
"circuit_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"name": "",
"noc_contact": "",
"portal_url": "",
"slug": "",
"tags": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/circuits/providers/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/circuits/providers/"
payload = {
"account": "",
"admin_contact": "",
"asn": 0,
"circuit_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"name": "",
"noc_contact": "",
"portal_url": "",
"slug": "",
"tags": []
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/circuits/providers/"
payload <- "{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\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}}/circuits/providers/")
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 \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\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/circuits/providers/') do |req|
req.body = "{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/circuits/providers/";
let payload = json!({
"account": "",
"admin_contact": "",
"asn": 0,
"circuit_count": 0,
"comments": "",
"created": "",
"custom_fields": json!({}),
"id": 0,
"last_updated": "",
"name": "",
"noc_contact": "",
"portal_url": "",
"slug": "",
"tags": ()
});
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}}/circuits/providers/ \
--header 'content-type: application/json' \
--data '{
"account": "",
"admin_contact": "",
"asn": 0,
"circuit_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"name": "",
"noc_contact": "",
"portal_url": "",
"slug": "",
"tags": []
}'
echo '{
"account": "",
"admin_contact": "",
"asn": 0,
"circuit_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"name": "",
"noc_contact": "",
"portal_url": "",
"slug": "",
"tags": []
}' | \
http POST {{baseUrl}}/circuits/providers/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "account": "",\n "admin_contact": "",\n "asn": 0,\n "circuit_count": 0,\n "comments": "",\n "created": "",\n "custom_fields": {},\n "id": 0,\n "last_updated": "",\n "name": "",\n "noc_contact": "",\n "portal_url": "",\n "slug": "",\n "tags": []\n}' \
--output-document \
- {{baseUrl}}/circuits/providers/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"account": "",
"admin_contact": "",
"asn": 0,
"circuit_count": 0,
"comments": "",
"created": "",
"custom_fields": [],
"id": 0,
"last_updated": "",
"name": "",
"noc_contact": "",
"portal_url": "",
"slug": "",
"tags": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/circuits/providers/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
circuits_providers_delete
{{baseUrl}}/circuits/providers/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/circuits/providers/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/circuits/providers/:id/")
require "http/client"
url = "{{baseUrl}}/circuits/providers/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/circuits/providers/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/circuits/providers/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/circuits/providers/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/circuits/providers/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/circuits/providers/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/circuits/providers/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/circuits/providers/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/circuits/providers/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/circuits/providers/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/circuits/providers/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/circuits/providers/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/circuits/providers/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/circuits/providers/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/circuits/providers/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/circuits/providers/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/circuits/providers/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/circuits/providers/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/circuits/providers/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/circuits/providers/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/circuits/providers/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/circuits/providers/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/circuits/providers/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/circuits/providers/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/circuits/providers/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/circuits/providers/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/circuits/providers/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/circuits/providers/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/circuits/providers/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/circuits/providers/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/circuits/providers/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/circuits/providers/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/circuits/providers/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/circuits/providers/:id/
http DELETE {{baseUrl}}/circuits/providers/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/circuits/providers/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/circuits/providers/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
circuits_providers_graphs
{{baseUrl}}/circuits/providers/:id/graphs/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/circuits/providers/:id/graphs/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/circuits/providers/:id/graphs/")
require "http/client"
url = "{{baseUrl}}/circuits/providers/:id/graphs/"
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}}/circuits/providers/:id/graphs/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/circuits/providers/:id/graphs/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/circuits/providers/:id/graphs/"
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/circuits/providers/:id/graphs/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/circuits/providers/:id/graphs/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/circuits/providers/:id/graphs/"))
.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}}/circuits/providers/:id/graphs/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/circuits/providers/:id/graphs/")
.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}}/circuits/providers/:id/graphs/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/circuits/providers/:id/graphs/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/circuits/providers/:id/graphs/';
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}}/circuits/providers/:id/graphs/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/circuits/providers/:id/graphs/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/circuits/providers/:id/graphs/',
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}}/circuits/providers/:id/graphs/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/circuits/providers/:id/graphs/');
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}}/circuits/providers/:id/graphs/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/circuits/providers/:id/graphs/';
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}}/circuits/providers/:id/graphs/"]
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}}/circuits/providers/:id/graphs/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/circuits/providers/:id/graphs/",
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}}/circuits/providers/:id/graphs/');
echo $response->getBody();
setUrl('{{baseUrl}}/circuits/providers/:id/graphs/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/circuits/providers/:id/graphs/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/circuits/providers/:id/graphs/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/circuits/providers/:id/graphs/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/circuits/providers/:id/graphs/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/circuits/providers/:id/graphs/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/circuits/providers/:id/graphs/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/circuits/providers/:id/graphs/")
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/circuits/providers/:id/graphs/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/circuits/providers/:id/graphs/";
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}}/circuits/providers/:id/graphs/
http GET {{baseUrl}}/circuits/providers/:id/graphs/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/circuits/providers/:id/graphs/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/circuits/providers/:id/graphs/")! 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
circuits_providers_list
{{baseUrl}}/circuits/providers/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/circuits/providers/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/circuits/providers/")
require "http/client"
url = "{{baseUrl}}/circuits/providers/"
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}}/circuits/providers/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/circuits/providers/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/circuits/providers/"
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/circuits/providers/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/circuits/providers/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/circuits/providers/"))
.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}}/circuits/providers/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/circuits/providers/")
.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}}/circuits/providers/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/circuits/providers/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/circuits/providers/';
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}}/circuits/providers/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/circuits/providers/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/circuits/providers/',
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}}/circuits/providers/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/circuits/providers/');
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}}/circuits/providers/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/circuits/providers/';
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}}/circuits/providers/"]
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}}/circuits/providers/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/circuits/providers/",
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}}/circuits/providers/');
echo $response->getBody();
setUrl('{{baseUrl}}/circuits/providers/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/circuits/providers/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/circuits/providers/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/circuits/providers/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/circuits/providers/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/circuits/providers/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/circuits/providers/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/circuits/providers/")
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/circuits/providers/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/circuits/providers/";
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}}/circuits/providers/
http GET {{baseUrl}}/circuits/providers/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/circuits/providers/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/circuits/providers/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
circuits_providers_partial_update
{{baseUrl}}/circuits/providers/:id/
BODY json
{
"account": "",
"admin_contact": "",
"asn": 0,
"circuit_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"name": "",
"noc_contact": "",
"portal_url": "",
"slug": "",
"tags": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/circuits/providers/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/circuits/providers/:id/" {:content-type :json
:form-params {:account ""
:admin_contact ""
:asn 0
:circuit_count 0
:comments ""
:created ""
:custom_fields {}
:id 0
:last_updated ""
:name ""
:noc_contact ""
:portal_url ""
:slug ""
:tags []}})
require "http/client"
url = "{{baseUrl}}/circuits/providers/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\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}}/circuits/providers/:id/"),
Content = new StringContent("{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\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}}/circuits/providers/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/circuits/providers/:id/"
payload := strings.NewReader("{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\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/circuits/providers/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 250
{
"account": "",
"admin_contact": "",
"asn": 0,
"circuit_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"name": "",
"noc_contact": "",
"portal_url": "",
"slug": "",
"tags": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/circuits/providers/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/circuits/providers/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\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 \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/circuits/providers/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/circuits/providers/:id/")
.header("content-type", "application/json")
.body("{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\n}")
.asString();
const data = JSON.stringify({
account: '',
admin_contact: '',
asn: 0,
circuit_count: 0,
comments: '',
created: '',
custom_fields: {},
id: 0,
last_updated: '',
name: '',
noc_contact: '',
portal_url: '',
slug: '',
tags: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/circuits/providers/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/circuits/providers/:id/',
headers: {'content-type': 'application/json'},
data: {
account: '',
admin_contact: '',
asn: 0,
circuit_count: 0,
comments: '',
created: '',
custom_fields: {},
id: 0,
last_updated: '',
name: '',
noc_contact: '',
portal_url: '',
slug: '',
tags: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/circuits/providers/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"account":"","admin_contact":"","asn":0,"circuit_count":0,"comments":"","created":"","custom_fields":{},"id":0,"last_updated":"","name":"","noc_contact":"","portal_url":"","slug":"","tags":[]}'
};
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}}/circuits/providers/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "account": "",\n "admin_contact": "",\n "asn": 0,\n "circuit_count": 0,\n "comments": "",\n "created": "",\n "custom_fields": {},\n "id": 0,\n "last_updated": "",\n "name": "",\n "noc_contact": "",\n "portal_url": "",\n "slug": "",\n "tags": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/circuits/providers/:id/")
.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/circuits/providers/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
account: '',
admin_contact: '',
asn: 0,
circuit_count: 0,
comments: '',
created: '',
custom_fields: {},
id: 0,
last_updated: '',
name: '',
noc_contact: '',
portal_url: '',
slug: '',
tags: []
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/circuits/providers/:id/',
headers: {'content-type': 'application/json'},
body: {
account: '',
admin_contact: '',
asn: 0,
circuit_count: 0,
comments: '',
created: '',
custom_fields: {},
id: 0,
last_updated: '',
name: '',
noc_contact: '',
portal_url: '',
slug: '',
tags: []
},
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}}/circuits/providers/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
account: '',
admin_contact: '',
asn: 0,
circuit_count: 0,
comments: '',
created: '',
custom_fields: {},
id: 0,
last_updated: '',
name: '',
noc_contact: '',
portal_url: '',
slug: '',
tags: []
});
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}}/circuits/providers/:id/',
headers: {'content-type': 'application/json'},
data: {
account: '',
admin_contact: '',
asn: 0,
circuit_count: 0,
comments: '',
created: '',
custom_fields: {},
id: 0,
last_updated: '',
name: '',
noc_contact: '',
portal_url: '',
slug: '',
tags: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/circuits/providers/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"account":"","admin_contact":"","asn":0,"circuit_count":0,"comments":"","created":"","custom_fields":{},"id":0,"last_updated":"","name":"","noc_contact":"","portal_url":"","slug":"","tags":[]}'
};
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 = @{ @"account": @"",
@"admin_contact": @"",
@"asn": @0,
@"circuit_count": @0,
@"comments": @"",
@"created": @"",
@"custom_fields": @{ },
@"id": @0,
@"last_updated": @"",
@"name": @"",
@"noc_contact": @"",
@"portal_url": @"",
@"slug": @"",
@"tags": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/circuits/providers/:id/"]
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}}/circuits/providers/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/circuits/providers/:id/",
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([
'account' => '',
'admin_contact' => '',
'asn' => 0,
'circuit_count' => 0,
'comments' => '',
'created' => '',
'custom_fields' => [
],
'id' => 0,
'last_updated' => '',
'name' => '',
'noc_contact' => '',
'portal_url' => '',
'slug' => '',
'tags' => [
]
]),
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}}/circuits/providers/:id/', [
'body' => '{
"account": "",
"admin_contact": "",
"asn": 0,
"circuit_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"name": "",
"noc_contact": "",
"portal_url": "",
"slug": "",
"tags": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/circuits/providers/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'account' => '',
'admin_contact' => '',
'asn' => 0,
'circuit_count' => 0,
'comments' => '',
'created' => '',
'custom_fields' => [
],
'id' => 0,
'last_updated' => '',
'name' => '',
'noc_contact' => '',
'portal_url' => '',
'slug' => '',
'tags' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'account' => '',
'admin_contact' => '',
'asn' => 0,
'circuit_count' => 0,
'comments' => '',
'created' => '',
'custom_fields' => [
],
'id' => 0,
'last_updated' => '',
'name' => '',
'noc_contact' => '',
'portal_url' => '',
'slug' => '',
'tags' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/circuits/providers/:id/');
$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}}/circuits/providers/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"account": "",
"admin_contact": "",
"asn": 0,
"circuit_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"name": "",
"noc_contact": "",
"portal_url": "",
"slug": "",
"tags": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/circuits/providers/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"account": "",
"admin_contact": "",
"asn": 0,
"circuit_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"name": "",
"noc_contact": "",
"portal_url": "",
"slug": "",
"tags": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/circuits/providers/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/circuits/providers/:id/"
payload = {
"account": "",
"admin_contact": "",
"asn": 0,
"circuit_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"name": "",
"noc_contact": "",
"portal_url": "",
"slug": "",
"tags": []
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/circuits/providers/:id/"
payload <- "{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\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}}/circuits/providers/:id/")
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 \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\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/circuits/providers/:id/') do |req|
req.body = "{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\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}}/circuits/providers/:id/";
let payload = json!({
"account": "",
"admin_contact": "",
"asn": 0,
"circuit_count": 0,
"comments": "",
"created": "",
"custom_fields": json!({}),
"id": 0,
"last_updated": "",
"name": "",
"noc_contact": "",
"portal_url": "",
"slug": "",
"tags": ()
});
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}}/circuits/providers/:id/ \
--header 'content-type: application/json' \
--data '{
"account": "",
"admin_contact": "",
"asn": 0,
"circuit_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"name": "",
"noc_contact": "",
"portal_url": "",
"slug": "",
"tags": []
}'
echo '{
"account": "",
"admin_contact": "",
"asn": 0,
"circuit_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"name": "",
"noc_contact": "",
"portal_url": "",
"slug": "",
"tags": []
}' | \
http PATCH {{baseUrl}}/circuits/providers/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "account": "",\n "admin_contact": "",\n "asn": 0,\n "circuit_count": 0,\n "comments": "",\n "created": "",\n "custom_fields": {},\n "id": 0,\n "last_updated": "",\n "name": "",\n "noc_contact": "",\n "portal_url": "",\n "slug": "",\n "tags": []\n}' \
--output-document \
- {{baseUrl}}/circuits/providers/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"account": "",
"admin_contact": "",
"asn": 0,
"circuit_count": 0,
"comments": "",
"created": "",
"custom_fields": [],
"id": 0,
"last_updated": "",
"name": "",
"noc_contact": "",
"portal_url": "",
"slug": "",
"tags": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/circuits/providers/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
circuits_providers_read
{{baseUrl}}/circuits/providers/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/circuits/providers/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/circuits/providers/:id/")
require "http/client"
url = "{{baseUrl}}/circuits/providers/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/circuits/providers/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/circuits/providers/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/circuits/providers/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/circuits/providers/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/circuits/providers/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/circuits/providers/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/circuits/providers/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/circuits/providers/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/circuits/providers/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/circuits/providers/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/circuits/providers/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/circuits/providers/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/circuits/providers/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/circuits/providers/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/circuits/providers/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/circuits/providers/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/circuits/providers/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/circuits/providers/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/circuits/providers/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/circuits/providers/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/circuits/providers/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/circuits/providers/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/circuits/providers/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/circuits/providers/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/circuits/providers/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/circuits/providers/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/circuits/providers/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/circuits/providers/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/circuits/providers/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/circuits/providers/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/circuits/providers/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/circuits/providers/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/circuits/providers/:id/
http GET {{baseUrl}}/circuits/providers/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/circuits/providers/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/circuits/providers/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
circuits_providers_update
{{baseUrl}}/circuits/providers/:id/
BODY json
{
"account": "",
"admin_contact": "",
"asn": 0,
"circuit_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"name": "",
"noc_contact": "",
"portal_url": "",
"slug": "",
"tags": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/circuits/providers/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/circuits/providers/:id/" {:content-type :json
:form-params {:account ""
:admin_contact ""
:asn 0
:circuit_count 0
:comments ""
:created ""
:custom_fields {}
:id 0
:last_updated ""
:name ""
:noc_contact ""
:portal_url ""
:slug ""
:tags []}})
require "http/client"
url = "{{baseUrl}}/circuits/providers/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\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}}/circuits/providers/:id/"),
Content = new StringContent("{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\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}}/circuits/providers/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/circuits/providers/:id/"
payload := strings.NewReader("{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\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/circuits/providers/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 250
{
"account": "",
"admin_contact": "",
"asn": 0,
"circuit_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"name": "",
"noc_contact": "",
"portal_url": "",
"slug": "",
"tags": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/circuits/providers/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/circuits/providers/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\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 \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/circuits/providers/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/circuits/providers/:id/")
.header("content-type", "application/json")
.body("{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\n}")
.asString();
const data = JSON.stringify({
account: '',
admin_contact: '',
asn: 0,
circuit_count: 0,
comments: '',
created: '',
custom_fields: {},
id: 0,
last_updated: '',
name: '',
noc_contact: '',
portal_url: '',
slug: '',
tags: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/circuits/providers/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/circuits/providers/:id/',
headers: {'content-type': 'application/json'},
data: {
account: '',
admin_contact: '',
asn: 0,
circuit_count: 0,
comments: '',
created: '',
custom_fields: {},
id: 0,
last_updated: '',
name: '',
noc_contact: '',
portal_url: '',
slug: '',
tags: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/circuits/providers/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"account":"","admin_contact":"","asn":0,"circuit_count":0,"comments":"","created":"","custom_fields":{},"id":0,"last_updated":"","name":"","noc_contact":"","portal_url":"","slug":"","tags":[]}'
};
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}}/circuits/providers/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "account": "",\n "admin_contact": "",\n "asn": 0,\n "circuit_count": 0,\n "comments": "",\n "created": "",\n "custom_fields": {},\n "id": 0,\n "last_updated": "",\n "name": "",\n "noc_contact": "",\n "portal_url": "",\n "slug": "",\n "tags": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/circuits/providers/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/circuits/providers/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
account: '',
admin_contact: '',
asn: 0,
circuit_count: 0,
comments: '',
created: '',
custom_fields: {},
id: 0,
last_updated: '',
name: '',
noc_contact: '',
portal_url: '',
slug: '',
tags: []
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/circuits/providers/:id/',
headers: {'content-type': 'application/json'},
body: {
account: '',
admin_contact: '',
asn: 0,
circuit_count: 0,
comments: '',
created: '',
custom_fields: {},
id: 0,
last_updated: '',
name: '',
noc_contact: '',
portal_url: '',
slug: '',
tags: []
},
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}}/circuits/providers/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
account: '',
admin_contact: '',
asn: 0,
circuit_count: 0,
comments: '',
created: '',
custom_fields: {},
id: 0,
last_updated: '',
name: '',
noc_contact: '',
portal_url: '',
slug: '',
tags: []
});
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}}/circuits/providers/:id/',
headers: {'content-type': 'application/json'},
data: {
account: '',
admin_contact: '',
asn: 0,
circuit_count: 0,
comments: '',
created: '',
custom_fields: {},
id: 0,
last_updated: '',
name: '',
noc_contact: '',
portal_url: '',
slug: '',
tags: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/circuits/providers/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"account":"","admin_contact":"","asn":0,"circuit_count":0,"comments":"","created":"","custom_fields":{},"id":0,"last_updated":"","name":"","noc_contact":"","portal_url":"","slug":"","tags":[]}'
};
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 = @{ @"account": @"",
@"admin_contact": @"",
@"asn": @0,
@"circuit_count": @0,
@"comments": @"",
@"created": @"",
@"custom_fields": @{ },
@"id": @0,
@"last_updated": @"",
@"name": @"",
@"noc_contact": @"",
@"portal_url": @"",
@"slug": @"",
@"tags": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/circuits/providers/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/circuits/providers/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/circuits/providers/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'account' => '',
'admin_contact' => '',
'asn' => 0,
'circuit_count' => 0,
'comments' => '',
'created' => '',
'custom_fields' => [
],
'id' => 0,
'last_updated' => '',
'name' => '',
'noc_contact' => '',
'portal_url' => '',
'slug' => '',
'tags' => [
]
]),
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}}/circuits/providers/:id/', [
'body' => '{
"account": "",
"admin_contact": "",
"asn": 0,
"circuit_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"name": "",
"noc_contact": "",
"portal_url": "",
"slug": "",
"tags": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/circuits/providers/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'account' => '',
'admin_contact' => '',
'asn' => 0,
'circuit_count' => 0,
'comments' => '',
'created' => '',
'custom_fields' => [
],
'id' => 0,
'last_updated' => '',
'name' => '',
'noc_contact' => '',
'portal_url' => '',
'slug' => '',
'tags' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'account' => '',
'admin_contact' => '',
'asn' => 0,
'circuit_count' => 0,
'comments' => '',
'created' => '',
'custom_fields' => [
],
'id' => 0,
'last_updated' => '',
'name' => '',
'noc_contact' => '',
'portal_url' => '',
'slug' => '',
'tags' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/circuits/providers/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/circuits/providers/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"account": "",
"admin_contact": "",
"asn": 0,
"circuit_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"name": "",
"noc_contact": "",
"portal_url": "",
"slug": "",
"tags": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/circuits/providers/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"account": "",
"admin_contact": "",
"asn": 0,
"circuit_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"name": "",
"noc_contact": "",
"portal_url": "",
"slug": "",
"tags": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/circuits/providers/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/circuits/providers/:id/"
payload = {
"account": "",
"admin_contact": "",
"asn": 0,
"circuit_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"name": "",
"noc_contact": "",
"portal_url": "",
"slug": "",
"tags": []
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/circuits/providers/:id/"
payload <- "{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\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}}/circuits/providers/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\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/circuits/providers/:id/') do |req|
req.body = "{\n \"account\": \"\",\n \"admin_contact\": \"\",\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"noc_contact\": \"\",\n \"portal_url\": \"\",\n \"slug\": \"\",\n \"tags\": []\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}}/circuits/providers/:id/";
let payload = json!({
"account": "",
"admin_contact": "",
"asn": 0,
"circuit_count": 0,
"comments": "",
"created": "",
"custom_fields": json!({}),
"id": 0,
"last_updated": "",
"name": "",
"noc_contact": "",
"portal_url": "",
"slug": "",
"tags": ()
});
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}}/circuits/providers/:id/ \
--header 'content-type: application/json' \
--data '{
"account": "",
"admin_contact": "",
"asn": 0,
"circuit_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"name": "",
"noc_contact": "",
"portal_url": "",
"slug": "",
"tags": []
}'
echo '{
"account": "",
"admin_contact": "",
"asn": 0,
"circuit_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"name": "",
"noc_contact": "",
"portal_url": "",
"slug": "",
"tags": []
}' | \
http PUT {{baseUrl}}/circuits/providers/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "account": "",\n "admin_contact": "",\n "asn": 0,\n "circuit_count": 0,\n "comments": "",\n "created": "",\n "custom_fields": {},\n "id": 0,\n "last_updated": "",\n "name": "",\n "noc_contact": "",\n "portal_url": "",\n "slug": "",\n "tags": []\n}' \
--output-document \
- {{baseUrl}}/circuits/providers/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"account": "",
"admin_contact": "",
"asn": 0,
"circuit_count": 0,
"comments": "",
"created": "",
"custom_fields": [],
"id": 0,
"last_updated": "",
"name": "",
"noc_contact": "",
"portal_url": "",
"slug": "",
"tags": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/circuits/providers/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
dcim_cables_create
{{baseUrl}}/dcim/cables/
BODY json
{
"color": "",
"id": 0,
"label": "",
"length": 0,
"length_unit": "",
"status": "",
"termination_a": {},
"termination_a_id": 0,
"termination_a_type": "",
"termination_b": {},
"termination_b_id": 0,
"termination_b_type": "",
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/cables/");
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 \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/dcim/cables/" {:content-type :json
:form-params {:color ""
:id 0
:label ""
:length 0
:length_unit ""
:status ""
:termination_a {}
:termination_a_id 0
:termination_a_type ""
:termination_b {}
:termination_b_id 0
:termination_b_type ""
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/cables/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/dcim/cables/"),
Content = new StringContent("{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/cables/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/cables/"
payload := strings.NewReader("{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/dcim/cables/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 261
{
"color": "",
"id": 0,
"label": "",
"length": 0,
"length_unit": "",
"status": "",
"termination_a": {},
"termination_a_id": 0,
"termination_a_type": "",
"termination_b": {},
"termination_b_id": 0,
"termination_b_type": "",
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/dcim/cables/")
.setHeader("content-type", "application/json")
.setBody("{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/cables/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/cables/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/dcim/cables/")
.header("content-type", "application/json")
.body("{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
color: '',
id: 0,
label: '',
length: 0,
length_unit: '',
status: '',
termination_a: {},
termination_a_id: 0,
termination_a_type: '',
termination_b: {},
termination_b_id: 0,
termination_b_type: '',
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/dcim/cables/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/cables/',
headers: {'content-type': 'application/json'},
data: {
color: '',
id: 0,
label: '',
length: 0,
length_unit: '',
status: '',
termination_a: {},
termination_a_id: 0,
termination_a_type: '',
termination_b: {},
termination_b_id: 0,
termination_b_type: '',
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/cables/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"color":"","id":0,"label":"","length":0,"length_unit":"","status":"","termination_a":{},"termination_a_id":0,"termination_a_type":"","termination_b":{},"termination_b_id":0,"termination_b_type":"","type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/cables/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "color": "",\n "id": 0,\n "label": "",\n "length": 0,\n "length_unit": "",\n "status": "",\n "termination_a": {},\n "termination_a_id": 0,\n "termination_a_type": "",\n "termination_b": {},\n "termination_b_id": 0,\n "termination_b_type": "",\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/cables/")
.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/dcim/cables/',
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({
color: '',
id: 0,
label: '',
length: 0,
length_unit: '',
status: '',
termination_a: {},
termination_a_id: 0,
termination_a_type: '',
termination_b: {},
termination_b_id: 0,
termination_b_type: '',
type: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/cables/',
headers: {'content-type': 'application/json'},
body: {
color: '',
id: 0,
label: '',
length: 0,
length_unit: '',
status: '',
termination_a: {},
termination_a_id: 0,
termination_a_type: '',
termination_b: {},
termination_b_id: 0,
termination_b_type: '',
type: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/dcim/cables/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
color: '',
id: 0,
label: '',
length: 0,
length_unit: '',
status: '',
termination_a: {},
termination_a_id: 0,
termination_a_type: '',
termination_b: {},
termination_b_id: 0,
termination_b_type: '',
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/cables/',
headers: {'content-type': 'application/json'},
data: {
color: '',
id: 0,
label: '',
length: 0,
length_unit: '',
status: '',
termination_a: {},
termination_a_id: 0,
termination_a_type: '',
termination_b: {},
termination_b_id: 0,
termination_b_type: '',
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/cables/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"color":"","id":0,"label":"","length":0,"length_unit":"","status":"","termination_a":{},"termination_a_id":0,"termination_a_type":"","termination_b":{},"termination_b_id":0,"termination_b_type":"","type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"color": @"",
@"id": @0,
@"label": @"",
@"length": @0,
@"length_unit": @"",
@"status": @"",
@"termination_a": @{ },
@"termination_a_id": @0,
@"termination_a_type": @"",
@"termination_b": @{ },
@"termination_b_id": @0,
@"termination_b_type": @"",
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/cables/"]
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}}/dcim/cables/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/cables/",
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([
'color' => '',
'id' => 0,
'label' => '',
'length' => 0,
'length_unit' => '',
'status' => '',
'termination_a' => [
],
'termination_a_id' => 0,
'termination_a_type' => '',
'termination_b' => [
],
'termination_b_id' => 0,
'termination_b_type' => '',
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/dcim/cables/', [
'body' => '{
"color": "",
"id": 0,
"label": "",
"length": 0,
"length_unit": "",
"status": "",
"termination_a": {},
"termination_a_id": 0,
"termination_a_type": "",
"termination_b": {},
"termination_b_id": 0,
"termination_b_type": "",
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/cables/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'color' => '',
'id' => 0,
'label' => '',
'length' => 0,
'length_unit' => '',
'status' => '',
'termination_a' => [
],
'termination_a_id' => 0,
'termination_a_type' => '',
'termination_b' => [
],
'termination_b_id' => 0,
'termination_b_type' => '',
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'color' => '',
'id' => 0,
'label' => '',
'length' => 0,
'length_unit' => '',
'status' => '',
'termination_a' => [
],
'termination_a_id' => 0,
'termination_a_type' => '',
'termination_b' => [
],
'termination_b_id' => 0,
'termination_b_type' => '',
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/cables/');
$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}}/dcim/cables/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"color": "",
"id": 0,
"label": "",
"length": 0,
"length_unit": "",
"status": "",
"termination_a": {},
"termination_a_id": 0,
"termination_a_type": "",
"termination_b": {},
"termination_b_id": 0,
"termination_b_type": "",
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/cables/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"color": "",
"id": 0,
"label": "",
"length": 0,
"length_unit": "",
"status": "",
"termination_a": {},
"termination_a_id": 0,
"termination_a_type": "",
"termination_b": {},
"termination_b_id": 0,
"termination_b_type": "",
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/dcim/cables/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/cables/"
payload = {
"color": "",
"id": 0,
"label": "",
"length": 0,
"length_unit": "",
"status": "",
"termination_a": {},
"termination_a_id": 0,
"termination_a_type": "",
"termination_b": {},
"termination_b_id": 0,
"termination_b_type": "",
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/cables/"
payload <- "{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/cables/")
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 \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/dcim/cables/') do |req|
req.body = "{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/cables/";
let payload = json!({
"color": "",
"id": 0,
"label": "",
"length": 0,
"length_unit": "",
"status": "",
"termination_a": json!({}),
"termination_a_id": 0,
"termination_a_type": "",
"termination_b": json!({}),
"termination_b_id": 0,
"termination_b_type": "",
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/dcim/cables/ \
--header 'content-type: application/json' \
--data '{
"color": "",
"id": 0,
"label": "",
"length": 0,
"length_unit": "",
"status": "",
"termination_a": {},
"termination_a_id": 0,
"termination_a_type": "",
"termination_b": {},
"termination_b_id": 0,
"termination_b_type": "",
"type": ""
}'
echo '{
"color": "",
"id": 0,
"label": "",
"length": 0,
"length_unit": "",
"status": "",
"termination_a": {},
"termination_a_id": 0,
"termination_a_type": "",
"termination_b": {},
"termination_b_id": 0,
"termination_b_type": "",
"type": ""
}' | \
http POST {{baseUrl}}/dcim/cables/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "color": "",\n "id": 0,\n "label": "",\n "length": 0,\n "length_unit": "",\n "status": "",\n "termination_a": {},\n "termination_a_id": 0,\n "termination_a_type": "",\n "termination_b": {},\n "termination_b_id": 0,\n "termination_b_type": "",\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/cables/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"color": "",
"id": 0,
"label": "",
"length": 0,
"length_unit": "",
"status": "",
"termination_a": [],
"termination_a_id": 0,
"termination_a_type": "",
"termination_b": [],
"termination_b_id": 0,
"termination_b_type": "",
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/cables/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
dcim_cables_delete
{{baseUrl}}/dcim/cables/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/cables/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/dcim/cables/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/cables/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/dcim/cables/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/cables/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/cables/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/dcim/cables/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/dcim/cables/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/cables/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/cables/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/dcim/cables/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/dcim/cables/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/cables/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/cables/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/cables/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/cables/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/cables/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/cables/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/dcim/cables/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/cables/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/cables/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/cables/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/cables/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/cables/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/dcim/cables/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/cables/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/cables/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/cables/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/cables/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/dcim/cables/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/cables/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/cables/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/cables/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/dcim/cables/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/cables/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/dcim/cables/:id/
http DELETE {{baseUrl}}/dcim/cables/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/dcim/cables/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/cables/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_cables_list
{{baseUrl}}/dcim/cables/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/cables/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/cables/")
require "http/client"
url = "{{baseUrl}}/dcim/cables/"
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}}/dcim/cables/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/cables/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/cables/"
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/dcim/cables/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/cables/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/cables/"))
.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}}/dcim/cables/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/cables/")
.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}}/dcim/cables/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/cables/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/cables/';
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}}/dcim/cables/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/cables/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/cables/',
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}}/dcim/cables/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/cables/');
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}}/dcim/cables/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/cables/';
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}}/dcim/cables/"]
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}}/dcim/cables/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/cables/",
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}}/dcim/cables/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/cables/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/cables/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/cables/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/cables/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/cables/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/cables/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/cables/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/cables/")
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/dcim/cables/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/cables/";
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}}/dcim/cables/
http GET {{baseUrl}}/dcim/cables/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/cables/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/cables/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
dcim_cables_partial_update
{{baseUrl}}/dcim/cables/:id/
BODY json
{
"color": "",
"id": 0,
"label": "",
"length": 0,
"length_unit": "",
"status": "",
"termination_a": {},
"termination_a_id": 0,
"termination_a_type": "",
"termination_b": {},
"termination_b_id": 0,
"termination_b_type": "",
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/cables/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/dcim/cables/:id/" {:content-type :json
:form-params {:color ""
:id 0
:label ""
:length 0
:length_unit ""
:status ""
:termination_a {}
:termination_a_id 0
:termination_a_type ""
:termination_b {}
:termination_b_id 0
:termination_b_type ""
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/cables/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\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}}/dcim/cables/:id/"),
Content = new StringContent("{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/cables/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/cables/:id/"
payload := strings.NewReader("{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\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/dcim/cables/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 261
{
"color": "",
"id": 0,
"label": "",
"length": 0,
"length_unit": "",
"status": "",
"termination_a": {},
"termination_a_id": 0,
"termination_a_type": "",
"termination_b": {},
"termination_b_id": 0,
"termination_b_type": "",
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/dcim/cables/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/cables/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/cables/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/dcim/cables/:id/")
.header("content-type", "application/json")
.body("{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
color: '',
id: 0,
label: '',
length: 0,
length_unit: '',
status: '',
termination_a: {},
termination_a_id: 0,
termination_a_type: '',
termination_b: {},
termination_b_id: 0,
termination_b_type: '',
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/dcim/cables/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/cables/:id/',
headers: {'content-type': 'application/json'},
data: {
color: '',
id: 0,
label: '',
length: 0,
length_unit: '',
status: '',
termination_a: {},
termination_a_id: 0,
termination_a_type: '',
termination_b: {},
termination_b_id: 0,
termination_b_type: '',
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/cables/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"color":"","id":0,"label":"","length":0,"length_unit":"","status":"","termination_a":{},"termination_a_id":0,"termination_a_type":"","termination_b":{},"termination_b_id":0,"termination_b_type":"","type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/cables/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "color": "",\n "id": 0,\n "label": "",\n "length": 0,\n "length_unit": "",\n "status": "",\n "termination_a": {},\n "termination_a_id": 0,\n "termination_a_type": "",\n "termination_b": {},\n "termination_b_id": 0,\n "termination_b_type": "",\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/cables/:id/")
.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/dcim/cables/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
color: '',
id: 0,
label: '',
length: 0,
length_unit: '',
status: '',
termination_a: {},
termination_a_id: 0,
termination_a_type: '',
termination_b: {},
termination_b_id: 0,
termination_b_type: '',
type: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/cables/:id/',
headers: {'content-type': 'application/json'},
body: {
color: '',
id: 0,
label: '',
length: 0,
length_unit: '',
status: '',
termination_a: {},
termination_a_id: 0,
termination_a_type: '',
termination_b: {},
termination_b_id: 0,
termination_b_type: '',
type: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/dcim/cables/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
color: '',
id: 0,
label: '',
length: 0,
length_unit: '',
status: '',
termination_a: {},
termination_a_id: 0,
termination_a_type: '',
termination_b: {},
termination_b_id: 0,
termination_b_type: '',
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/cables/:id/',
headers: {'content-type': 'application/json'},
data: {
color: '',
id: 0,
label: '',
length: 0,
length_unit: '',
status: '',
termination_a: {},
termination_a_id: 0,
termination_a_type: '',
termination_b: {},
termination_b_id: 0,
termination_b_type: '',
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/cables/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"color":"","id":0,"label":"","length":0,"length_unit":"","status":"","termination_a":{},"termination_a_id":0,"termination_a_type":"","termination_b":{},"termination_b_id":0,"termination_b_type":"","type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"color": @"",
@"id": @0,
@"label": @"",
@"length": @0,
@"length_unit": @"",
@"status": @"",
@"termination_a": @{ },
@"termination_a_id": @0,
@"termination_a_type": @"",
@"termination_b": @{ },
@"termination_b_id": @0,
@"termination_b_type": @"",
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/cables/:id/"]
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}}/dcim/cables/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/cables/:id/",
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([
'color' => '',
'id' => 0,
'label' => '',
'length' => 0,
'length_unit' => '',
'status' => '',
'termination_a' => [
],
'termination_a_id' => 0,
'termination_a_type' => '',
'termination_b' => [
],
'termination_b_id' => 0,
'termination_b_type' => '',
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/dcim/cables/:id/', [
'body' => '{
"color": "",
"id": 0,
"label": "",
"length": 0,
"length_unit": "",
"status": "",
"termination_a": {},
"termination_a_id": 0,
"termination_a_type": "",
"termination_b": {},
"termination_b_id": 0,
"termination_b_type": "",
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/cables/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'color' => '',
'id' => 0,
'label' => '',
'length' => 0,
'length_unit' => '',
'status' => '',
'termination_a' => [
],
'termination_a_id' => 0,
'termination_a_type' => '',
'termination_b' => [
],
'termination_b_id' => 0,
'termination_b_type' => '',
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'color' => '',
'id' => 0,
'label' => '',
'length' => 0,
'length_unit' => '',
'status' => '',
'termination_a' => [
],
'termination_a_id' => 0,
'termination_a_type' => '',
'termination_b' => [
],
'termination_b_id' => 0,
'termination_b_type' => '',
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/cables/:id/');
$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}}/dcim/cables/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"color": "",
"id": 0,
"label": "",
"length": 0,
"length_unit": "",
"status": "",
"termination_a": {},
"termination_a_id": 0,
"termination_a_type": "",
"termination_b": {},
"termination_b_id": 0,
"termination_b_type": "",
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/cables/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"color": "",
"id": 0,
"label": "",
"length": 0,
"length_unit": "",
"status": "",
"termination_a": {},
"termination_a_id": 0,
"termination_a_type": "",
"termination_b": {},
"termination_b_id": 0,
"termination_b_type": "",
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/dcim/cables/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/cables/:id/"
payload = {
"color": "",
"id": 0,
"label": "",
"length": 0,
"length_unit": "",
"status": "",
"termination_a": {},
"termination_a_id": 0,
"termination_a_type": "",
"termination_b": {},
"termination_b_id": 0,
"termination_b_type": "",
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/cables/:id/"
payload <- "{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\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}}/dcim/cables/:id/")
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 \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/dcim/cables/:id/') do |req|
req.body = "{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\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}}/dcim/cables/:id/";
let payload = json!({
"color": "",
"id": 0,
"label": "",
"length": 0,
"length_unit": "",
"status": "",
"termination_a": json!({}),
"termination_a_id": 0,
"termination_a_type": "",
"termination_b": json!({}),
"termination_b_id": 0,
"termination_b_type": "",
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/dcim/cables/:id/ \
--header 'content-type: application/json' \
--data '{
"color": "",
"id": 0,
"label": "",
"length": 0,
"length_unit": "",
"status": "",
"termination_a": {},
"termination_a_id": 0,
"termination_a_type": "",
"termination_b": {},
"termination_b_id": 0,
"termination_b_type": "",
"type": ""
}'
echo '{
"color": "",
"id": 0,
"label": "",
"length": 0,
"length_unit": "",
"status": "",
"termination_a": {},
"termination_a_id": 0,
"termination_a_type": "",
"termination_b": {},
"termination_b_id": 0,
"termination_b_type": "",
"type": ""
}' | \
http PATCH {{baseUrl}}/dcim/cables/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "color": "",\n "id": 0,\n "label": "",\n "length": 0,\n "length_unit": "",\n "status": "",\n "termination_a": {},\n "termination_a_id": 0,\n "termination_a_type": "",\n "termination_b": {},\n "termination_b_id": 0,\n "termination_b_type": "",\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/cables/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"color": "",
"id": 0,
"label": "",
"length": 0,
"length_unit": "",
"status": "",
"termination_a": [],
"termination_a_id": 0,
"termination_a_type": "",
"termination_b": [],
"termination_b_id": 0,
"termination_b_type": "",
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/cables/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_cables_read
{{baseUrl}}/dcim/cables/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/cables/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/cables/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/cables/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/dcim/cables/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/cables/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/cables/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/dcim/cables/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/cables/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/cables/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/cables/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/cables/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/dcim/cables/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/cables/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/cables/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/cables/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/cables/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/cables/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/dcim/cables/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/cables/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/dcim/cables/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/cables/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/cables/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/cables/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/cables/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/dcim/cables/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/cables/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/cables/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/cables/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/cables/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/cables/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/cables/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/cables/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/cables/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/dcim/cables/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/cables/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/dcim/cables/:id/
http GET {{baseUrl}}/dcim/cables/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/cables/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/cables/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
dcim_cables_update
{{baseUrl}}/dcim/cables/:id/
BODY json
{
"color": "",
"id": 0,
"label": "",
"length": 0,
"length_unit": "",
"status": "",
"termination_a": {},
"termination_a_id": 0,
"termination_a_type": "",
"termination_b": {},
"termination_b_id": 0,
"termination_b_type": "",
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/cables/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/dcim/cables/:id/" {:content-type :json
:form-params {:color ""
:id 0
:label ""
:length 0
:length_unit ""
:status ""
:termination_a {}
:termination_a_id 0
:termination_a_type ""
:termination_b {}
:termination_b_id 0
:termination_b_type ""
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/cables/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\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}}/dcim/cables/:id/"),
Content = new StringContent("{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/cables/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/cables/:id/"
payload := strings.NewReader("{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\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/dcim/cables/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 261
{
"color": "",
"id": 0,
"label": "",
"length": 0,
"length_unit": "",
"status": "",
"termination_a": {},
"termination_a_id": 0,
"termination_a_type": "",
"termination_b": {},
"termination_b_id": 0,
"termination_b_type": "",
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/dcim/cables/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/cables/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/cables/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/dcim/cables/:id/")
.header("content-type", "application/json")
.body("{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
color: '',
id: 0,
label: '',
length: 0,
length_unit: '',
status: '',
termination_a: {},
termination_a_id: 0,
termination_a_type: '',
termination_b: {},
termination_b_id: 0,
termination_b_type: '',
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/dcim/cables/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/cables/:id/',
headers: {'content-type': 'application/json'},
data: {
color: '',
id: 0,
label: '',
length: 0,
length_unit: '',
status: '',
termination_a: {},
termination_a_id: 0,
termination_a_type: '',
termination_b: {},
termination_b_id: 0,
termination_b_type: '',
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/cables/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"color":"","id":0,"label":"","length":0,"length_unit":"","status":"","termination_a":{},"termination_a_id":0,"termination_a_type":"","termination_b":{},"termination_b_id":0,"termination_b_type":"","type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/cables/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "color": "",\n "id": 0,\n "label": "",\n "length": 0,\n "length_unit": "",\n "status": "",\n "termination_a": {},\n "termination_a_id": 0,\n "termination_a_type": "",\n "termination_b": {},\n "termination_b_id": 0,\n "termination_b_type": "",\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/cables/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/cables/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
color: '',
id: 0,
label: '',
length: 0,
length_unit: '',
status: '',
termination_a: {},
termination_a_id: 0,
termination_a_type: '',
termination_b: {},
termination_b_id: 0,
termination_b_type: '',
type: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/cables/:id/',
headers: {'content-type': 'application/json'},
body: {
color: '',
id: 0,
label: '',
length: 0,
length_unit: '',
status: '',
termination_a: {},
termination_a_id: 0,
termination_a_type: '',
termination_b: {},
termination_b_id: 0,
termination_b_type: '',
type: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/dcim/cables/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
color: '',
id: 0,
label: '',
length: 0,
length_unit: '',
status: '',
termination_a: {},
termination_a_id: 0,
termination_a_type: '',
termination_b: {},
termination_b_id: 0,
termination_b_type: '',
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/cables/:id/',
headers: {'content-type': 'application/json'},
data: {
color: '',
id: 0,
label: '',
length: 0,
length_unit: '',
status: '',
termination_a: {},
termination_a_id: 0,
termination_a_type: '',
termination_b: {},
termination_b_id: 0,
termination_b_type: '',
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/cables/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"color":"","id":0,"label":"","length":0,"length_unit":"","status":"","termination_a":{},"termination_a_id":0,"termination_a_type":"","termination_b":{},"termination_b_id":0,"termination_b_type":"","type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"color": @"",
@"id": @0,
@"label": @"",
@"length": @0,
@"length_unit": @"",
@"status": @"",
@"termination_a": @{ },
@"termination_a_id": @0,
@"termination_a_type": @"",
@"termination_b": @{ },
@"termination_b_id": @0,
@"termination_b_type": @"",
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/cables/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/cables/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/cables/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'color' => '',
'id' => 0,
'label' => '',
'length' => 0,
'length_unit' => '',
'status' => '',
'termination_a' => [
],
'termination_a_id' => 0,
'termination_a_type' => '',
'termination_b' => [
],
'termination_b_id' => 0,
'termination_b_type' => '',
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/dcim/cables/:id/', [
'body' => '{
"color": "",
"id": 0,
"label": "",
"length": 0,
"length_unit": "",
"status": "",
"termination_a": {},
"termination_a_id": 0,
"termination_a_type": "",
"termination_b": {},
"termination_b_id": 0,
"termination_b_type": "",
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/cables/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'color' => '',
'id' => 0,
'label' => '',
'length' => 0,
'length_unit' => '',
'status' => '',
'termination_a' => [
],
'termination_a_id' => 0,
'termination_a_type' => '',
'termination_b' => [
],
'termination_b_id' => 0,
'termination_b_type' => '',
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'color' => '',
'id' => 0,
'label' => '',
'length' => 0,
'length_unit' => '',
'status' => '',
'termination_a' => [
],
'termination_a_id' => 0,
'termination_a_type' => '',
'termination_b' => [
],
'termination_b_id' => 0,
'termination_b_type' => '',
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/cables/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/cables/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"color": "",
"id": 0,
"label": "",
"length": 0,
"length_unit": "",
"status": "",
"termination_a": {},
"termination_a_id": 0,
"termination_a_type": "",
"termination_b": {},
"termination_b_id": 0,
"termination_b_type": "",
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/cables/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"color": "",
"id": 0,
"label": "",
"length": 0,
"length_unit": "",
"status": "",
"termination_a": {},
"termination_a_id": 0,
"termination_a_type": "",
"termination_b": {},
"termination_b_id": 0,
"termination_b_type": "",
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/dcim/cables/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/cables/:id/"
payload = {
"color": "",
"id": 0,
"label": "",
"length": 0,
"length_unit": "",
"status": "",
"termination_a": {},
"termination_a_id": 0,
"termination_a_type": "",
"termination_b": {},
"termination_b_id": 0,
"termination_b_type": "",
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/cables/:id/"
payload <- "{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\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}}/dcim/cables/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/dcim/cables/:id/') do |req|
req.body = "{\n \"color\": \"\",\n \"id\": 0,\n \"label\": \"\",\n \"length\": 0,\n \"length_unit\": \"\",\n \"status\": \"\",\n \"termination_a\": {},\n \"termination_a_id\": 0,\n \"termination_a_type\": \"\",\n \"termination_b\": {},\n \"termination_b_id\": 0,\n \"termination_b_type\": \"\",\n \"type\": \"\"\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}}/dcim/cables/:id/";
let payload = json!({
"color": "",
"id": 0,
"label": "",
"length": 0,
"length_unit": "",
"status": "",
"termination_a": json!({}),
"termination_a_id": 0,
"termination_a_type": "",
"termination_b": json!({}),
"termination_b_id": 0,
"termination_b_type": "",
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/dcim/cables/:id/ \
--header 'content-type: application/json' \
--data '{
"color": "",
"id": 0,
"label": "",
"length": 0,
"length_unit": "",
"status": "",
"termination_a": {},
"termination_a_id": 0,
"termination_a_type": "",
"termination_b": {},
"termination_b_id": 0,
"termination_b_type": "",
"type": ""
}'
echo '{
"color": "",
"id": 0,
"label": "",
"length": 0,
"length_unit": "",
"status": "",
"termination_a": {},
"termination_a_id": 0,
"termination_a_type": "",
"termination_b": {},
"termination_b_id": 0,
"termination_b_type": "",
"type": ""
}' | \
http PUT {{baseUrl}}/dcim/cables/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "color": "",\n "id": 0,\n "label": "",\n "length": 0,\n "length_unit": "",\n "status": "",\n "termination_a": {},\n "termination_a_id": 0,\n "termination_a_type": "",\n "termination_b": {},\n "termination_b_id": 0,\n "termination_b_type": "",\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/cables/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"color": "",
"id": 0,
"label": "",
"length": 0,
"length_unit": "",
"status": "",
"termination_a": [],
"termination_a_id": 0,
"termination_a_type": "",
"termination_b": [],
"termination_b_id": 0,
"termination_b_type": "",
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/cables/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_connected-device_list
{{baseUrl}}/dcim/connected-device/
QUERY PARAMS
peer_device
peer_interface
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/connected-device/?peer_device=&peer_interface=");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/connected-device/" {:query-params {:peer_device ""
:peer_interface ""}})
require "http/client"
url = "{{baseUrl}}/dcim/connected-device/?peer_device=&peer_interface="
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}}/dcim/connected-device/?peer_device=&peer_interface="),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/connected-device/?peer_device=&peer_interface=");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/connected-device/?peer_device=&peer_interface="
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/dcim/connected-device/?peer_device=&peer_interface= HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/connected-device/?peer_device=&peer_interface=")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/connected-device/?peer_device=&peer_interface="))
.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}}/dcim/connected-device/?peer_device=&peer_interface=")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/connected-device/?peer_device=&peer_interface=")
.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}}/dcim/connected-device/?peer_device=&peer_interface=');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/dcim/connected-device/',
params: {peer_device: '', peer_interface: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/connected-device/?peer_device=&peer_interface=';
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}}/dcim/connected-device/?peer_device=&peer_interface=',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/connected-device/?peer_device=&peer_interface=")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/connected-device/?peer_device=&peer_interface=',
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}}/dcim/connected-device/',
qs: {peer_device: '', peer_interface: ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/connected-device/');
req.query({
peer_device: '',
peer_interface: ''
});
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}}/dcim/connected-device/',
params: {peer_device: '', peer_interface: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/connected-device/?peer_device=&peer_interface=';
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}}/dcim/connected-device/?peer_device=&peer_interface="]
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}}/dcim/connected-device/?peer_device=&peer_interface=" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/connected-device/?peer_device=&peer_interface=",
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}}/dcim/connected-device/?peer_device=&peer_interface=');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/connected-device/');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'peer_device' => '',
'peer_interface' => ''
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/connected-device/');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'peer_device' => '',
'peer_interface' => ''
]));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/connected-device/?peer_device=&peer_interface=' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/connected-device/?peer_device=&peer_interface=' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/connected-device/?peer_device=&peer_interface=")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/connected-device/"
querystring = {"peer_device":"","peer_interface":""}
response = requests.get(url, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/connected-device/"
queryString <- list(
peer_device = "",
peer_interface = ""
)
response <- VERB("GET", url, query = queryString, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/connected-device/?peer_device=&peer_interface=")
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/dcim/connected-device/') do |req|
req.params['peer_device'] = ''
req.params['peer_interface'] = ''
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/connected-device/";
let querystring = [
("peer_device", ""),
("peer_interface", ""),
];
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}}/dcim/connected-device/?peer_device=&peer_interface='
http GET '{{baseUrl}}/dcim/connected-device/?peer_device=&peer_interface='
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/dcim/connected-device/?peer_device=&peer_interface='
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/connected-device/?peer_device=&peer_interface=")! 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
dcim_console-connections_list
{{baseUrl}}/dcim/console-connections/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/console-connections/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/console-connections/")
require "http/client"
url = "{{baseUrl}}/dcim/console-connections/"
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}}/dcim/console-connections/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/console-connections/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/console-connections/"
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/dcim/console-connections/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/console-connections/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/console-connections/"))
.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}}/dcim/console-connections/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/console-connections/")
.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}}/dcim/console-connections/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/console-connections/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/console-connections/';
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}}/dcim/console-connections/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/console-connections/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/console-connections/',
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}}/dcim/console-connections/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/console-connections/');
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}}/dcim/console-connections/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/console-connections/';
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}}/dcim/console-connections/"]
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}}/dcim/console-connections/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/console-connections/",
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}}/dcim/console-connections/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/console-connections/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/console-connections/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/console-connections/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/console-connections/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/console-connections/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/console-connections/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/console-connections/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/console-connections/")
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/dcim/console-connections/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/console-connections/";
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}}/dcim/console-connections/
http GET {{baseUrl}}/dcim/console-connections/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/console-connections/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/console-connections/")! 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
dcim_console-port-templates_create
{{baseUrl}}/dcim/console-port-templates/
BODY json
{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/console-port-templates/");
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 \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/dcim/console-port-templates/" {:content-type :json
:form-params {:device_type 0
:id 0
:name ""
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/console-port-templates/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/dcim/console-port-templates/"),
Content = new StringContent("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/console-port-templates/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/console-port-templates/"
payload := strings.NewReader("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/dcim/console-port-templates/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 61
{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/dcim/console-port-templates/")
.setHeader("content-type", "application/json")
.setBody("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/console-port-templates/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/console-port-templates/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/dcim/console-port-templates/")
.header("content-type", "application/json")
.body("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
device_type: 0,
id: 0,
name: '',
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/dcim/console-port-templates/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/console-port-templates/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, id: 0, name: '', type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/console-port-templates/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"id":0,"name":"","type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/console-port-templates/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "device_type": 0,\n "id": 0,\n "name": "",\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/console-port-templates/")
.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/dcim/console-port-templates/',
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({device_type: 0, id: 0, name: '', type: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/console-port-templates/',
headers: {'content-type': 'application/json'},
body: {device_type: 0, id: 0, name: '', type: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/dcim/console-port-templates/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
device_type: 0,
id: 0,
name: '',
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/console-port-templates/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, id: 0, name: '', type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/console-port-templates/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"id":0,"name":"","type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"device_type": @0,
@"id": @0,
@"name": @"",
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/console-port-templates/"]
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}}/dcim/console-port-templates/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/console-port-templates/",
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([
'device_type' => 0,
'id' => 0,
'name' => '',
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/dcim/console-port-templates/', [
'body' => '{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/console-port-templates/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'device_type' => 0,
'id' => 0,
'name' => '',
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'device_type' => 0,
'id' => 0,
'name' => '',
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/console-port-templates/');
$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}}/dcim/console-port-templates/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/console-port-templates/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/dcim/console-port-templates/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/console-port-templates/"
payload = {
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/console-port-templates/"
payload <- "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/console-port-templates/")
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 \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/dcim/console-port-templates/') do |req|
req.body = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/console-port-templates/";
let payload = json!({
"device_type": 0,
"id": 0,
"name": "",
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/dcim/console-port-templates/ \
--header 'content-type: application/json' \
--data '{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}'
echo '{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}' | \
http POST {{baseUrl}}/dcim/console-port-templates/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "device_type": 0,\n "id": 0,\n "name": "",\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/console-port-templates/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"device_type": 0,
"id": 0,
"name": "",
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/console-port-templates/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
dcim_console-port-templates_delete
{{baseUrl}}/dcim/console-port-templates/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/console-port-templates/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/dcim/console-port-templates/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/console-port-templates/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/dcim/console-port-templates/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/console-port-templates/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/console-port-templates/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/dcim/console-port-templates/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/dcim/console-port-templates/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/console-port-templates/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/console-port-templates/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/dcim/console-port-templates/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/dcim/console-port-templates/:id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/dcim/console-port-templates/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/console-port-templates/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/console-port-templates/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/console-port-templates/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/console-port-templates/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/dcim/console-port-templates/:id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/dcim/console-port-templates/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/dcim/console-port-templates/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/console-port-templates/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/console-port-templates/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/console-port-templates/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/console-port-templates/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/dcim/console-port-templates/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/console-port-templates/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/console-port-templates/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/console-port-templates/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/console-port-templates/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/dcim/console-port-templates/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/console-port-templates/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/console-port-templates/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/console-port-templates/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/dcim/console-port-templates/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/console-port-templates/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/dcim/console-port-templates/:id/
http DELETE {{baseUrl}}/dcim/console-port-templates/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/dcim/console-port-templates/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/console-port-templates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_console-port-templates_list
{{baseUrl}}/dcim/console-port-templates/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/console-port-templates/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/console-port-templates/")
require "http/client"
url = "{{baseUrl}}/dcim/console-port-templates/"
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}}/dcim/console-port-templates/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/console-port-templates/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/console-port-templates/"
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/dcim/console-port-templates/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/console-port-templates/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/console-port-templates/"))
.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}}/dcim/console-port-templates/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/console-port-templates/")
.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}}/dcim/console-port-templates/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/console-port-templates/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/console-port-templates/';
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}}/dcim/console-port-templates/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/console-port-templates/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/console-port-templates/',
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}}/dcim/console-port-templates/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/console-port-templates/');
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}}/dcim/console-port-templates/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/console-port-templates/';
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}}/dcim/console-port-templates/"]
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}}/dcim/console-port-templates/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/console-port-templates/",
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}}/dcim/console-port-templates/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/console-port-templates/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/console-port-templates/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/console-port-templates/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/console-port-templates/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/console-port-templates/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/console-port-templates/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/console-port-templates/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/console-port-templates/")
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/dcim/console-port-templates/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/console-port-templates/";
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}}/dcim/console-port-templates/
http GET {{baseUrl}}/dcim/console-port-templates/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/console-port-templates/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/console-port-templates/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
dcim_console-port-templates_partial_update
{{baseUrl}}/dcim/console-port-templates/:id/
BODY json
{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/console-port-templates/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/dcim/console-port-templates/:id/" {:content-type :json
:form-params {:device_type 0
:id 0
:name ""
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/console-port-templates/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\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}}/dcim/console-port-templates/:id/"),
Content = new StringContent("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/console-port-templates/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/console-port-templates/:id/"
payload := strings.NewReader("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\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/dcim/console-port-templates/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 61
{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/dcim/console-port-templates/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/console-port-templates/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/console-port-templates/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/dcim/console-port-templates/:id/")
.header("content-type", "application/json")
.body("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
device_type: 0,
id: 0,
name: '',
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/dcim/console-port-templates/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/console-port-templates/:id/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, id: 0, name: '', type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/console-port-templates/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"id":0,"name":"","type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/console-port-templates/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "device_type": 0,\n "id": 0,\n "name": "",\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/console-port-templates/:id/")
.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/dcim/console-port-templates/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({device_type: 0, id: 0, name: '', type: ''}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/console-port-templates/:id/',
headers: {'content-type': 'application/json'},
body: {device_type: 0, id: 0, name: '', type: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/dcim/console-port-templates/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
device_type: 0,
id: 0,
name: '',
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/console-port-templates/:id/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, id: 0, name: '', type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/console-port-templates/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"id":0,"name":"","type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"device_type": @0,
@"id": @0,
@"name": @"",
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/console-port-templates/:id/"]
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}}/dcim/console-port-templates/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/console-port-templates/:id/",
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([
'device_type' => 0,
'id' => 0,
'name' => '',
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/dcim/console-port-templates/:id/', [
'body' => '{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/console-port-templates/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'device_type' => 0,
'id' => 0,
'name' => '',
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'device_type' => 0,
'id' => 0,
'name' => '',
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/console-port-templates/:id/');
$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}}/dcim/console-port-templates/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/console-port-templates/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/dcim/console-port-templates/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/console-port-templates/:id/"
payload = {
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/console-port-templates/:id/"
payload <- "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\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}}/dcim/console-port-templates/:id/")
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 \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/dcim/console-port-templates/:id/') do |req|
req.body = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\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}}/dcim/console-port-templates/:id/";
let payload = json!({
"device_type": 0,
"id": 0,
"name": "",
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.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}}/dcim/console-port-templates/:id/ \
--header 'content-type: application/json' \
--data '{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}'
echo '{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}' | \
http PATCH {{baseUrl}}/dcim/console-port-templates/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "device_type": 0,\n "id": 0,\n "name": "",\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/console-port-templates/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"device_type": 0,
"id": 0,
"name": "",
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/console-port-templates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_console-port-templates_read
{{baseUrl}}/dcim/console-port-templates/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/console-port-templates/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/console-port-templates/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/console-port-templates/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/dcim/console-port-templates/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/console-port-templates/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/console-port-templates/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/dcim/console-port-templates/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/console-port-templates/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/console-port-templates/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/console-port-templates/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/console-port-templates/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/dcim/console-port-templates/:id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/dcim/console-port-templates/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/console-port-templates/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/console-port-templates/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/console-port-templates/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/console-port-templates/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/dcim/console-port-templates/:id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/console-port-templates/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/dcim/console-port-templates/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/console-port-templates/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/console-port-templates/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/console-port-templates/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/console-port-templates/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/dcim/console-port-templates/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/console-port-templates/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/console-port-templates/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/console-port-templates/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/console-port-templates/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/console-port-templates/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/console-port-templates/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/console-port-templates/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/console-port-templates/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/dcim/console-port-templates/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/console-port-templates/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/dcim/console-port-templates/:id/
http GET {{baseUrl}}/dcim/console-port-templates/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/console-port-templates/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/console-port-templates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
dcim_console-port-templates_update
{{baseUrl}}/dcim/console-port-templates/:id/
BODY json
{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/console-port-templates/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/dcim/console-port-templates/:id/" {:content-type :json
:form-params {:device_type 0
:id 0
:name ""
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/console-port-templates/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\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}}/dcim/console-port-templates/:id/"),
Content = new StringContent("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/console-port-templates/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/console-port-templates/:id/"
payload := strings.NewReader("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\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/dcim/console-port-templates/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 61
{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/dcim/console-port-templates/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/console-port-templates/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/console-port-templates/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/dcim/console-port-templates/:id/")
.header("content-type", "application/json")
.body("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
device_type: 0,
id: 0,
name: '',
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/dcim/console-port-templates/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/console-port-templates/:id/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, id: 0, name: '', type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/console-port-templates/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"id":0,"name":"","type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/console-port-templates/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "device_type": 0,\n "id": 0,\n "name": "",\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/console-port-templates/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/console-port-templates/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({device_type: 0, id: 0, name: '', type: ''}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/console-port-templates/:id/',
headers: {'content-type': 'application/json'},
body: {device_type: 0, id: 0, name: '', type: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/dcim/console-port-templates/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
device_type: 0,
id: 0,
name: '',
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/console-port-templates/:id/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, id: 0, name: '', type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/console-port-templates/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"id":0,"name":"","type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"device_type": @0,
@"id": @0,
@"name": @"",
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/console-port-templates/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/console-port-templates/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/console-port-templates/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'device_type' => 0,
'id' => 0,
'name' => '',
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/dcim/console-port-templates/:id/', [
'body' => '{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/console-port-templates/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'device_type' => 0,
'id' => 0,
'name' => '',
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'device_type' => 0,
'id' => 0,
'name' => '',
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/console-port-templates/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/console-port-templates/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/console-port-templates/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/dcim/console-port-templates/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/console-port-templates/:id/"
payload = {
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/console-port-templates/:id/"
payload <- "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\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}}/dcim/console-port-templates/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/dcim/console-port-templates/:id/') do |req|
req.body = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\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}}/dcim/console-port-templates/:id/";
let payload = json!({
"device_type": 0,
"id": 0,
"name": "",
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.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}}/dcim/console-port-templates/:id/ \
--header 'content-type: application/json' \
--data '{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}'
echo '{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}' | \
http PUT {{baseUrl}}/dcim/console-port-templates/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "device_type": 0,\n "id": 0,\n "name": "",\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/console-port-templates/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"device_type": 0,
"id": 0,
"name": "",
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/console-port-templates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
dcim_console-ports_create
{{baseUrl}}/dcim/console-ports/
BODY json
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/console-ports/");
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 \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/dcim/console-ports/" {:content-type :json
:form-params {:cable {:id 0
:label ""
:url ""}
:connected_endpoint {}
:connected_endpoint_type ""
:connection_status false
:description ""
:device 0
:id 0
:name ""
:tags []
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/console-ports/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/dcim/console-ports/"),
Content = new StringContent("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/console-ports/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/console-ports/"
payload := strings.NewReader("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/dcim/console-ports/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 244
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/dcim/console-ports/")
.setHeader("content-type", "application/json")
.setBody("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/console-ports/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/console-ports/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/dcim/console-ports/")
.header("content-type", "application/json")
.body("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
cable: {
id: 0,
label: '',
url: ''
},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
name: '',
tags: [],
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/dcim/console-ports/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/console-ports/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
name: '',
tags: [],
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/console-ports/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"connected_endpoint":{},"connected_endpoint_type":"","connection_status":false,"description":"","device":0,"id":0,"name":"","tags":[],"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/console-ports/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "connected_endpoint": {},\n "connected_endpoint_type": "",\n "connection_status": false,\n "description": "",\n "device": 0,\n "id": 0,\n "name": "",\n "tags": [],\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/console-ports/")
.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/dcim/console-ports/',
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({
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
name: '',
tags: [],
type: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/console-ports/',
headers: {'content-type': 'application/json'},
body: {
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
name: '',
tags: [],
type: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/dcim/console-ports/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cable: {
id: 0,
label: '',
url: ''
},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
name: '',
tags: [],
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/console-ports/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
name: '',
tags: [],
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/console-ports/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"connected_endpoint":{},"connected_endpoint_type":"","connection_status":false,"description":"","device":0,"id":0,"name":"","tags":[],"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"cable": @{ @"id": @0, @"label": @"", @"url": @"" },
@"connected_endpoint": @{ },
@"connected_endpoint_type": @"",
@"connection_status": @NO,
@"description": @"",
@"device": @0,
@"id": @0,
@"name": @"",
@"tags": @[ ],
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/console-ports/"]
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}}/dcim/console-ports/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/console-ports/",
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([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'device' => 0,
'id' => 0,
'name' => '',
'tags' => [
],
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/dcim/console-ports/', [
'body' => '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/console-ports/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'device' => 0,
'id' => 0,
'name' => '',
'tags' => [
],
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'device' => 0,
'id' => 0,
'name' => '',
'tags' => [
],
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/console-ports/');
$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}}/dcim/console-ports/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/console-ports/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/dcim/console-ports/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/console-ports/"
payload = {
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": False,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/console-ports/"
payload <- "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/console-ports/")
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 \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/dcim/console-ports/') do |req|
req.body = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/console-ports/";
let payload = json!({
"cable": json!({
"id": 0,
"label": "",
"url": ""
}),
"connected_endpoint": json!({}),
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": (),
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/dcim/console-ports/ \
--header 'content-type: application/json' \
--data '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}'
echo '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}' | \
http POST {{baseUrl}}/dcim/console-ports/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "connected_endpoint": {},\n "connected_endpoint_type": "",\n "connection_status": false,\n "description": "",\n "device": 0,\n "id": 0,\n "name": "",\n "tags": [],\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/console-ports/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cable": [
"id": 0,
"label": "",
"url": ""
],
"connected_endpoint": [],
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/console-ports/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
dcim_console-ports_delete
{{baseUrl}}/dcim/console-ports/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/console-ports/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/dcim/console-ports/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/console-ports/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/dcim/console-ports/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/console-ports/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/console-ports/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/dcim/console-ports/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/dcim/console-ports/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/console-ports/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/console-ports/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/dcim/console-ports/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/dcim/console-ports/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/console-ports/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/console-ports/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/console-ports/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/console-ports/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/console-ports/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/console-ports/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/dcim/console-ports/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/console-ports/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/console-ports/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/console-ports/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/console-ports/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/console-ports/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/dcim/console-ports/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/console-ports/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/console-ports/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/console-ports/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/console-ports/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/dcim/console-ports/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/console-ports/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/console-ports/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/console-ports/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/dcim/console-ports/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/console-ports/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/dcim/console-ports/:id/
http DELETE {{baseUrl}}/dcim/console-ports/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/dcim/console-ports/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/console-ports/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_console-ports_list
{{baseUrl}}/dcim/console-ports/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/console-ports/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/console-ports/")
require "http/client"
url = "{{baseUrl}}/dcim/console-ports/"
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}}/dcim/console-ports/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/console-ports/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/console-ports/"
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/dcim/console-ports/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/console-ports/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/console-ports/"))
.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}}/dcim/console-ports/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/console-ports/")
.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}}/dcim/console-ports/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/console-ports/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/console-ports/';
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}}/dcim/console-ports/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/console-ports/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/console-ports/',
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}}/dcim/console-ports/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/console-ports/');
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}}/dcim/console-ports/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/console-ports/';
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}}/dcim/console-ports/"]
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}}/dcim/console-ports/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/console-ports/",
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}}/dcim/console-ports/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/console-ports/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/console-ports/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/console-ports/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/console-ports/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/console-ports/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/console-ports/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/console-ports/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/console-ports/")
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/dcim/console-ports/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/console-ports/";
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}}/dcim/console-ports/
http GET {{baseUrl}}/dcim/console-ports/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/console-ports/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/console-ports/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
dcim_console-ports_partial_update
{{baseUrl}}/dcim/console-ports/:id/
BODY json
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/console-ports/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/dcim/console-ports/:id/" {:content-type :json
:form-params {:cable {:id 0
:label ""
:url ""}
:connected_endpoint {}
:connected_endpoint_type ""
:connection_status false
:description ""
:device 0
:id 0
:name ""
:tags []
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/console-ports/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\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}}/dcim/console-ports/:id/"),
Content = new StringContent("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/console-ports/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/console-ports/:id/"
payload := strings.NewReader("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\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/dcim/console-ports/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 244
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/dcim/console-ports/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/console-ports/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/console-ports/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/dcim/console-ports/:id/")
.header("content-type", "application/json")
.body("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
cable: {
id: 0,
label: '',
url: ''
},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
name: '',
tags: [],
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/dcim/console-ports/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/console-ports/:id/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
name: '',
tags: [],
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/console-ports/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"connected_endpoint":{},"connected_endpoint_type":"","connection_status":false,"description":"","device":0,"id":0,"name":"","tags":[],"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/console-ports/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "connected_endpoint": {},\n "connected_endpoint_type": "",\n "connection_status": false,\n "description": "",\n "device": 0,\n "id": 0,\n "name": "",\n "tags": [],\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/console-ports/:id/")
.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/dcim/console-ports/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
name: '',
tags: [],
type: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/console-ports/:id/',
headers: {'content-type': 'application/json'},
body: {
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
name: '',
tags: [],
type: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/dcim/console-ports/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cable: {
id: 0,
label: '',
url: ''
},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
name: '',
tags: [],
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/console-ports/:id/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
name: '',
tags: [],
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/console-ports/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"connected_endpoint":{},"connected_endpoint_type":"","connection_status":false,"description":"","device":0,"id":0,"name":"","tags":[],"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"cable": @{ @"id": @0, @"label": @"", @"url": @"" },
@"connected_endpoint": @{ },
@"connected_endpoint_type": @"",
@"connection_status": @NO,
@"description": @"",
@"device": @0,
@"id": @0,
@"name": @"",
@"tags": @[ ],
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/console-ports/:id/"]
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}}/dcim/console-ports/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/console-ports/:id/",
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([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'device' => 0,
'id' => 0,
'name' => '',
'tags' => [
],
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/dcim/console-ports/:id/', [
'body' => '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/console-ports/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'device' => 0,
'id' => 0,
'name' => '',
'tags' => [
],
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'device' => 0,
'id' => 0,
'name' => '',
'tags' => [
],
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/console-ports/:id/');
$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}}/dcim/console-ports/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/console-ports/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/dcim/console-ports/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/console-ports/:id/"
payload = {
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": False,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/console-ports/:id/"
payload <- "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\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}}/dcim/console-ports/:id/")
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 \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/dcim/console-ports/:id/') do |req|
req.body = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\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}}/dcim/console-ports/:id/";
let payload = json!({
"cable": json!({
"id": 0,
"label": "",
"url": ""
}),
"connected_endpoint": json!({}),
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": (),
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/dcim/console-ports/:id/ \
--header 'content-type: application/json' \
--data '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}'
echo '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}' | \
http PATCH {{baseUrl}}/dcim/console-ports/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "connected_endpoint": {},\n "connected_endpoint_type": "",\n "connection_status": false,\n "description": "",\n "device": 0,\n "id": 0,\n "name": "",\n "tags": [],\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/console-ports/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cable": [
"id": 0,
"label": "",
"url": ""
],
"connected_endpoint": [],
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/console-ports/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_console-ports_read
{{baseUrl}}/dcim/console-ports/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/console-ports/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/console-ports/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/console-ports/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/dcim/console-ports/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/console-ports/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/console-ports/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/dcim/console-ports/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/console-ports/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/console-ports/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/console-ports/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/console-ports/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/dcim/console-ports/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/console-ports/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/console-ports/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/console-ports/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/console-ports/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/console-ports/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/dcim/console-ports/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/console-ports/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/dcim/console-ports/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/console-ports/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/console-ports/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/console-ports/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/console-ports/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/dcim/console-ports/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/console-ports/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/console-ports/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/console-ports/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/console-ports/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/console-ports/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/console-ports/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/console-ports/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/console-ports/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/dcim/console-ports/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/console-ports/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/dcim/console-ports/:id/
http GET {{baseUrl}}/dcim/console-ports/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/console-ports/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/console-ports/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_console-ports_trace
{{baseUrl}}/dcim/console-ports/:id/trace/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/console-ports/:id/trace/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/console-ports/:id/trace/")
require "http/client"
url = "{{baseUrl}}/dcim/console-ports/:id/trace/"
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}}/dcim/console-ports/:id/trace/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/console-ports/:id/trace/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/console-ports/:id/trace/"
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/dcim/console-ports/:id/trace/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/console-ports/:id/trace/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/console-ports/:id/trace/"))
.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}}/dcim/console-ports/:id/trace/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/console-ports/:id/trace/")
.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}}/dcim/console-ports/:id/trace/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/dcim/console-ports/:id/trace/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/console-ports/:id/trace/';
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}}/dcim/console-ports/:id/trace/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/console-ports/:id/trace/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/console-ports/:id/trace/',
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}}/dcim/console-ports/:id/trace/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/console-ports/:id/trace/');
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}}/dcim/console-ports/:id/trace/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/console-ports/:id/trace/';
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}}/dcim/console-ports/:id/trace/"]
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}}/dcim/console-ports/:id/trace/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/console-ports/:id/trace/",
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}}/dcim/console-ports/:id/trace/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/console-ports/:id/trace/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/console-ports/:id/trace/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/console-ports/:id/trace/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/console-ports/:id/trace/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/console-ports/:id/trace/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/console-ports/:id/trace/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/console-ports/:id/trace/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/console-ports/:id/trace/")
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/dcim/console-ports/:id/trace/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/console-ports/:id/trace/";
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}}/dcim/console-ports/:id/trace/
http GET {{baseUrl}}/dcim/console-ports/:id/trace/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/console-ports/:id/trace/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/console-ports/:id/trace/")! 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()
PUT
dcim_console-ports_update
{{baseUrl}}/dcim/console-ports/:id/
BODY json
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/console-ports/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/dcim/console-ports/:id/" {:content-type :json
:form-params {:cable {:id 0
:label ""
:url ""}
:connected_endpoint {}
:connected_endpoint_type ""
:connection_status false
:description ""
:device 0
:id 0
:name ""
:tags []
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/console-ports/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\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}}/dcim/console-ports/:id/"),
Content = new StringContent("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/console-ports/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/console-ports/:id/"
payload := strings.NewReader("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\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/dcim/console-ports/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 244
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/dcim/console-ports/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/console-ports/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/console-ports/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/dcim/console-ports/:id/")
.header("content-type", "application/json")
.body("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
cable: {
id: 0,
label: '',
url: ''
},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
name: '',
tags: [],
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/dcim/console-ports/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/console-ports/:id/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
name: '',
tags: [],
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/console-ports/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"connected_endpoint":{},"connected_endpoint_type":"","connection_status":false,"description":"","device":0,"id":0,"name":"","tags":[],"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/console-ports/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "connected_endpoint": {},\n "connected_endpoint_type": "",\n "connection_status": false,\n "description": "",\n "device": 0,\n "id": 0,\n "name": "",\n "tags": [],\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/console-ports/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/console-ports/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
name: '',
tags: [],
type: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/console-ports/:id/',
headers: {'content-type': 'application/json'},
body: {
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
name: '',
tags: [],
type: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/dcim/console-ports/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cable: {
id: 0,
label: '',
url: ''
},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
name: '',
tags: [],
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/console-ports/:id/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
name: '',
tags: [],
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/console-ports/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"connected_endpoint":{},"connected_endpoint_type":"","connection_status":false,"description":"","device":0,"id":0,"name":"","tags":[],"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"cable": @{ @"id": @0, @"label": @"", @"url": @"" },
@"connected_endpoint": @{ },
@"connected_endpoint_type": @"",
@"connection_status": @NO,
@"description": @"",
@"device": @0,
@"id": @0,
@"name": @"",
@"tags": @[ ],
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/console-ports/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/console-ports/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/console-ports/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'device' => 0,
'id' => 0,
'name' => '',
'tags' => [
],
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/dcim/console-ports/:id/', [
'body' => '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/console-ports/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'device' => 0,
'id' => 0,
'name' => '',
'tags' => [
],
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'device' => 0,
'id' => 0,
'name' => '',
'tags' => [
],
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/console-ports/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/console-ports/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/console-ports/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/dcim/console-ports/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/console-ports/:id/"
payload = {
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": False,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/console-ports/:id/"
payload <- "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\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}}/dcim/console-ports/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/dcim/console-ports/:id/') do |req|
req.body = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\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}}/dcim/console-ports/:id/";
let payload = json!({
"cable": json!({
"id": 0,
"label": "",
"url": ""
}),
"connected_endpoint": json!({}),
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": (),
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/dcim/console-ports/:id/ \
--header 'content-type: application/json' \
--data '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}'
echo '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}' | \
http PUT {{baseUrl}}/dcim/console-ports/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "connected_endpoint": {},\n "connected_endpoint_type": "",\n "connection_status": false,\n "description": "",\n "device": 0,\n "id": 0,\n "name": "",\n "tags": [],\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/console-ports/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cable": [
"id": 0,
"label": "",
"url": ""
],
"connected_endpoint": [],
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/console-ports/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
dcim_console-server-port-templates_create
{{baseUrl}}/dcim/console-server-port-templates/
BODY json
{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/console-server-port-templates/");
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 \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/dcim/console-server-port-templates/" {:content-type :json
:form-params {:device_type 0
:id 0
:name ""
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/console-server-port-templates/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/dcim/console-server-port-templates/"),
Content = new StringContent("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/console-server-port-templates/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/console-server-port-templates/"
payload := strings.NewReader("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/dcim/console-server-port-templates/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 61
{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/dcim/console-server-port-templates/")
.setHeader("content-type", "application/json")
.setBody("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/console-server-port-templates/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/console-server-port-templates/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/dcim/console-server-port-templates/")
.header("content-type", "application/json")
.body("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
device_type: 0,
id: 0,
name: '',
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/dcim/console-server-port-templates/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/console-server-port-templates/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, id: 0, name: '', type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/console-server-port-templates/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"id":0,"name":"","type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/console-server-port-templates/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "device_type": 0,\n "id": 0,\n "name": "",\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/console-server-port-templates/")
.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/dcim/console-server-port-templates/',
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({device_type: 0, id: 0, name: '', type: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/console-server-port-templates/',
headers: {'content-type': 'application/json'},
body: {device_type: 0, id: 0, name: '', type: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/dcim/console-server-port-templates/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
device_type: 0,
id: 0,
name: '',
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/console-server-port-templates/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, id: 0, name: '', type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/console-server-port-templates/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"id":0,"name":"","type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"device_type": @0,
@"id": @0,
@"name": @"",
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/console-server-port-templates/"]
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}}/dcim/console-server-port-templates/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/console-server-port-templates/",
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([
'device_type' => 0,
'id' => 0,
'name' => '',
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/dcim/console-server-port-templates/', [
'body' => '{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/console-server-port-templates/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'device_type' => 0,
'id' => 0,
'name' => '',
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'device_type' => 0,
'id' => 0,
'name' => '',
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/console-server-port-templates/');
$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}}/dcim/console-server-port-templates/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/console-server-port-templates/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/dcim/console-server-port-templates/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/console-server-port-templates/"
payload = {
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/console-server-port-templates/"
payload <- "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/console-server-port-templates/")
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 \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/dcim/console-server-port-templates/') do |req|
req.body = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/console-server-port-templates/";
let payload = json!({
"device_type": 0,
"id": 0,
"name": "",
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/dcim/console-server-port-templates/ \
--header 'content-type: application/json' \
--data '{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}'
echo '{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}' | \
http POST {{baseUrl}}/dcim/console-server-port-templates/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "device_type": 0,\n "id": 0,\n "name": "",\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/console-server-port-templates/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"device_type": 0,
"id": 0,
"name": "",
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/console-server-port-templates/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
dcim_console-server-port-templates_delete
{{baseUrl}}/dcim/console-server-port-templates/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/console-server-port-templates/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/dcim/console-server-port-templates/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/console-server-port-templates/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/dcim/console-server-port-templates/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/console-server-port-templates/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/console-server-port-templates/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/dcim/console-server-port-templates/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/dcim/console-server-port-templates/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/console-server-port-templates/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/console-server-port-templates/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/dcim/console-server-port-templates/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/dcim/console-server-port-templates/:id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/dcim/console-server-port-templates/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/console-server-port-templates/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/console-server-port-templates/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/console-server-port-templates/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/console-server-port-templates/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/dcim/console-server-port-templates/:id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/dcim/console-server-port-templates/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/dcim/console-server-port-templates/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/console-server-port-templates/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/console-server-port-templates/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/console-server-port-templates/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/console-server-port-templates/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/dcim/console-server-port-templates/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/console-server-port-templates/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/console-server-port-templates/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/console-server-port-templates/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/console-server-port-templates/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/dcim/console-server-port-templates/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/console-server-port-templates/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/console-server-port-templates/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/console-server-port-templates/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/dcim/console-server-port-templates/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/console-server-port-templates/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/dcim/console-server-port-templates/:id/
http DELETE {{baseUrl}}/dcim/console-server-port-templates/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/dcim/console-server-port-templates/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/console-server-port-templates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_console-server-port-templates_list
{{baseUrl}}/dcim/console-server-port-templates/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/console-server-port-templates/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/console-server-port-templates/")
require "http/client"
url = "{{baseUrl}}/dcim/console-server-port-templates/"
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}}/dcim/console-server-port-templates/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/console-server-port-templates/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/console-server-port-templates/"
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/dcim/console-server-port-templates/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/console-server-port-templates/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/console-server-port-templates/"))
.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}}/dcim/console-server-port-templates/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/console-server-port-templates/")
.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}}/dcim/console-server-port-templates/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/dcim/console-server-port-templates/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/console-server-port-templates/';
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}}/dcim/console-server-port-templates/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/console-server-port-templates/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/console-server-port-templates/',
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}}/dcim/console-server-port-templates/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/console-server-port-templates/');
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}}/dcim/console-server-port-templates/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/console-server-port-templates/';
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}}/dcim/console-server-port-templates/"]
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}}/dcim/console-server-port-templates/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/console-server-port-templates/",
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}}/dcim/console-server-port-templates/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/console-server-port-templates/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/console-server-port-templates/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/console-server-port-templates/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/console-server-port-templates/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/console-server-port-templates/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/console-server-port-templates/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/console-server-port-templates/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/console-server-port-templates/")
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/dcim/console-server-port-templates/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/console-server-port-templates/";
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}}/dcim/console-server-port-templates/
http GET {{baseUrl}}/dcim/console-server-port-templates/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/console-server-port-templates/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/console-server-port-templates/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
dcim_console-server-port-templates_partial_update
{{baseUrl}}/dcim/console-server-port-templates/:id/
BODY json
{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/console-server-port-templates/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/dcim/console-server-port-templates/:id/" {:content-type :json
:form-params {:device_type 0
:id 0
:name ""
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/console-server-port-templates/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\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}}/dcim/console-server-port-templates/:id/"),
Content = new StringContent("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/console-server-port-templates/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/console-server-port-templates/:id/"
payload := strings.NewReader("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\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/dcim/console-server-port-templates/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 61
{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/dcim/console-server-port-templates/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/console-server-port-templates/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/console-server-port-templates/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/dcim/console-server-port-templates/:id/")
.header("content-type", "application/json")
.body("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
device_type: 0,
id: 0,
name: '',
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/dcim/console-server-port-templates/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/console-server-port-templates/:id/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, id: 0, name: '', type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/console-server-port-templates/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"id":0,"name":"","type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/console-server-port-templates/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "device_type": 0,\n "id": 0,\n "name": "",\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/console-server-port-templates/:id/")
.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/dcim/console-server-port-templates/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({device_type: 0, id: 0, name: '', type: ''}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/console-server-port-templates/:id/',
headers: {'content-type': 'application/json'},
body: {device_type: 0, id: 0, name: '', type: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/dcim/console-server-port-templates/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
device_type: 0,
id: 0,
name: '',
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/console-server-port-templates/:id/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, id: 0, name: '', type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/console-server-port-templates/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"id":0,"name":"","type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"device_type": @0,
@"id": @0,
@"name": @"",
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/console-server-port-templates/:id/"]
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}}/dcim/console-server-port-templates/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/console-server-port-templates/:id/",
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([
'device_type' => 0,
'id' => 0,
'name' => '',
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/dcim/console-server-port-templates/:id/', [
'body' => '{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/console-server-port-templates/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'device_type' => 0,
'id' => 0,
'name' => '',
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'device_type' => 0,
'id' => 0,
'name' => '',
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/console-server-port-templates/:id/');
$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}}/dcim/console-server-port-templates/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/console-server-port-templates/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/dcim/console-server-port-templates/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/console-server-port-templates/:id/"
payload = {
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/console-server-port-templates/:id/"
payload <- "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\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}}/dcim/console-server-port-templates/:id/")
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 \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/dcim/console-server-port-templates/:id/') do |req|
req.body = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\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}}/dcim/console-server-port-templates/:id/";
let payload = json!({
"device_type": 0,
"id": 0,
"name": "",
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.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}}/dcim/console-server-port-templates/:id/ \
--header 'content-type: application/json' \
--data '{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}'
echo '{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}' | \
http PATCH {{baseUrl}}/dcim/console-server-port-templates/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "device_type": 0,\n "id": 0,\n "name": "",\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/console-server-port-templates/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"device_type": 0,
"id": 0,
"name": "",
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/console-server-port-templates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_console-server-port-templates_read
{{baseUrl}}/dcim/console-server-port-templates/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/console-server-port-templates/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/console-server-port-templates/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/console-server-port-templates/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/dcim/console-server-port-templates/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/console-server-port-templates/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/console-server-port-templates/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/dcim/console-server-port-templates/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/console-server-port-templates/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/console-server-port-templates/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/console-server-port-templates/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/console-server-port-templates/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/dcim/console-server-port-templates/:id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/dcim/console-server-port-templates/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/console-server-port-templates/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/console-server-port-templates/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/console-server-port-templates/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/console-server-port-templates/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/dcim/console-server-port-templates/:id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/console-server-port-templates/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/dcim/console-server-port-templates/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/console-server-port-templates/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/console-server-port-templates/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/console-server-port-templates/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/console-server-port-templates/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/dcim/console-server-port-templates/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/console-server-port-templates/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/console-server-port-templates/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/console-server-port-templates/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/console-server-port-templates/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/console-server-port-templates/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/console-server-port-templates/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/console-server-port-templates/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/console-server-port-templates/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/dcim/console-server-port-templates/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/console-server-port-templates/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/dcim/console-server-port-templates/:id/
http GET {{baseUrl}}/dcim/console-server-port-templates/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/console-server-port-templates/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/console-server-port-templates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
dcim_console-server-port-templates_update
{{baseUrl}}/dcim/console-server-port-templates/:id/
BODY json
{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/console-server-port-templates/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/dcim/console-server-port-templates/:id/" {:content-type :json
:form-params {:device_type 0
:id 0
:name ""
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/console-server-port-templates/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\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}}/dcim/console-server-port-templates/:id/"),
Content = new StringContent("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/console-server-port-templates/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/console-server-port-templates/:id/"
payload := strings.NewReader("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\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/dcim/console-server-port-templates/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 61
{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/dcim/console-server-port-templates/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/console-server-port-templates/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/console-server-port-templates/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/dcim/console-server-port-templates/:id/")
.header("content-type", "application/json")
.body("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
device_type: 0,
id: 0,
name: '',
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/dcim/console-server-port-templates/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/console-server-port-templates/:id/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, id: 0, name: '', type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/console-server-port-templates/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"id":0,"name":"","type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/console-server-port-templates/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "device_type": 0,\n "id": 0,\n "name": "",\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/console-server-port-templates/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/console-server-port-templates/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({device_type: 0, id: 0, name: '', type: ''}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/console-server-port-templates/:id/',
headers: {'content-type': 'application/json'},
body: {device_type: 0, id: 0, name: '', type: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/dcim/console-server-port-templates/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
device_type: 0,
id: 0,
name: '',
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/console-server-port-templates/:id/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, id: 0, name: '', type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/console-server-port-templates/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"id":0,"name":"","type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"device_type": @0,
@"id": @0,
@"name": @"",
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/console-server-port-templates/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/console-server-port-templates/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/console-server-port-templates/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'device_type' => 0,
'id' => 0,
'name' => '',
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/dcim/console-server-port-templates/:id/', [
'body' => '{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/console-server-port-templates/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'device_type' => 0,
'id' => 0,
'name' => '',
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'device_type' => 0,
'id' => 0,
'name' => '',
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/console-server-port-templates/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/console-server-port-templates/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/console-server-port-templates/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/dcim/console-server-port-templates/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/console-server-port-templates/:id/"
payload = {
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/console-server-port-templates/:id/"
payload <- "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\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}}/dcim/console-server-port-templates/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/dcim/console-server-port-templates/:id/') do |req|
req.body = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"type\": \"\"\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}}/dcim/console-server-port-templates/:id/";
let payload = json!({
"device_type": 0,
"id": 0,
"name": "",
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.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}}/dcim/console-server-port-templates/:id/ \
--header 'content-type: application/json' \
--data '{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}'
echo '{
"device_type": 0,
"id": 0,
"name": "",
"type": ""
}' | \
http PUT {{baseUrl}}/dcim/console-server-port-templates/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "device_type": 0,\n "id": 0,\n "name": "",\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/console-server-port-templates/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"device_type": 0,
"id": 0,
"name": "",
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/console-server-port-templates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
dcim_console-server-ports_create
{{baseUrl}}/dcim/console-server-ports/
BODY json
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/console-server-ports/");
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 \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/dcim/console-server-ports/" {:content-type :json
:form-params {:cable {:id 0
:label ""
:url ""}
:connected_endpoint {}
:connected_endpoint_type ""
:connection_status false
:description ""
:device 0
:id 0
:name ""
:tags []
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/console-server-ports/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/dcim/console-server-ports/"),
Content = new StringContent("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/console-server-ports/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/console-server-ports/"
payload := strings.NewReader("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/dcim/console-server-ports/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 244
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/dcim/console-server-ports/")
.setHeader("content-type", "application/json")
.setBody("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/console-server-ports/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/console-server-ports/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/dcim/console-server-ports/")
.header("content-type", "application/json")
.body("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
cable: {
id: 0,
label: '',
url: ''
},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
name: '',
tags: [],
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/dcim/console-server-ports/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/console-server-ports/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
name: '',
tags: [],
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/console-server-ports/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"connected_endpoint":{},"connected_endpoint_type":"","connection_status":false,"description":"","device":0,"id":0,"name":"","tags":[],"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/console-server-ports/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "connected_endpoint": {},\n "connected_endpoint_type": "",\n "connection_status": false,\n "description": "",\n "device": 0,\n "id": 0,\n "name": "",\n "tags": [],\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/console-server-ports/")
.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/dcim/console-server-ports/',
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({
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
name: '',
tags: [],
type: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/console-server-ports/',
headers: {'content-type': 'application/json'},
body: {
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
name: '',
tags: [],
type: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/dcim/console-server-ports/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cable: {
id: 0,
label: '',
url: ''
},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
name: '',
tags: [],
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/console-server-ports/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
name: '',
tags: [],
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/console-server-ports/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"connected_endpoint":{},"connected_endpoint_type":"","connection_status":false,"description":"","device":0,"id":0,"name":"","tags":[],"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"cable": @{ @"id": @0, @"label": @"", @"url": @"" },
@"connected_endpoint": @{ },
@"connected_endpoint_type": @"",
@"connection_status": @NO,
@"description": @"",
@"device": @0,
@"id": @0,
@"name": @"",
@"tags": @[ ],
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/console-server-ports/"]
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}}/dcim/console-server-ports/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/console-server-ports/",
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([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'device' => 0,
'id' => 0,
'name' => '',
'tags' => [
],
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/dcim/console-server-ports/', [
'body' => '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/console-server-ports/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'device' => 0,
'id' => 0,
'name' => '',
'tags' => [
],
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'device' => 0,
'id' => 0,
'name' => '',
'tags' => [
],
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/console-server-ports/');
$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}}/dcim/console-server-ports/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/console-server-ports/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/dcim/console-server-ports/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/console-server-ports/"
payload = {
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": False,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/console-server-ports/"
payload <- "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/console-server-ports/")
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 \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/dcim/console-server-ports/') do |req|
req.body = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/console-server-ports/";
let payload = json!({
"cable": json!({
"id": 0,
"label": "",
"url": ""
}),
"connected_endpoint": json!({}),
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": (),
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/dcim/console-server-ports/ \
--header 'content-type: application/json' \
--data '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}'
echo '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}' | \
http POST {{baseUrl}}/dcim/console-server-ports/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "connected_endpoint": {},\n "connected_endpoint_type": "",\n "connection_status": false,\n "description": "",\n "device": 0,\n "id": 0,\n "name": "",\n "tags": [],\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/console-server-ports/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cable": [
"id": 0,
"label": "",
"url": ""
],
"connected_endpoint": [],
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/console-server-ports/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
dcim_console-server-ports_delete
{{baseUrl}}/dcim/console-server-ports/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/console-server-ports/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/dcim/console-server-ports/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/console-server-ports/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/dcim/console-server-ports/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/console-server-ports/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/console-server-ports/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/dcim/console-server-ports/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/dcim/console-server-ports/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/console-server-ports/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/console-server-ports/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/dcim/console-server-ports/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/dcim/console-server-ports/:id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/dcim/console-server-ports/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/console-server-ports/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/console-server-ports/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/console-server-ports/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/console-server-ports/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/dcim/console-server-ports/:id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/dcim/console-server-ports/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/dcim/console-server-ports/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/console-server-ports/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/console-server-ports/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/console-server-ports/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/console-server-ports/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/dcim/console-server-ports/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/console-server-ports/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/console-server-ports/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/console-server-ports/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/console-server-ports/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/dcim/console-server-ports/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/console-server-ports/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/console-server-ports/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/console-server-ports/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/dcim/console-server-ports/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/console-server-ports/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/dcim/console-server-ports/:id/
http DELETE {{baseUrl}}/dcim/console-server-ports/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/dcim/console-server-ports/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/console-server-ports/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_console-server-ports_list
{{baseUrl}}/dcim/console-server-ports/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/console-server-ports/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/console-server-ports/")
require "http/client"
url = "{{baseUrl}}/dcim/console-server-ports/"
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}}/dcim/console-server-ports/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/console-server-ports/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/console-server-ports/"
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/dcim/console-server-ports/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/console-server-ports/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/console-server-ports/"))
.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}}/dcim/console-server-ports/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/console-server-ports/")
.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}}/dcim/console-server-ports/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/console-server-ports/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/console-server-ports/';
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}}/dcim/console-server-ports/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/console-server-ports/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/console-server-ports/',
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}}/dcim/console-server-ports/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/console-server-ports/');
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}}/dcim/console-server-ports/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/console-server-ports/';
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}}/dcim/console-server-ports/"]
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}}/dcim/console-server-ports/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/console-server-ports/",
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}}/dcim/console-server-ports/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/console-server-ports/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/console-server-ports/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/console-server-ports/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/console-server-ports/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/console-server-ports/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/console-server-ports/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/console-server-ports/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/console-server-ports/")
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/dcim/console-server-ports/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/console-server-ports/";
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}}/dcim/console-server-ports/
http GET {{baseUrl}}/dcim/console-server-ports/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/console-server-ports/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/console-server-ports/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
dcim_console-server-ports_partial_update
{{baseUrl}}/dcim/console-server-ports/:id/
BODY json
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/console-server-ports/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/dcim/console-server-ports/:id/" {:content-type :json
:form-params {:cable {:id 0
:label ""
:url ""}
:connected_endpoint {}
:connected_endpoint_type ""
:connection_status false
:description ""
:device 0
:id 0
:name ""
:tags []
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/console-server-ports/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\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}}/dcim/console-server-ports/:id/"),
Content = new StringContent("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/console-server-ports/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/console-server-ports/:id/"
payload := strings.NewReader("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\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/dcim/console-server-ports/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 244
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/dcim/console-server-ports/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/console-server-ports/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/console-server-ports/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/dcim/console-server-ports/:id/")
.header("content-type", "application/json")
.body("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
cable: {
id: 0,
label: '',
url: ''
},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
name: '',
tags: [],
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/dcim/console-server-ports/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/console-server-ports/:id/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
name: '',
tags: [],
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/console-server-ports/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"connected_endpoint":{},"connected_endpoint_type":"","connection_status":false,"description":"","device":0,"id":0,"name":"","tags":[],"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/console-server-ports/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "connected_endpoint": {},\n "connected_endpoint_type": "",\n "connection_status": false,\n "description": "",\n "device": 0,\n "id": 0,\n "name": "",\n "tags": [],\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/console-server-ports/:id/")
.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/dcim/console-server-ports/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
name: '',
tags: [],
type: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/console-server-ports/:id/',
headers: {'content-type': 'application/json'},
body: {
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
name: '',
tags: [],
type: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/dcim/console-server-ports/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cable: {
id: 0,
label: '',
url: ''
},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
name: '',
tags: [],
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/console-server-ports/:id/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
name: '',
tags: [],
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/console-server-ports/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"connected_endpoint":{},"connected_endpoint_type":"","connection_status":false,"description":"","device":0,"id":0,"name":"","tags":[],"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"cable": @{ @"id": @0, @"label": @"", @"url": @"" },
@"connected_endpoint": @{ },
@"connected_endpoint_type": @"",
@"connection_status": @NO,
@"description": @"",
@"device": @0,
@"id": @0,
@"name": @"",
@"tags": @[ ],
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/console-server-ports/:id/"]
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}}/dcim/console-server-ports/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/console-server-ports/:id/",
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([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'device' => 0,
'id' => 0,
'name' => '',
'tags' => [
],
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/dcim/console-server-ports/:id/', [
'body' => '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/console-server-ports/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'device' => 0,
'id' => 0,
'name' => '',
'tags' => [
],
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'device' => 0,
'id' => 0,
'name' => '',
'tags' => [
],
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/console-server-ports/:id/');
$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}}/dcim/console-server-ports/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/console-server-ports/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/dcim/console-server-ports/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/console-server-ports/:id/"
payload = {
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": False,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/console-server-ports/:id/"
payload <- "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\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}}/dcim/console-server-ports/:id/")
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 \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/dcim/console-server-ports/:id/') do |req|
req.body = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\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}}/dcim/console-server-ports/:id/";
let payload = json!({
"cable": json!({
"id": 0,
"label": "",
"url": ""
}),
"connected_endpoint": json!({}),
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": (),
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/dcim/console-server-ports/:id/ \
--header 'content-type: application/json' \
--data '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}'
echo '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}' | \
http PATCH {{baseUrl}}/dcim/console-server-ports/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "connected_endpoint": {},\n "connected_endpoint_type": "",\n "connection_status": false,\n "description": "",\n "device": 0,\n "id": 0,\n "name": "",\n "tags": [],\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/console-server-ports/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cable": [
"id": 0,
"label": "",
"url": ""
],
"connected_endpoint": [],
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/console-server-ports/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_console-server-ports_read
{{baseUrl}}/dcim/console-server-ports/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/console-server-ports/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/console-server-ports/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/console-server-ports/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/dcim/console-server-ports/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/console-server-ports/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/console-server-ports/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/dcim/console-server-ports/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/console-server-ports/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/console-server-ports/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/console-server-ports/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/console-server-ports/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/dcim/console-server-ports/:id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/dcim/console-server-ports/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/console-server-ports/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/console-server-ports/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/console-server-ports/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/console-server-ports/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/dcim/console-server-ports/:id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/console-server-ports/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/dcim/console-server-ports/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/console-server-ports/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/console-server-ports/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/console-server-ports/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/console-server-ports/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/dcim/console-server-ports/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/console-server-ports/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/console-server-ports/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/console-server-ports/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/console-server-ports/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/console-server-ports/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/console-server-ports/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/console-server-ports/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/console-server-ports/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/dcim/console-server-ports/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/console-server-ports/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/dcim/console-server-ports/:id/
http GET {{baseUrl}}/dcim/console-server-ports/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/console-server-ports/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/console-server-ports/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_console-server-ports_trace
{{baseUrl}}/dcim/console-server-ports/:id/trace/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/console-server-ports/:id/trace/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/console-server-ports/:id/trace/")
require "http/client"
url = "{{baseUrl}}/dcim/console-server-ports/:id/trace/"
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}}/dcim/console-server-ports/:id/trace/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/console-server-ports/:id/trace/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/console-server-ports/:id/trace/"
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/dcim/console-server-ports/:id/trace/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/console-server-ports/:id/trace/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/console-server-ports/:id/trace/"))
.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}}/dcim/console-server-ports/:id/trace/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/console-server-ports/:id/trace/")
.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}}/dcim/console-server-ports/:id/trace/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/dcim/console-server-ports/:id/trace/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/console-server-ports/:id/trace/';
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}}/dcim/console-server-ports/:id/trace/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/console-server-ports/:id/trace/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/console-server-ports/:id/trace/',
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}}/dcim/console-server-ports/:id/trace/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/console-server-ports/:id/trace/');
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}}/dcim/console-server-ports/:id/trace/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/console-server-ports/:id/trace/';
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}}/dcim/console-server-ports/:id/trace/"]
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}}/dcim/console-server-ports/:id/trace/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/console-server-ports/:id/trace/",
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}}/dcim/console-server-ports/:id/trace/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/console-server-ports/:id/trace/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/console-server-ports/:id/trace/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/console-server-ports/:id/trace/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/console-server-ports/:id/trace/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/console-server-ports/:id/trace/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/console-server-ports/:id/trace/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/console-server-ports/:id/trace/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/console-server-ports/:id/trace/")
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/dcim/console-server-ports/:id/trace/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/console-server-ports/:id/trace/";
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}}/dcim/console-server-ports/:id/trace/
http GET {{baseUrl}}/dcim/console-server-ports/:id/trace/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/console-server-ports/:id/trace/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/console-server-ports/:id/trace/")! 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()
PUT
dcim_console-server-ports_update
{{baseUrl}}/dcim/console-server-ports/:id/
BODY json
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/console-server-ports/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/dcim/console-server-ports/:id/" {:content-type :json
:form-params {:cable {:id 0
:label ""
:url ""}
:connected_endpoint {}
:connected_endpoint_type ""
:connection_status false
:description ""
:device 0
:id 0
:name ""
:tags []
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/console-server-ports/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\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}}/dcim/console-server-ports/:id/"),
Content = new StringContent("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/console-server-ports/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/console-server-ports/:id/"
payload := strings.NewReader("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\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/dcim/console-server-ports/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 244
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/dcim/console-server-ports/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/console-server-ports/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/console-server-ports/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/dcim/console-server-ports/:id/")
.header("content-type", "application/json")
.body("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
cable: {
id: 0,
label: '',
url: ''
},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
name: '',
tags: [],
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/dcim/console-server-ports/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/console-server-ports/:id/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
name: '',
tags: [],
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/console-server-ports/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"connected_endpoint":{},"connected_endpoint_type":"","connection_status":false,"description":"","device":0,"id":0,"name":"","tags":[],"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/console-server-ports/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "connected_endpoint": {},\n "connected_endpoint_type": "",\n "connection_status": false,\n "description": "",\n "device": 0,\n "id": 0,\n "name": "",\n "tags": [],\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/console-server-ports/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/console-server-ports/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
name: '',
tags: [],
type: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/console-server-ports/:id/',
headers: {'content-type': 'application/json'},
body: {
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
name: '',
tags: [],
type: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/dcim/console-server-ports/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cable: {
id: 0,
label: '',
url: ''
},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
name: '',
tags: [],
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/console-server-ports/:id/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
name: '',
tags: [],
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/console-server-ports/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"connected_endpoint":{},"connected_endpoint_type":"","connection_status":false,"description":"","device":0,"id":0,"name":"","tags":[],"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"cable": @{ @"id": @0, @"label": @"", @"url": @"" },
@"connected_endpoint": @{ },
@"connected_endpoint_type": @"",
@"connection_status": @NO,
@"description": @"",
@"device": @0,
@"id": @0,
@"name": @"",
@"tags": @[ ],
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/console-server-ports/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/console-server-ports/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/console-server-ports/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'device' => 0,
'id' => 0,
'name' => '',
'tags' => [
],
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/dcim/console-server-ports/:id/', [
'body' => '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/console-server-ports/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'device' => 0,
'id' => 0,
'name' => '',
'tags' => [
],
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'device' => 0,
'id' => 0,
'name' => '',
'tags' => [
],
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/console-server-ports/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/console-server-ports/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/console-server-ports/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/dcim/console-server-ports/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/console-server-ports/:id/"
payload = {
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": False,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/console-server-ports/:id/"
payload <- "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\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}}/dcim/console-server-ports/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/dcim/console-server-ports/:id/') do |req|
req.body = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\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}}/dcim/console-server-ports/:id/";
let payload = json!({
"cable": json!({
"id": 0,
"label": "",
"url": ""
}),
"connected_endpoint": json!({}),
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": (),
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/dcim/console-server-ports/:id/ \
--header 'content-type: application/json' \
--data '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}'
echo '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
}' | \
http PUT {{baseUrl}}/dcim/console-server-ports/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "connected_endpoint": {},\n "connected_endpoint_type": "",\n "connection_status": false,\n "description": "",\n "device": 0,\n "id": 0,\n "name": "",\n "tags": [],\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/console-server-ports/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cable": [
"id": 0,
"label": "",
"url": ""
],
"connected_endpoint": [],
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"name": "",
"tags": [],
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/console-server-ports/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
dcim_device-bay-templates_create
{{baseUrl}}/dcim/device-bay-templates/
BODY json
{
"device_type": 0,
"id": 0,
"name": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/device-bay-templates/");
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 \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/dcim/device-bay-templates/" {:content-type :json
:form-params {:device_type 0
:id 0
:name ""}})
require "http/client"
url = "{{baseUrl}}/dcim/device-bay-templates/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/dcim/device-bay-templates/"),
Content = new StringContent("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/device-bay-templates/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/device-bay-templates/"
payload := strings.NewReader("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/dcim/device-bay-templates/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 47
{
"device_type": 0,
"id": 0,
"name": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/dcim/device-bay-templates/")
.setHeader("content-type", "application/json")
.setBody("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/device-bay-templates/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/device-bay-templates/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/dcim/device-bay-templates/")
.header("content-type", "application/json")
.body("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\n}")
.asString();
const data = JSON.stringify({
device_type: 0,
id: 0,
name: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/dcim/device-bay-templates/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/device-bay-templates/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, id: 0, name: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/device-bay-templates/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"id":0,"name":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/device-bay-templates/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "device_type": 0,\n "id": 0,\n "name": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/device-bay-templates/")
.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/dcim/device-bay-templates/',
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({device_type: 0, id: 0, name: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/device-bay-templates/',
headers: {'content-type': 'application/json'},
body: {device_type: 0, id: 0, name: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/dcim/device-bay-templates/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
device_type: 0,
id: 0,
name: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/device-bay-templates/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, id: 0, name: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/device-bay-templates/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"id":0,"name":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"device_type": @0,
@"id": @0,
@"name": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/device-bay-templates/"]
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}}/dcim/device-bay-templates/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/device-bay-templates/",
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([
'device_type' => 0,
'id' => 0,
'name' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/dcim/device-bay-templates/', [
'body' => '{
"device_type": 0,
"id": 0,
"name": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/device-bay-templates/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'device_type' => 0,
'id' => 0,
'name' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'device_type' => 0,
'id' => 0,
'name' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/device-bay-templates/');
$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}}/dcim/device-bay-templates/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"id": 0,
"name": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/device-bay-templates/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"id": 0,
"name": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/dcim/device-bay-templates/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/device-bay-templates/"
payload = {
"device_type": 0,
"id": 0,
"name": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/device-bay-templates/"
payload <- "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/device-bay-templates/")
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 \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/dcim/device-bay-templates/') do |req|
req.body = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/device-bay-templates/";
let payload = json!({
"device_type": 0,
"id": 0,
"name": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/dcim/device-bay-templates/ \
--header 'content-type: application/json' \
--data '{
"device_type": 0,
"id": 0,
"name": ""
}'
echo '{
"device_type": 0,
"id": 0,
"name": ""
}' | \
http POST {{baseUrl}}/dcim/device-bay-templates/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "device_type": 0,\n "id": 0,\n "name": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/device-bay-templates/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"device_type": 0,
"id": 0,
"name": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/device-bay-templates/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
dcim_device-bay-templates_delete
{{baseUrl}}/dcim/device-bay-templates/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/device-bay-templates/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/dcim/device-bay-templates/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/device-bay-templates/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/dcim/device-bay-templates/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/device-bay-templates/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/device-bay-templates/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/dcim/device-bay-templates/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/dcim/device-bay-templates/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/device-bay-templates/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/device-bay-templates/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/dcim/device-bay-templates/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/dcim/device-bay-templates/:id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/dcim/device-bay-templates/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/device-bay-templates/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/device-bay-templates/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/device-bay-templates/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/device-bay-templates/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/dcim/device-bay-templates/:id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/dcim/device-bay-templates/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/dcim/device-bay-templates/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/device-bay-templates/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/device-bay-templates/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/device-bay-templates/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/device-bay-templates/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/dcim/device-bay-templates/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/device-bay-templates/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/device-bay-templates/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/device-bay-templates/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/device-bay-templates/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/dcim/device-bay-templates/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/device-bay-templates/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/device-bay-templates/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/device-bay-templates/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/dcim/device-bay-templates/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/device-bay-templates/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/dcim/device-bay-templates/:id/
http DELETE {{baseUrl}}/dcim/device-bay-templates/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/dcim/device-bay-templates/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/device-bay-templates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_device-bay-templates_list
{{baseUrl}}/dcim/device-bay-templates/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/device-bay-templates/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/device-bay-templates/")
require "http/client"
url = "{{baseUrl}}/dcim/device-bay-templates/"
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}}/dcim/device-bay-templates/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/device-bay-templates/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/device-bay-templates/"
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/dcim/device-bay-templates/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/device-bay-templates/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/device-bay-templates/"))
.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}}/dcim/device-bay-templates/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/device-bay-templates/")
.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}}/dcim/device-bay-templates/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/device-bay-templates/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/device-bay-templates/';
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}}/dcim/device-bay-templates/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/device-bay-templates/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/device-bay-templates/',
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}}/dcim/device-bay-templates/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/device-bay-templates/');
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}}/dcim/device-bay-templates/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/device-bay-templates/';
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}}/dcim/device-bay-templates/"]
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}}/dcim/device-bay-templates/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/device-bay-templates/",
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}}/dcim/device-bay-templates/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/device-bay-templates/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/device-bay-templates/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/device-bay-templates/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/device-bay-templates/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/device-bay-templates/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/device-bay-templates/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/device-bay-templates/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/device-bay-templates/")
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/dcim/device-bay-templates/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/device-bay-templates/";
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}}/dcim/device-bay-templates/
http GET {{baseUrl}}/dcim/device-bay-templates/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/device-bay-templates/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/device-bay-templates/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
dcim_device-bay-templates_partial_update
{{baseUrl}}/dcim/device-bay-templates/:id/
BODY json
{
"device_type": 0,
"id": 0,
"name": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/device-bay-templates/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/dcim/device-bay-templates/:id/" {:content-type :json
:form-params {:device_type 0
:id 0
:name ""}})
require "http/client"
url = "{{baseUrl}}/dcim/device-bay-templates/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\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}}/dcim/device-bay-templates/:id/"),
Content = new StringContent("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/device-bay-templates/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/device-bay-templates/:id/"
payload := strings.NewReader("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\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/dcim/device-bay-templates/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 47
{
"device_type": 0,
"id": 0,
"name": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/dcim/device-bay-templates/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/device-bay-templates/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/device-bay-templates/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/dcim/device-bay-templates/:id/")
.header("content-type", "application/json")
.body("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\n}")
.asString();
const data = JSON.stringify({
device_type: 0,
id: 0,
name: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/dcim/device-bay-templates/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/device-bay-templates/:id/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, id: 0, name: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/device-bay-templates/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"id":0,"name":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/device-bay-templates/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "device_type": 0,\n "id": 0,\n "name": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/device-bay-templates/:id/")
.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/dcim/device-bay-templates/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({device_type: 0, id: 0, name: ''}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/device-bay-templates/:id/',
headers: {'content-type': 'application/json'},
body: {device_type: 0, id: 0, name: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/dcim/device-bay-templates/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
device_type: 0,
id: 0,
name: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/device-bay-templates/:id/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, id: 0, name: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/device-bay-templates/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"id":0,"name":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"device_type": @0,
@"id": @0,
@"name": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/device-bay-templates/:id/"]
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}}/dcim/device-bay-templates/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/device-bay-templates/:id/",
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([
'device_type' => 0,
'id' => 0,
'name' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/dcim/device-bay-templates/:id/', [
'body' => '{
"device_type": 0,
"id": 0,
"name": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/device-bay-templates/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'device_type' => 0,
'id' => 0,
'name' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'device_type' => 0,
'id' => 0,
'name' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/device-bay-templates/:id/');
$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}}/dcim/device-bay-templates/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"id": 0,
"name": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/device-bay-templates/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"id": 0,
"name": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/dcim/device-bay-templates/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/device-bay-templates/:id/"
payload = {
"device_type": 0,
"id": 0,
"name": ""
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/device-bay-templates/:id/"
payload <- "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\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}}/dcim/device-bay-templates/:id/")
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 \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/dcim/device-bay-templates/:id/') do |req|
req.body = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\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}}/dcim/device-bay-templates/:id/";
let payload = json!({
"device_type": 0,
"id": 0,
"name": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/dcim/device-bay-templates/:id/ \
--header 'content-type: application/json' \
--data '{
"device_type": 0,
"id": 0,
"name": ""
}'
echo '{
"device_type": 0,
"id": 0,
"name": ""
}' | \
http PATCH {{baseUrl}}/dcim/device-bay-templates/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "device_type": 0,\n "id": 0,\n "name": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/device-bay-templates/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"device_type": 0,
"id": 0,
"name": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/device-bay-templates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_device-bay-templates_read
{{baseUrl}}/dcim/device-bay-templates/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/device-bay-templates/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/device-bay-templates/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/device-bay-templates/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/dcim/device-bay-templates/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/device-bay-templates/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/device-bay-templates/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/dcim/device-bay-templates/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/device-bay-templates/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/device-bay-templates/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/device-bay-templates/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/device-bay-templates/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/dcim/device-bay-templates/:id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/dcim/device-bay-templates/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/device-bay-templates/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/device-bay-templates/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/device-bay-templates/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/device-bay-templates/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/dcim/device-bay-templates/:id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/device-bay-templates/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/dcim/device-bay-templates/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/device-bay-templates/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/device-bay-templates/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/device-bay-templates/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/device-bay-templates/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/dcim/device-bay-templates/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/device-bay-templates/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/device-bay-templates/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/device-bay-templates/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/device-bay-templates/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/device-bay-templates/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/device-bay-templates/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/device-bay-templates/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/device-bay-templates/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/dcim/device-bay-templates/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/device-bay-templates/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/dcim/device-bay-templates/:id/
http GET {{baseUrl}}/dcim/device-bay-templates/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/device-bay-templates/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/device-bay-templates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
dcim_device-bay-templates_update
{{baseUrl}}/dcim/device-bay-templates/:id/
BODY json
{
"device_type": 0,
"id": 0,
"name": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/device-bay-templates/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/dcim/device-bay-templates/:id/" {:content-type :json
:form-params {:device_type 0
:id 0
:name ""}})
require "http/client"
url = "{{baseUrl}}/dcim/device-bay-templates/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\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}}/dcim/device-bay-templates/:id/"),
Content = new StringContent("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/device-bay-templates/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/device-bay-templates/:id/"
payload := strings.NewReader("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\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/dcim/device-bay-templates/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 47
{
"device_type": 0,
"id": 0,
"name": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/dcim/device-bay-templates/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/device-bay-templates/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/device-bay-templates/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/dcim/device-bay-templates/:id/")
.header("content-type", "application/json")
.body("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\n}")
.asString();
const data = JSON.stringify({
device_type: 0,
id: 0,
name: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/dcim/device-bay-templates/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/device-bay-templates/:id/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, id: 0, name: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/device-bay-templates/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"id":0,"name":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/device-bay-templates/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "device_type": 0,\n "id": 0,\n "name": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/device-bay-templates/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/device-bay-templates/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({device_type: 0, id: 0, name: ''}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/device-bay-templates/:id/',
headers: {'content-type': 'application/json'},
body: {device_type: 0, id: 0, name: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/dcim/device-bay-templates/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
device_type: 0,
id: 0,
name: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/device-bay-templates/:id/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, id: 0, name: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/device-bay-templates/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"id":0,"name":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"device_type": @0,
@"id": @0,
@"name": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/device-bay-templates/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/device-bay-templates/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/device-bay-templates/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'device_type' => 0,
'id' => 0,
'name' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/dcim/device-bay-templates/:id/', [
'body' => '{
"device_type": 0,
"id": 0,
"name": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/device-bay-templates/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'device_type' => 0,
'id' => 0,
'name' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'device_type' => 0,
'id' => 0,
'name' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/device-bay-templates/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/device-bay-templates/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"id": 0,
"name": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/device-bay-templates/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"id": 0,
"name": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/dcim/device-bay-templates/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/device-bay-templates/:id/"
payload = {
"device_type": 0,
"id": 0,
"name": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/device-bay-templates/:id/"
payload <- "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\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}}/dcim/device-bay-templates/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/dcim/device-bay-templates/:id/') do |req|
req.body = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\"\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}}/dcim/device-bay-templates/:id/";
let payload = json!({
"device_type": 0,
"id": 0,
"name": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/dcim/device-bay-templates/:id/ \
--header 'content-type: application/json' \
--data '{
"device_type": 0,
"id": 0,
"name": ""
}'
echo '{
"device_type": 0,
"id": 0,
"name": ""
}' | \
http PUT {{baseUrl}}/dcim/device-bay-templates/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "device_type": 0,\n "id": 0,\n "name": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/device-bay-templates/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"device_type": 0,
"id": 0,
"name": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/device-bay-templates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
dcim_device-bays_create
{{baseUrl}}/dcim/device-bays/
BODY json
{
"description": "",
"device": 0,
"id": 0,
"installed_device": 0,
"name": "",
"tags": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/device-bays/");
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 \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/dcim/device-bays/" {:content-type :json
:form-params {:description ""
:device 0
:id 0
:installed_device 0
:name ""
:tags []}})
require "http/client"
url = "{{baseUrl}}/dcim/device-bays/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\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}}/dcim/device-bays/"),
Content = new StringContent("{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\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}}/dcim/device-bays/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/device-bays/"
payload := strings.NewReader("{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\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/dcim/device-bays/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 102
{
"description": "",
"device": 0,
"id": 0,
"installed_device": 0,
"name": "",
"tags": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/dcim/device-bays/")
.setHeader("content-type", "application/json")
.setBody("{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/device-bays/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\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 \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/device-bays/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/dcim/device-bays/")
.header("content-type", "application/json")
.body("{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\n}")
.asString();
const data = JSON.stringify({
description: '',
device: 0,
id: 0,
installed_device: 0,
name: '',
tags: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/dcim/device-bays/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/device-bays/',
headers: {'content-type': 'application/json'},
data: {description: '', device: 0, id: 0, installed_device: 0, name: '', tags: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/device-bays/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"description":"","device":0,"id":0,"installed_device":0,"name":"","tags":[]}'
};
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}}/dcim/device-bays/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "description": "",\n "device": 0,\n "id": 0,\n "installed_device": 0,\n "name": "",\n "tags": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/device-bays/")
.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/dcim/device-bays/',
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({description: '', device: 0, id: 0, installed_device: 0, name: '', tags: []}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/device-bays/',
headers: {'content-type': 'application/json'},
body: {description: '', device: 0, id: 0, installed_device: 0, name: '', tags: []},
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}}/dcim/device-bays/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
description: '',
device: 0,
id: 0,
installed_device: 0,
name: '',
tags: []
});
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}}/dcim/device-bays/',
headers: {'content-type': 'application/json'},
data: {description: '', device: 0, id: 0, installed_device: 0, name: '', tags: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/device-bays/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"description":"","device":0,"id":0,"installed_device":0,"name":"","tags":[]}'
};
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 = @{ @"description": @"",
@"device": @0,
@"id": @0,
@"installed_device": @0,
@"name": @"",
@"tags": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/device-bays/"]
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}}/dcim/device-bays/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/device-bays/",
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([
'description' => '',
'device' => 0,
'id' => 0,
'installed_device' => 0,
'name' => '',
'tags' => [
]
]),
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}}/dcim/device-bays/', [
'body' => '{
"description": "",
"device": 0,
"id": 0,
"installed_device": 0,
"name": "",
"tags": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/device-bays/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'description' => '',
'device' => 0,
'id' => 0,
'installed_device' => 0,
'name' => '',
'tags' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'description' => '',
'device' => 0,
'id' => 0,
'installed_device' => 0,
'name' => '',
'tags' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/dcim/device-bays/');
$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}}/dcim/device-bays/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"device": 0,
"id": 0,
"installed_device": 0,
"name": "",
"tags": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/device-bays/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"device": 0,
"id": 0,
"installed_device": 0,
"name": "",
"tags": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/dcim/device-bays/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/device-bays/"
payload = {
"description": "",
"device": 0,
"id": 0,
"installed_device": 0,
"name": "",
"tags": []
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/device-bays/"
payload <- "{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\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}}/dcim/device-bays/")
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 \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\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/dcim/device-bays/') do |req|
req.body = "{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/device-bays/";
let payload = json!({
"description": "",
"device": 0,
"id": 0,
"installed_device": 0,
"name": "",
"tags": ()
});
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}}/dcim/device-bays/ \
--header 'content-type: application/json' \
--data '{
"description": "",
"device": 0,
"id": 0,
"installed_device": 0,
"name": "",
"tags": []
}'
echo '{
"description": "",
"device": 0,
"id": 0,
"installed_device": 0,
"name": "",
"tags": []
}' | \
http POST {{baseUrl}}/dcim/device-bays/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "description": "",\n "device": 0,\n "id": 0,\n "installed_device": 0,\n "name": "",\n "tags": []\n}' \
--output-document \
- {{baseUrl}}/dcim/device-bays/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"description": "",
"device": 0,
"id": 0,
"installed_device": 0,
"name": "",
"tags": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/device-bays/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
dcim_device-bays_delete
{{baseUrl}}/dcim/device-bays/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/device-bays/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/dcim/device-bays/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/device-bays/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/dcim/device-bays/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/device-bays/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/device-bays/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/dcim/device-bays/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/dcim/device-bays/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/device-bays/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/device-bays/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/dcim/device-bays/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/dcim/device-bays/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/device-bays/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/device-bays/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/device-bays/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/device-bays/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/device-bays/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/device-bays/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/dcim/device-bays/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/device-bays/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/device-bays/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/device-bays/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/device-bays/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/device-bays/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/dcim/device-bays/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/device-bays/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/device-bays/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/device-bays/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/device-bays/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/dcim/device-bays/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/device-bays/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/device-bays/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/device-bays/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/dcim/device-bays/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/device-bays/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/dcim/device-bays/:id/
http DELETE {{baseUrl}}/dcim/device-bays/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/dcim/device-bays/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/device-bays/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_device-bays_list
{{baseUrl}}/dcim/device-bays/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/device-bays/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/device-bays/")
require "http/client"
url = "{{baseUrl}}/dcim/device-bays/"
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}}/dcim/device-bays/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/device-bays/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/device-bays/"
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/dcim/device-bays/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/device-bays/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/device-bays/"))
.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}}/dcim/device-bays/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/device-bays/")
.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}}/dcim/device-bays/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/device-bays/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/device-bays/';
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}}/dcim/device-bays/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/device-bays/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/device-bays/',
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}}/dcim/device-bays/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/device-bays/');
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}}/dcim/device-bays/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/device-bays/';
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}}/dcim/device-bays/"]
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}}/dcim/device-bays/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/device-bays/",
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}}/dcim/device-bays/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/device-bays/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/device-bays/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/device-bays/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/device-bays/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/device-bays/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/device-bays/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/device-bays/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/device-bays/")
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/dcim/device-bays/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/device-bays/";
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}}/dcim/device-bays/
http GET {{baseUrl}}/dcim/device-bays/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/device-bays/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/device-bays/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
dcim_device-bays_partial_update
{{baseUrl}}/dcim/device-bays/:id/
BODY json
{
"description": "",
"device": 0,
"id": 0,
"installed_device": 0,
"name": "",
"tags": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/device-bays/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/dcim/device-bays/:id/" {:content-type :json
:form-params {:description ""
:device 0
:id 0
:installed_device 0
:name ""
:tags []}})
require "http/client"
url = "{{baseUrl}}/dcim/device-bays/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\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}}/dcim/device-bays/:id/"),
Content = new StringContent("{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\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}}/dcim/device-bays/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/device-bays/:id/"
payload := strings.NewReader("{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\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/dcim/device-bays/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 102
{
"description": "",
"device": 0,
"id": 0,
"installed_device": 0,
"name": "",
"tags": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/dcim/device-bays/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/device-bays/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\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 \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/device-bays/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/dcim/device-bays/:id/")
.header("content-type", "application/json")
.body("{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\n}")
.asString();
const data = JSON.stringify({
description: '',
device: 0,
id: 0,
installed_device: 0,
name: '',
tags: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/dcim/device-bays/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/device-bays/:id/',
headers: {'content-type': 'application/json'},
data: {description: '', device: 0, id: 0, installed_device: 0, name: '', tags: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/device-bays/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"description":"","device":0,"id":0,"installed_device":0,"name":"","tags":[]}'
};
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}}/dcim/device-bays/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "description": "",\n "device": 0,\n "id": 0,\n "installed_device": 0,\n "name": "",\n "tags": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/device-bays/:id/")
.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/dcim/device-bays/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({description: '', device: 0, id: 0, installed_device: 0, name: '', tags: []}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/device-bays/:id/',
headers: {'content-type': 'application/json'},
body: {description: '', device: 0, id: 0, installed_device: 0, name: '', tags: []},
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}}/dcim/device-bays/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
description: '',
device: 0,
id: 0,
installed_device: 0,
name: '',
tags: []
});
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}}/dcim/device-bays/:id/',
headers: {'content-type': 'application/json'},
data: {description: '', device: 0, id: 0, installed_device: 0, name: '', tags: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/device-bays/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"description":"","device":0,"id":0,"installed_device":0,"name":"","tags":[]}'
};
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 = @{ @"description": @"",
@"device": @0,
@"id": @0,
@"installed_device": @0,
@"name": @"",
@"tags": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/device-bays/:id/"]
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}}/dcim/device-bays/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/device-bays/:id/",
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([
'description' => '',
'device' => 0,
'id' => 0,
'installed_device' => 0,
'name' => '',
'tags' => [
]
]),
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}}/dcim/device-bays/:id/', [
'body' => '{
"description": "",
"device": 0,
"id": 0,
"installed_device": 0,
"name": "",
"tags": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/device-bays/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'description' => '',
'device' => 0,
'id' => 0,
'installed_device' => 0,
'name' => '',
'tags' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'description' => '',
'device' => 0,
'id' => 0,
'installed_device' => 0,
'name' => '',
'tags' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/dcim/device-bays/:id/');
$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}}/dcim/device-bays/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"device": 0,
"id": 0,
"installed_device": 0,
"name": "",
"tags": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/device-bays/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"device": 0,
"id": 0,
"installed_device": 0,
"name": "",
"tags": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/dcim/device-bays/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/device-bays/:id/"
payload = {
"description": "",
"device": 0,
"id": 0,
"installed_device": 0,
"name": "",
"tags": []
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/device-bays/:id/"
payload <- "{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\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}}/dcim/device-bays/:id/")
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 \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\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/dcim/device-bays/:id/') do |req|
req.body = "{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\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}}/dcim/device-bays/:id/";
let payload = json!({
"description": "",
"device": 0,
"id": 0,
"installed_device": 0,
"name": "",
"tags": ()
});
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}}/dcim/device-bays/:id/ \
--header 'content-type: application/json' \
--data '{
"description": "",
"device": 0,
"id": 0,
"installed_device": 0,
"name": "",
"tags": []
}'
echo '{
"description": "",
"device": 0,
"id": 0,
"installed_device": 0,
"name": "",
"tags": []
}' | \
http PATCH {{baseUrl}}/dcim/device-bays/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "description": "",\n "device": 0,\n "id": 0,\n "installed_device": 0,\n "name": "",\n "tags": []\n}' \
--output-document \
- {{baseUrl}}/dcim/device-bays/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"description": "",
"device": 0,
"id": 0,
"installed_device": 0,
"name": "",
"tags": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/device-bays/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_device-bays_read
{{baseUrl}}/dcim/device-bays/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/device-bays/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/device-bays/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/device-bays/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/dcim/device-bays/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/device-bays/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/device-bays/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/dcim/device-bays/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/device-bays/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/device-bays/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/device-bays/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/device-bays/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/dcim/device-bays/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/device-bays/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/device-bays/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/device-bays/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/device-bays/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/device-bays/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/dcim/device-bays/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/device-bays/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/dcim/device-bays/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/device-bays/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/device-bays/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/device-bays/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/device-bays/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/dcim/device-bays/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/device-bays/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/device-bays/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/device-bays/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/device-bays/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/device-bays/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/device-bays/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/device-bays/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/device-bays/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/dcim/device-bays/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/device-bays/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/dcim/device-bays/:id/
http GET {{baseUrl}}/dcim/device-bays/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/device-bays/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/device-bays/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
dcim_device-bays_update
{{baseUrl}}/dcim/device-bays/:id/
BODY json
{
"description": "",
"device": 0,
"id": 0,
"installed_device": 0,
"name": "",
"tags": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/device-bays/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/dcim/device-bays/:id/" {:content-type :json
:form-params {:description ""
:device 0
:id 0
:installed_device 0
:name ""
:tags []}})
require "http/client"
url = "{{baseUrl}}/dcim/device-bays/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\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}}/dcim/device-bays/:id/"),
Content = new StringContent("{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\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}}/dcim/device-bays/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/device-bays/:id/"
payload := strings.NewReader("{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\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/dcim/device-bays/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 102
{
"description": "",
"device": 0,
"id": 0,
"installed_device": 0,
"name": "",
"tags": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/dcim/device-bays/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/device-bays/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\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 \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/device-bays/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/dcim/device-bays/:id/")
.header("content-type", "application/json")
.body("{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\n}")
.asString();
const data = JSON.stringify({
description: '',
device: 0,
id: 0,
installed_device: 0,
name: '',
tags: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/dcim/device-bays/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/device-bays/:id/',
headers: {'content-type': 'application/json'},
data: {description: '', device: 0, id: 0, installed_device: 0, name: '', tags: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/device-bays/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"description":"","device":0,"id":0,"installed_device":0,"name":"","tags":[]}'
};
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}}/dcim/device-bays/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "description": "",\n "device": 0,\n "id": 0,\n "installed_device": 0,\n "name": "",\n "tags": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/device-bays/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/device-bays/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({description: '', device: 0, id: 0, installed_device: 0, name: '', tags: []}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/device-bays/:id/',
headers: {'content-type': 'application/json'},
body: {description: '', device: 0, id: 0, installed_device: 0, name: '', tags: []},
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}}/dcim/device-bays/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
description: '',
device: 0,
id: 0,
installed_device: 0,
name: '',
tags: []
});
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}}/dcim/device-bays/:id/',
headers: {'content-type': 'application/json'},
data: {description: '', device: 0, id: 0, installed_device: 0, name: '', tags: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/device-bays/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"description":"","device":0,"id":0,"installed_device":0,"name":"","tags":[]}'
};
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 = @{ @"description": @"",
@"device": @0,
@"id": @0,
@"installed_device": @0,
@"name": @"",
@"tags": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/device-bays/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/device-bays/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/device-bays/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'description' => '',
'device' => 0,
'id' => 0,
'installed_device' => 0,
'name' => '',
'tags' => [
]
]),
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}}/dcim/device-bays/:id/', [
'body' => '{
"description": "",
"device": 0,
"id": 0,
"installed_device": 0,
"name": "",
"tags": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/device-bays/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'description' => '',
'device' => 0,
'id' => 0,
'installed_device' => 0,
'name' => '',
'tags' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'description' => '',
'device' => 0,
'id' => 0,
'installed_device' => 0,
'name' => '',
'tags' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/dcim/device-bays/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/device-bays/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"device": 0,
"id": 0,
"installed_device": 0,
"name": "",
"tags": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/device-bays/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"device": 0,
"id": 0,
"installed_device": 0,
"name": "",
"tags": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/dcim/device-bays/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/device-bays/:id/"
payload = {
"description": "",
"device": 0,
"id": 0,
"installed_device": 0,
"name": "",
"tags": []
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/device-bays/:id/"
payload <- "{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\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}}/dcim/device-bays/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\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/dcim/device-bays/:id/') do |req|
req.body = "{\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"installed_device\": 0,\n \"name\": \"\",\n \"tags\": []\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}}/dcim/device-bays/:id/";
let payload = json!({
"description": "",
"device": 0,
"id": 0,
"installed_device": 0,
"name": "",
"tags": ()
});
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}}/dcim/device-bays/:id/ \
--header 'content-type: application/json' \
--data '{
"description": "",
"device": 0,
"id": 0,
"installed_device": 0,
"name": "",
"tags": []
}'
echo '{
"description": "",
"device": 0,
"id": 0,
"installed_device": 0,
"name": "",
"tags": []
}' | \
http PUT {{baseUrl}}/dcim/device-bays/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "description": "",\n "device": 0,\n "id": 0,\n "installed_device": 0,\n "name": "",\n "tags": []\n}' \
--output-document \
- {{baseUrl}}/dcim/device-bays/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"description": "",
"device": 0,
"id": 0,
"installed_device": 0,
"name": "",
"tags": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/device-bays/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
dcim_device-roles_create
{{baseUrl}}/dcim/device-roles/
BODY json
{
"color": "",
"description": "",
"device_count": 0,
"id": 0,
"name": "",
"slug": "",
"virtualmachine_count": 0,
"vm_role": false
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/device-roles/");
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 \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/dcim/device-roles/" {:content-type :json
:form-params {:color ""
:description ""
:device_count 0
:id 0
:name ""
:slug ""
:virtualmachine_count 0
:vm_role false}})
require "http/client"
url = "{{baseUrl}}/dcim/device-roles/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\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}}/dcim/device-roles/"),
Content = new StringContent("{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\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}}/dcim/device-roles/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/device-roles/"
payload := strings.NewReader("{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\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/dcim/device-roles/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 147
{
"color": "",
"description": "",
"device_count": 0,
"id": 0,
"name": "",
"slug": "",
"virtualmachine_count": 0,
"vm_role": false
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/dcim/device-roles/")
.setHeader("content-type", "application/json")
.setBody("{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/device-roles/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\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 \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/device-roles/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/dcim/device-roles/")
.header("content-type", "application/json")
.body("{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\n}")
.asString();
const data = JSON.stringify({
color: '',
description: '',
device_count: 0,
id: 0,
name: '',
slug: '',
virtualmachine_count: 0,
vm_role: false
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/dcim/device-roles/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/device-roles/',
headers: {'content-type': 'application/json'},
data: {
color: '',
description: '',
device_count: 0,
id: 0,
name: '',
slug: '',
virtualmachine_count: 0,
vm_role: false
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/device-roles/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"color":"","description":"","device_count":0,"id":0,"name":"","slug":"","virtualmachine_count":0,"vm_role":false}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/device-roles/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "color": "",\n "description": "",\n "device_count": 0,\n "id": 0,\n "name": "",\n "slug": "",\n "virtualmachine_count": 0,\n "vm_role": false\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/device-roles/")
.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/dcim/device-roles/',
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({
color: '',
description: '',
device_count: 0,
id: 0,
name: '',
slug: '',
virtualmachine_count: 0,
vm_role: false
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/device-roles/',
headers: {'content-type': 'application/json'},
body: {
color: '',
description: '',
device_count: 0,
id: 0,
name: '',
slug: '',
virtualmachine_count: 0,
vm_role: false
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/dcim/device-roles/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
color: '',
description: '',
device_count: 0,
id: 0,
name: '',
slug: '',
virtualmachine_count: 0,
vm_role: false
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/device-roles/',
headers: {'content-type': 'application/json'},
data: {
color: '',
description: '',
device_count: 0,
id: 0,
name: '',
slug: '',
virtualmachine_count: 0,
vm_role: false
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/device-roles/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"color":"","description":"","device_count":0,"id":0,"name":"","slug":"","virtualmachine_count":0,"vm_role":false}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"color": @"",
@"description": @"",
@"device_count": @0,
@"id": @0,
@"name": @"",
@"slug": @"",
@"virtualmachine_count": @0,
@"vm_role": @NO };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/device-roles/"]
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}}/dcim/device-roles/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/device-roles/",
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([
'color' => '',
'description' => '',
'device_count' => 0,
'id' => 0,
'name' => '',
'slug' => '',
'virtualmachine_count' => 0,
'vm_role' => null
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/dcim/device-roles/', [
'body' => '{
"color": "",
"description": "",
"device_count": 0,
"id": 0,
"name": "",
"slug": "",
"virtualmachine_count": 0,
"vm_role": false
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/device-roles/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'color' => '',
'description' => '',
'device_count' => 0,
'id' => 0,
'name' => '',
'slug' => '',
'virtualmachine_count' => 0,
'vm_role' => null
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'color' => '',
'description' => '',
'device_count' => 0,
'id' => 0,
'name' => '',
'slug' => '',
'virtualmachine_count' => 0,
'vm_role' => null
]));
$request->setRequestUrl('{{baseUrl}}/dcim/device-roles/');
$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}}/dcim/device-roles/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"color": "",
"description": "",
"device_count": 0,
"id": 0,
"name": "",
"slug": "",
"virtualmachine_count": 0,
"vm_role": false
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/device-roles/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"color": "",
"description": "",
"device_count": 0,
"id": 0,
"name": "",
"slug": "",
"virtualmachine_count": 0,
"vm_role": false
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/dcim/device-roles/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/device-roles/"
payload = {
"color": "",
"description": "",
"device_count": 0,
"id": 0,
"name": "",
"slug": "",
"virtualmachine_count": 0,
"vm_role": False
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/device-roles/"
payload <- "{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\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}}/dcim/device-roles/")
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 \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\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/dcim/device-roles/') do |req|
req.body = "{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/device-roles/";
let payload = json!({
"color": "",
"description": "",
"device_count": 0,
"id": 0,
"name": "",
"slug": "",
"virtualmachine_count": 0,
"vm_role": false
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/dcim/device-roles/ \
--header 'content-type: application/json' \
--data '{
"color": "",
"description": "",
"device_count": 0,
"id": 0,
"name": "",
"slug": "",
"virtualmachine_count": 0,
"vm_role": false
}'
echo '{
"color": "",
"description": "",
"device_count": 0,
"id": 0,
"name": "",
"slug": "",
"virtualmachine_count": 0,
"vm_role": false
}' | \
http POST {{baseUrl}}/dcim/device-roles/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "color": "",\n "description": "",\n "device_count": 0,\n "id": 0,\n "name": "",\n "slug": "",\n "virtualmachine_count": 0,\n "vm_role": false\n}' \
--output-document \
- {{baseUrl}}/dcim/device-roles/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"color": "",
"description": "",
"device_count": 0,
"id": 0,
"name": "",
"slug": "",
"virtualmachine_count": 0,
"vm_role": false
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/device-roles/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
dcim_device-roles_delete
{{baseUrl}}/dcim/device-roles/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/device-roles/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/dcim/device-roles/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/device-roles/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/dcim/device-roles/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/device-roles/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/device-roles/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/dcim/device-roles/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/dcim/device-roles/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/device-roles/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/device-roles/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/dcim/device-roles/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/dcim/device-roles/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/device-roles/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/device-roles/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/device-roles/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/device-roles/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/device-roles/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/device-roles/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/dcim/device-roles/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/device-roles/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/device-roles/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/device-roles/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/device-roles/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/device-roles/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/dcim/device-roles/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/device-roles/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/device-roles/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/device-roles/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/device-roles/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/dcim/device-roles/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/device-roles/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/device-roles/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/device-roles/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/dcim/device-roles/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/device-roles/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/dcim/device-roles/:id/
http DELETE {{baseUrl}}/dcim/device-roles/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/dcim/device-roles/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/device-roles/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_device-roles_list
{{baseUrl}}/dcim/device-roles/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/device-roles/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/device-roles/")
require "http/client"
url = "{{baseUrl}}/dcim/device-roles/"
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}}/dcim/device-roles/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/device-roles/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/device-roles/"
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/dcim/device-roles/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/device-roles/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/device-roles/"))
.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}}/dcim/device-roles/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/device-roles/")
.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}}/dcim/device-roles/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/device-roles/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/device-roles/';
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}}/dcim/device-roles/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/device-roles/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/device-roles/',
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}}/dcim/device-roles/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/device-roles/');
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}}/dcim/device-roles/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/device-roles/';
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}}/dcim/device-roles/"]
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}}/dcim/device-roles/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/device-roles/",
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}}/dcim/device-roles/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/device-roles/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/device-roles/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/device-roles/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/device-roles/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/device-roles/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/device-roles/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/device-roles/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/device-roles/")
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/dcim/device-roles/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/device-roles/";
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}}/dcim/device-roles/
http GET {{baseUrl}}/dcim/device-roles/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/device-roles/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/device-roles/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
dcim_device-roles_partial_update
{{baseUrl}}/dcim/device-roles/:id/
BODY json
{
"color": "",
"description": "",
"device_count": 0,
"id": 0,
"name": "",
"slug": "",
"virtualmachine_count": 0,
"vm_role": false
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/device-roles/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/dcim/device-roles/:id/" {:content-type :json
:form-params {:color ""
:description ""
:device_count 0
:id 0
:name ""
:slug ""
:virtualmachine_count 0
:vm_role false}})
require "http/client"
url = "{{baseUrl}}/dcim/device-roles/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\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}}/dcim/device-roles/:id/"),
Content = new StringContent("{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\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}}/dcim/device-roles/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/device-roles/:id/"
payload := strings.NewReader("{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\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/dcim/device-roles/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 147
{
"color": "",
"description": "",
"device_count": 0,
"id": 0,
"name": "",
"slug": "",
"virtualmachine_count": 0,
"vm_role": false
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/dcim/device-roles/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/device-roles/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\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 \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/device-roles/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/dcim/device-roles/:id/")
.header("content-type", "application/json")
.body("{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\n}")
.asString();
const data = JSON.stringify({
color: '',
description: '',
device_count: 0,
id: 0,
name: '',
slug: '',
virtualmachine_count: 0,
vm_role: false
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/dcim/device-roles/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/device-roles/:id/',
headers: {'content-type': 'application/json'},
data: {
color: '',
description: '',
device_count: 0,
id: 0,
name: '',
slug: '',
virtualmachine_count: 0,
vm_role: false
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/device-roles/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"color":"","description":"","device_count":0,"id":0,"name":"","slug":"","virtualmachine_count":0,"vm_role":false}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/device-roles/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "color": "",\n "description": "",\n "device_count": 0,\n "id": 0,\n "name": "",\n "slug": "",\n "virtualmachine_count": 0,\n "vm_role": false\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/device-roles/:id/")
.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/dcim/device-roles/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
color: '',
description: '',
device_count: 0,
id: 0,
name: '',
slug: '',
virtualmachine_count: 0,
vm_role: false
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/device-roles/:id/',
headers: {'content-type': 'application/json'},
body: {
color: '',
description: '',
device_count: 0,
id: 0,
name: '',
slug: '',
virtualmachine_count: 0,
vm_role: false
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/dcim/device-roles/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
color: '',
description: '',
device_count: 0,
id: 0,
name: '',
slug: '',
virtualmachine_count: 0,
vm_role: false
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/device-roles/:id/',
headers: {'content-type': 'application/json'},
data: {
color: '',
description: '',
device_count: 0,
id: 0,
name: '',
slug: '',
virtualmachine_count: 0,
vm_role: false
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/device-roles/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"color":"","description":"","device_count":0,"id":0,"name":"","slug":"","virtualmachine_count":0,"vm_role":false}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"color": @"",
@"description": @"",
@"device_count": @0,
@"id": @0,
@"name": @"",
@"slug": @"",
@"virtualmachine_count": @0,
@"vm_role": @NO };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/device-roles/:id/"]
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}}/dcim/device-roles/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/device-roles/:id/",
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([
'color' => '',
'description' => '',
'device_count' => 0,
'id' => 0,
'name' => '',
'slug' => '',
'virtualmachine_count' => 0,
'vm_role' => null
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/dcim/device-roles/:id/', [
'body' => '{
"color": "",
"description": "",
"device_count": 0,
"id": 0,
"name": "",
"slug": "",
"virtualmachine_count": 0,
"vm_role": false
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/device-roles/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'color' => '',
'description' => '',
'device_count' => 0,
'id' => 0,
'name' => '',
'slug' => '',
'virtualmachine_count' => 0,
'vm_role' => null
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'color' => '',
'description' => '',
'device_count' => 0,
'id' => 0,
'name' => '',
'slug' => '',
'virtualmachine_count' => 0,
'vm_role' => null
]));
$request->setRequestUrl('{{baseUrl}}/dcim/device-roles/:id/');
$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}}/dcim/device-roles/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"color": "",
"description": "",
"device_count": 0,
"id": 0,
"name": "",
"slug": "",
"virtualmachine_count": 0,
"vm_role": false
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/device-roles/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"color": "",
"description": "",
"device_count": 0,
"id": 0,
"name": "",
"slug": "",
"virtualmachine_count": 0,
"vm_role": false
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/dcim/device-roles/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/device-roles/:id/"
payload = {
"color": "",
"description": "",
"device_count": 0,
"id": 0,
"name": "",
"slug": "",
"virtualmachine_count": 0,
"vm_role": False
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/device-roles/:id/"
payload <- "{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\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}}/dcim/device-roles/:id/")
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 \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\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/dcim/device-roles/:id/') do |req|
req.body = "{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\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}}/dcim/device-roles/:id/";
let payload = json!({
"color": "",
"description": "",
"device_count": 0,
"id": 0,
"name": "",
"slug": "",
"virtualmachine_count": 0,
"vm_role": false
});
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}}/dcim/device-roles/:id/ \
--header 'content-type: application/json' \
--data '{
"color": "",
"description": "",
"device_count": 0,
"id": 0,
"name": "",
"slug": "",
"virtualmachine_count": 0,
"vm_role": false
}'
echo '{
"color": "",
"description": "",
"device_count": 0,
"id": 0,
"name": "",
"slug": "",
"virtualmachine_count": 0,
"vm_role": false
}' | \
http PATCH {{baseUrl}}/dcim/device-roles/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "color": "",\n "description": "",\n "device_count": 0,\n "id": 0,\n "name": "",\n "slug": "",\n "virtualmachine_count": 0,\n "vm_role": false\n}' \
--output-document \
- {{baseUrl}}/dcim/device-roles/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"color": "",
"description": "",
"device_count": 0,
"id": 0,
"name": "",
"slug": "",
"virtualmachine_count": 0,
"vm_role": false
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/device-roles/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_device-roles_read
{{baseUrl}}/dcim/device-roles/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/device-roles/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/device-roles/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/device-roles/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/dcim/device-roles/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/device-roles/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/device-roles/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/dcim/device-roles/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/device-roles/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/device-roles/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/device-roles/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/device-roles/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/dcim/device-roles/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/device-roles/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/device-roles/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/device-roles/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/device-roles/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/device-roles/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/dcim/device-roles/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/device-roles/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/dcim/device-roles/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/device-roles/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/device-roles/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/device-roles/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/device-roles/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/dcim/device-roles/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/device-roles/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/device-roles/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/device-roles/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/device-roles/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/device-roles/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/device-roles/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/device-roles/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/device-roles/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/dcim/device-roles/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/device-roles/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/dcim/device-roles/:id/
http GET {{baseUrl}}/dcim/device-roles/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/device-roles/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/device-roles/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
dcim_device-roles_update
{{baseUrl}}/dcim/device-roles/:id/
BODY json
{
"color": "",
"description": "",
"device_count": 0,
"id": 0,
"name": "",
"slug": "",
"virtualmachine_count": 0,
"vm_role": false
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/device-roles/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/dcim/device-roles/:id/" {:content-type :json
:form-params {:color ""
:description ""
:device_count 0
:id 0
:name ""
:slug ""
:virtualmachine_count 0
:vm_role false}})
require "http/client"
url = "{{baseUrl}}/dcim/device-roles/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\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}}/dcim/device-roles/:id/"),
Content = new StringContent("{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\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}}/dcim/device-roles/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/device-roles/:id/"
payload := strings.NewReader("{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\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/dcim/device-roles/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 147
{
"color": "",
"description": "",
"device_count": 0,
"id": 0,
"name": "",
"slug": "",
"virtualmachine_count": 0,
"vm_role": false
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/dcim/device-roles/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/device-roles/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\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 \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/device-roles/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/dcim/device-roles/:id/")
.header("content-type", "application/json")
.body("{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\n}")
.asString();
const data = JSON.stringify({
color: '',
description: '',
device_count: 0,
id: 0,
name: '',
slug: '',
virtualmachine_count: 0,
vm_role: false
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/dcim/device-roles/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/device-roles/:id/',
headers: {'content-type': 'application/json'},
data: {
color: '',
description: '',
device_count: 0,
id: 0,
name: '',
slug: '',
virtualmachine_count: 0,
vm_role: false
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/device-roles/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"color":"","description":"","device_count":0,"id":0,"name":"","slug":"","virtualmachine_count":0,"vm_role":false}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/device-roles/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "color": "",\n "description": "",\n "device_count": 0,\n "id": 0,\n "name": "",\n "slug": "",\n "virtualmachine_count": 0,\n "vm_role": false\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/device-roles/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/device-roles/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
color: '',
description: '',
device_count: 0,
id: 0,
name: '',
slug: '',
virtualmachine_count: 0,
vm_role: false
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/device-roles/:id/',
headers: {'content-type': 'application/json'},
body: {
color: '',
description: '',
device_count: 0,
id: 0,
name: '',
slug: '',
virtualmachine_count: 0,
vm_role: false
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/dcim/device-roles/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
color: '',
description: '',
device_count: 0,
id: 0,
name: '',
slug: '',
virtualmachine_count: 0,
vm_role: false
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/device-roles/:id/',
headers: {'content-type': 'application/json'},
data: {
color: '',
description: '',
device_count: 0,
id: 0,
name: '',
slug: '',
virtualmachine_count: 0,
vm_role: false
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/device-roles/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"color":"","description":"","device_count":0,"id":0,"name":"","slug":"","virtualmachine_count":0,"vm_role":false}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"color": @"",
@"description": @"",
@"device_count": @0,
@"id": @0,
@"name": @"",
@"slug": @"",
@"virtualmachine_count": @0,
@"vm_role": @NO };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/device-roles/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/device-roles/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/device-roles/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'color' => '',
'description' => '',
'device_count' => 0,
'id' => 0,
'name' => '',
'slug' => '',
'virtualmachine_count' => 0,
'vm_role' => null
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/dcim/device-roles/:id/', [
'body' => '{
"color": "",
"description": "",
"device_count": 0,
"id": 0,
"name": "",
"slug": "",
"virtualmachine_count": 0,
"vm_role": false
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/device-roles/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'color' => '',
'description' => '',
'device_count' => 0,
'id' => 0,
'name' => '',
'slug' => '',
'virtualmachine_count' => 0,
'vm_role' => null
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'color' => '',
'description' => '',
'device_count' => 0,
'id' => 0,
'name' => '',
'slug' => '',
'virtualmachine_count' => 0,
'vm_role' => null
]));
$request->setRequestUrl('{{baseUrl}}/dcim/device-roles/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/device-roles/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"color": "",
"description": "",
"device_count": 0,
"id": 0,
"name": "",
"slug": "",
"virtualmachine_count": 0,
"vm_role": false
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/device-roles/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"color": "",
"description": "",
"device_count": 0,
"id": 0,
"name": "",
"slug": "",
"virtualmachine_count": 0,
"vm_role": false
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/dcim/device-roles/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/device-roles/:id/"
payload = {
"color": "",
"description": "",
"device_count": 0,
"id": 0,
"name": "",
"slug": "",
"virtualmachine_count": 0,
"vm_role": False
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/device-roles/:id/"
payload <- "{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\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}}/dcim/device-roles/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\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/dcim/device-roles/:id/') do |req|
req.body = "{\n \"color\": \"\",\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0,\n \"vm_role\": false\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}}/dcim/device-roles/:id/";
let payload = json!({
"color": "",
"description": "",
"device_count": 0,
"id": 0,
"name": "",
"slug": "",
"virtualmachine_count": 0,
"vm_role": false
});
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}}/dcim/device-roles/:id/ \
--header 'content-type: application/json' \
--data '{
"color": "",
"description": "",
"device_count": 0,
"id": 0,
"name": "",
"slug": "",
"virtualmachine_count": 0,
"vm_role": false
}'
echo '{
"color": "",
"description": "",
"device_count": 0,
"id": 0,
"name": "",
"slug": "",
"virtualmachine_count": 0,
"vm_role": false
}' | \
http PUT {{baseUrl}}/dcim/device-roles/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "color": "",\n "description": "",\n "device_count": 0,\n "id": 0,\n "name": "",\n "slug": "",\n "virtualmachine_count": 0,\n "vm_role": false\n}' \
--output-document \
- {{baseUrl}}/dcim/device-roles/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"color": "",
"description": "",
"device_count": 0,
"id": 0,
"name": "",
"slug": "",
"virtualmachine_count": 0,
"vm_role": false
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/device-roles/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
dcim_device-types_create
{{baseUrl}}/dcim/device-types/
BODY json
{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"display_name": "",
"front_image": "",
"id": 0,
"is_full_depth": false,
"last_updated": "",
"manufacturer": 0,
"model": "",
"part_number": "",
"rear_image": "",
"slug": "",
"subdevice_role": "",
"tags": [],
"u_height": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/device-types/");
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 \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/dcim/device-types/" {:content-type :json
:form-params {:comments ""
:created ""
:custom_fields {}
:device_count 0
:display_name ""
:front_image ""
:id 0
:is_full_depth false
:last_updated ""
:manufacturer 0
:model ""
:part_number ""
:rear_image ""
:slug ""
:subdevice_role ""
:tags []
:u_height 0}})
require "http/client"
url = "{{baseUrl}}/dcim/device-types/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/dcim/device-types/"),
Content = new StringContent("{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/device-types/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/device-types/"
payload := strings.NewReader("{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/dcim/device-types/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 329
{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"display_name": "",
"front_image": "",
"id": 0,
"is_full_depth": false,
"last_updated": "",
"manufacturer": 0,
"model": "",
"part_number": "",
"rear_image": "",
"slug": "",
"subdevice_role": "",
"tags": [],
"u_height": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/dcim/device-types/")
.setHeader("content-type", "application/json")
.setBody("{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/device-types/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/device-types/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/dcim/device-types/")
.header("content-type", "application/json")
.body("{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\n}")
.asString();
const data = JSON.stringify({
comments: '',
created: '',
custom_fields: {},
device_count: 0,
display_name: '',
front_image: '',
id: 0,
is_full_depth: false,
last_updated: '',
manufacturer: 0,
model: '',
part_number: '',
rear_image: '',
slug: '',
subdevice_role: '',
tags: [],
u_height: 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}}/dcim/device-types/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/device-types/',
headers: {'content-type': 'application/json'},
data: {
comments: '',
created: '',
custom_fields: {},
device_count: 0,
display_name: '',
front_image: '',
id: 0,
is_full_depth: false,
last_updated: '',
manufacturer: 0,
model: '',
part_number: '',
rear_image: '',
slug: '',
subdevice_role: '',
tags: [],
u_height: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/device-types/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"comments":"","created":"","custom_fields":{},"device_count":0,"display_name":"","front_image":"","id":0,"is_full_depth":false,"last_updated":"","manufacturer":0,"model":"","part_number":"","rear_image":"","slug":"","subdevice_role":"","tags":[],"u_height":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}}/dcim/device-types/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "comments": "",\n "created": "",\n "custom_fields": {},\n "device_count": 0,\n "display_name": "",\n "front_image": "",\n "id": 0,\n "is_full_depth": false,\n "last_updated": "",\n "manufacturer": 0,\n "model": "",\n "part_number": "",\n "rear_image": "",\n "slug": "",\n "subdevice_role": "",\n "tags": [],\n "u_height": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/device-types/")
.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/dcim/device-types/',
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({
comments: '',
created: '',
custom_fields: {},
device_count: 0,
display_name: '',
front_image: '',
id: 0,
is_full_depth: false,
last_updated: '',
manufacturer: 0,
model: '',
part_number: '',
rear_image: '',
slug: '',
subdevice_role: '',
tags: [],
u_height: 0
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/device-types/',
headers: {'content-type': 'application/json'},
body: {
comments: '',
created: '',
custom_fields: {},
device_count: 0,
display_name: '',
front_image: '',
id: 0,
is_full_depth: false,
last_updated: '',
manufacturer: 0,
model: '',
part_number: '',
rear_image: '',
slug: '',
subdevice_role: '',
tags: [],
u_height: 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}}/dcim/device-types/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
comments: '',
created: '',
custom_fields: {},
device_count: 0,
display_name: '',
front_image: '',
id: 0,
is_full_depth: false,
last_updated: '',
manufacturer: 0,
model: '',
part_number: '',
rear_image: '',
slug: '',
subdevice_role: '',
tags: [],
u_height: 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}}/dcim/device-types/',
headers: {'content-type': 'application/json'},
data: {
comments: '',
created: '',
custom_fields: {},
device_count: 0,
display_name: '',
front_image: '',
id: 0,
is_full_depth: false,
last_updated: '',
manufacturer: 0,
model: '',
part_number: '',
rear_image: '',
slug: '',
subdevice_role: '',
tags: [],
u_height: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/device-types/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"comments":"","created":"","custom_fields":{},"device_count":0,"display_name":"","front_image":"","id":0,"is_full_depth":false,"last_updated":"","manufacturer":0,"model":"","part_number":"","rear_image":"","slug":"","subdevice_role":"","tags":[],"u_height":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 = @{ @"comments": @"",
@"created": @"",
@"custom_fields": @{ },
@"device_count": @0,
@"display_name": @"",
@"front_image": @"",
@"id": @0,
@"is_full_depth": @NO,
@"last_updated": @"",
@"manufacturer": @0,
@"model": @"",
@"part_number": @"",
@"rear_image": @"",
@"slug": @"",
@"subdevice_role": @"",
@"tags": @[ ],
@"u_height": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/device-types/"]
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}}/dcim/device-types/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/device-types/",
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([
'comments' => '',
'created' => '',
'custom_fields' => [
],
'device_count' => 0,
'display_name' => '',
'front_image' => '',
'id' => 0,
'is_full_depth' => null,
'last_updated' => '',
'manufacturer' => 0,
'model' => '',
'part_number' => '',
'rear_image' => '',
'slug' => '',
'subdevice_role' => '',
'tags' => [
],
'u_height' => 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}}/dcim/device-types/', [
'body' => '{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"display_name": "",
"front_image": "",
"id": 0,
"is_full_depth": false,
"last_updated": "",
"manufacturer": 0,
"model": "",
"part_number": "",
"rear_image": "",
"slug": "",
"subdevice_role": "",
"tags": [],
"u_height": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/device-types/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'comments' => '',
'created' => '',
'custom_fields' => [
],
'device_count' => 0,
'display_name' => '',
'front_image' => '',
'id' => 0,
'is_full_depth' => null,
'last_updated' => '',
'manufacturer' => 0,
'model' => '',
'part_number' => '',
'rear_image' => '',
'slug' => '',
'subdevice_role' => '',
'tags' => [
],
'u_height' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'comments' => '',
'created' => '',
'custom_fields' => [
],
'device_count' => 0,
'display_name' => '',
'front_image' => '',
'id' => 0,
'is_full_depth' => null,
'last_updated' => '',
'manufacturer' => 0,
'model' => '',
'part_number' => '',
'rear_image' => '',
'slug' => '',
'subdevice_role' => '',
'tags' => [
],
'u_height' => 0
]));
$request->setRequestUrl('{{baseUrl}}/dcim/device-types/');
$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}}/dcim/device-types/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"display_name": "",
"front_image": "",
"id": 0,
"is_full_depth": false,
"last_updated": "",
"manufacturer": 0,
"model": "",
"part_number": "",
"rear_image": "",
"slug": "",
"subdevice_role": "",
"tags": [],
"u_height": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/device-types/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"display_name": "",
"front_image": "",
"id": 0,
"is_full_depth": false,
"last_updated": "",
"manufacturer": 0,
"model": "",
"part_number": "",
"rear_image": "",
"slug": "",
"subdevice_role": "",
"tags": [],
"u_height": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/dcim/device-types/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/device-types/"
payload = {
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"display_name": "",
"front_image": "",
"id": 0,
"is_full_depth": False,
"last_updated": "",
"manufacturer": 0,
"model": "",
"part_number": "",
"rear_image": "",
"slug": "",
"subdevice_role": "",
"tags": [],
"u_height": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/device-types/"
payload <- "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/device-types/")
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 \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/dcim/device-types/') do |req|
req.body = "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/device-types/";
let payload = json!({
"comments": "",
"created": "",
"custom_fields": json!({}),
"device_count": 0,
"display_name": "",
"front_image": "",
"id": 0,
"is_full_depth": false,
"last_updated": "",
"manufacturer": 0,
"model": "",
"part_number": "",
"rear_image": "",
"slug": "",
"subdevice_role": "",
"tags": (),
"u_height": 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}}/dcim/device-types/ \
--header 'content-type: application/json' \
--data '{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"display_name": "",
"front_image": "",
"id": 0,
"is_full_depth": false,
"last_updated": "",
"manufacturer": 0,
"model": "",
"part_number": "",
"rear_image": "",
"slug": "",
"subdevice_role": "",
"tags": [],
"u_height": 0
}'
echo '{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"display_name": "",
"front_image": "",
"id": 0,
"is_full_depth": false,
"last_updated": "",
"manufacturer": 0,
"model": "",
"part_number": "",
"rear_image": "",
"slug": "",
"subdevice_role": "",
"tags": [],
"u_height": 0
}' | \
http POST {{baseUrl}}/dcim/device-types/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "comments": "",\n "created": "",\n "custom_fields": {},\n "device_count": 0,\n "display_name": "",\n "front_image": "",\n "id": 0,\n "is_full_depth": false,\n "last_updated": "",\n "manufacturer": 0,\n "model": "",\n "part_number": "",\n "rear_image": "",\n "slug": "",\n "subdevice_role": "",\n "tags": [],\n "u_height": 0\n}' \
--output-document \
- {{baseUrl}}/dcim/device-types/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"comments": "",
"created": "",
"custom_fields": [],
"device_count": 0,
"display_name": "",
"front_image": "",
"id": 0,
"is_full_depth": false,
"last_updated": "",
"manufacturer": 0,
"model": "",
"part_number": "",
"rear_image": "",
"slug": "",
"subdevice_role": "",
"tags": [],
"u_height": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/device-types/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
dcim_device-types_delete
{{baseUrl}}/dcim/device-types/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/device-types/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/dcim/device-types/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/device-types/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/dcim/device-types/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/device-types/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/device-types/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/dcim/device-types/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/dcim/device-types/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/device-types/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/device-types/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/dcim/device-types/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/dcim/device-types/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/device-types/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/device-types/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/device-types/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/device-types/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/device-types/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/device-types/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/dcim/device-types/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/device-types/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/device-types/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/device-types/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/device-types/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/device-types/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/dcim/device-types/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/device-types/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/device-types/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/device-types/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/device-types/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/dcim/device-types/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/device-types/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/device-types/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/device-types/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/dcim/device-types/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/device-types/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/dcim/device-types/:id/
http DELETE {{baseUrl}}/dcim/device-types/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/dcim/device-types/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/device-types/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_device-types_list
{{baseUrl}}/dcim/device-types/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/device-types/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/device-types/")
require "http/client"
url = "{{baseUrl}}/dcim/device-types/"
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}}/dcim/device-types/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/device-types/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/device-types/"
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/dcim/device-types/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/device-types/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/device-types/"))
.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}}/dcim/device-types/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/device-types/")
.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}}/dcim/device-types/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/device-types/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/device-types/';
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}}/dcim/device-types/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/device-types/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/device-types/',
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}}/dcim/device-types/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/device-types/');
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}}/dcim/device-types/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/device-types/';
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}}/dcim/device-types/"]
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}}/dcim/device-types/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/device-types/",
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}}/dcim/device-types/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/device-types/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/device-types/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/device-types/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/device-types/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/device-types/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/device-types/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/device-types/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/device-types/")
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/dcim/device-types/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/device-types/";
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}}/dcim/device-types/
http GET {{baseUrl}}/dcim/device-types/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/device-types/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/device-types/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
dcim_device-types_partial_update
{{baseUrl}}/dcim/device-types/:id/
BODY json
{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"display_name": "",
"front_image": "",
"id": 0,
"is_full_depth": false,
"last_updated": "",
"manufacturer": 0,
"model": "",
"part_number": "",
"rear_image": "",
"slug": "",
"subdevice_role": "",
"tags": [],
"u_height": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/device-types/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/dcim/device-types/:id/" {:content-type :json
:form-params {:comments ""
:created ""
:custom_fields {}
:device_count 0
:display_name ""
:front_image ""
:id 0
:is_full_depth false
:last_updated ""
:manufacturer 0
:model ""
:part_number ""
:rear_image ""
:slug ""
:subdevice_role ""
:tags []
:u_height 0}})
require "http/client"
url = "{{baseUrl}}/dcim/device-types/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\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}}/dcim/device-types/:id/"),
Content = new StringContent("{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/device-types/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/device-types/:id/"
payload := strings.NewReader("{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\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/dcim/device-types/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 329
{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"display_name": "",
"front_image": "",
"id": 0,
"is_full_depth": false,
"last_updated": "",
"manufacturer": 0,
"model": "",
"part_number": "",
"rear_image": "",
"slug": "",
"subdevice_role": "",
"tags": [],
"u_height": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/dcim/device-types/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/device-types/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/device-types/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/dcim/device-types/:id/")
.header("content-type", "application/json")
.body("{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\n}")
.asString();
const data = JSON.stringify({
comments: '',
created: '',
custom_fields: {},
device_count: 0,
display_name: '',
front_image: '',
id: 0,
is_full_depth: false,
last_updated: '',
manufacturer: 0,
model: '',
part_number: '',
rear_image: '',
slug: '',
subdevice_role: '',
tags: [],
u_height: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/dcim/device-types/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/device-types/:id/',
headers: {'content-type': 'application/json'},
data: {
comments: '',
created: '',
custom_fields: {},
device_count: 0,
display_name: '',
front_image: '',
id: 0,
is_full_depth: false,
last_updated: '',
manufacturer: 0,
model: '',
part_number: '',
rear_image: '',
slug: '',
subdevice_role: '',
tags: [],
u_height: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/device-types/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"comments":"","created":"","custom_fields":{},"device_count":0,"display_name":"","front_image":"","id":0,"is_full_depth":false,"last_updated":"","manufacturer":0,"model":"","part_number":"","rear_image":"","slug":"","subdevice_role":"","tags":[],"u_height":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}}/dcim/device-types/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "comments": "",\n "created": "",\n "custom_fields": {},\n "device_count": 0,\n "display_name": "",\n "front_image": "",\n "id": 0,\n "is_full_depth": false,\n "last_updated": "",\n "manufacturer": 0,\n "model": "",\n "part_number": "",\n "rear_image": "",\n "slug": "",\n "subdevice_role": "",\n "tags": [],\n "u_height": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/device-types/:id/")
.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/dcim/device-types/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
comments: '',
created: '',
custom_fields: {},
device_count: 0,
display_name: '',
front_image: '',
id: 0,
is_full_depth: false,
last_updated: '',
manufacturer: 0,
model: '',
part_number: '',
rear_image: '',
slug: '',
subdevice_role: '',
tags: [],
u_height: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/device-types/:id/',
headers: {'content-type': 'application/json'},
body: {
comments: '',
created: '',
custom_fields: {},
device_count: 0,
display_name: '',
front_image: '',
id: 0,
is_full_depth: false,
last_updated: '',
manufacturer: 0,
model: '',
part_number: '',
rear_image: '',
slug: '',
subdevice_role: '',
tags: [],
u_height: 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('PATCH', '{{baseUrl}}/dcim/device-types/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
comments: '',
created: '',
custom_fields: {},
device_count: 0,
display_name: '',
front_image: '',
id: 0,
is_full_depth: false,
last_updated: '',
manufacturer: 0,
model: '',
part_number: '',
rear_image: '',
slug: '',
subdevice_role: '',
tags: [],
u_height: 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: 'PATCH',
url: '{{baseUrl}}/dcim/device-types/:id/',
headers: {'content-type': 'application/json'},
data: {
comments: '',
created: '',
custom_fields: {},
device_count: 0,
display_name: '',
front_image: '',
id: 0,
is_full_depth: false,
last_updated: '',
manufacturer: 0,
model: '',
part_number: '',
rear_image: '',
slug: '',
subdevice_role: '',
tags: [],
u_height: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/device-types/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"comments":"","created":"","custom_fields":{},"device_count":0,"display_name":"","front_image":"","id":0,"is_full_depth":false,"last_updated":"","manufacturer":0,"model":"","part_number":"","rear_image":"","slug":"","subdevice_role":"","tags":[],"u_height":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 = @{ @"comments": @"",
@"created": @"",
@"custom_fields": @{ },
@"device_count": @0,
@"display_name": @"",
@"front_image": @"",
@"id": @0,
@"is_full_depth": @NO,
@"last_updated": @"",
@"manufacturer": @0,
@"model": @"",
@"part_number": @"",
@"rear_image": @"",
@"slug": @"",
@"subdevice_role": @"",
@"tags": @[ ],
@"u_height": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/device-types/:id/"]
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}}/dcim/device-types/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/device-types/:id/",
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([
'comments' => '',
'created' => '',
'custom_fields' => [
],
'device_count' => 0,
'display_name' => '',
'front_image' => '',
'id' => 0,
'is_full_depth' => null,
'last_updated' => '',
'manufacturer' => 0,
'model' => '',
'part_number' => '',
'rear_image' => '',
'slug' => '',
'subdevice_role' => '',
'tags' => [
],
'u_height' => 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('PATCH', '{{baseUrl}}/dcim/device-types/:id/', [
'body' => '{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"display_name": "",
"front_image": "",
"id": 0,
"is_full_depth": false,
"last_updated": "",
"manufacturer": 0,
"model": "",
"part_number": "",
"rear_image": "",
"slug": "",
"subdevice_role": "",
"tags": [],
"u_height": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/device-types/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'comments' => '',
'created' => '',
'custom_fields' => [
],
'device_count' => 0,
'display_name' => '',
'front_image' => '',
'id' => 0,
'is_full_depth' => null,
'last_updated' => '',
'manufacturer' => 0,
'model' => '',
'part_number' => '',
'rear_image' => '',
'slug' => '',
'subdevice_role' => '',
'tags' => [
],
'u_height' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'comments' => '',
'created' => '',
'custom_fields' => [
],
'device_count' => 0,
'display_name' => '',
'front_image' => '',
'id' => 0,
'is_full_depth' => null,
'last_updated' => '',
'manufacturer' => 0,
'model' => '',
'part_number' => '',
'rear_image' => '',
'slug' => '',
'subdevice_role' => '',
'tags' => [
],
'u_height' => 0
]));
$request->setRequestUrl('{{baseUrl}}/dcim/device-types/:id/');
$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}}/dcim/device-types/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"display_name": "",
"front_image": "",
"id": 0,
"is_full_depth": false,
"last_updated": "",
"manufacturer": 0,
"model": "",
"part_number": "",
"rear_image": "",
"slug": "",
"subdevice_role": "",
"tags": [],
"u_height": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/device-types/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"display_name": "",
"front_image": "",
"id": 0,
"is_full_depth": false,
"last_updated": "",
"manufacturer": 0,
"model": "",
"part_number": "",
"rear_image": "",
"slug": "",
"subdevice_role": "",
"tags": [],
"u_height": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/dcim/device-types/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/device-types/:id/"
payload = {
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"display_name": "",
"front_image": "",
"id": 0,
"is_full_depth": False,
"last_updated": "",
"manufacturer": 0,
"model": "",
"part_number": "",
"rear_image": "",
"slug": "",
"subdevice_role": "",
"tags": [],
"u_height": 0
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/device-types/:id/"
payload <- "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\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}}/dcim/device-types/:id/")
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 \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/dcim/device-types/:id/') do |req|
req.body = "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\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}}/dcim/device-types/:id/";
let payload = json!({
"comments": "",
"created": "",
"custom_fields": json!({}),
"device_count": 0,
"display_name": "",
"front_image": "",
"id": 0,
"is_full_depth": false,
"last_updated": "",
"manufacturer": 0,
"model": "",
"part_number": "",
"rear_image": "",
"slug": "",
"subdevice_role": "",
"tags": (),
"u_height": 0
});
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}}/dcim/device-types/:id/ \
--header 'content-type: application/json' \
--data '{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"display_name": "",
"front_image": "",
"id": 0,
"is_full_depth": false,
"last_updated": "",
"manufacturer": 0,
"model": "",
"part_number": "",
"rear_image": "",
"slug": "",
"subdevice_role": "",
"tags": [],
"u_height": 0
}'
echo '{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"display_name": "",
"front_image": "",
"id": 0,
"is_full_depth": false,
"last_updated": "",
"manufacturer": 0,
"model": "",
"part_number": "",
"rear_image": "",
"slug": "",
"subdevice_role": "",
"tags": [],
"u_height": 0
}' | \
http PATCH {{baseUrl}}/dcim/device-types/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "comments": "",\n "created": "",\n "custom_fields": {},\n "device_count": 0,\n "display_name": "",\n "front_image": "",\n "id": 0,\n "is_full_depth": false,\n "last_updated": "",\n "manufacturer": 0,\n "model": "",\n "part_number": "",\n "rear_image": "",\n "slug": "",\n "subdevice_role": "",\n "tags": [],\n "u_height": 0\n}' \
--output-document \
- {{baseUrl}}/dcim/device-types/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"comments": "",
"created": "",
"custom_fields": [],
"device_count": 0,
"display_name": "",
"front_image": "",
"id": 0,
"is_full_depth": false,
"last_updated": "",
"manufacturer": 0,
"model": "",
"part_number": "",
"rear_image": "",
"slug": "",
"subdevice_role": "",
"tags": [],
"u_height": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/device-types/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_device-types_read
{{baseUrl}}/dcim/device-types/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/device-types/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/device-types/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/device-types/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/dcim/device-types/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/device-types/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/device-types/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/dcim/device-types/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/device-types/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/device-types/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/device-types/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/device-types/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/dcim/device-types/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/device-types/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/device-types/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/device-types/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/device-types/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/device-types/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/dcim/device-types/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/device-types/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/dcim/device-types/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/device-types/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/device-types/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/device-types/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/device-types/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/dcim/device-types/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/device-types/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/device-types/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/device-types/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/device-types/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/device-types/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/device-types/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/device-types/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/device-types/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/dcim/device-types/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/device-types/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/dcim/device-types/:id/
http GET {{baseUrl}}/dcim/device-types/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/device-types/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/device-types/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
dcim_device-types_update
{{baseUrl}}/dcim/device-types/:id/
BODY json
{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"display_name": "",
"front_image": "",
"id": 0,
"is_full_depth": false,
"last_updated": "",
"manufacturer": 0,
"model": "",
"part_number": "",
"rear_image": "",
"slug": "",
"subdevice_role": "",
"tags": [],
"u_height": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/device-types/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/dcim/device-types/:id/" {:content-type :json
:form-params {:comments ""
:created ""
:custom_fields {}
:device_count 0
:display_name ""
:front_image ""
:id 0
:is_full_depth false
:last_updated ""
:manufacturer 0
:model ""
:part_number ""
:rear_image ""
:slug ""
:subdevice_role ""
:tags []
:u_height 0}})
require "http/client"
url = "{{baseUrl}}/dcim/device-types/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\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}}/dcim/device-types/:id/"),
Content = new StringContent("{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/device-types/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/device-types/:id/"
payload := strings.NewReader("{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\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/dcim/device-types/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 329
{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"display_name": "",
"front_image": "",
"id": 0,
"is_full_depth": false,
"last_updated": "",
"manufacturer": 0,
"model": "",
"part_number": "",
"rear_image": "",
"slug": "",
"subdevice_role": "",
"tags": [],
"u_height": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/dcim/device-types/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/device-types/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/device-types/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/dcim/device-types/:id/")
.header("content-type", "application/json")
.body("{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\n}")
.asString();
const data = JSON.stringify({
comments: '',
created: '',
custom_fields: {},
device_count: 0,
display_name: '',
front_image: '',
id: 0,
is_full_depth: false,
last_updated: '',
manufacturer: 0,
model: '',
part_number: '',
rear_image: '',
slug: '',
subdevice_role: '',
tags: [],
u_height: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/dcim/device-types/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/device-types/:id/',
headers: {'content-type': 'application/json'},
data: {
comments: '',
created: '',
custom_fields: {},
device_count: 0,
display_name: '',
front_image: '',
id: 0,
is_full_depth: false,
last_updated: '',
manufacturer: 0,
model: '',
part_number: '',
rear_image: '',
slug: '',
subdevice_role: '',
tags: [],
u_height: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/device-types/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"comments":"","created":"","custom_fields":{},"device_count":0,"display_name":"","front_image":"","id":0,"is_full_depth":false,"last_updated":"","manufacturer":0,"model":"","part_number":"","rear_image":"","slug":"","subdevice_role":"","tags":[],"u_height":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}}/dcim/device-types/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "comments": "",\n "created": "",\n "custom_fields": {},\n "device_count": 0,\n "display_name": "",\n "front_image": "",\n "id": 0,\n "is_full_depth": false,\n "last_updated": "",\n "manufacturer": 0,\n "model": "",\n "part_number": "",\n "rear_image": "",\n "slug": "",\n "subdevice_role": "",\n "tags": [],\n "u_height": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/device-types/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/device-types/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
comments: '',
created: '',
custom_fields: {},
device_count: 0,
display_name: '',
front_image: '',
id: 0,
is_full_depth: false,
last_updated: '',
manufacturer: 0,
model: '',
part_number: '',
rear_image: '',
slug: '',
subdevice_role: '',
tags: [],
u_height: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/device-types/:id/',
headers: {'content-type': 'application/json'},
body: {
comments: '',
created: '',
custom_fields: {},
device_count: 0,
display_name: '',
front_image: '',
id: 0,
is_full_depth: false,
last_updated: '',
manufacturer: 0,
model: '',
part_number: '',
rear_image: '',
slug: '',
subdevice_role: '',
tags: [],
u_height: 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('PUT', '{{baseUrl}}/dcim/device-types/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
comments: '',
created: '',
custom_fields: {},
device_count: 0,
display_name: '',
front_image: '',
id: 0,
is_full_depth: false,
last_updated: '',
manufacturer: 0,
model: '',
part_number: '',
rear_image: '',
slug: '',
subdevice_role: '',
tags: [],
u_height: 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: 'PUT',
url: '{{baseUrl}}/dcim/device-types/:id/',
headers: {'content-type': 'application/json'},
data: {
comments: '',
created: '',
custom_fields: {},
device_count: 0,
display_name: '',
front_image: '',
id: 0,
is_full_depth: false,
last_updated: '',
manufacturer: 0,
model: '',
part_number: '',
rear_image: '',
slug: '',
subdevice_role: '',
tags: [],
u_height: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/device-types/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"comments":"","created":"","custom_fields":{},"device_count":0,"display_name":"","front_image":"","id":0,"is_full_depth":false,"last_updated":"","manufacturer":0,"model":"","part_number":"","rear_image":"","slug":"","subdevice_role":"","tags":[],"u_height":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 = @{ @"comments": @"",
@"created": @"",
@"custom_fields": @{ },
@"device_count": @0,
@"display_name": @"",
@"front_image": @"",
@"id": @0,
@"is_full_depth": @NO,
@"last_updated": @"",
@"manufacturer": @0,
@"model": @"",
@"part_number": @"",
@"rear_image": @"",
@"slug": @"",
@"subdevice_role": @"",
@"tags": @[ ],
@"u_height": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/device-types/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/device-types/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/device-types/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'comments' => '',
'created' => '',
'custom_fields' => [
],
'device_count' => 0,
'display_name' => '',
'front_image' => '',
'id' => 0,
'is_full_depth' => null,
'last_updated' => '',
'manufacturer' => 0,
'model' => '',
'part_number' => '',
'rear_image' => '',
'slug' => '',
'subdevice_role' => '',
'tags' => [
],
'u_height' => 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('PUT', '{{baseUrl}}/dcim/device-types/:id/', [
'body' => '{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"display_name": "",
"front_image": "",
"id": 0,
"is_full_depth": false,
"last_updated": "",
"manufacturer": 0,
"model": "",
"part_number": "",
"rear_image": "",
"slug": "",
"subdevice_role": "",
"tags": [],
"u_height": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/device-types/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'comments' => '',
'created' => '',
'custom_fields' => [
],
'device_count' => 0,
'display_name' => '',
'front_image' => '',
'id' => 0,
'is_full_depth' => null,
'last_updated' => '',
'manufacturer' => 0,
'model' => '',
'part_number' => '',
'rear_image' => '',
'slug' => '',
'subdevice_role' => '',
'tags' => [
],
'u_height' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'comments' => '',
'created' => '',
'custom_fields' => [
],
'device_count' => 0,
'display_name' => '',
'front_image' => '',
'id' => 0,
'is_full_depth' => null,
'last_updated' => '',
'manufacturer' => 0,
'model' => '',
'part_number' => '',
'rear_image' => '',
'slug' => '',
'subdevice_role' => '',
'tags' => [
],
'u_height' => 0
]));
$request->setRequestUrl('{{baseUrl}}/dcim/device-types/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/device-types/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"display_name": "",
"front_image": "",
"id": 0,
"is_full_depth": false,
"last_updated": "",
"manufacturer": 0,
"model": "",
"part_number": "",
"rear_image": "",
"slug": "",
"subdevice_role": "",
"tags": [],
"u_height": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/device-types/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"display_name": "",
"front_image": "",
"id": 0,
"is_full_depth": false,
"last_updated": "",
"manufacturer": 0,
"model": "",
"part_number": "",
"rear_image": "",
"slug": "",
"subdevice_role": "",
"tags": [],
"u_height": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/dcim/device-types/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/device-types/:id/"
payload = {
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"display_name": "",
"front_image": "",
"id": 0,
"is_full_depth": False,
"last_updated": "",
"manufacturer": 0,
"model": "",
"part_number": "",
"rear_image": "",
"slug": "",
"subdevice_role": "",
"tags": [],
"u_height": 0
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/device-types/:id/"
payload <- "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\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}}/dcim/device-types/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/dcim/device-types/:id/') do |req|
req.body = "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"display_name\": \"\",\n \"front_image\": \"\",\n \"id\": 0,\n \"is_full_depth\": false,\n \"last_updated\": \"\",\n \"manufacturer\": 0,\n \"model\": \"\",\n \"part_number\": \"\",\n \"rear_image\": \"\",\n \"slug\": \"\",\n \"subdevice_role\": \"\",\n \"tags\": [],\n \"u_height\": 0\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}}/dcim/device-types/:id/";
let payload = json!({
"comments": "",
"created": "",
"custom_fields": json!({}),
"device_count": 0,
"display_name": "",
"front_image": "",
"id": 0,
"is_full_depth": false,
"last_updated": "",
"manufacturer": 0,
"model": "",
"part_number": "",
"rear_image": "",
"slug": "",
"subdevice_role": "",
"tags": (),
"u_height": 0
});
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}}/dcim/device-types/:id/ \
--header 'content-type: application/json' \
--data '{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"display_name": "",
"front_image": "",
"id": 0,
"is_full_depth": false,
"last_updated": "",
"manufacturer": 0,
"model": "",
"part_number": "",
"rear_image": "",
"slug": "",
"subdevice_role": "",
"tags": [],
"u_height": 0
}'
echo '{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"display_name": "",
"front_image": "",
"id": 0,
"is_full_depth": false,
"last_updated": "",
"manufacturer": 0,
"model": "",
"part_number": "",
"rear_image": "",
"slug": "",
"subdevice_role": "",
"tags": [],
"u_height": 0
}' | \
http PUT {{baseUrl}}/dcim/device-types/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "comments": "",\n "created": "",\n "custom_fields": {},\n "device_count": 0,\n "display_name": "",\n "front_image": "",\n "id": 0,\n "is_full_depth": false,\n "last_updated": "",\n "manufacturer": 0,\n "model": "",\n "part_number": "",\n "rear_image": "",\n "slug": "",\n "subdevice_role": "",\n "tags": [],\n "u_height": 0\n}' \
--output-document \
- {{baseUrl}}/dcim/device-types/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"comments": "",
"created": "",
"custom_fields": [],
"device_count": 0,
"display_name": "",
"front_image": "",
"id": 0,
"is_full_depth": false,
"last_updated": "",
"manufacturer": 0,
"model": "",
"part_number": "",
"rear_image": "",
"slug": "",
"subdevice_role": "",
"tags": [],
"u_height": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/device-types/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
dcim_devices_create
{{baseUrl}}/dcim/devices/
BODY json
{
"asset_tag": "",
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"device_role": 0,
"device_type": 0,
"display_name": "",
"face": "",
"id": 0,
"last_updated": "",
"local_context_data": "",
"name": "",
"parent_device": {
"display_name": "",
"id": 0,
"name": "",
"url": ""
},
"platform": 0,
"position": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"rack": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vc_position": 0,
"vc_priority": 0,
"virtual_chassis": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/devices/");
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 \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/dcim/devices/" {:content-type :json
:form-params {:asset_tag ""
:cluster 0
:comments ""
:config_context {}
:created ""
:custom_fields {}
:device_role 0
:device_type 0
:display_name ""
:face ""
:id 0
:last_updated ""
:local_context_data ""
:name ""
:parent_device {:display_name ""
:id 0
:name ""
:url ""}
:platform 0
:position 0
:primary_ip ""
:primary_ip4 0
:primary_ip6 0
:rack 0
:serial ""
:site 0
:status ""
:tags []
:tenant 0
:vc_position 0
:vc_priority 0
:virtual_chassis 0}})
require "http/client"
url = "{{baseUrl}}/dcim/devices/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/dcim/devices/"),
Content = new StringContent("{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/devices/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/devices/"
payload := strings.NewReader("{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/dcim/devices/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 608
{
"asset_tag": "",
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"device_role": 0,
"device_type": 0,
"display_name": "",
"face": "",
"id": 0,
"last_updated": "",
"local_context_data": "",
"name": "",
"parent_device": {
"display_name": "",
"id": 0,
"name": "",
"url": ""
},
"platform": 0,
"position": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"rack": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vc_position": 0,
"vc_priority": 0,
"virtual_chassis": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/dcim/devices/")
.setHeader("content-type", "application/json")
.setBody("{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/devices/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/devices/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/dcim/devices/")
.header("content-type", "application/json")
.body("{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\n}")
.asString();
const data = JSON.stringify({
asset_tag: '',
cluster: 0,
comments: '',
config_context: {},
created: '',
custom_fields: {},
device_role: 0,
device_type: 0,
display_name: '',
face: '',
id: 0,
last_updated: '',
local_context_data: '',
name: '',
parent_device: {
display_name: '',
id: 0,
name: '',
url: ''
},
platform: 0,
position: 0,
primary_ip: '',
primary_ip4: 0,
primary_ip6: 0,
rack: 0,
serial: '',
site: 0,
status: '',
tags: [],
tenant: 0,
vc_position: 0,
vc_priority: 0,
virtual_chassis: 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}}/dcim/devices/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/devices/',
headers: {'content-type': 'application/json'},
data: {
asset_tag: '',
cluster: 0,
comments: '',
config_context: {},
created: '',
custom_fields: {},
device_role: 0,
device_type: 0,
display_name: '',
face: '',
id: 0,
last_updated: '',
local_context_data: '',
name: '',
parent_device: {display_name: '', id: 0, name: '', url: ''},
platform: 0,
position: 0,
primary_ip: '',
primary_ip4: 0,
primary_ip6: 0,
rack: 0,
serial: '',
site: 0,
status: '',
tags: [],
tenant: 0,
vc_position: 0,
vc_priority: 0,
virtual_chassis: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/devices/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"asset_tag":"","cluster":0,"comments":"","config_context":{},"created":"","custom_fields":{},"device_role":0,"device_type":0,"display_name":"","face":"","id":0,"last_updated":"","local_context_data":"","name":"","parent_device":{"display_name":"","id":0,"name":"","url":""},"platform":0,"position":0,"primary_ip":"","primary_ip4":0,"primary_ip6":0,"rack":0,"serial":"","site":0,"status":"","tags":[],"tenant":0,"vc_position":0,"vc_priority":0,"virtual_chassis":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}}/dcim/devices/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "asset_tag": "",\n "cluster": 0,\n "comments": "",\n "config_context": {},\n "created": "",\n "custom_fields": {},\n "device_role": 0,\n "device_type": 0,\n "display_name": "",\n "face": "",\n "id": 0,\n "last_updated": "",\n "local_context_data": "",\n "name": "",\n "parent_device": {\n "display_name": "",\n "id": 0,\n "name": "",\n "url": ""\n },\n "platform": 0,\n "position": 0,\n "primary_ip": "",\n "primary_ip4": 0,\n "primary_ip6": 0,\n "rack": 0,\n "serial": "",\n "site": 0,\n "status": "",\n "tags": [],\n "tenant": 0,\n "vc_position": 0,\n "vc_priority": 0,\n "virtual_chassis": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/devices/")
.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/dcim/devices/',
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({
asset_tag: '',
cluster: 0,
comments: '',
config_context: {},
created: '',
custom_fields: {},
device_role: 0,
device_type: 0,
display_name: '',
face: '',
id: 0,
last_updated: '',
local_context_data: '',
name: '',
parent_device: {display_name: '', id: 0, name: '', url: ''},
platform: 0,
position: 0,
primary_ip: '',
primary_ip4: 0,
primary_ip6: 0,
rack: 0,
serial: '',
site: 0,
status: '',
tags: [],
tenant: 0,
vc_position: 0,
vc_priority: 0,
virtual_chassis: 0
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/devices/',
headers: {'content-type': 'application/json'},
body: {
asset_tag: '',
cluster: 0,
comments: '',
config_context: {},
created: '',
custom_fields: {},
device_role: 0,
device_type: 0,
display_name: '',
face: '',
id: 0,
last_updated: '',
local_context_data: '',
name: '',
parent_device: {display_name: '', id: 0, name: '', url: ''},
platform: 0,
position: 0,
primary_ip: '',
primary_ip4: 0,
primary_ip6: 0,
rack: 0,
serial: '',
site: 0,
status: '',
tags: [],
tenant: 0,
vc_position: 0,
vc_priority: 0,
virtual_chassis: 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}}/dcim/devices/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
asset_tag: '',
cluster: 0,
comments: '',
config_context: {},
created: '',
custom_fields: {},
device_role: 0,
device_type: 0,
display_name: '',
face: '',
id: 0,
last_updated: '',
local_context_data: '',
name: '',
parent_device: {
display_name: '',
id: 0,
name: '',
url: ''
},
platform: 0,
position: 0,
primary_ip: '',
primary_ip4: 0,
primary_ip6: 0,
rack: 0,
serial: '',
site: 0,
status: '',
tags: [],
tenant: 0,
vc_position: 0,
vc_priority: 0,
virtual_chassis: 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}}/dcim/devices/',
headers: {'content-type': 'application/json'},
data: {
asset_tag: '',
cluster: 0,
comments: '',
config_context: {},
created: '',
custom_fields: {},
device_role: 0,
device_type: 0,
display_name: '',
face: '',
id: 0,
last_updated: '',
local_context_data: '',
name: '',
parent_device: {display_name: '', id: 0, name: '', url: ''},
platform: 0,
position: 0,
primary_ip: '',
primary_ip4: 0,
primary_ip6: 0,
rack: 0,
serial: '',
site: 0,
status: '',
tags: [],
tenant: 0,
vc_position: 0,
vc_priority: 0,
virtual_chassis: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/devices/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"asset_tag":"","cluster":0,"comments":"","config_context":{},"created":"","custom_fields":{},"device_role":0,"device_type":0,"display_name":"","face":"","id":0,"last_updated":"","local_context_data":"","name":"","parent_device":{"display_name":"","id":0,"name":"","url":""},"platform":0,"position":0,"primary_ip":"","primary_ip4":0,"primary_ip6":0,"rack":0,"serial":"","site":0,"status":"","tags":[],"tenant":0,"vc_position":0,"vc_priority":0,"virtual_chassis":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 = @{ @"asset_tag": @"",
@"cluster": @0,
@"comments": @"",
@"config_context": @{ },
@"created": @"",
@"custom_fields": @{ },
@"device_role": @0,
@"device_type": @0,
@"display_name": @"",
@"face": @"",
@"id": @0,
@"last_updated": @"",
@"local_context_data": @"",
@"name": @"",
@"parent_device": @{ @"display_name": @"", @"id": @0, @"name": @"", @"url": @"" },
@"platform": @0,
@"position": @0,
@"primary_ip": @"",
@"primary_ip4": @0,
@"primary_ip6": @0,
@"rack": @0,
@"serial": @"",
@"site": @0,
@"status": @"",
@"tags": @[ ],
@"tenant": @0,
@"vc_position": @0,
@"vc_priority": @0,
@"virtual_chassis": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/devices/"]
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}}/dcim/devices/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/devices/",
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([
'asset_tag' => '',
'cluster' => 0,
'comments' => '',
'config_context' => [
],
'created' => '',
'custom_fields' => [
],
'device_role' => 0,
'device_type' => 0,
'display_name' => '',
'face' => '',
'id' => 0,
'last_updated' => '',
'local_context_data' => '',
'name' => '',
'parent_device' => [
'display_name' => '',
'id' => 0,
'name' => '',
'url' => ''
],
'platform' => 0,
'position' => 0,
'primary_ip' => '',
'primary_ip4' => 0,
'primary_ip6' => 0,
'rack' => 0,
'serial' => '',
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'vc_position' => 0,
'vc_priority' => 0,
'virtual_chassis' => 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}}/dcim/devices/', [
'body' => '{
"asset_tag": "",
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"device_role": 0,
"device_type": 0,
"display_name": "",
"face": "",
"id": 0,
"last_updated": "",
"local_context_data": "",
"name": "",
"parent_device": {
"display_name": "",
"id": 0,
"name": "",
"url": ""
},
"platform": 0,
"position": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"rack": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vc_position": 0,
"vc_priority": 0,
"virtual_chassis": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/devices/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'asset_tag' => '',
'cluster' => 0,
'comments' => '',
'config_context' => [
],
'created' => '',
'custom_fields' => [
],
'device_role' => 0,
'device_type' => 0,
'display_name' => '',
'face' => '',
'id' => 0,
'last_updated' => '',
'local_context_data' => '',
'name' => '',
'parent_device' => [
'display_name' => '',
'id' => 0,
'name' => '',
'url' => ''
],
'platform' => 0,
'position' => 0,
'primary_ip' => '',
'primary_ip4' => 0,
'primary_ip6' => 0,
'rack' => 0,
'serial' => '',
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'vc_position' => 0,
'vc_priority' => 0,
'virtual_chassis' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'asset_tag' => '',
'cluster' => 0,
'comments' => '',
'config_context' => [
],
'created' => '',
'custom_fields' => [
],
'device_role' => 0,
'device_type' => 0,
'display_name' => '',
'face' => '',
'id' => 0,
'last_updated' => '',
'local_context_data' => '',
'name' => '',
'parent_device' => [
'display_name' => '',
'id' => 0,
'name' => '',
'url' => ''
],
'platform' => 0,
'position' => 0,
'primary_ip' => '',
'primary_ip4' => 0,
'primary_ip6' => 0,
'rack' => 0,
'serial' => '',
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'vc_position' => 0,
'vc_priority' => 0,
'virtual_chassis' => 0
]));
$request->setRequestUrl('{{baseUrl}}/dcim/devices/');
$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}}/dcim/devices/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"asset_tag": "",
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"device_role": 0,
"device_type": 0,
"display_name": "",
"face": "",
"id": 0,
"last_updated": "",
"local_context_data": "",
"name": "",
"parent_device": {
"display_name": "",
"id": 0,
"name": "",
"url": ""
},
"platform": 0,
"position": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"rack": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vc_position": 0,
"vc_priority": 0,
"virtual_chassis": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/devices/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"asset_tag": "",
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"device_role": 0,
"device_type": 0,
"display_name": "",
"face": "",
"id": 0,
"last_updated": "",
"local_context_data": "",
"name": "",
"parent_device": {
"display_name": "",
"id": 0,
"name": "",
"url": ""
},
"platform": 0,
"position": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"rack": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vc_position": 0,
"vc_priority": 0,
"virtual_chassis": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/dcim/devices/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/devices/"
payload = {
"asset_tag": "",
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"device_role": 0,
"device_type": 0,
"display_name": "",
"face": "",
"id": 0,
"last_updated": "",
"local_context_data": "",
"name": "",
"parent_device": {
"display_name": "",
"id": 0,
"name": "",
"url": ""
},
"platform": 0,
"position": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"rack": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vc_position": 0,
"vc_priority": 0,
"virtual_chassis": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/devices/"
payload <- "{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/devices/")
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 \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/dcim/devices/') do |req|
req.body = "{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/devices/";
let payload = json!({
"asset_tag": "",
"cluster": 0,
"comments": "",
"config_context": json!({}),
"created": "",
"custom_fields": json!({}),
"device_role": 0,
"device_type": 0,
"display_name": "",
"face": "",
"id": 0,
"last_updated": "",
"local_context_data": "",
"name": "",
"parent_device": json!({
"display_name": "",
"id": 0,
"name": "",
"url": ""
}),
"platform": 0,
"position": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"rack": 0,
"serial": "",
"site": 0,
"status": "",
"tags": (),
"tenant": 0,
"vc_position": 0,
"vc_priority": 0,
"virtual_chassis": 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}}/dcim/devices/ \
--header 'content-type: application/json' \
--data '{
"asset_tag": "",
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"device_role": 0,
"device_type": 0,
"display_name": "",
"face": "",
"id": 0,
"last_updated": "",
"local_context_data": "",
"name": "",
"parent_device": {
"display_name": "",
"id": 0,
"name": "",
"url": ""
},
"platform": 0,
"position": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"rack": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vc_position": 0,
"vc_priority": 0,
"virtual_chassis": 0
}'
echo '{
"asset_tag": "",
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"device_role": 0,
"device_type": 0,
"display_name": "",
"face": "",
"id": 0,
"last_updated": "",
"local_context_data": "",
"name": "",
"parent_device": {
"display_name": "",
"id": 0,
"name": "",
"url": ""
},
"platform": 0,
"position": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"rack": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vc_position": 0,
"vc_priority": 0,
"virtual_chassis": 0
}' | \
http POST {{baseUrl}}/dcim/devices/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "asset_tag": "",\n "cluster": 0,\n "comments": "",\n "config_context": {},\n "created": "",\n "custom_fields": {},\n "device_role": 0,\n "device_type": 0,\n "display_name": "",\n "face": "",\n "id": 0,\n "last_updated": "",\n "local_context_data": "",\n "name": "",\n "parent_device": {\n "display_name": "",\n "id": 0,\n "name": "",\n "url": ""\n },\n "platform": 0,\n "position": 0,\n "primary_ip": "",\n "primary_ip4": 0,\n "primary_ip6": 0,\n "rack": 0,\n "serial": "",\n "site": 0,\n "status": "",\n "tags": [],\n "tenant": 0,\n "vc_position": 0,\n "vc_priority": 0,\n "virtual_chassis": 0\n}' \
--output-document \
- {{baseUrl}}/dcim/devices/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"asset_tag": "",
"cluster": 0,
"comments": "",
"config_context": [],
"created": "",
"custom_fields": [],
"device_role": 0,
"device_type": 0,
"display_name": "",
"face": "",
"id": 0,
"last_updated": "",
"local_context_data": "",
"name": "",
"parent_device": [
"display_name": "",
"id": 0,
"name": "",
"url": ""
],
"platform": 0,
"position": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"rack": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vc_position": 0,
"vc_priority": 0,
"virtual_chassis": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/devices/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
dcim_devices_delete
{{baseUrl}}/dcim/devices/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/devices/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/dcim/devices/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/devices/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/dcim/devices/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/devices/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/devices/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/dcim/devices/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/dcim/devices/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/devices/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/devices/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/dcim/devices/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/dcim/devices/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/devices/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/devices/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/devices/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/devices/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/devices/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/devices/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/dcim/devices/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/devices/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/devices/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/devices/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/devices/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/devices/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/dcim/devices/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/devices/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/devices/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/devices/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/devices/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/dcim/devices/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/devices/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/devices/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/devices/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/dcim/devices/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/devices/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/dcim/devices/:id/
http DELETE {{baseUrl}}/dcim/devices/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/dcim/devices/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/devices/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_devices_graphs
{{baseUrl}}/dcim/devices/:id/graphs/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/devices/:id/graphs/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/devices/:id/graphs/")
require "http/client"
url = "{{baseUrl}}/dcim/devices/:id/graphs/"
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}}/dcim/devices/:id/graphs/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/devices/:id/graphs/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/devices/:id/graphs/"
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/dcim/devices/:id/graphs/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/devices/:id/graphs/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/devices/:id/graphs/"))
.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}}/dcim/devices/:id/graphs/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/devices/:id/graphs/")
.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}}/dcim/devices/:id/graphs/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/devices/:id/graphs/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/devices/:id/graphs/';
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}}/dcim/devices/:id/graphs/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/devices/:id/graphs/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/devices/:id/graphs/',
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}}/dcim/devices/:id/graphs/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/devices/:id/graphs/');
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}}/dcim/devices/:id/graphs/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/devices/:id/graphs/';
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}}/dcim/devices/:id/graphs/"]
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}}/dcim/devices/:id/graphs/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/devices/:id/graphs/",
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}}/dcim/devices/:id/graphs/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/devices/:id/graphs/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/devices/:id/graphs/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/devices/:id/graphs/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/devices/:id/graphs/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/devices/:id/graphs/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/devices/:id/graphs/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/devices/:id/graphs/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/devices/:id/graphs/")
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/dcim/devices/:id/graphs/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/devices/:id/graphs/";
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}}/dcim/devices/:id/graphs/
http GET {{baseUrl}}/dcim/devices/:id/graphs/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/devices/:id/graphs/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/devices/:id/graphs/")! 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
dcim_devices_list
{{baseUrl}}/dcim/devices/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/devices/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/devices/")
require "http/client"
url = "{{baseUrl}}/dcim/devices/"
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}}/dcim/devices/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/devices/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/devices/"
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/dcim/devices/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/devices/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/devices/"))
.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}}/dcim/devices/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/devices/")
.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}}/dcim/devices/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/devices/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/devices/';
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}}/dcim/devices/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/devices/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/devices/',
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}}/dcim/devices/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/devices/');
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}}/dcim/devices/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/devices/';
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}}/dcim/devices/"]
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}}/dcim/devices/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/devices/",
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}}/dcim/devices/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/devices/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/devices/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/devices/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/devices/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/devices/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/devices/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/devices/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/devices/")
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/dcim/devices/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/devices/";
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}}/dcim/devices/
http GET {{baseUrl}}/dcim/devices/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/devices/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/devices/")! 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
dcim_devices_napalm
{{baseUrl}}/dcim/devices/:id/napalm/
QUERY PARAMS
method
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/devices/:id/napalm/?method=");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/devices/:id/napalm/" {:query-params {:method ""}})
require "http/client"
url = "{{baseUrl}}/dcim/devices/:id/napalm/?method="
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}}/dcim/devices/:id/napalm/?method="),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/devices/:id/napalm/?method=");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/devices/:id/napalm/?method="
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/dcim/devices/:id/napalm/?method= HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/devices/:id/napalm/?method=")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/devices/:id/napalm/?method="))
.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}}/dcim/devices/:id/napalm/?method=")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/devices/:id/napalm/?method=")
.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}}/dcim/devices/:id/napalm/?method=');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/dcim/devices/:id/napalm/',
params: {method: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/devices/:id/napalm/?method=';
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}}/dcim/devices/:id/napalm/?method=',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/devices/:id/napalm/?method=")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/devices/:id/napalm/?method=',
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}}/dcim/devices/:id/napalm/',
qs: {method: ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/devices/:id/napalm/');
req.query({
method: ''
});
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}}/dcim/devices/:id/napalm/',
params: {method: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/devices/:id/napalm/?method=';
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}}/dcim/devices/:id/napalm/?method="]
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}}/dcim/devices/:id/napalm/?method=" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/devices/:id/napalm/?method=",
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}}/dcim/devices/:id/napalm/?method=');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/devices/:id/napalm/');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'method' => ''
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/devices/:id/napalm/');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'method' => ''
]));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/devices/:id/napalm/?method=' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/devices/:id/napalm/?method=' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/devices/:id/napalm/?method=")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/devices/:id/napalm/"
querystring = {"method":""}
response = requests.get(url, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/devices/:id/napalm/"
queryString <- list(method = "")
response <- VERB("GET", url, query = queryString, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/devices/:id/napalm/?method=")
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/dcim/devices/:id/napalm/') do |req|
req.params['method'] = ''
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/devices/:id/napalm/";
let querystring = [
("method", ""),
];
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}}/dcim/devices/:id/napalm/?method='
http GET '{{baseUrl}}/dcim/devices/:id/napalm/?method='
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/dcim/devices/:id/napalm/?method='
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/devices/:id/napalm/?method=")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
dcim_devices_partial_update
{{baseUrl}}/dcim/devices/:id/
BODY json
{
"asset_tag": "",
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"device_role": 0,
"device_type": 0,
"display_name": "",
"face": "",
"id": 0,
"last_updated": "",
"local_context_data": "",
"name": "",
"parent_device": {
"display_name": "",
"id": 0,
"name": "",
"url": ""
},
"platform": 0,
"position": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"rack": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vc_position": 0,
"vc_priority": 0,
"virtual_chassis": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/devices/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/dcim/devices/:id/" {:content-type :json
:form-params {:asset_tag ""
:cluster 0
:comments ""
:config_context {}
:created ""
:custom_fields {}
:device_role 0
:device_type 0
:display_name ""
:face ""
:id 0
:last_updated ""
:local_context_data ""
:name ""
:parent_device {:display_name ""
:id 0
:name ""
:url ""}
:platform 0
:position 0
:primary_ip ""
:primary_ip4 0
:primary_ip6 0
:rack 0
:serial ""
:site 0
:status ""
:tags []
:tenant 0
:vc_position 0
:vc_priority 0
:virtual_chassis 0}})
require "http/client"
url = "{{baseUrl}}/dcim/devices/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\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}}/dcim/devices/:id/"),
Content = new StringContent("{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/devices/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/devices/:id/"
payload := strings.NewReader("{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\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/dcim/devices/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 608
{
"asset_tag": "",
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"device_role": 0,
"device_type": 0,
"display_name": "",
"face": "",
"id": 0,
"last_updated": "",
"local_context_data": "",
"name": "",
"parent_device": {
"display_name": "",
"id": 0,
"name": "",
"url": ""
},
"platform": 0,
"position": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"rack": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vc_position": 0,
"vc_priority": 0,
"virtual_chassis": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/dcim/devices/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/devices/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/devices/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/dcim/devices/:id/")
.header("content-type", "application/json")
.body("{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\n}")
.asString();
const data = JSON.stringify({
asset_tag: '',
cluster: 0,
comments: '',
config_context: {},
created: '',
custom_fields: {},
device_role: 0,
device_type: 0,
display_name: '',
face: '',
id: 0,
last_updated: '',
local_context_data: '',
name: '',
parent_device: {
display_name: '',
id: 0,
name: '',
url: ''
},
platform: 0,
position: 0,
primary_ip: '',
primary_ip4: 0,
primary_ip6: 0,
rack: 0,
serial: '',
site: 0,
status: '',
tags: [],
tenant: 0,
vc_position: 0,
vc_priority: 0,
virtual_chassis: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/dcim/devices/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/devices/:id/',
headers: {'content-type': 'application/json'},
data: {
asset_tag: '',
cluster: 0,
comments: '',
config_context: {},
created: '',
custom_fields: {},
device_role: 0,
device_type: 0,
display_name: '',
face: '',
id: 0,
last_updated: '',
local_context_data: '',
name: '',
parent_device: {display_name: '', id: 0, name: '', url: ''},
platform: 0,
position: 0,
primary_ip: '',
primary_ip4: 0,
primary_ip6: 0,
rack: 0,
serial: '',
site: 0,
status: '',
tags: [],
tenant: 0,
vc_position: 0,
vc_priority: 0,
virtual_chassis: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/devices/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"asset_tag":"","cluster":0,"comments":"","config_context":{},"created":"","custom_fields":{},"device_role":0,"device_type":0,"display_name":"","face":"","id":0,"last_updated":"","local_context_data":"","name":"","parent_device":{"display_name":"","id":0,"name":"","url":""},"platform":0,"position":0,"primary_ip":"","primary_ip4":0,"primary_ip6":0,"rack":0,"serial":"","site":0,"status":"","tags":[],"tenant":0,"vc_position":0,"vc_priority":0,"virtual_chassis":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}}/dcim/devices/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "asset_tag": "",\n "cluster": 0,\n "comments": "",\n "config_context": {},\n "created": "",\n "custom_fields": {},\n "device_role": 0,\n "device_type": 0,\n "display_name": "",\n "face": "",\n "id": 0,\n "last_updated": "",\n "local_context_data": "",\n "name": "",\n "parent_device": {\n "display_name": "",\n "id": 0,\n "name": "",\n "url": ""\n },\n "platform": 0,\n "position": 0,\n "primary_ip": "",\n "primary_ip4": 0,\n "primary_ip6": 0,\n "rack": 0,\n "serial": "",\n "site": 0,\n "status": "",\n "tags": [],\n "tenant": 0,\n "vc_position": 0,\n "vc_priority": 0,\n "virtual_chassis": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/devices/:id/")
.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/dcim/devices/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
asset_tag: '',
cluster: 0,
comments: '',
config_context: {},
created: '',
custom_fields: {},
device_role: 0,
device_type: 0,
display_name: '',
face: '',
id: 0,
last_updated: '',
local_context_data: '',
name: '',
parent_device: {display_name: '', id: 0, name: '', url: ''},
platform: 0,
position: 0,
primary_ip: '',
primary_ip4: 0,
primary_ip6: 0,
rack: 0,
serial: '',
site: 0,
status: '',
tags: [],
tenant: 0,
vc_position: 0,
vc_priority: 0,
virtual_chassis: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/devices/:id/',
headers: {'content-type': 'application/json'},
body: {
asset_tag: '',
cluster: 0,
comments: '',
config_context: {},
created: '',
custom_fields: {},
device_role: 0,
device_type: 0,
display_name: '',
face: '',
id: 0,
last_updated: '',
local_context_data: '',
name: '',
parent_device: {display_name: '', id: 0, name: '', url: ''},
platform: 0,
position: 0,
primary_ip: '',
primary_ip4: 0,
primary_ip6: 0,
rack: 0,
serial: '',
site: 0,
status: '',
tags: [],
tenant: 0,
vc_position: 0,
vc_priority: 0,
virtual_chassis: 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('PATCH', '{{baseUrl}}/dcim/devices/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
asset_tag: '',
cluster: 0,
comments: '',
config_context: {},
created: '',
custom_fields: {},
device_role: 0,
device_type: 0,
display_name: '',
face: '',
id: 0,
last_updated: '',
local_context_data: '',
name: '',
parent_device: {
display_name: '',
id: 0,
name: '',
url: ''
},
platform: 0,
position: 0,
primary_ip: '',
primary_ip4: 0,
primary_ip6: 0,
rack: 0,
serial: '',
site: 0,
status: '',
tags: [],
tenant: 0,
vc_position: 0,
vc_priority: 0,
virtual_chassis: 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: 'PATCH',
url: '{{baseUrl}}/dcim/devices/:id/',
headers: {'content-type': 'application/json'},
data: {
asset_tag: '',
cluster: 0,
comments: '',
config_context: {},
created: '',
custom_fields: {},
device_role: 0,
device_type: 0,
display_name: '',
face: '',
id: 0,
last_updated: '',
local_context_data: '',
name: '',
parent_device: {display_name: '', id: 0, name: '', url: ''},
platform: 0,
position: 0,
primary_ip: '',
primary_ip4: 0,
primary_ip6: 0,
rack: 0,
serial: '',
site: 0,
status: '',
tags: [],
tenant: 0,
vc_position: 0,
vc_priority: 0,
virtual_chassis: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/devices/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"asset_tag":"","cluster":0,"comments":"","config_context":{},"created":"","custom_fields":{},"device_role":0,"device_type":0,"display_name":"","face":"","id":0,"last_updated":"","local_context_data":"","name":"","parent_device":{"display_name":"","id":0,"name":"","url":""},"platform":0,"position":0,"primary_ip":"","primary_ip4":0,"primary_ip6":0,"rack":0,"serial":"","site":0,"status":"","tags":[],"tenant":0,"vc_position":0,"vc_priority":0,"virtual_chassis":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 = @{ @"asset_tag": @"",
@"cluster": @0,
@"comments": @"",
@"config_context": @{ },
@"created": @"",
@"custom_fields": @{ },
@"device_role": @0,
@"device_type": @0,
@"display_name": @"",
@"face": @"",
@"id": @0,
@"last_updated": @"",
@"local_context_data": @"",
@"name": @"",
@"parent_device": @{ @"display_name": @"", @"id": @0, @"name": @"", @"url": @"" },
@"platform": @0,
@"position": @0,
@"primary_ip": @"",
@"primary_ip4": @0,
@"primary_ip6": @0,
@"rack": @0,
@"serial": @"",
@"site": @0,
@"status": @"",
@"tags": @[ ],
@"tenant": @0,
@"vc_position": @0,
@"vc_priority": @0,
@"virtual_chassis": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/devices/:id/"]
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}}/dcim/devices/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/devices/:id/",
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([
'asset_tag' => '',
'cluster' => 0,
'comments' => '',
'config_context' => [
],
'created' => '',
'custom_fields' => [
],
'device_role' => 0,
'device_type' => 0,
'display_name' => '',
'face' => '',
'id' => 0,
'last_updated' => '',
'local_context_data' => '',
'name' => '',
'parent_device' => [
'display_name' => '',
'id' => 0,
'name' => '',
'url' => ''
],
'platform' => 0,
'position' => 0,
'primary_ip' => '',
'primary_ip4' => 0,
'primary_ip6' => 0,
'rack' => 0,
'serial' => '',
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'vc_position' => 0,
'vc_priority' => 0,
'virtual_chassis' => 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('PATCH', '{{baseUrl}}/dcim/devices/:id/', [
'body' => '{
"asset_tag": "",
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"device_role": 0,
"device_type": 0,
"display_name": "",
"face": "",
"id": 0,
"last_updated": "",
"local_context_data": "",
"name": "",
"parent_device": {
"display_name": "",
"id": 0,
"name": "",
"url": ""
},
"platform": 0,
"position": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"rack": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vc_position": 0,
"vc_priority": 0,
"virtual_chassis": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/devices/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'asset_tag' => '',
'cluster' => 0,
'comments' => '',
'config_context' => [
],
'created' => '',
'custom_fields' => [
],
'device_role' => 0,
'device_type' => 0,
'display_name' => '',
'face' => '',
'id' => 0,
'last_updated' => '',
'local_context_data' => '',
'name' => '',
'parent_device' => [
'display_name' => '',
'id' => 0,
'name' => '',
'url' => ''
],
'platform' => 0,
'position' => 0,
'primary_ip' => '',
'primary_ip4' => 0,
'primary_ip6' => 0,
'rack' => 0,
'serial' => '',
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'vc_position' => 0,
'vc_priority' => 0,
'virtual_chassis' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'asset_tag' => '',
'cluster' => 0,
'comments' => '',
'config_context' => [
],
'created' => '',
'custom_fields' => [
],
'device_role' => 0,
'device_type' => 0,
'display_name' => '',
'face' => '',
'id' => 0,
'last_updated' => '',
'local_context_data' => '',
'name' => '',
'parent_device' => [
'display_name' => '',
'id' => 0,
'name' => '',
'url' => ''
],
'platform' => 0,
'position' => 0,
'primary_ip' => '',
'primary_ip4' => 0,
'primary_ip6' => 0,
'rack' => 0,
'serial' => '',
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'vc_position' => 0,
'vc_priority' => 0,
'virtual_chassis' => 0
]));
$request->setRequestUrl('{{baseUrl}}/dcim/devices/:id/');
$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}}/dcim/devices/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"asset_tag": "",
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"device_role": 0,
"device_type": 0,
"display_name": "",
"face": "",
"id": 0,
"last_updated": "",
"local_context_data": "",
"name": "",
"parent_device": {
"display_name": "",
"id": 0,
"name": "",
"url": ""
},
"platform": 0,
"position": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"rack": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vc_position": 0,
"vc_priority": 0,
"virtual_chassis": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/devices/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"asset_tag": "",
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"device_role": 0,
"device_type": 0,
"display_name": "",
"face": "",
"id": 0,
"last_updated": "",
"local_context_data": "",
"name": "",
"parent_device": {
"display_name": "",
"id": 0,
"name": "",
"url": ""
},
"platform": 0,
"position": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"rack": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vc_position": 0,
"vc_priority": 0,
"virtual_chassis": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/dcim/devices/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/devices/:id/"
payload = {
"asset_tag": "",
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"device_role": 0,
"device_type": 0,
"display_name": "",
"face": "",
"id": 0,
"last_updated": "",
"local_context_data": "",
"name": "",
"parent_device": {
"display_name": "",
"id": 0,
"name": "",
"url": ""
},
"platform": 0,
"position": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"rack": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vc_position": 0,
"vc_priority": 0,
"virtual_chassis": 0
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/devices/:id/"
payload <- "{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\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}}/dcim/devices/:id/")
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 \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/dcim/devices/:id/') do |req|
req.body = "{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\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}}/dcim/devices/:id/";
let payload = json!({
"asset_tag": "",
"cluster": 0,
"comments": "",
"config_context": json!({}),
"created": "",
"custom_fields": json!({}),
"device_role": 0,
"device_type": 0,
"display_name": "",
"face": "",
"id": 0,
"last_updated": "",
"local_context_data": "",
"name": "",
"parent_device": json!({
"display_name": "",
"id": 0,
"name": "",
"url": ""
}),
"platform": 0,
"position": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"rack": 0,
"serial": "",
"site": 0,
"status": "",
"tags": (),
"tenant": 0,
"vc_position": 0,
"vc_priority": 0,
"virtual_chassis": 0
});
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}}/dcim/devices/:id/ \
--header 'content-type: application/json' \
--data '{
"asset_tag": "",
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"device_role": 0,
"device_type": 0,
"display_name": "",
"face": "",
"id": 0,
"last_updated": "",
"local_context_data": "",
"name": "",
"parent_device": {
"display_name": "",
"id": 0,
"name": "",
"url": ""
},
"platform": 0,
"position": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"rack": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vc_position": 0,
"vc_priority": 0,
"virtual_chassis": 0
}'
echo '{
"asset_tag": "",
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"device_role": 0,
"device_type": 0,
"display_name": "",
"face": "",
"id": 0,
"last_updated": "",
"local_context_data": "",
"name": "",
"parent_device": {
"display_name": "",
"id": 0,
"name": "",
"url": ""
},
"platform": 0,
"position": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"rack": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vc_position": 0,
"vc_priority": 0,
"virtual_chassis": 0
}' | \
http PATCH {{baseUrl}}/dcim/devices/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "asset_tag": "",\n "cluster": 0,\n "comments": "",\n "config_context": {},\n "created": "",\n "custom_fields": {},\n "device_role": 0,\n "device_type": 0,\n "display_name": "",\n "face": "",\n "id": 0,\n "last_updated": "",\n "local_context_data": "",\n "name": "",\n "parent_device": {\n "display_name": "",\n "id": 0,\n "name": "",\n "url": ""\n },\n "platform": 0,\n "position": 0,\n "primary_ip": "",\n "primary_ip4": 0,\n "primary_ip6": 0,\n "rack": 0,\n "serial": "",\n "site": 0,\n "status": "",\n "tags": [],\n "tenant": 0,\n "vc_position": 0,\n "vc_priority": 0,\n "virtual_chassis": 0\n}' \
--output-document \
- {{baseUrl}}/dcim/devices/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"asset_tag": "",
"cluster": 0,
"comments": "",
"config_context": [],
"created": "",
"custom_fields": [],
"device_role": 0,
"device_type": 0,
"display_name": "",
"face": "",
"id": 0,
"last_updated": "",
"local_context_data": "",
"name": "",
"parent_device": [
"display_name": "",
"id": 0,
"name": "",
"url": ""
],
"platform": 0,
"position": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"rack": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vc_position": 0,
"vc_priority": 0,
"virtual_chassis": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/devices/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_devices_read
{{baseUrl}}/dcim/devices/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/devices/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/devices/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/devices/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/dcim/devices/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/devices/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/devices/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/dcim/devices/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/devices/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/devices/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/devices/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/devices/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/dcim/devices/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/devices/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/devices/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/devices/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/devices/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/devices/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/dcim/devices/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/devices/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/dcim/devices/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/devices/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/devices/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/devices/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/devices/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/dcim/devices/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/devices/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/devices/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/devices/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/devices/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/devices/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/devices/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/devices/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/devices/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/dcim/devices/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/devices/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/dcim/devices/:id/
http GET {{baseUrl}}/dcim/devices/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/devices/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/devices/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
dcim_devices_update
{{baseUrl}}/dcim/devices/:id/
BODY json
{
"asset_tag": "",
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"device_role": 0,
"device_type": 0,
"display_name": "",
"face": "",
"id": 0,
"last_updated": "",
"local_context_data": "",
"name": "",
"parent_device": {
"display_name": "",
"id": 0,
"name": "",
"url": ""
},
"platform": 0,
"position": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"rack": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vc_position": 0,
"vc_priority": 0,
"virtual_chassis": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/devices/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/dcim/devices/:id/" {:content-type :json
:form-params {:asset_tag ""
:cluster 0
:comments ""
:config_context {}
:created ""
:custom_fields {}
:device_role 0
:device_type 0
:display_name ""
:face ""
:id 0
:last_updated ""
:local_context_data ""
:name ""
:parent_device {:display_name ""
:id 0
:name ""
:url ""}
:platform 0
:position 0
:primary_ip ""
:primary_ip4 0
:primary_ip6 0
:rack 0
:serial ""
:site 0
:status ""
:tags []
:tenant 0
:vc_position 0
:vc_priority 0
:virtual_chassis 0}})
require "http/client"
url = "{{baseUrl}}/dcim/devices/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\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}}/dcim/devices/:id/"),
Content = new StringContent("{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/devices/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/devices/:id/"
payload := strings.NewReader("{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\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/dcim/devices/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 608
{
"asset_tag": "",
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"device_role": 0,
"device_type": 0,
"display_name": "",
"face": "",
"id": 0,
"last_updated": "",
"local_context_data": "",
"name": "",
"parent_device": {
"display_name": "",
"id": 0,
"name": "",
"url": ""
},
"platform": 0,
"position": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"rack": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vc_position": 0,
"vc_priority": 0,
"virtual_chassis": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/dcim/devices/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/devices/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/devices/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/dcim/devices/:id/")
.header("content-type", "application/json")
.body("{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\n}")
.asString();
const data = JSON.stringify({
asset_tag: '',
cluster: 0,
comments: '',
config_context: {},
created: '',
custom_fields: {},
device_role: 0,
device_type: 0,
display_name: '',
face: '',
id: 0,
last_updated: '',
local_context_data: '',
name: '',
parent_device: {
display_name: '',
id: 0,
name: '',
url: ''
},
platform: 0,
position: 0,
primary_ip: '',
primary_ip4: 0,
primary_ip6: 0,
rack: 0,
serial: '',
site: 0,
status: '',
tags: [],
tenant: 0,
vc_position: 0,
vc_priority: 0,
virtual_chassis: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/dcim/devices/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/devices/:id/',
headers: {'content-type': 'application/json'},
data: {
asset_tag: '',
cluster: 0,
comments: '',
config_context: {},
created: '',
custom_fields: {},
device_role: 0,
device_type: 0,
display_name: '',
face: '',
id: 0,
last_updated: '',
local_context_data: '',
name: '',
parent_device: {display_name: '', id: 0, name: '', url: ''},
platform: 0,
position: 0,
primary_ip: '',
primary_ip4: 0,
primary_ip6: 0,
rack: 0,
serial: '',
site: 0,
status: '',
tags: [],
tenant: 0,
vc_position: 0,
vc_priority: 0,
virtual_chassis: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/devices/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"asset_tag":"","cluster":0,"comments":"","config_context":{},"created":"","custom_fields":{},"device_role":0,"device_type":0,"display_name":"","face":"","id":0,"last_updated":"","local_context_data":"","name":"","parent_device":{"display_name":"","id":0,"name":"","url":""},"platform":0,"position":0,"primary_ip":"","primary_ip4":0,"primary_ip6":0,"rack":0,"serial":"","site":0,"status":"","tags":[],"tenant":0,"vc_position":0,"vc_priority":0,"virtual_chassis":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}}/dcim/devices/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "asset_tag": "",\n "cluster": 0,\n "comments": "",\n "config_context": {},\n "created": "",\n "custom_fields": {},\n "device_role": 0,\n "device_type": 0,\n "display_name": "",\n "face": "",\n "id": 0,\n "last_updated": "",\n "local_context_data": "",\n "name": "",\n "parent_device": {\n "display_name": "",\n "id": 0,\n "name": "",\n "url": ""\n },\n "platform": 0,\n "position": 0,\n "primary_ip": "",\n "primary_ip4": 0,\n "primary_ip6": 0,\n "rack": 0,\n "serial": "",\n "site": 0,\n "status": "",\n "tags": [],\n "tenant": 0,\n "vc_position": 0,\n "vc_priority": 0,\n "virtual_chassis": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/devices/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/devices/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
asset_tag: '',
cluster: 0,
comments: '',
config_context: {},
created: '',
custom_fields: {},
device_role: 0,
device_type: 0,
display_name: '',
face: '',
id: 0,
last_updated: '',
local_context_data: '',
name: '',
parent_device: {display_name: '', id: 0, name: '', url: ''},
platform: 0,
position: 0,
primary_ip: '',
primary_ip4: 0,
primary_ip6: 0,
rack: 0,
serial: '',
site: 0,
status: '',
tags: [],
tenant: 0,
vc_position: 0,
vc_priority: 0,
virtual_chassis: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/devices/:id/',
headers: {'content-type': 'application/json'},
body: {
asset_tag: '',
cluster: 0,
comments: '',
config_context: {},
created: '',
custom_fields: {},
device_role: 0,
device_type: 0,
display_name: '',
face: '',
id: 0,
last_updated: '',
local_context_data: '',
name: '',
parent_device: {display_name: '', id: 0, name: '', url: ''},
platform: 0,
position: 0,
primary_ip: '',
primary_ip4: 0,
primary_ip6: 0,
rack: 0,
serial: '',
site: 0,
status: '',
tags: [],
tenant: 0,
vc_position: 0,
vc_priority: 0,
virtual_chassis: 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('PUT', '{{baseUrl}}/dcim/devices/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
asset_tag: '',
cluster: 0,
comments: '',
config_context: {},
created: '',
custom_fields: {},
device_role: 0,
device_type: 0,
display_name: '',
face: '',
id: 0,
last_updated: '',
local_context_data: '',
name: '',
parent_device: {
display_name: '',
id: 0,
name: '',
url: ''
},
platform: 0,
position: 0,
primary_ip: '',
primary_ip4: 0,
primary_ip6: 0,
rack: 0,
serial: '',
site: 0,
status: '',
tags: [],
tenant: 0,
vc_position: 0,
vc_priority: 0,
virtual_chassis: 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: 'PUT',
url: '{{baseUrl}}/dcim/devices/:id/',
headers: {'content-type': 'application/json'},
data: {
asset_tag: '',
cluster: 0,
comments: '',
config_context: {},
created: '',
custom_fields: {},
device_role: 0,
device_type: 0,
display_name: '',
face: '',
id: 0,
last_updated: '',
local_context_data: '',
name: '',
parent_device: {display_name: '', id: 0, name: '', url: ''},
platform: 0,
position: 0,
primary_ip: '',
primary_ip4: 0,
primary_ip6: 0,
rack: 0,
serial: '',
site: 0,
status: '',
tags: [],
tenant: 0,
vc_position: 0,
vc_priority: 0,
virtual_chassis: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/devices/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"asset_tag":"","cluster":0,"comments":"","config_context":{},"created":"","custom_fields":{},"device_role":0,"device_type":0,"display_name":"","face":"","id":0,"last_updated":"","local_context_data":"","name":"","parent_device":{"display_name":"","id":0,"name":"","url":""},"platform":0,"position":0,"primary_ip":"","primary_ip4":0,"primary_ip6":0,"rack":0,"serial":"","site":0,"status":"","tags":[],"tenant":0,"vc_position":0,"vc_priority":0,"virtual_chassis":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 = @{ @"asset_tag": @"",
@"cluster": @0,
@"comments": @"",
@"config_context": @{ },
@"created": @"",
@"custom_fields": @{ },
@"device_role": @0,
@"device_type": @0,
@"display_name": @"",
@"face": @"",
@"id": @0,
@"last_updated": @"",
@"local_context_data": @"",
@"name": @"",
@"parent_device": @{ @"display_name": @"", @"id": @0, @"name": @"", @"url": @"" },
@"platform": @0,
@"position": @0,
@"primary_ip": @"",
@"primary_ip4": @0,
@"primary_ip6": @0,
@"rack": @0,
@"serial": @"",
@"site": @0,
@"status": @"",
@"tags": @[ ],
@"tenant": @0,
@"vc_position": @0,
@"vc_priority": @0,
@"virtual_chassis": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/devices/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/devices/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/devices/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'asset_tag' => '',
'cluster' => 0,
'comments' => '',
'config_context' => [
],
'created' => '',
'custom_fields' => [
],
'device_role' => 0,
'device_type' => 0,
'display_name' => '',
'face' => '',
'id' => 0,
'last_updated' => '',
'local_context_data' => '',
'name' => '',
'parent_device' => [
'display_name' => '',
'id' => 0,
'name' => '',
'url' => ''
],
'platform' => 0,
'position' => 0,
'primary_ip' => '',
'primary_ip4' => 0,
'primary_ip6' => 0,
'rack' => 0,
'serial' => '',
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'vc_position' => 0,
'vc_priority' => 0,
'virtual_chassis' => 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('PUT', '{{baseUrl}}/dcim/devices/:id/', [
'body' => '{
"asset_tag": "",
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"device_role": 0,
"device_type": 0,
"display_name": "",
"face": "",
"id": 0,
"last_updated": "",
"local_context_data": "",
"name": "",
"parent_device": {
"display_name": "",
"id": 0,
"name": "",
"url": ""
},
"platform": 0,
"position": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"rack": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vc_position": 0,
"vc_priority": 0,
"virtual_chassis": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/devices/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'asset_tag' => '',
'cluster' => 0,
'comments' => '',
'config_context' => [
],
'created' => '',
'custom_fields' => [
],
'device_role' => 0,
'device_type' => 0,
'display_name' => '',
'face' => '',
'id' => 0,
'last_updated' => '',
'local_context_data' => '',
'name' => '',
'parent_device' => [
'display_name' => '',
'id' => 0,
'name' => '',
'url' => ''
],
'platform' => 0,
'position' => 0,
'primary_ip' => '',
'primary_ip4' => 0,
'primary_ip6' => 0,
'rack' => 0,
'serial' => '',
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'vc_position' => 0,
'vc_priority' => 0,
'virtual_chassis' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'asset_tag' => '',
'cluster' => 0,
'comments' => '',
'config_context' => [
],
'created' => '',
'custom_fields' => [
],
'device_role' => 0,
'device_type' => 0,
'display_name' => '',
'face' => '',
'id' => 0,
'last_updated' => '',
'local_context_data' => '',
'name' => '',
'parent_device' => [
'display_name' => '',
'id' => 0,
'name' => '',
'url' => ''
],
'platform' => 0,
'position' => 0,
'primary_ip' => '',
'primary_ip4' => 0,
'primary_ip6' => 0,
'rack' => 0,
'serial' => '',
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'vc_position' => 0,
'vc_priority' => 0,
'virtual_chassis' => 0
]));
$request->setRequestUrl('{{baseUrl}}/dcim/devices/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/devices/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"asset_tag": "",
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"device_role": 0,
"device_type": 0,
"display_name": "",
"face": "",
"id": 0,
"last_updated": "",
"local_context_data": "",
"name": "",
"parent_device": {
"display_name": "",
"id": 0,
"name": "",
"url": ""
},
"platform": 0,
"position": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"rack": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vc_position": 0,
"vc_priority": 0,
"virtual_chassis": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/devices/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"asset_tag": "",
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"device_role": 0,
"device_type": 0,
"display_name": "",
"face": "",
"id": 0,
"last_updated": "",
"local_context_data": "",
"name": "",
"parent_device": {
"display_name": "",
"id": 0,
"name": "",
"url": ""
},
"platform": 0,
"position": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"rack": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vc_position": 0,
"vc_priority": 0,
"virtual_chassis": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/dcim/devices/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/devices/:id/"
payload = {
"asset_tag": "",
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"device_role": 0,
"device_type": 0,
"display_name": "",
"face": "",
"id": 0,
"last_updated": "",
"local_context_data": "",
"name": "",
"parent_device": {
"display_name": "",
"id": 0,
"name": "",
"url": ""
},
"platform": 0,
"position": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"rack": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vc_position": 0,
"vc_priority": 0,
"virtual_chassis": 0
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/devices/:id/"
payload <- "{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\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}}/dcim/devices/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/dcim/devices/:id/') do |req|
req.body = "{\n \"asset_tag\": \"\",\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_role\": 0,\n \"device_type\": 0,\n \"display_name\": \"\",\n \"face\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"name\": \"\",\n \"parent_device\": {\n \"display_name\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\"\n },\n \"platform\": 0,\n \"position\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"rack\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vc_position\": 0,\n \"vc_priority\": 0,\n \"virtual_chassis\": 0\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}}/dcim/devices/:id/";
let payload = json!({
"asset_tag": "",
"cluster": 0,
"comments": "",
"config_context": json!({}),
"created": "",
"custom_fields": json!({}),
"device_role": 0,
"device_type": 0,
"display_name": "",
"face": "",
"id": 0,
"last_updated": "",
"local_context_data": "",
"name": "",
"parent_device": json!({
"display_name": "",
"id": 0,
"name": "",
"url": ""
}),
"platform": 0,
"position": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"rack": 0,
"serial": "",
"site": 0,
"status": "",
"tags": (),
"tenant": 0,
"vc_position": 0,
"vc_priority": 0,
"virtual_chassis": 0
});
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}}/dcim/devices/:id/ \
--header 'content-type: application/json' \
--data '{
"asset_tag": "",
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"device_role": 0,
"device_type": 0,
"display_name": "",
"face": "",
"id": 0,
"last_updated": "",
"local_context_data": "",
"name": "",
"parent_device": {
"display_name": "",
"id": 0,
"name": "",
"url": ""
},
"platform": 0,
"position": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"rack": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vc_position": 0,
"vc_priority": 0,
"virtual_chassis": 0
}'
echo '{
"asset_tag": "",
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"device_role": 0,
"device_type": 0,
"display_name": "",
"face": "",
"id": 0,
"last_updated": "",
"local_context_data": "",
"name": "",
"parent_device": {
"display_name": "",
"id": 0,
"name": "",
"url": ""
},
"platform": 0,
"position": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"rack": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vc_position": 0,
"vc_priority": 0,
"virtual_chassis": 0
}' | \
http PUT {{baseUrl}}/dcim/devices/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "asset_tag": "",\n "cluster": 0,\n "comments": "",\n "config_context": {},\n "created": "",\n "custom_fields": {},\n "device_role": 0,\n "device_type": 0,\n "display_name": "",\n "face": "",\n "id": 0,\n "last_updated": "",\n "local_context_data": "",\n "name": "",\n "parent_device": {\n "display_name": "",\n "id": 0,\n "name": "",\n "url": ""\n },\n "platform": 0,\n "position": 0,\n "primary_ip": "",\n "primary_ip4": 0,\n "primary_ip6": 0,\n "rack": 0,\n "serial": "",\n "site": 0,\n "status": "",\n "tags": [],\n "tenant": 0,\n "vc_position": 0,\n "vc_priority": 0,\n "virtual_chassis": 0\n}' \
--output-document \
- {{baseUrl}}/dcim/devices/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"asset_tag": "",
"cluster": 0,
"comments": "",
"config_context": [],
"created": "",
"custom_fields": [],
"device_role": 0,
"device_type": 0,
"display_name": "",
"face": "",
"id": 0,
"last_updated": "",
"local_context_data": "",
"name": "",
"parent_device": [
"display_name": "",
"id": 0,
"name": "",
"url": ""
],
"platform": 0,
"position": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"rack": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vc_position": 0,
"vc_priority": 0,
"virtual_chassis": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/devices/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
dcim_front-port-templates_create
{{baseUrl}}/dcim/front-port-templates/
BODY json
{
"device_type": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/front-port-templates/");
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 \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/dcim/front-port-templates/" {:content-type :json
:form-params {:device_type 0
:id 0
:name ""
:rear_port 0
:rear_port_position 0
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/front-port-templates/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/dcim/front-port-templates/"),
Content = new StringContent("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/front-port-templates/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/front-port-templates/"
payload := strings.NewReader("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/dcim/front-port-templates/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 106
{
"device_type": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/dcim/front-port-templates/")
.setHeader("content-type", "application/json")
.setBody("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/front-port-templates/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/front-port-templates/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/dcim/front-port-templates/")
.header("content-type", "application/json")
.body("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
device_type: 0,
id: 0,
name: '',
rear_port: 0,
rear_port_position: 0,
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/dcim/front-port-templates/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/front-port-templates/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, id: 0, name: '', rear_port: 0, rear_port_position: 0, type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/front-port-templates/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"id":0,"name":"","rear_port":0,"rear_port_position":0,"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/front-port-templates/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "device_type": 0,\n "id": 0,\n "name": "",\n "rear_port": 0,\n "rear_port_position": 0,\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/front-port-templates/")
.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/dcim/front-port-templates/',
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({device_type: 0, id: 0, name: '', rear_port: 0, rear_port_position: 0, type: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/front-port-templates/',
headers: {'content-type': 'application/json'},
body: {device_type: 0, id: 0, name: '', rear_port: 0, rear_port_position: 0, type: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/dcim/front-port-templates/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
device_type: 0,
id: 0,
name: '',
rear_port: 0,
rear_port_position: 0,
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/front-port-templates/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, id: 0, name: '', rear_port: 0, rear_port_position: 0, type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/front-port-templates/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"id":0,"name":"","rear_port":0,"rear_port_position":0,"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"device_type": @0,
@"id": @0,
@"name": @"",
@"rear_port": @0,
@"rear_port_position": @0,
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/front-port-templates/"]
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}}/dcim/front-port-templates/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/front-port-templates/",
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([
'device_type' => 0,
'id' => 0,
'name' => '',
'rear_port' => 0,
'rear_port_position' => 0,
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/dcim/front-port-templates/', [
'body' => '{
"device_type": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/front-port-templates/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'device_type' => 0,
'id' => 0,
'name' => '',
'rear_port' => 0,
'rear_port_position' => 0,
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'device_type' => 0,
'id' => 0,
'name' => '',
'rear_port' => 0,
'rear_port_position' => 0,
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/front-port-templates/');
$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}}/dcim/front-port-templates/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/front-port-templates/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/dcim/front-port-templates/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/front-port-templates/"
payload = {
"device_type": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/front-port-templates/"
payload <- "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/front-port-templates/")
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 \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/dcim/front-port-templates/') do |req|
req.body = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/front-port-templates/";
let payload = json!({
"device_type": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/dcim/front-port-templates/ \
--header 'content-type: application/json' \
--data '{
"device_type": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"type": ""
}'
echo '{
"device_type": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"type": ""
}' | \
http POST {{baseUrl}}/dcim/front-port-templates/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "device_type": 0,\n "id": 0,\n "name": "",\n "rear_port": 0,\n "rear_port_position": 0,\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/front-port-templates/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"device_type": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/front-port-templates/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
dcim_front-port-templates_delete
{{baseUrl}}/dcim/front-port-templates/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/front-port-templates/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/dcim/front-port-templates/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/front-port-templates/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/dcim/front-port-templates/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/front-port-templates/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/front-port-templates/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/dcim/front-port-templates/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/dcim/front-port-templates/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/front-port-templates/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/front-port-templates/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/dcim/front-port-templates/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/dcim/front-port-templates/:id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/dcim/front-port-templates/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/front-port-templates/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/front-port-templates/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/front-port-templates/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/front-port-templates/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/dcim/front-port-templates/:id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/dcim/front-port-templates/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/dcim/front-port-templates/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/front-port-templates/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/front-port-templates/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/front-port-templates/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/front-port-templates/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/dcim/front-port-templates/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/front-port-templates/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/front-port-templates/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/front-port-templates/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/front-port-templates/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/dcim/front-port-templates/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/front-port-templates/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/front-port-templates/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/front-port-templates/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/dcim/front-port-templates/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/front-port-templates/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/dcim/front-port-templates/:id/
http DELETE {{baseUrl}}/dcim/front-port-templates/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/dcim/front-port-templates/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/front-port-templates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_front-port-templates_list
{{baseUrl}}/dcim/front-port-templates/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/front-port-templates/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/front-port-templates/")
require "http/client"
url = "{{baseUrl}}/dcim/front-port-templates/"
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}}/dcim/front-port-templates/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/front-port-templates/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/front-port-templates/"
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/dcim/front-port-templates/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/front-port-templates/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/front-port-templates/"))
.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}}/dcim/front-port-templates/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/front-port-templates/")
.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}}/dcim/front-port-templates/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/front-port-templates/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/front-port-templates/';
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}}/dcim/front-port-templates/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/front-port-templates/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/front-port-templates/',
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}}/dcim/front-port-templates/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/front-port-templates/');
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}}/dcim/front-port-templates/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/front-port-templates/';
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}}/dcim/front-port-templates/"]
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}}/dcim/front-port-templates/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/front-port-templates/",
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}}/dcim/front-port-templates/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/front-port-templates/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/front-port-templates/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/front-port-templates/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/front-port-templates/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/front-port-templates/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/front-port-templates/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/front-port-templates/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/front-port-templates/")
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/dcim/front-port-templates/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/front-port-templates/";
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}}/dcim/front-port-templates/
http GET {{baseUrl}}/dcim/front-port-templates/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/front-port-templates/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/front-port-templates/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
dcim_front-port-templates_partial_update
{{baseUrl}}/dcim/front-port-templates/:id/
BODY json
{
"device_type": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/front-port-templates/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/dcim/front-port-templates/:id/" {:content-type :json
:form-params {:device_type 0
:id 0
:name ""
:rear_port 0
:rear_port_position 0
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/front-port-templates/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\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}}/dcim/front-port-templates/:id/"),
Content = new StringContent("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/front-port-templates/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/front-port-templates/:id/"
payload := strings.NewReader("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\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/dcim/front-port-templates/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 106
{
"device_type": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/dcim/front-port-templates/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/front-port-templates/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/front-port-templates/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/dcim/front-port-templates/:id/")
.header("content-type", "application/json")
.body("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
device_type: 0,
id: 0,
name: '',
rear_port: 0,
rear_port_position: 0,
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/dcim/front-port-templates/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/front-port-templates/:id/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, id: 0, name: '', rear_port: 0, rear_port_position: 0, type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/front-port-templates/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"id":0,"name":"","rear_port":0,"rear_port_position":0,"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/front-port-templates/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "device_type": 0,\n "id": 0,\n "name": "",\n "rear_port": 0,\n "rear_port_position": 0,\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/front-port-templates/:id/")
.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/dcim/front-port-templates/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({device_type: 0, id: 0, name: '', rear_port: 0, rear_port_position: 0, type: ''}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/front-port-templates/:id/',
headers: {'content-type': 'application/json'},
body: {device_type: 0, id: 0, name: '', rear_port: 0, rear_port_position: 0, type: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/dcim/front-port-templates/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
device_type: 0,
id: 0,
name: '',
rear_port: 0,
rear_port_position: 0,
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/front-port-templates/:id/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, id: 0, name: '', rear_port: 0, rear_port_position: 0, type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/front-port-templates/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"id":0,"name":"","rear_port":0,"rear_port_position":0,"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"device_type": @0,
@"id": @0,
@"name": @"",
@"rear_port": @0,
@"rear_port_position": @0,
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/front-port-templates/:id/"]
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}}/dcim/front-port-templates/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/front-port-templates/:id/",
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([
'device_type' => 0,
'id' => 0,
'name' => '',
'rear_port' => 0,
'rear_port_position' => 0,
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/dcim/front-port-templates/:id/', [
'body' => '{
"device_type": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/front-port-templates/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'device_type' => 0,
'id' => 0,
'name' => '',
'rear_port' => 0,
'rear_port_position' => 0,
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'device_type' => 0,
'id' => 0,
'name' => '',
'rear_port' => 0,
'rear_port_position' => 0,
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/front-port-templates/:id/');
$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}}/dcim/front-port-templates/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/front-port-templates/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/dcim/front-port-templates/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/front-port-templates/:id/"
payload = {
"device_type": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/front-port-templates/:id/"
payload <- "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\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}}/dcim/front-port-templates/:id/")
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 \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/dcim/front-port-templates/:id/') do |req|
req.body = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\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}}/dcim/front-port-templates/:id/";
let payload = json!({
"device_type": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/dcim/front-port-templates/:id/ \
--header 'content-type: application/json' \
--data '{
"device_type": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"type": ""
}'
echo '{
"device_type": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"type": ""
}' | \
http PATCH {{baseUrl}}/dcim/front-port-templates/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "device_type": 0,\n "id": 0,\n "name": "",\n "rear_port": 0,\n "rear_port_position": 0,\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/front-port-templates/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"device_type": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/front-port-templates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_front-port-templates_read
{{baseUrl}}/dcim/front-port-templates/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/front-port-templates/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/front-port-templates/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/front-port-templates/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/dcim/front-port-templates/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/front-port-templates/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/front-port-templates/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/dcim/front-port-templates/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/front-port-templates/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/front-port-templates/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/front-port-templates/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/front-port-templates/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/dcim/front-port-templates/:id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/dcim/front-port-templates/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/front-port-templates/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/front-port-templates/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/front-port-templates/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/front-port-templates/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/dcim/front-port-templates/:id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/front-port-templates/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/dcim/front-port-templates/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/front-port-templates/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/front-port-templates/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/front-port-templates/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/front-port-templates/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/dcim/front-port-templates/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/front-port-templates/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/front-port-templates/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/front-port-templates/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/front-port-templates/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/front-port-templates/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/front-port-templates/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/front-port-templates/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/front-port-templates/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/dcim/front-port-templates/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/front-port-templates/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/dcim/front-port-templates/:id/
http GET {{baseUrl}}/dcim/front-port-templates/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/front-port-templates/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/front-port-templates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
dcim_front-port-templates_update
{{baseUrl}}/dcim/front-port-templates/:id/
BODY json
{
"device_type": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/front-port-templates/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/dcim/front-port-templates/:id/" {:content-type :json
:form-params {:device_type 0
:id 0
:name ""
:rear_port 0
:rear_port_position 0
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/front-port-templates/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\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}}/dcim/front-port-templates/:id/"),
Content = new StringContent("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/front-port-templates/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/front-port-templates/:id/"
payload := strings.NewReader("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\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/dcim/front-port-templates/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 106
{
"device_type": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/dcim/front-port-templates/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/front-port-templates/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/front-port-templates/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/dcim/front-port-templates/:id/")
.header("content-type", "application/json")
.body("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
device_type: 0,
id: 0,
name: '',
rear_port: 0,
rear_port_position: 0,
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/dcim/front-port-templates/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/front-port-templates/:id/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, id: 0, name: '', rear_port: 0, rear_port_position: 0, type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/front-port-templates/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"id":0,"name":"","rear_port":0,"rear_port_position":0,"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/front-port-templates/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "device_type": 0,\n "id": 0,\n "name": "",\n "rear_port": 0,\n "rear_port_position": 0,\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/front-port-templates/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/front-port-templates/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({device_type: 0, id: 0, name: '', rear_port: 0, rear_port_position: 0, type: ''}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/front-port-templates/:id/',
headers: {'content-type': 'application/json'},
body: {device_type: 0, id: 0, name: '', rear_port: 0, rear_port_position: 0, type: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/dcim/front-port-templates/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
device_type: 0,
id: 0,
name: '',
rear_port: 0,
rear_port_position: 0,
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/front-port-templates/:id/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, id: 0, name: '', rear_port: 0, rear_port_position: 0, type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/front-port-templates/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"id":0,"name":"","rear_port":0,"rear_port_position":0,"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"device_type": @0,
@"id": @0,
@"name": @"",
@"rear_port": @0,
@"rear_port_position": @0,
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/front-port-templates/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/front-port-templates/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/front-port-templates/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'device_type' => 0,
'id' => 0,
'name' => '',
'rear_port' => 0,
'rear_port_position' => 0,
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/dcim/front-port-templates/:id/', [
'body' => '{
"device_type": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/front-port-templates/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'device_type' => 0,
'id' => 0,
'name' => '',
'rear_port' => 0,
'rear_port_position' => 0,
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'device_type' => 0,
'id' => 0,
'name' => '',
'rear_port' => 0,
'rear_port_position' => 0,
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/front-port-templates/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/front-port-templates/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/front-port-templates/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/dcim/front-port-templates/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/front-port-templates/:id/"
payload = {
"device_type": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/front-port-templates/:id/"
payload <- "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\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}}/dcim/front-port-templates/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/dcim/front-port-templates/:id/') do |req|
req.body = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"type\": \"\"\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}}/dcim/front-port-templates/:id/";
let payload = json!({
"device_type": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/dcim/front-port-templates/:id/ \
--header 'content-type: application/json' \
--data '{
"device_type": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"type": ""
}'
echo '{
"device_type": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"type": ""
}' | \
http PUT {{baseUrl}}/dcim/front-port-templates/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "device_type": 0,\n "id": 0,\n "name": "",\n "rear_port": 0,\n "rear_port_position": 0,\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/front-port-templates/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"device_type": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/front-port-templates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
dcim_front-ports_create
{{baseUrl}}/dcim/front-ports/
BODY json
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"tags": [],
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/front-ports/");
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 \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/dcim/front-ports/" {:content-type :json
:form-params {:cable {:id 0
:label ""
:url ""}
:description ""
:device 0
:id 0
:name ""
:rear_port 0
:rear_port_position 0
:tags []
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/front-ports/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/dcim/front-ports/"),
Content = new StringContent("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/front-ports/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/front-ports/"
payload := strings.NewReader("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/dcim/front-ports/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 198
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"tags": [],
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/dcim/front-ports/")
.setHeader("content-type", "application/json")
.setBody("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/front-ports/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/front-ports/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/dcim/front-ports/")
.header("content-type", "application/json")
.body("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
cable: {
id: 0,
label: '',
url: ''
},
description: '',
device: 0,
id: 0,
name: '',
rear_port: 0,
rear_port_position: 0,
tags: [],
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/dcim/front-ports/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/front-ports/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
description: '',
device: 0,
id: 0,
name: '',
rear_port: 0,
rear_port_position: 0,
tags: [],
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/front-ports/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"description":"","device":0,"id":0,"name":"","rear_port":0,"rear_port_position":0,"tags":[],"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/front-ports/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "description": "",\n "device": 0,\n "id": 0,\n "name": "",\n "rear_port": 0,\n "rear_port_position": 0,\n "tags": [],\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/front-ports/")
.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/dcim/front-ports/',
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({
cable: {id: 0, label: '', url: ''},
description: '',
device: 0,
id: 0,
name: '',
rear_port: 0,
rear_port_position: 0,
tags: [],
type: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/front-ports/',
headers: {'content-type': 'application/json'},
body: {
cable: {id: 0, label: '', url: ''},
description: '',
device: 0,
id: 0,
name: '',
rear_port: 0,
rear_port_position: 0,
tags: [],
type: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/dcim/front-ports/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cable: {
id: 0,
label: '',
url: ''
},
description: '',
device: 0,
id: 0,
name: '',
rear_port: 0,
rear_port_position: 0,
tags: [],
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/front-ports/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
description: '',
device: 0,
id: 0,
name: '',
rear_port: 0,
rear_port_position: 0,
tags: [],
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/front-ports/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"description":"","device":0,"id":0,"name":"","rear_port":0,"rear_port_position":0,"tags":[],"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"cable": @{ @"id": @0, @"label": @"", @"url": @"" },
@"description": @"",
@"device": @0,
@"id": @0,
@"name": @"",
@"rear_port": @0,
@"rear_port_position": @0,
@"tags": @[ ],
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/front-ports/"]
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}}/dcim/front-ports/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/front-ports/",
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([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'description' => '',
'device' => 0,
'id' => 0,
'name' => '',
'rear_port' => 0,
'rear_port_position' => 0,
'tags' => [
],
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/dcim/front-ports/', [
'body' => '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"tags": [],
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/front-ports/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'description' => '',
'device' => 0,
'id' => 0,
'name' => '',
'rear_port' => 0,
'rear_port_position' => 0,
'tags' => [
],
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'description' => '',
'device' => 0,
'id' => 0,
'name' => '',
'rear_port' => 0,
'rear_port_position' => 0,
'tags' => [
],
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/front-ports/');
$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}}/dcim/front-ports/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"tags": [],
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/front-ports/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"tags": [],
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/dcim/front-ports/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/front-ports/"
payload = {
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"tags": [],
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/front-ports/"
payload <- "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/front-ports/")
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 \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/dcim/front-ports/') do |req|
req.body = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/front-ports/";
let payload = json!({
"cable": json!({
"id": 0,
"label": "",
"url": ""
}),
"description": "",
"device": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"tags": (),
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/dcim/front-ports/ \
--header 'content-type: application/json' \
--data '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"tags": [],
"type": ""
}'
echo '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"tags": [],
"type": ""
}' | \
http POST {{baseUrl}}/dcim/front-ports/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "description": "",\n "device": 0,\n "id": 0,\n "name": "",\n "rear_port": 0,\n "rear_port_position": 0,\n "tags": [],\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/front-ports/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cable": [
"id": 0,
"label": "",
"url": ""
],
"description": "",
"device": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"tags": [],
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/front-ports/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
dcim_front-ports_delete
{{baseUrl}}/dcim/front-ports/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/front-ports/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/dcim/front-ports/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/front-ports/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/dcim/front-ports/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/front-ports/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/front-ports/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/dcim/front-ports/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/dcim/front-ports/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/front-ports/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/front-ports/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/dcim/front-ports/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/dcim/front-ports/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/front-ports/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/front-ports/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/front-ports/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/front-ports/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/front-ports/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/front-ports/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/dcim/front-ports/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/front-ports/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/front-ports/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/front-ports/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/front-ports/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/front-ports/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/dcim/front-ports/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/front-ports/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/front-ports/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/front-ports/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/front-ports/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/dcim/front-ports/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/front-ports/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/front-ports/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/front-ports/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/dcim/front-ports/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/front-ports/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/dcim/front-ports/:id/
http DELETE {{baseUrl}}/dcim/front-ports/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/dcim/front-ports/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/front-ports/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_front-ports_list
{{baseUrl}}/dcim/front-ports/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/front-ports/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/front-ports/")
require "http/client"
url = "{{baseUrl}}/dcim/front-ports/"
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}}/dcim/front-ports/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/front-ports/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/front-ports/"
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/dcim/front-ports/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/front-ports/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/front-ports/"))
.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}}/dcim/front-ports/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/front-ports/")
.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}}/dcim/front-ports/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/front-ports/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/front-ports/';
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}}/dcim/front-ports/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/front-ports/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/front-ports/',
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}}/dcim/front-ports/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/front-ports/');
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}}/dcim/front-ports/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/front-ports/';
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}}/dcim/front-ports/"]
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}}/dcim/front-ports/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/front-ports/",
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}}/dcim/front-ports/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/front-ports/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/front-ports/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/front-ports/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/front-ports/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/front-ports/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/front-ports/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/front-ports/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/front-ports/")
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/dcim/front-ports/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/front-ports/";
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}}/dcim/front-ports/
http GET {{baseUrl}}/dcim/front-ports/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/front-ports/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/front-ports/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
dcim_front-ports_partial_update
{{baseUrl}}/dcim/front-ports/:id/
BODY json
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"tags": [],
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/front-ports/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/dcim/front-ports/:id/" {:content-type :json
:form-params {:cable {:id 0
:label ""
:url ""}
:description ""
:device 0
:id 0
:name ""
:rear_port 0
:rear_port_position 0
:tags []
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/front-ports/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\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}}/dcim/front-ports/:id/"),
Content = new StringContent("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/front-ports/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/front-ports/:id/"
payload := strings.NewReader("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\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/dcim/front-ports/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 198
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"tags": [],
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/dcim/front-ports/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/front-ports/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/front-ports/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/dcim/front-ports/:id/")
.header("content-type", "application/json")
.body("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
cable: {
id: 0,
label: '',
url: ''
},
description: '',
device: 0,
id: 0,
name: '',
rear_port: 0,
rear_port_position: 0,
tags: [],
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/dcim/front-ports/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/front-ports/:id/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
description: '',
device: 0,
id: 0,
name: '',
rear_port: 0,
rear_port_position: 0,
tags: [],
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/front-ports/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"description":"","device":0,"id":0,"name":"","rear_port":0,"rear_port_position":0,"tags":[],"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/front-ports/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "description": "",\n "device": 0,\n "id": 0,\n "name": "",\n "rear_port": 0,\n "rear_port_position": 0,\n "tags": [],\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/front-ports/:id/")
.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/dcim/front-ports/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
cable: {id: 0, label: '', url: ''},
description: '',
device: 0,
id: 0,
name: '',
rear_port: 0,
rear_port_position: 0,
tags: [],
type: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/front-ports/:id/',
headers: {'content-type': 'application/json'},
body: {
cable: {id: 0, label: '', url: ''},
description: '',
device: 0,
id: 0,
name: '',
rear_port: 0,
rear_port_position: 0,
tags: [],
type: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/dcim/front-ports/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cable: {
id: 0,
label: '',
url: ''
},
description: '',
device: 0,
id: 0,
name: '',
rear_port: 0,
rear_port_position: 0,
tags: [],
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/front-ports/:id/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
description: '',
device: 0,
id: 0,
name: '',
rear_port: 0,
rear_port_position: 0,
tags: [],
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/front-ports/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"description":"","device":0,"id":0,"name":"","rear_port":0,"rear_port_position":0,"tags":[],"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"cable": @{ @"id": @0, @"label": @"", @"url": @"" },
@"description": @"",
@"device": @0,
@"id": @0,
@"name": @"",
@"rear_port": @0,
@"rear_port_position": @0,
@"tags": @[ ],
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/front-ports/:id/"]
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}}/dcim/front-ports/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/front-ports/:id/",
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([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'description' => '',
'device' => 0,
'id' => 0,
'name' => '',
'rear_port' => 0,
'rear_port_position' => 0,
'tags' => [
],
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/dcim/front-ports/:id/', [
'body' => '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"tags": [],
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/front-ports/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'description' => '',
'device' => 0,
'id' => 0,
'name' => '',
'rear_port' => 0,
'rear_port_position' => 0,
'tags' => [
],
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'description' => '',
'device' => 0,
'id' => 0,
'name' => '',
'rear_port' => 0,
'rear_port_position' => 0,
'tags' => [
],
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/front-ports/:id/');
$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}}/dcim/front-ports/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"tags": [],
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/front-ports/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"tags": [],
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/dcim/front-ports/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/front-ports/:id/"
payload = {
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"tags": [],
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/front-ports/:id/"
payload <- "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\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}}/dcim/front-ports/:id/")
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 \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/dcim/front-ports/:id/') do |req|
req.body = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\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}}/dcim/front-ports/:id/";
let payload = json!({
"cable": json!({
"id": 0,
"label": "",
"url": ""
}),
"description": "",
"device": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"tags": (),
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/dcim/front-ports/:id/ \
--header 'content-type: application/json' \
--data '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"tags": [],
"type": ""
}'
echo '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"tags": [],
"type": ""
}' | \
http PATCH {{baseUrl}}/dcim/front-ports/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "description": "",\n "device": 0,\n "id": 0,\n "name": "",\n "rear_port": 0,\n "rear_port_position": 0,\n "tags": [],\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/front-ports/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cable": [
"id": 0,
"label": "",
"url": ""
],
"description": "",
"device": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"tags": [],
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/front-ports/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_front-ports_read
{{baseUrl}}/dcim/front-ports/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/front-ports/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/front-ports/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/front-ports/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/dcim/front-ports/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/front-ports/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/front-ports/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/dcim/front-ports/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/front-ports/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/front-ports/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/front-ports/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/front-ports/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/dcim/front-ports/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/front-ports/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/front-ports/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/front-ports/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/front-ports/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/front-ports/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/dcim/front-ports/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/front-ports/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/dcim/front-ports/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/front-ports/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/front-ports/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/front-ports/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/front-ports/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/dcim/front-ports/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/front-ports/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/front-ports/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/front-ports/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/front-ports/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/front-ports/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/front-ports/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/front-ports/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/front-ports/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/dcim/front-ports/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/front-ports/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/dcim/front-ports/:id/
http GET {{baseUrl}}/dcim/front-ports/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/front-ports/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/front-ports/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_front-ports_trace
{{baseUrl}}/dcim/front-ports/:id/trace/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/front-ports/:id/trace/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/front-ports/:id/trace/")
require "http/client"
url = "{{baseUrl}}/dcim/front-ports/:id/trace/"
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}}/dcim/front-ports/:id/trace/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/front-ports/:id/trace/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/front-ports/:id/trace/"
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/dcim/front-ports/:id/trace/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/front-ports/:id/trace/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/front-ports/:id/trace/"))
.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}}/dcim/front-ports/:id/trace/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/front-ports/:id/trace/")
.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}}/dcim/front-ports/:id/trace/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/front-ports/:id/trace/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/front-ports/:id/trace/';
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}}/dcim/front-ports/:id/trace/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/front-ports/:id/trace/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/front-ports/:id/trace/',
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}}/dcim/front-ports/:id/trace/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/front-ports/:id/trace/');
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}}/dcim/front-ports/:id/trace/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/front-ports/:id/trace/';
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}}/dcim/front-ports/:id/trace/"]
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}}/dcim/front-ports/:id/trace/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/front-ports/:id/trace/",
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}}/dcim/front-ports/:id/trace/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/front-ports/:id/trace/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/front-ports/:id/trace/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/front-ports/:id/trace/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/front-ports/:id/trace/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/front-ports/:id/trace/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/front-ports/:id/trace/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/front-ports/:id/trace/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/front-ports/:id/trace/")
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/dcim/front-ports/:id/trace/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/front-ports/:id/trace/";
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}}/dcim/front-ports/:id/trace/
http GET {{baseUrl}}/dcim/front-ports/:id/trace/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/front-ports/:id/trace/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/front-ports/:id/trace/")! 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()
PUT
dcim_front-ports_update
{{baseUrl}}/dcim/front-ports/:id/
BODY json
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"tags": [],
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/front-ports/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/dcim/front-ports/:id/" {:content-type :json
:form-params {:cable {:id 0
:label ""
:url ""}
:description ""
:device 0
:id 0
:name ""
:rear_port 0
:rear_port_position 0
:tags []
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/front-ports/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\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}}/dcim/front-ports/:id/"),
Content = new StringContent("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/front-ports/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/front-ports/:id/"
payload := strings.NewReader("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\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/dcim/front-ports/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 198
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"tags": [],
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/dcim/front-ports/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/front-ports/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/front-ports/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/dcim/front-ports/:id/")
.header("content-type", "application/json")
.body("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
cable: {
id: 0,
label: '',
url: ''
},
description: '',
device: 0,
id: 0,
name: '',
rear_port: 0,
rear_port_position: 0,
tags: [],
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/dcim/front-ports/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/front-ports/:id/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
description: '',
device: 0,
id: 0,
name: '',
rear_port: 0,
rear_port_position: 0,
tags: [],
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/front-ports/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"description":"","device":0,"id":0,"name":"","rear_port":0,"rear_port_position":0,"tags":[],"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/front-ports/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "description": "",\n "device": 0,\n "id": 0,\n "name": "",\n "rear_port": 0,\n "rear_port_position": 0,\n "tags": [],\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/front-ports/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/front-ports/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
cable: {id: 0, label: '', url: ''},
description: '',
device: 0,
id: 0,
name: '',
rear_port: 0,
rear_port_position: 0,
tags: [],
type: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/front-ports/:id/',
headers: {'content-type': 'application/json'},
body: {
cable: {id: 0, label: '', url: ''},
description: '',
device: 0,
id: 0,
name: '',
rear_port: 0,
rear_port_position: 0,
tags: [],
type: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/dcim/front-ports/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cable: {
id: 0,
label: '',
url: ''
},
description: '',
device: 0,
id: 0,
name: '',
rear_port: 0,
rear_port_position: 0,
tags: [],
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/front-ports/:id/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
description: '',
device: 0,
id: 0,
name: '',
rear_port: 0,
rear_port_position: 0,
tags: [],
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/front-ports/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"description":"","device":0,"id":0,"name":"","rear_port":0,"rear_port_position":0,"tags":[],"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"cable": @{ @"id": @0, @"label": @"", @"url": @"" },
@"description": @"",
@"device": @0,
@"id": @0,
@"name": @"",
@"rear_port": @0,
@"rear_port_position": @0,
@"tags": @[ ],
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/front-ports/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/front-ports/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/front-ports/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'description' => '',
'device' => 0,
'id' => 0,
'name' => '',
'rear_port' => 0,
'rear_port_position' => 0,
'tags' => [
],
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/dcim/front-ports/:id/', [
'body' => '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"tags": [],
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/front-ports/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'description' => '',
'device' => 0,
'id' => 0,
'name' => '',
'rear_port' => 0,
'rear_port_position' => 0,
'tags' => [
],
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'description' => '',
'device' => 0,
'id' => 0,
'name' => '',
'rear_port' => 0,
'rear_port_position' => 0,
'tags' => [
],
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/front-ports/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/front-ports/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"tags": [],
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/front-ports/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"tags": [],
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/dcim/front-ports/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/front-ports/:id/"
payload = {
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"tags": [],
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/front-ports/:id/"
payload <- "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\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}}/dcim/front-ports/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/dcim/front-ports/:id/') do |req|
req.body = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"rear_port\": 0,\n \"rear_port_position\": 0,\n \"tags\": [],\n \"type\": \"\"\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}}/dcim/front-ports/:id/";
let payload = json!({
"cable": json!({
"id": 0,
"label": "",
"url": ""
}),
"description": "",
"device": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"tags": (),
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/dcim/front-ports/:id/ \
--header 'content-type: application/json' \
--data '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"tags": [],
"type": ""
}'
echo '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"tags": [],
"type": ""
}' | \
http PUT {{baseUrl}}/dcim/front-ports/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "description": "",\n "device": 0,\n "id": 0,\n "name": "",\n "rear_port": 0,\n "rear_port_position": 0,\n "tags": [],\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/front-ports/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cable": [
"id": 0,
"label": "",
"url": ""
],
"description": "",
"device": 0,
"id": 0,
"name": "",
"rear_port": 0,
"rear_port_position": 0,
"tags": [],
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/front-ports/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_interface-connections_list
{{baseUrl}}/dcim/interface-connections/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/interface-connections/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/interface-connections/")
require "http/client"
url = "{{baseUrl}}/dcim/interface-connections/"
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}}/dcim/interface-connections/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/interface-connections/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/interface-connections/"
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/dcim/interface-connections/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/interface-connections/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/interface-connections/"))
.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}}/dcim/interface-connections/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/interface-connections/")
.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}}/dcim/interface-connections/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/interface-connections/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/interface-connections/';
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}}/dcim/interface-connections/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/interface-connections/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/interface-connections/',
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}}/dcim/interface-connections/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/interface-connections/');
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}}/dcim/interface-connections/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/interface-connections/';
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}}/dcim/interface-connections/"]
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}}/dcim/interface-connections/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/interface-connections/",
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}}/dcim/interface-connections/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/interface-connections/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/interface-connections/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/interface-connections/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/interface-connections/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/interface-connections/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/interface-connections/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/interface-connections/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/interface-connections/")
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/dcim/interface-connections/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/interface-connections/";
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}}/dcim/interface-connections/
http GET {{baseUrl}}/dcim/interface-connections/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/interface-connections/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/interface-connections/")! 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
dcim_interface-templates_create
{{baseUrl}}/dcim/interface-templates/
BODY json
{
"device_type": 0,
"id": 0,
"mgmt_only": false,
"name": "",
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/interface-templates/");
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 \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/dcim/interface-templates/" {:content-type :json
:form-params {:device_type 0
:id 0
:mgmt_only false
:name ""
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/interface-templates/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/dcim/interface-templates/"),
Content = new StringContent("{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/interface-templates/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/interface-templates/"
payload := strings.NewReader("{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/dcim/interface-templates/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 83
{
"device_type": 0,
"id": 0,
"mgmt_only": false,
"name": "",
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/dcim/interface-templates/")
.setHeader("content-type", "application/json")
.setBody("{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/interface-templates/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/interface-templates/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/dcim/interface-templates/")
.header("content-type", "application/json")
.body("{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
device_type: 0,
id: 0,
mgmt_only: false,
name: '',
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/dcim/interface-templates/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/interface-templates/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, id: 0, mgmt_only: false, name: '', type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/interface-templates/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"id":0,"mgmt_only":false,"name":"","type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/interface-templates/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "device_type": 0,\n "id": 0,\n "mgmt_only": false,\n "name": "",\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/interface-templates/")
.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/dcim/interface-templates/',
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({device_type: 0, id: 0, mgmt_only: false, name: '', type: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/interface-templates/',
headers: {'content-type': 'application/json'},
body: {device_type: 0, id: 0, mgmt_only: false, name: '', type: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/dcim/interface-templates/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
device_type: 0,
id: 0,
mgmt_only: false,
name: '',
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/interface-templates/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, id: 0, mgmt_only: false, name: '', type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/interface-templates/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"id":0,"mgmt_only":false,"name":"","type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"device_type": @0,
@"id": @0,
@"mgmt_only": @NO,
@"name": @"",
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/interface-templates/"]
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}}/dcim/interface-templates/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/interface-templates/",
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([
'device_type' => 0,
'id' => 0,
'mgmt_only' => null,
'name' => '',
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/dcim/interface-templates/', [
'body' => '{
"device_type": 0,
"id": 0,
"mgmt_only": false,
"name": "",
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/interface-templates/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'device_type' => 0,
'id' => 0,
'mgmt_only' => null,
'name' => '',
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'device_type' => 0,
'id' => 0,
'mgmt_only' => null,
'name' => '',
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/interface-templates/');
$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}}/dcim/interface-templates/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"id": 0,
"mgmt_only": false,
"name": "",
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/interface-templates/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"id": 0,
"mgmt_only": false,
"name": "",
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/dcim/interface-templates/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/interface-templates/"
payload = {
"device_type": 0,
"id": 0,
"mgmt_only": False,
"name": "",
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/interface-templates/"
payload <- "{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/interface-templates/")
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 \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/dcim/interface-templates/') do |req|
req.body = "{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/interface-templates/";
let payload = json!({
"device_type": 0,
"id": 0,
"mgmt_only": false,
"name": "",
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/dcim/interface-templates/ \
--header 'content-type: application/json' \
--data '{
"device_type": 0,
"id": 0,
"mgmt_only": false,
"name": "",
"type": ""
}'
echo '{
"device_type": 0,
"id": 0,
"mgmt_only": false,
"name": "",
"type": ""
}' | \
http POST {{baseUrl}}/dcim/interface-templates/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "device_type": 0,\n "id": 0,\n "mgmt_only": false,\n "name": "",\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/interface-templates/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"device_type": 0,
"id": 0,
"mgmt_only": false,
"name": "",
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/interface-templates/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
dcim_interface-templates_delete
{{baseUrl}}/dcim/interface-templates/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/interface-templates/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/dcim/interface-templates/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/interface-templates/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/dcim/interface-templates/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/interface-templates/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/interface-templates/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/dcim/interface-templates/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/dcim/interface-templates/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/interface-templates/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/interface-templates/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/dcim/interface-templates/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/dcim/interface-templates/:id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/dcim/interface-templates/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/interface-templates/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/interface-templates/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/interface-templates/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/interface-templates/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/dcim/interface-templates/:id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/dcim/interface-templates/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/dcim/interface-templates/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/interface-templates/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/interface-templates/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/interface-templates/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/interface-templates/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/dcim/interface-templates/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/interface-templates/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/interface-templates/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/interface-templates/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/interface-templates/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/dcim/interface-templates/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/interface-templates/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/interface-templates/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/interface-templates/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/dcim/interface-templates/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/interface-templates/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/dcim/interface-templates/:id/
http DELETE {{baseUrl}}/dcim/interface-templates/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/dcim/interface-templates/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/interface-templates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_interface-templates_list
{{baseUrl}}/dcim/interface-templates/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/interface-templates/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/interface-templates/")
require "http/client"
url = "{{baseUrl}}/dcim/interface-templates/"
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}}/dcim/interface-templates/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/interface-templates/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/interface-templates/"
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/dcim/interface-templates/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/interface-templates/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/interface-templates/"))
.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}}/dcim/interface-templates/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/interface-templates/")
.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}}/dcim/interface-templates/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/interface-templates/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/interface-templates/';
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}}/dcim/interface-templates/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/interface-templates/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/interface-templates/',
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}}/dcim/interface-templates/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/interface-templates/');
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}}/dcim/interface-templates/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/interface-templates/';
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}}/dcim/interface-templates/"]
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}}/dcim/interface-templates/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/interface-templates/",
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}}/dcim/interface-templates/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/interface-templates/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/interface-templates/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/interface-templates/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/interface-templates/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/interface-templates/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/interface-templates/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/interface-templates/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/interface-templates/")
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/dcim/interface-templates/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/interface-templates/";
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}}/dcim/interface-templates/
http GET {{baseUrl}}/dcim/interface-templates/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/interface-templates/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/interface-templates/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
dcim_interface-templates_partial_update
{{baseUrl}}/dcim/interface-templates/:id/
BODY json
{
"device_type": 0,
"id": 0,
"mgmt_only": false,
"name": "",
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/interface-templates/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/dcim/interface-templates/:id/" {:content-type :json
:form-params {:device_type 0
:id 0
:mgmt_only false
:name ""
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/interface-templates/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\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}}/dcim/interface-templates/:id/"),
Content = new StringContent("{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/interface-templates/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/interface-templates/:id/"
payload := strings.NewReader("{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\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/dcim/interface-templates/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 83
{
"device_type": 0,
"id": 0,
"mgmt_only": false,
"name": "",
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/dcim/interface-templates/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/interface-templates/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/interface-templates/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/dcim/interface-templates/:id/")
.header("content-type", "application/json")
.body("{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
device_type: 0,
id: 0,
mgmt_only: false,
name: '',
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/dcim/interface-templates/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/interface-templates/:id/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, id: 0, mgmt_only: false, name: '', type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/interface-templates/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"id":0,"mgmt_only":false,"name":"","type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/interface-templates/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "device_type": 0,\n "id": 0,\n "mgmt_only": false,\n "name": "",\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/interface-templates/:id/")
.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/dcim/interface-templates/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({device_type: 0, id: 0, mgmt_only: false, name: '', type: ''}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/interface-templates/:id/',
headers: {'content-type': 'application/json'},
body: {device_type: 0, id: 0, mgmt_only: false, name: '', type: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/dcim/interface-templates/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
device_type: 0,
id: 0,
mgmt_only: false,
name: '',
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/interface-templates/:id/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, id: 0, mgmt_only: false, name: '', type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/interface-templates/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"id":0,"mgmt_only":false,"name":"","type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"device_type": @0,
@"id": @0,
@"mgmt_only": @NO,
@"name": @"",
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/interface-templates/:id/"]
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}}/dcim/interface-templates/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/interface-templates/:id/",
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([
'device_type' => 0,
'id' => 0,
'mgmt_only' => null,
'name' => '',
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/dcim/interface-templates/:id/', [
'body' => '{
"device_type": 0,
"id": 0,
"mgmt_only": false,
"name": "",
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/interface-templates/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'device_type' => 0,
'id' => 0,
'mgmt_only' => null,
'name' => '',
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'device_type' => 0,
'id' => 0,
'mgmt_only' => null,
'name' => '',
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/interface-templates/:id/');
$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}}/dcim/interface-templates/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"id": 0,
"mgmt_only": false,
"name": "",
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/interface-templates/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"id": 0,
"mgmt_only": false,
"name": "",
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/dcim/interface-templates/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/interface-templates/:id/"
payload = {
"device_type": 0,
"id": 0,
"mgmt_only": False,
"name": "",
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/interface-templates/:id/"
payload <- "{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\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}}/dcim/interface-templates/:id/")
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 \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/dcim/interface-templates/:id/') do |req|
req.body = "{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\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}}/dcim/interface-templates/:id/";
let payload = json!({
"device_type": 0,
"id": 0,
"mgmt_only": false,
"name": "",
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.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}}/dcim/interface-templates/:id/ \
--header 'content-type: application/json' \
--data '{
"device_type": 0,
"id": 0,
"mgmt_only": false,
"name": "",
"type": ""
}'
echo '{
"device_type": 0,
"id": 0,
"mgmt_only": false,
"name": "",
"type": ""
}' | \
http PATCH {{baseUrl}}/dcim/interface-templates/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "device_type": 0,\n "id": 0,\n "mgmt_only": false,\n "name": "",\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/interface-templates/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"device_type": 0,
"id": 0,
"mgmt_only": false,
"name": "",
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/interface-templates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_interface-templates_read
{{baseUrl}}/dcim/interface-templates/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/interface-templates/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/interface-templates/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/interface-templates/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/dcim/interface-templates/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/interface-templates/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/interface-templates/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/dcim/interface-templates/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/interface-templates/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/interface-templates/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/interface-templates/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/interface-templates/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/dcim/interface-templates/:id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/dcim/interface-templates/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/interface-templates/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/interface-templates/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/interface-templates/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/interface-templates/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/dcim/interface-templates/:id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/interface-templates/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/dcim/interface-templates/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/interface-templates/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/interface-templates/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/interface-templates/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/interface-templates/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/dcim/interface-templates/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/interface-templates/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/interface-templates/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/interface-templates/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/interface-templates/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/interface-templates/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/interface-templates/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/interface-templates/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/interface-templates/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/dcim/interface-templates/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/interface-templates/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/dcim/interface-templates/:id/
http GET {{baseUrl}}/dcim/interface-templates/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/interface-templates/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/interface-templates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
dcim_interface-templates_update
{{baseUrl}}/dcim/interface-templates/:id/
BODY json
{
"device_type": 0,
"id": 0,
"mgmt_only": false,
"name": "",
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/interface-templates/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/dcim/interface-templates/:id/" {:content-type :json
:form-params {:device_type 0
:id 0
:mgmt_only false
:name ""
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/interface-templates/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\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}}/dcim/interface-templates/:id/"),
Content = new StringContent("{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/interface-templates/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/interface-templates/:id/"
payload := strings.NewReader("{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\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/dcim/interface-templates/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 83
{
"device_type": 0,
"id": 0,
"mgmt_only": false,
"name": "",
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/dcim/interface-templates/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/interface-templates/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/interface-templates/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/dcim/interface-templates/:id/")
.header("content-type", "application/json")
.body("{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
device_type: 0,
id: 0,
mgmt_only: false,
name: '',
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/dcim/interface-templates/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/interface-templates/:id/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, id: 0, mgmt_only: false, name: '', type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/interface-templates/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"id":0,"mgmt_only":false,"name":"","type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/interface-templates/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "device_type": 0,\n "id": 0,\n "mgmt_only": false,\n "name": "",\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/interface-templates/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/interface-templates/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({device_type: 0, id: 0, mgmt_only: false, name: '', type: ''}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/interface-templates/:id/',
headers: {'content-type': 'application/json'},
body: {device_type: 0, id: 0, mgmt_only: false, name: '', type: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/dcim/interface-templates/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
device_type: 0,
id: 0,
mgmt_only: false,
name: '',
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/interface-templates/:id/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, id: 0, mgmt_only: false, name: '', type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/interface-templates/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"id":0,"mgmt_only":false,"name":"","type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"device_type": @0,
@"id": @0,
@"mgmt_only": @NO,
@"name": @"",
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/interface-templates/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/interface-templates/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/interface-templates/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'device_type' => 0,
'id' => 0,
'mgmt_only' => null,
'name' => '',
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/dcim/interface-templates/:id/', [
'body' => '{
"device_type": 0,
"id": 0,
"mgmt_only": false,
"name": "",
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/interface-templates/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'device_type' => 0,
'id' => 0,
'mgmt_only' => null,
'name' => '',
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'device_type' => 0,
'id' => 0,
'mgmt_only' => null,
'name' => '',
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/interface-templates/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/interface-templates/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"id": 0,
"mgmt_only": false,
"name": "",
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/interface-templates/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"id": 0,
"mgmt_only": false,
"name": "",
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/dcim/interface-templates/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/interface-templates/:id/"
payload = {
"device_type": 0,
"id": 0,
"mgmt_only": False,
"name": "",
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/interface-templates/:id/"
payload <- "{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\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}}/dcim/interface-templates/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/dcim/interface-templates/:id/') do |req|
req.body = "{\n \"device_type\": 0,\n \"id\": 0,\n \"mgmt_only\": false,\n \"name\": \"\",\n \"type\": \"\"\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}}/dcim/interface-templates/:id/";
let payload = json!({
"device_type": 0,
"id": 0,
"mgmt_only": false,
"name": "",
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.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}}/dcim/interface-templates/:id/ \
--header 'content-type: application/json' \
--data '{
"device_type": 0,
"id": 0,
"mgmt_only": false,
"name": "",
"type": ""
}'
echo '{
"device_type": 0,
"id": 0,
"mgmt_only": false,
"name": "",
"type": ""
}' | \
http PUT {{baseUrl}}/dcim/interface-templates/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "device_type": 0,\n "id": 0,\n "mgmt_only": false,\n "name": "",\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/interface-templates/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"device_type": 0,
"id": 0,
"mgmt_only": false,
"name": "",
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/interface-templates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
dcim_interfaces_create
{{baseUrl}}/dcim/interfaces/
BODY json
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"count_ipaddresses": 0,
"description": "",
"device": 0,
"enabled": false,
"id": 0,
"lag": 0,
"mac_address": "",
"mgmt_only": false,
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/interfaces/");
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 \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/dcim/interfaces/" {:content-type :json
:form-params {:cable {:id 0
:label ""
:url ""}
:connected_endpoint {}
:connected_endpoint_type ""
:connection_status false
:count_ipaddresses 0
:description ""
:device 0
:enabled false
:id 0
:lag 0
:mac_address ""
:mgmt_only false
:mode ""
:mtu 0
:name ""
:tagged_vlans []
:tags []
:type ""
:untagged_vlan 0}})
require "http/client"
url = "{{baseUrl}}/dcim/interfaces/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/dcim/interfaces/"),
Content = new StringContent("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/interfaces/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/interfaces/"
payload := strings.NewReader("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/dcim/interfaces/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 415
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"count_ipaddresses": 0,
"description": "",
"device": 0,
"enabled": false,
"id": 0,
"lag": 0,
"mac_address": "",
"mgmt_only": false,
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/dcim/interfaces/")
.setHeader("content-type", "application/json")
.setBody("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/interfaces/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/interfaces/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/dcim/interfaces/")
.header("content-type", "application/json")
.body("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\n}")
.asString();
const data = JSON.stringify({
cable: {
id: 0,
label: '',
url: ''
},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
count_ipaddresses: 0,
description: '',
device: 0,
enabled: false,
id: 0,
lag: 0,
mac_address: '',
mgmt_only: false,
mode: '',
mtu: 0,
name: '',
tagged_vlans: [],
tags: [],
type: '',
untagged_vlan: 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}}/dcim/interfaces/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/interfaces/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
count_ipaddresses: 0,
description: '',
device: 0,
enabled: false,
id: 0,
lag: 0,
mac_address: '',
mgmt_only: false,
mode: '',
mtu: 0,
name: '',
tagged_vlans: [],
tags: [],
type: '',
untagged_vlan: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/interfaces/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"connected_endpoint":{},"connected_endpoint_type":"","connection_status":false,"count_ipaddresses":0,"description":"","device":0,"enabled":false,"id":0,"lag":0,"mac_address":"","mgmt_only":false,"mode":"","mtu":0,"name":"","tagged_vlans":[],"tags":[],"type":"","untagged_vlan":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}}/dcim/interfaces/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "connected_endpoint": {},\n "connected_endpoint_type": "",\n "connection_status": false,\n "count_ipaddresses": 0,\n "description": "",\n "device": 0,\n "enabled": false,\n "id": 0,\n "lag": 0,\n "mac_address": "",\n "mgmt_only": false,\n "mode": "",\n "mtu": 0,\n "name": "",\n "tagged_vlans": [],\n "tags": [],\n "type": "",\n "untagged_vlan": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/interfaces/")
.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/dcim/interfaces/',
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({
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
count_ipaddresses: 0,
description: '',
device: 0,
enabled: false,
id: 0,
lag: 0,
mac_address: '',
mgmt_only: false,
mode: '',
mtu: 0,
name: '',
tagged_vlans: [],
tags: [],
type: '',
untagged_vlan: 0
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/interfaces/',
headers: {'content-type': 'application/json'},
body: {
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
count_ipaddresses: 0,
description: '',
device: 0,
enabled: false,
id: 0,
lag: 0,
mac_address: '',
mgmt_only: false,
mode: '',
mtu: 0,
name: '',
tagged_vlans: [],
tags: [],
type: '',
untagged_vlan: 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}}/dcim/interfaces/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cable: {
id: 0,
label: '',
url: ''
},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
count_ipaddresses: 0,
description: '',
device: 0,
enabled: false,
id: 0,
lag: 0,
mac_address: '',
mgmt_only: false,
mode: '',
mtu: 0,
name: '',
tagged_vlans: [],
tags: [],
type: '',
untagged_vlan: 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}}/dcim/interfaces/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
count_ipaddresses: 0,
description: '',
device: 0,
enabled: false,
id: 0,
lag: 0,
mac_address: '',
mgmt_only: false,
mode: '',
mtu: 0,
name: '',
tagged_vlans: [],
tags: [],
type: '',
untagged_vlan: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/interfaces/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"connected_endpoint":{},"connected_endpoint_type":"","connection_status":false,"count_ipaddresses":0,"description":"","device":0,"enabled":false,"id":0,"lag":0,"mac_address":"","mgmt_only":false,"mode":"","mtu":0,"name":"","tagged_vlans":[],"tags":[],"type":"","untagged_vlan":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 = @{ @"cable": @{ @"id": @0, @"label": @"", @"url": @"" },
@"connected_endpoint": @{ },
@"connected_endpoint_type": @"",
@"connection_status": @NO,
@"count_ipaddresses": @0,
@"description": @"",
@"device": @0,
@"enabled": @NO,
@"id": @0,
@"lag": @0,
@"mac_address": @"",
@"mgmt_only": @NO,
@"mode": @"",
@"mtu": @0,
@"name": @"",
@"tagged_vlans": @[ ],
@"tags": @[ ],
@"type": @"",
@"untagged_vlan": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/interfaces/"]
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}}/dcim/interfaces/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/interfaces/",
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([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'count_ipaddresses' => 0,
'description' => '',
'device' => 0,
'enabled' => null,
'id' => 0,
'lag' => 0,
'mac_address' => '',
'mgmt_only' => null,
'mode' => '',
'mtu' => 0,
'name' => '',
'tagged_vlans' => [
],
'tags' => [
],
'type' => '',
'untagged_vlan' => 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}}/dcim/interfaces/', [
'body' => '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"count_ipaddresses": 0,
"description": "",
"device": 0,
"enabled": false,
"id": 0,
"lag": 0,
"mac_address": "",
"mgmt_only": false,
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/interfaces/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'count_ipaddresses' => 0,
'description' => '',
'device' => 0,
'enabled' => null,
'id' => 0,
'lag' => 0,
'mac_address' => '',
'mgmt_only' => null,
'mode' => '',
'mtu' => 0,
'name' => '',
'tagged_vlans' => [
],
'tags' => [
],
'type' => '',
'untagged_vlan' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'count_ipaddresses' => 0,
'description' => '',
'device' => 0,
'enabled' => null,
'id' => 0,
'lag' => 0,
'mac_address' => '',
'mgmt_only' => null,
'mode' => '',
'mtu' => 0,
'name' => '',
'tagged_vlans' => [
],
'tags' => [
],
'type' => '',
'untagged_vlan' => 0
]));
$request->setRequestUrl('{{baseUrl}}/dcim/interfaces/');
$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}}/dcim/interfaces/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"count_ipaddresses": 0,
"description": "",
"device": 0,
"enabled": false,
"id": 0,
"lag": 0,
"mac_address": "",
"mgmt_only": false,
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/interfaces/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"count_ipaddresses": 0,
"description": "",
"device": 0,
"enabled": false,
"id": 0,
"lag": 0,
"mac_address": "",
"mgmt_only": false,
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/dcim/interfaces/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/interfaces/"
payload = {
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": False,
"count_ipaddresses": 0,
"description": "",
"device": 0,
"enabled": False,
"id": 0,
"lag": 0,
"mac_address": "",
"mgmt_only": False,
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/interfaces/"
payload <- "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/interfaces/")
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 \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/dcim/interfaces/') do |req|
req.body = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/interfaces/";
let payload = json!({
"cable": json!({
"id": 0,
"label": "",
"url": ""
}),
"connected_endpoint": json!({}),
"connected_endpoint_type": "",
"connection_status": false,
"count_ipaddresses": 0,
"description": "",
"device": 0,
"enabled": false,
"id": 0,
"lag": 0,
"mac_address": "",
"mgmt_only": false,
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": (),
"tags": (),
"type": "",
"untagged_vlan": 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}}/dcim/interfaces/ \
--header 'content-type: application/json' \
--data '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"count_ipaddresses": 0,
"description": "",
"device": 0,
"enabled": false,
"id": 0,
"lag": 0,
"mac_address": "",
"mgmt_only": false,
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0
}'
echo '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"count_ipaddresses": 0,
"description": "",
"device": 0,
"enabled": false,
"id": 0,
"lag": 0,
"mac_address": "",
"mgmt_only": false,
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0
}' | \
http POST {{baseUrl}}/dcim/interfaces/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "connected_endpoint": {},\n "connected_endpoint_type": "",\n "connection_status": false,\n "count_ipaddresses": 0,\n "description": "",\n "device": 0,\n "enabled": false,\n "id": 0,\n "lag": 0,\n "mac_address": "",\n "mgmt_only": false,\n "mode": "",\n "mtu": 0,\n "name": "",\n "tagged_vlans": [],\n "tags": [],\n "type": "",\n "untagged_vlan": 0\n}' \
--output-document \
- {{baseUrl}}/dcim/interfaces/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cable": [
"id": 0,
"label": "",
"url": ""
],
"connected_endpoint": [],
"connected_endpoint_type": "",
"connection_status": false,
"count_ipaddresses": 0,
"description": "",
"device": 0,
"enabled": false,
"id": 0,
"lag": 0,
"mac_address": "",
"mgmt_only": false,
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/interfaces/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
dcim_interfaces_delete
{{baseUrl}}/dcim/interfaces/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/interfaces/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/dcim/interfaces/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/interfaces/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/dcim/interfaces/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/interfaces/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/interfaces/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/dcim/interfaces/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/dcim/interfaces/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/interfaces/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/interfaces/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/dcim/interfaces/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/dcim/interfaces/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/interfaces/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/interfaces/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/interfaces/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/interfaces/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/interfaces/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/interfaces/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/dcim/interfaces/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/interfaces/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/interfaces/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/interfaces/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/interfaces/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/interfaces/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/dcim/interfaces/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/interfaces/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/interfaces/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/interfaces/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/interfaces/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/dcim/interfaces/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/interfaces/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/interfaces/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/interfaces/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/dcim/interfaces/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/interfaces/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/dcim/interfaces/:id/
http DELETE {{baseUrl}}/dcim/interfaces/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/dcim/interfaces/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/interfaces/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_interfaces_graphs
{{baseUrl}}/dcim/interfaces/:id/graphs/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/interfaces/:id/graphs/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/interfaces/:id/graphs/")
require "http/client"
url = "{{baseUrl}}/dcim/interfaces/:id/graphs/"
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}}/dcim/interfaces/:id/graphs/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/interfaces/:id/graphs/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/interfaces/:id/graphs/"
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/dcim/interfaces/:id/graphs/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/interfaces/:id/graphs/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/interfaces/:id/graphs/"))
.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}}/dcim/interfaces/:id/graphs/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/interfaces/:id/graphs/")
.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}}/dcim/interfaces/:id/graphs/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/interfaces/:id/graphs/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/interfaces/:id/graphs/';
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}}/dcim/interfaces/:id/graphs/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/interfaces/:id/graphs/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/interfaces/:id/graphs/',
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}}/dcim/interfaces/:id/graphs/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/interfaces/:id/graphs/');
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}}/dcim/interfaces/:id/graphs/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/interfaces/:id/graphs/';
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}}/dcim/interfaces/:id/graphs/"]
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}}/dcim/interfaces/:id/graphs/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/interfaces/:id/graphs/",
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}}/dcim/interfaces/:id/graphs/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/interfaces/:id/graphs/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/interfaces/:id/graphs/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/interfaces/:id/graphs/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/interfaces/:id/graphs/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/interfaces/:id/graphs/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/interfaces/:id/graphs/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/interfaces/:id/graphs/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/interfaces/:id/graphs/")
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/dcim/interfaces/:id/graphs/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/interfaces/:id/graphs/";
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}}/dcim/interfaces/:id/graphs/
http GET {{baseUrl}}/dcim/interfaces/:id/graphs/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/interfaces/:id/graphs/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/interfaces/:id/graphs/")! 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
dcim_interfaces_list
{{baseUrl}}/dcim/interfaces/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/interfaces/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/interfaces/")
require "http/client"
url = "{{baseUrl}}/dcim/interfaces/"
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}}/dcim/interfaces/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/interfaces/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/interfaces/"
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/dcim/interfaces/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/interfaces/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/interfaces/"))
.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}}/dcim/interfaces/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/interfaces/")
.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}}/dcim/interfaces/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/interfaces/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/interfaces/';
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}}/dcim/interfaces/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/interfaces/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/interfaces/',
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}}/dcim/interfaces/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/interfaces/');
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}}/dcim/interfaces/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/interfaces/';
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}}/dcim/interfaces/"]
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}}/dcim/interfaces/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/interfaces/",
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}}/dcim/interfaces/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/interfaces/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/interfaces/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/interfaces/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/interfaces/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/interfaces/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/interfaces/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/interfaces/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/interfaces/")
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/dcim/interfaces/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/interfaces/";
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}}/dcim/interfaces/
http GET {{baseUrl}}/dcim/interfaces/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/interfaces/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/interfaces/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
dcim_interfaces_partial_update
{{baseUrl}}/dcim/interfaces/:id/
BODY json
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"count_ipaddresses": 0,
"description": "",
"device": 0,
"enabled": false,
"id": 0,
"lag": 0,
"mac_address": "",
"mgmt_only": false,
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/interfaces/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/dcim/interfaces/:id/" {:content-type :json
:form-params {:cable {:id 0
:label ""
:url ""}
:connected_endpoint {}
:connected_endpoint_type ""
:connection_status false
:count_ipaddresses 0
:description ""
:device 0
:enabled false
:id 0
:lag 0
:mac_address ""
:mgmt_only false
:mode ""
:mtu 0
:name ""
:tagged_vlans []
:tags []
:type ""
:untagged_vlan 0}})
require "http/client"
url = "{{baseUrl}}/dcim/interfaces/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\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}}/dcim/interfaces/:id/"),
Content = new StringContent("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/interfaces/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/interfaces/:id/"
payload := strings.NewReader("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\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/dcim/interfaces/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 415
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"count_ipaddresses": 0,
"description": "",
"device": 0,
"enabled": false,
"id": 0,
"lag": 0,
"mac_address": "",
"mgmt_only": false,
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/dcim/interfaces/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/interfaces/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/interfaces/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/dcim/interfaces/:id/")
.header("content-type", "application/json")
.body("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\n}")
.asString();
const data = JSON.stringify({
cable: {
id: 0,
label: '',
url: ''
},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
count_ipaddresses: 0,
description: '',
device: 0,
enabled: false,
id: 0,
lag: 0,
mac_address: '',
mgmt_only: false,
mode: '',
mtu: 0,
name: '',
tagged_vlans: [],
tags: [],
type: '',
untagged_vlan: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/dcim/interfaces/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/interfaces/:id/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
count_ipaddresses: 0,
description: '',
device: 0,
enabled: false,
id: 0,
lag: 0,
mac_address: '',
mgmt_only: false,
mode: '',
mtu: 0,
name: '',
tagged_vlans: [],
tags: [],
type: '',
untagged_vlan: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/interfaces/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"connected_endpoint":{},"connected_endpoint_type":"","connection_status":false,"count_ipaddresses":0,"description":"","device":0,"enabled":false,"id":0,"lag":0,"mac_address":"","mgmt_only":false,"mode":"","mtu":0,"name":"","tagged_vlans":[],"tags":[],"type":"","untagged_vlan":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}}/dcim/interfaces/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "connected_endpoint": {},\n "connected_endpoint_type": "",\n "connection_status": false,\n "count_ipaddresses": 0,\n "description": "",\n "device": 0,\n "enabled": false,\n "id": 0,\n "lag": 0,\n "mac_address": "",\n "mgmt_only": false,\n "mode": "",\n "mtu": 0,\n "name": "",\n "tagged_vlans": [],\n "tags": [],\n "type": "",\n "untagged_vlan": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/interfaces/:id/")
.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/dcim/interfaces/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
count_ipaddresses: 0,
description: '',
device: 0,
enabled: false,
id: 0,
lag: 0,
mac_address: '',
mgmt_only: false,
mode: '',
mtu: 0,
name: '',
tagged_vlans: [],
tags: [],
type: '',
untagged_vlan: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/interfaces/:id/',
headers: {'content-type': 'application/json'},
body: {
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
count_ipaddresses: 0,
description: '',
device: 0,
enabled: false,
id: 0,
lag: 0,
mac_address: '',
mgmt_only: false,
mode: '',
mtu: 0,
name: '',
tagged_vlans: [],
tags: [],
type: '',
untagged_vlan: 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('PATCH', '{{baseUrl}}/dcim/interfaces/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cable: {
id: 0,
label: '',
url: ''
},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
count_ipaddresses: 0,
description: '',
device: 0,
enabled: false,
id: 0,
lag: 0,
mac_address: '',
mgmt_only: false,
mode: '',
mtu: 0,
name: '',
tagged_vlans: [],
tags: [],
type: '',
untagged_vlan: 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: 'PATCH',
url: '{{baseUrl}}/dcim/interfaces/:id/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
count_ipaddresses: 0,
description: '',
device: 0,
enabled: false,
id: 0,
lag: 0,
mac_address: '',
mgmt_only: false,
mode: '',
mtu: 0,
name: '',
tagged_vlans: [],
tags: [],
type: '',
untagged_vlan: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/interfaces/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"connected_endpoint":{},"connected_endpoint_type":"","connection_status":false,"count_ipaddresses":0,"description":"","device":0,"enabled":false,"id":0,"lag":0,"mac_address":"","mgmt_only":false,"mode":"","mtu":0,"name":"","tagged_vlans":[],"tags":[],"type":"","untagged_vlan":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 = @{ @"cable": @{ @"id": @0, @"label": @"", @"url": @"" },
@"connected_endpoint": @{ },
@"connected_endpoint_type": @"",
@"connection_status": @NO,
@"count_ipaddresses": @0,
@"description": @"",
@"device": @0,
@"enabled": @NO,
@"id": @0,
@"lag": @0,
@"mac_address": @"",
@"mgmt_only": @NO,
@"mode": @"",
@"mtu": @0,
@"name": @"",
@"tagged_vlans": @[ ],
@"tags": @[ ],
@"type": @"",
@"untagged_vlan": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/interfaces/:id/"]
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}}/dcim/interfaces/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/interfaces/:id/",
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([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'count_ipaddresses' => 0,
'description' => '',
'device' => 0,
'enabled' => null,
'id' => 0,
'lag' => 0,
'mac_address' => '',
'mgmt_only' => null,
'mode' => '',
'mtu' => 0,
'name' => '',
'tagged_vlans' => [
],
'tags' => [
],
'type' => '',
'untagged_vlan' => 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('PATCH', '{{baseUrl}}/dcim/interfaces/:id/', [
'body' => '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"count_ipaddresses": 0,
"description": "",
"device": 0,
"enabled": false,
"id": 0,
"lag": 0,
"mac_address": "",
"mgmt_only": false,
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/interfaces/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'count_ipaddresses' => 0,
'description' => '',
'device' => 0,
'enabled' => null,
'id' => 0,
'lag' => 0,
'mac_address' => '',
'mgmt_only' => null,
'mode' => '',
'mtu' => 0,
'name' => '',
'tagged_vlans' => [
],
'tags' => [
],
'type' => '',
'untagged_vlan' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'count_ipaddresses' => 0,
'description' => '',
'device' => 0,
'enabled' => null,
'id' => 0,
'lag' => 0,
'mac_address' => '',
'mgmt_only' => null,
'mode' => '',
'mtu' => 0,
'name' => '',
'tagged_vlans' => [
],
'tags' => [
],
'type' => '',
'untagged_vlan' => 0
]));
$request->setRequestUrl('{{baseUrl}}/dcim/interfaces/:id/');
$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}}/dcim/interfaces/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"count_ipaddresses": 0,
"description": "",
"device": 0,
"enabled": false,
"id": 0,
"lag": 0,
"mac_address": "",
"mgmt_only": false,
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/interfaces/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"count_ipaddresses": 0,
"description": "",
"device": 0,
"enabled": false,
"id": 0,
"lag": 0,
"mac_address": "",
"mgmt_only": false,
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/dcim/interfaces/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/interfaces/:id/"
payload = {
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": False,
"count_ipaddresses": 0,
"description": "",
"device": 0,
"enabled": False,
"id": 0,
"lag": 0,
"mac_address": "",
"mgmt_only": False,
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/interfaces/:id/"
payload <- "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\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}}/dcim/interfaces/:id/")
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 \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/dcim/interfaces/:id/') do |req|
req.body = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\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}}/dcim/interfaces/:id/";
let payload = json!({
"cable": json!({
"id": 0,
"label": "",
"url": ""
}),
"connected_endpoint": json!({}),
"connected_endpoint_type": "",
"connection_status": false,
"count_ipaddresses": 0,
"description": "",
"device": 0,
"enabled": false,
"id": 0,
"lag": 0,
"mac_address": "",
"mgmt_only": false,
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": (),
"tags": (),
"type": "",
"untagged_vlan": 0
});
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}}/dcim/interfaces/:id/ \
--header 'content-type: application/json' \
--data '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"count_ipaddresses": 0,
"description": "",
"device": 0,
"enabled": false,
"id": 0,
"lag": 0,
"mac_address": "",
"mgmt_only": false,
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0
}'
echo '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"count_ipaddresses": 0,
"description": "",
"device": 0,
"enabled": false,
"id": 0,
"lag": 0,
"mac_address": "",
"mgmt_only": false,
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0
}' | \
http PATCH {{baseUrl}}/dcim/interfaces/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "connected_endpoint": {},\n "connected_endpoint_type": "",\n "connection_status": false,\n "count_ipaddresses": 0,\n "description": "",\n "device": 0,\n "enabled": false,\n "id": 0,\n "lag": 0,\n "mac_address": "",\n "mgmt_only": false,\n "mode": "",\n "mtu": 0,\n "name": "",\n "tagged_vlans": [],\n "tags": [],\n "type": "",\n "untagged_vlan": 0\n}' \
--output-document \
- {{baseUrl}}/dcim/interfaces/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cable": [
"id": 0,
"label": "",
"url": ""
],
"connected_endpoint": [],
"connected_endpoint_type": "",
"connection_status": false,
"count_ipaddresses": 0,
"description": "",
"device": 0,
"enabled": false,
"id": 0,
"lag": 0,
"mac_address": "",
"mgmt_only": false,
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/interfaces/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_interfaces_read
{{baseUrl}}/dcim/interfaces/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/interfaces/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/interfaces/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/interfaces/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/dcim/interfaces/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/interfaces/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/interfaces/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/dcim/interfaces/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/interfaces/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/interfaces/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/interfaces/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/interfaces/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/dcim/interfaces/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/interfaces/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/interfaces/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/interfaces/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/interfaces/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/interfaces/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/dcim/interfaces/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/interfaces/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/dcim/interfaces/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/interfaces/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/interfaces/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/interfaces/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/interfaces/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/dcim/interfaces/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/interfaces/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/interfaces/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/interfaces/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/interfaces/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/interfaces/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/interfaces/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/interfaces/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/interfaces/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/dcim/interfaces/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/interfaces/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/dcim/interfaces/:id/
http GET {{baseUrl}}/dcim/interfaces/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/interfaces/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/interfaces/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_interfaces_trace
{{baseUrl}}/dcim/interfaces/:id/trace/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/interfaces/:id/trace/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/interfaces/:id/trace/")
require "http/client"
url = "{{baseUrl}}/dcim/interfaces/:id/trace/"
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}}/dcim/interfaces/:id/trace/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/interfaces/:id/trace/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/interfaces/:id/trace/"
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/dcim/interfaces/:id/trace/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/interfaces/:id/trace/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/interfaces/:id/trace/"))
.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}}/dcim/interfaces/:id/trace/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/interfaces/:id/trace/")
.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}}/dcim/interfaces/:id/trace/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/interfaces/:id/trace/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/interfaces/:id/trace/';
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}}/dcim/interfaces/:id/trace/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/interfaces/:id/trace/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/interfaces/:id/trace/',
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}}/dcim/interfaces/:id/trace/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/interfaces/:id/trace/');
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}}/dcim/interfaces/:id/trace/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/interfaces/:id/trace/';
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}}/dcim/interfaces/:id/trace/"]
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}}/dcim/interfaces/:id/trace/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/interfaces/:id/trace/",
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}}/dcim/interfaces/:id/trace/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/interfaces/:id/trace/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/interfaces/:id/trace/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/interfaces/:id/trace/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/interfaces/:id/trace/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/interfaces/:id/trace/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/interfaces/:id/trace/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/interfaces/:id/trace/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/interfaces/:id/trace/")
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/dcim/interfaces/:id/trace/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/interfaces/:id/trace/";
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}}/dcim/interfaces/:id/trace/
http GET {{baseUrl}}/dcim/interfaces/:id/trace/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/interfaces/:id/trace/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/interfaces/:id/trace/")! 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()
PUT
dcim_interfaces_update
{{baseUrl}}/dcim/interfaces/:id/
BODY json
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"count_ipaddresses": 0,
"description": "",
"device": 0,
"enabled": false,
"id": 0,
"lag": 0,
"mac_address": "",
"mgmt_only": false,
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/interfaces/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/dcim/interfaces/:id/" {:content-type :json
:form-params {:cable {:id 0
:label ""
:url ""}
:connected_endpoint {}
:connected_endpoint_type ""
:connection_status false
:count_ipaddresses 0
:description ""
:device 0
:enabled false
:id 0
:lag 0
:mac_address ""
:mgmt_only false
:mode ""
:mtu 0
:name ""
:tagged_vlans []
:tags []
:type ""
:untagged_vlan 0}})
require "http/client"
url = "{{baseUrl}}/dcim/interfaces/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\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}}/dcim/interfaces/:id/"),
Content = new StringContent("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/interfaces/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/interfaces/:id/"
payload := strings.NewReader("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\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/dcim/interfaces/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 415
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"count_ipaddresses": 0,
"description": "",
"device": 0,
"enabled": false,
"id": 0,
"lag": 0,
"mac_address": "",
"mgmt_only": false,
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/dcim/interfaces/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/interfaces/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/interfaces/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/dcim/interfaces/:id/")
.header("content-type", "application/json")
.body("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\n}")
.asString();
const data = JSON.stringify({
cable: {
id: 0,
label: '',
url: ''
},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
count_ipaddresses: 0,
description: '',
device: 0,
enabled: false,
id: 0,
lag: 0,
mac_address: '',
mgmt_only: false,
mode: '',
mtu: 0,
name: '',
tagged_vlans: [],
tags: [],
type: '',
untagged_vlan: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/dcim/interfaces/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/interfaces/:id/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
count_ipaddresses: 0,
description: '',
device: 0,
enabled: false,
id: 0,
lag: 0,
mac_address: '',
mgmt_only: false,
mode: '',
mtu: 0,
name: '',
tagged_vlans: [],
tags: [],
type: '',
untagged_vlan: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/interfaces/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"connected_endpoint":{},"connected_endpoint_type":"","connection_status":false,"count_ipaddresses":0,"description":"","device":0,"enabled":false,"id":0,"lag":0,"mac_address":"","mgmt_only":false,"mode":"","mtu":0,"name":"","tagged_vlans":[],"tags":[],"type":"","untagged_vlan":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}}/dcim/interfaces/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "connected_endpoint": {},\n "connected_endpoint_type": "",\n "connection_status": false,\n "count_ipaddresses": 0,\n "description": "",\n "device": 0,\n "enabled": false,\n "id": 0,\n "lag": 0,\n "mac_address": "",\n "mgmt_only": false,\n "mode": "",\n "mtu": 0,\n "name": "",\n "tagged_vlans": [],\n "tags": [],\n "type": "",\n "untagged_vlan": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/interfaces/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/interfaces/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
count_ipaddresses: 0,
description: '',
device: 0,
enabled: false,
id: 0,
lag: 0,
mac_address: '',
mgmt_only: false,
mode: '',
mtu: 0,
name: '',
tagged_vlans: [],
tags: [],
type: '',
untagged_vlan: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/interfaces/:id/',
headers: {'content-type': 'application/json'},
body: {
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
count_ipaddresses: 0,
description: '',
device: 0,
enabled: false,
id: 0,
lag: 0,
mac_address: '',
mgmt_only: false,
mode: '',
mtu: 0,
name: '',
tagged_vlans: [],
tags: [],
type: '',
untagged_vlan: 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('PUT', '{{baseUrl}}/dcim/interfaces/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cable: {
id: 0,
label: '',
url: ''
},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
count_ipaddresses: 0,
description: '',
device: 0,
enabled: false,
id: 0,
lag: 0,
mac_address: '',
mgmt_only: false,
mode: '',
mtu: 0,
name: '',
tagged_vlans: [],
tags: [],
type: '',
untagged_vlan: 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: 'PUT',
url: '{{baseUrl}}/dcim/interfaces/:id/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
count_ipaddresses: 0,
description: '',
device: 0,
enabled: false,
id: 0,
lag: 0,
mac_address: '',
mgmt_only: false,
mode: '',
mtu: 0,
name: '',
tagged_vlans: [],
tags: [],
type: '',
untagged_vlan: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/interfaces/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"connected_endpoint":{},"connected_endpoint_type":"","connection_status":false,"count_ipaddresses":0,"description":"","device":0,"enabled":false,"id":0,"lag":0,"mac_address":"","mgmt_only":false,"mode":"","mtu":0,"name":"","tagged_vlans":[],"tags":[],"type":"","untagged_vlan":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 = @{ @"cable": @{ @"id": @0, @"label": @"", @"url": @"" },
@"connected_endpoint": @{ },
@"connected_endpoint_type": @"",
@"connection_status": @NO,
@"count_ipaddresses": @0,
@"description": @"",
@"device": @0,
@"enabled": @NO,
@"id": @0,
@"lag": @0,
@"mac_address": @"",
@"mgmt_only": @NO,
@"mode": @"",
@"mtu": @0,
@"name": @"",
@"tagged_vlans": @[ ],
@"tags": @[ ],
@"type": @"",
@"untagged_vlan": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/interfaces/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/interfaces/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/interfaces/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'count_ipaddresses' => 0,
'description' => '',
'device' => 0,
'enabled' => null,
'id' => 0,
'lag' => 0,
'mac_address' => '',
'mgmt_only' => null,
'mode' => '',
'mtu' => 0,
'name' => '',
'tagged_vlans' => [
],
'tags' => [
],
'type' => '',
'untagged_vlan' => 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('PUT', '{{baseUrl}}/dcim/interfaces/:id/', [
'body' => '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"count_ipaddresses": 0,
"description": "",
"device": 0,
"enabled": false,
"id": 0,
"lag": 0,
"mac_address": "",
"mgmt_only": false,
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/interfaces/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'count_ipaddresses' => 0,
'description' => '',
'device' => 0,
'enabled' => null,
'id' => 0,
'lag' => 0,
'mac_address' => '',
'mgmt_only' => null,
'mode' => '',
'mtu' => 0,
'name' => '',
'tagged_vlans' => [
],
'tags' => [
],
'type' => '',
'untagged_vlan' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'count_ipaddresses' => 0,
'description' => '',
'device' => 0,
'enabled' => null,
'id' => 0,
'lag' => 0,
'mac_address' => '',
'mgmt_only' => null,
'mode' => '',
'mtu' => 0,
'name' => '',
'tagged_vlans' => [
],
'tags' => [
],
'type' => '',
'untagged_vlan' => 0
]));
$request->setRequestUrl('{{baseUrl}}/dcim/interfaces/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/interfaces/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"count_ipaddresses": 0,
"description": "",
"device": 0,
"enabled": false,
"id": 0,
"lag": 0,
"mac_address": "",
"mgmt_only": false,
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/interfaces/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"count_ipaddresses": 0,
"description": "",
"device": 0,
"enabled": false,
"id": 0,
"lag": 0,
"mac_address": "",
"mgmt_only": false,
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/dcim/interfaces/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/interfaces/:id/"
payload = {
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": False,
"count_ipaddresses": 0,
"description": "",
"device": 0,
"enabled": False,
"id": 0,
"lag": 0,
"mac_address": "",
"mgmt_only": False,
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/interfaces/:id/"
payload <- "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\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}}/dcim/interfaces/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/dcim/interfaces/:id/') do |req|
req.body = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"count_ipaddresses\": 0,\n \"description\": \"\",\n \"device\": 0,\n \"enabled\": false,\n \"id\": 0,\n \"lag\": 0,\n \"mac_address\": \"\",\n \"mgmt_only\": false,\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0\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}}/dcim/interfaces/:id/";
let payload = json!({
"cable": json!({
"id": 0,
"label": "",
"url": ""
}),
"connected_endpoint": json!({}),
"connected_endpoint_type": "",
"connection_status": false,
"count_ipaddresses": 0,
"description": "",
"device": 0,
"enabled": false,
"id": 0,
"lag": 0,
"mac_address": "",
"mgmt_only": false,
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": (),
"tags": (),
"type": "",
"untagged_vlan": 0
});
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}}/dcim/interfaces/:id/ \
--header 'content-type: application/json' \
--data '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"count_ipaddresses": 0,
"description": "",
"device": 0,
"enabled": false,
"id": 0,
"lag": 0,
"mac_address": "",
"mgmt_only": false,
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0
}'
echo '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"count_ipaddresses": 0,
"description": "",
"device": 0,
"enabled": false,
"id": 0,
"lag": 0,
"mac_address": "",
"mgmt_only": false,
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0
}' | \
http PUT {{baseUrl}}/dcim/interfaces/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "connected_endpoint": {},\n "connected_endpoint_type": "",\n "connection_status": false,\n "count_ipaddresses": 0,\n "description": "",\n "device": 0,\n "enabled": false,\n "id": 0,\n "lag": 0,\n "mac_address": "",\n "mgmt_only": false,\n "mode": "",\n "mtu": 0,\n "name": "",\n "tagged_vlans": [],\n "tags": [],\n "type": "",\n "untagged_vlan": 0\n}' \
--output-document \
- {{baseUrl}}/dcim/interfaces/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cable": [
"id": 0,
"label": "",
"url": ""
],
"connected_endpoint": [],
"connected_endpoint_type": "",
"connection_status": false,
"count_ipaddresses": 0,
"description": "",
"device": 0,
"enabled": false,
"id": 0,
"lag": 0,
"mac_address": "",
"mgmt_only": false,
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/interfaces/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
dcim_inventory-items_create
{{baseUrl}}/dcim/inventory-items/
BODY json
{
"asset_tag": "",
"description": "",
"device": 0,
"discovered": false,
"id": 0,
"manufacturer": 0,
"name": "",
"parent": 0,
"part_id": "",
"serial": "",
"tags": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/inventory-items/");
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 \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/dcim/inventory-items/" {:content-type :json
:form-params {:asset_tag ""
:description ""
:device 0
:discovered false
:id 0
:manufacturer 0
:name ""
:parent 0
:part_id ""
:serial ""
:tags []}})
require "http/client"
url = "{{baseUrl}}/dcim/inventory-items/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\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}}/dcim/inventory-items/"),
Content = new StringContent("{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\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}}/dcim/inventory-items/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/inventory-items/"
payload := strings.NewReader("{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\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/dcim/inventory-items/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 188
{
"asset_tag": "",
"description": "",
"device": 0,
"discovered": false,
"id": 0,
"manufacturer": 0,
"name": "",
"parent": 0,
"part_id": "",
"serial": "",
"tags": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/dcim/inventory-items/")
.setHeader("content-type", "application/json")
.setBody("{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/inventory-items/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\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 \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/inventory-items/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/dcim/inventory-items/")
.header("content-type", "application/json")
.body("{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\n}")
.asString();
const data = JSON.stringify({
asset_tag: '',
description: '',
device: 0,
discovered: false,
id: 0,
manufacturer: 0,
name: '',
parent: 0,
part_id: '',
serial: '',
tags: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/dcim/inventory-items/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/inventory-items/',
headers: {'content-type': 'application/json'},
data: {
asset_tag: '',
description: '',
device: 0,
discovered: false,
id: 0,
manufacturer: 0,
name: '',
parent: 0,
part_id: '',
serial: '',
tags: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/inventory-items/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"asset_tag":"","description":"","device":0,"discovered":false,"id":0,"manufacturer":0,"name":"","parent":0,"part_id":"","serial":"","tags":[]}'
};
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}}/dcim/inventory-items/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "asset_tag": "",\n "description": "",\n "device": 0,\n "discovered": false,\n "id": 0,\n "manufacturer": 0,\n "name": "",\n "parent": 0,\n "part_id": "",\n "serial": "",\n "tags": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/inventory-items/")
.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/dcim/inventory-items/',
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({
asset_tag: '',
description: '',
device: 0,
discovered: false,
id: 0,
manufacturer: 0,
name: '',
parent: 0,
part_id: '',
serial: '',
tags: []
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/inventory-items/',
headers: {'content-type': 'application/json'},
body: {
asset_tag: '',
description: '',
device: 0,
discovered: false,
id: 0,
manufacturer: 0,
name: '',
parent: 0,
part_id: '',
serial: '',
tags: []
},
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}}/dcim/inventory-items/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
asset_tag: '',
description: '',
device: 0,
discovered: false,
id: 0,
manufacturer: 0,
name: '',
parent: 0,
part_id: '',
serial: '',
tags: []
});
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}}/dcim/inventory-items/',
headers: {'content-type': 'application/json'},
data: {
asset_tag: '',
description: '',
device: 0,
discovered: false,
id: 0,
manufacturer: 0,
name: '',
parent: 0,
part_id: '',
serial: '',
tags: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/inventory-items/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"asset_tag":"","description":"","device":0,"discovered":false,"id":0,"manufacturer":0,"name":"","parent":0,"part_id":"","serial":"","tags":[]}'
};
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 = @{ @"asset_tag": @"",
@"description": @"",
@"device": @0,
@"discovered": @NO,
@"id": @0,
@"manufacturer": @0,
@"name": @"",
@"parent": @0,
@"part_id": @"",
@"serial": @"",
@"tags": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/inventory-items/"]
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}}/dcim/inventory-items/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/inventory-items/",
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([
'asset_tag' => '',
'description' => '',
'device' => 0,
'discovered' => null,
'id' => 0,
'manufacturer' => 0,
'name' => '',
'parent' => 0,
'part_id' => '',
'serial' => '',
'tags' => [
]
]),
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}}/dcim/inventory-items/', [
'body' => '{
"asset_tag": "",
"description": "",
"device": 0,
"discovered": false,
"id": 0,
"manufacturer": 0,
"name": "",
"parent": 0,
"part_id": "",
"serial": "",
"tags": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/inventory-items/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'asset_tag' => '',
'description' => '',
'device' => 0,
'discovered' => null,
'id' => 0,
'manufacturer' => 0,
'name' => '',
'parent' => 0,
'part_id' => '',
'serial' => '',
'tags' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'asset_tag' => '',
'description' => '',
'device' => 0,
'discovered' => null,
'id' => 0,
'manufacturer' => 0,
'name' => '',
'parent' => 0,
'part_id' => '',
'serial' => '',
'tags' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/dcim/inventory-items/');
$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}}/dcim/inventory-items/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"asset_tag": "",
"description": "",
"device": 0,
"discovered": false,
"id": 0,
"manufacturer": 0,
"name": "",
"parent": 0,
"part_id": "",
"serial": "",
"tags": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/inventory-items/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"asset_tag": "",
"description": "",
"device": 0,
"discovered": false,
"id": 0,
"manufacturer": 0,
"name": "",
"parent": 0,
"part_id": "",
"serial": "",
"tags": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/dcim/inventory-items/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/inventory-items/"
payload = {
"asset_tag": "",
"description": "",
"device": 0,
"discovered": False,
"id": 0,
"manufacturer": 0,
"name": "",
"parent": 0,
"part_id": "",
"serial": "",
"tags": []
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/inventory-items/"
payload <- "{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\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}}/dcim/inventory-items/")
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 \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\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/dcim/inventory-items/') do |req|
req.body = "{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/inventory-items/";
let payload = json!({
"asset_tag": "",
"description": "",
"device": 0,
"discovered": false,
"id": 0,
"manufacturer": 0,
"name": "",
"parent": 0,
"part_id": "",
"serial": "",
"tags": ()
});
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}}/dcim/inventory-items/ \
--header 'content-type: application/json' \
--data '{
"asset_tag": "",
"description": "",
"device": 0,
"discovered": false,
"id": 0,
"manufacturer": 0,
"name": "",
"parent": 0,
"part_id": "",
"serial": "",
"tags": []
}'
echo '{
"asset_tag": "",
"description": "",
"device": 0,
"discovered": false,
"id": 0,
"manufacturer": 0,
"name": "",
"parent": 0,
"part_id": "",
"serial": "",
"tags": []
}' | \
http POST {{baseUrl}}/dcim/inventory-items/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "asset_tag": "",\n "description": "",\n "device": 0,\n "discovered": false,\n "id": 0,\n "manufacturer": 0,\n "name": "",\n "parent": 0,\n "part_id": "",\n "serial": "",\n "tags": []\n}' \
--output-document \
- {{baseUrl}}/dcim/inventory-items/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"asset_tag": "",
"description": "",
"device": 0,
"discovered": false,
"id": 0,
"manufacturer": 0,
"name": "",
"parent": 0,
"part_id": "",
"serial": "",
"tags": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/inventory-items/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
dcim_inventory-items_delete
{{baseUrl}}/dcim/inventory-items/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/inventory-items/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/dcim/inventory-items/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/inventory-items/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/dcim/inventory-items/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/inventory-items/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/inventory-items/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/dcim/inventory-items/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/dcim/inventory-items/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/inventory-items/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/inventory-items/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/dcim/inventory-items/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/dcim/inventory-items/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/inventory-items/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/inventory-items/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/inventory-items/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/inventory-items/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/inventory-items/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/inventory-items/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/dcim/inventory-items/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/inventory-items/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/inventory-items/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/inventory-items/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/inventory-items/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/inventory-items/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/dcim/inventory-items/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/inventory-items/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/inventory-items/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/inventory-items/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/inventory-items/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/dcim/inventory-items/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/inventory-items/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/inventory-items/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/inventory-items/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/dcim/inventory-items/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/inventory-items/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/dcim/inventory-items/:id/
http DELETE {{baseUrl}}/dcim/inventory-items/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/dcim/inventory-items/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/inventory-items/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_inventory-items_list
{{baseUrl}}/dcim/inventory-items/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/inventory-items/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/inventory-items/")
require "http/client"
url = "{{baseUrl}}/dcim/inventory-items/"
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}}/dcim/inventory-items/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/inventory-items/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/inventory-items/"
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/dcim/inventory-items/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/inventory-items/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/inventory-items/"))
.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}}/dcim/inventory-items/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/inventory-items/")
.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}}/dcim/inventory-items/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/inventory-items/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/inventory-items/';
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}}/dcim/inventory-items/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/inventory-items/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/inventory-items/',
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}}/dcim/inventory-items/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/inventory-items/');
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}}/dcim/inventory-items/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/inventory-items/';
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}}/dcim/inventory-items/"]
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}}/dcim/inventory-items/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/inventory-items/",
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}}/dcim/inventory-items/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/inventory-items/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/inventory-items/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/inventory-items/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/inventory-items/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/inventory-items/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/inventory-items/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/inventory-items/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/inventory-items/")
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/dcim/inventory-items/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/inventory-items/";
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}}/dcim/inventory-items/
http GET {{baseUrl}}/dcim/inventory-items/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/inventory-items/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/inventory-items/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
dcim_inventory-items_partial_update
{{baseUrl}}/dcim/inventory-items/:id/
BODY json
{
"asset_tag": "",
"description": "",
"device": 0,
"discovered": false,
"id": 0,
"manufacturer": 0,
"name": "",
"parent": 0,
"part_id": "",
"serial": "",
"tags": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/inventory-items/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/dcim/inventory-items/:id/" {:content-type :json
:form-params {:asset_tag ""
:description ""
:device 0
:discovered false
:id 0
:manufacturer 0
:name ""
:parent 0
:part_id ""
:serial ""
:tags []}})
require "http/client"
url = "{{baseUrl}}/dcim/inventory-items/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\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}}/dcim/inventory-items/:id/"),
Content = new StringContent("{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\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}}/dcim/inventory-items/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/inventory-items/:id/"
payload := strings.NewReader("{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\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/dcim/inventory-items/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 188
{
"asset_tag": "",
"description": "",
"device": 0,
"discovered": false,
"id": 0,
"manufacturer": 0,
"name": "",
"parent": 0,
"part_id": "",
"serial": "",
"tags": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/dcim/inventory-items/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/inventory-items/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\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 \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/inventory-items/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/dcim/inventory-items/:id/")
.header("content-type", "application/json")
.body("{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\n}")
.asString();
const data = JSON.stringify({
asset_tag: '',
description: '',
device: 0,
discovered: false,
id: 0,
manufacturer: 0,
name: '',
parent: 0,
part_id: '',
serial: '',
tags: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/dcim/inventory-items/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/inventory-items/:id/',
headers: {'content-type': 'application/json'},
data: {
asset_tag: '',
description: '',
device: 0,
discovered: false,
id: 0,
manufacturer: 0,
name: '',
parent: 0,
part_id: '',
serial: '',
tags: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/inventory-items/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"asset_tag":"","description":"","device":0,"discovered":false,"id":0,"manufacturer":0,"name":"","parent":0,"part_id":"","serial":"","tags":[]}'
};
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}}/dcim/inventory-items/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "asset_tag": "",\n "description": "",\n "device": 0,\n "discovered": false,\n "id": 0,\n "manufacturer": 0,\n "name": "",\n "parent": 0,\n "part_id": "",\n "serial": "",\n "tags": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/inventory-items/:id/")
.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/dcim/inventory-items/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
asset_tag: '',
description: '',
device: 0,
discovered: false,
id: 0,
manufacturer: 0,
name: '',
parent: 0,
part_id: '',
serial: '',
tags: []
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/inventory-items/:id/',
headers: {'content-type': 'application/json'},
body: {
asset_tag: '',
description: '',
device: 0,
discovered: false,
id: 0,
manufacturer: 0,
name: '',
parent: 0,
part_id: '',
serial: '',
tags: []
},
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}}/dcim/inventory-items/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
asset_tag: '',
description: '',
device: 0,
discovered: false,
id: 0,
manufacturer: 0,
name: '',
parent: 0,
part_id: '',
serial: '',
tags: []
});
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}}/dcim/inventory-items/:id/',
headers: {'content-type': 'application/json'},
data: {
asset_tag: '',
description: '',
device: 0,
discovered: false,
id: 0,
manufacturer: 0,
name: '',
parent: 0,
part_id: '',
serial: '',
tags: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/inventory-items/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"asset_tag":"","description":"","device":0,"discovered":false,"id":0,"manufacturer":0,"name":"","parent":0,"part_id":"","serial":"","tags":[]}'
};
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 = @{ @"asset_tag": @"",
@"description": @"",
@"device": @0,
@"discovered": @NO,
@"id": @0,
@"manufacturer": @0,
@"name": @"",
@"parent": @0,
@"part_id": @"",
@"serial": @"",
@"tags": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/inventory-items/:id/"]
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}}/dcim/inventory-items/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/inventory-items/:id/",
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([
'asset_tag' => '',
'description' => '',
'device' => 0,
'discovered' => null,
'id' => 0,
'manufacturer' => 0,
'name' => '',
'parent' => 0,
'part_id' => '',
'serial' => '',
'tags' => [
]
]),
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}}/dcim/inventory-items/:id/', [
'body' => '{
"asset_tag": "",
"description": "",
"device": 0,
"discovered": false,
"id": 0,
"manufacturer": 0,
"name": "",
"parent": 0,
"part_id": "",
"serial": "",
"tags": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/inventory-items/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'asset_tag' => '',
'description' => '',
'device' => 0,
'discovered' => null,
'id' => 0,
'manufacturer' => 0,
'name' => '',
'parent' => 0,
'part_id' => '',
'serial' => '',
'tags' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'asset_tag' => '',
'description' => '',
'device' => 0,
'discovered' => null,
'id' => 0,
'manufacturer' => 0,
'name' => '',
'parent' => 0,
'part_id' => '',
'serial' => '',
'tags' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/dcim/inventory-items/:id/');
$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}}/dcim/inventory-items/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"asset_tag": "",
"description": "",
"device": 0,
"discovered": false,
"id": 0,
"manufacturer": 0,
"name": "",
"parent": 0,
"part_id": "",
"serial": "",
"tags": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/inventory-items/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"asset_tag": "",
"description": "",
"device": 0,
"discovered": false,
"id": 0,
"manufacturer": 0,
"name": "",
"parent": 0,
"part_id": "",
"serial": "",
"tags": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/dcim/inventory-items/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/inventory-items/:id/"
payload = {
"asset_tag": "",
"description": "",
"device": 0,
"discovered": False,
"id": 0,
"manufacturer": 0,
"name": "",
"parent": 0,
"part_id": "",
"serial": "",
"tags": []
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/inventory-items/:id/"
payload <- "{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\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}}/dcim/inventory-items/:id/")
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 \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\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/dcim/inventory-items/:id/') do |req|
req.body = "{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\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}}/dcim/inventory-items/:id/";
let payload = json!({
"asset_tag": "",
"description": "",
"device": 0,
"discovered": false,
"id": 0,
"manufacturer": 0,
"name": "",
"parent": 0,
"part_id": "",
"serial": "",
"tags": ()
});
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}}/dcim/inventory-items/:id/ \
--header 'content-type: application/json' \
--data '{
"asset_tag": "",
"description": "",
"device": 0,
"discovered": false,
"id": 0,
"manufacturer": 0,
"name": "",
"parent": 0,
"part_id": "",
"serial": "",
"tags": []
}'
echo '{
"asset_tag": "",
"description": "",
"device": 0,
"discovered": false,
"id": 0,
"manufacturer": 0,
"name": "",
"parent": 0,
"part_id": "",
"serial": "",
"tags": []
}' | \
http PATCH {{baseUrl}}/dcim/inventory-items/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "asset_tag": "",\n "description": "",\n "device": 0,\n "discovered": false,\n "id": 0,\n "manufacturer": 0,\n "name": "",\n "parent": 0,\n "part_id": "",\n "serial": "",\n "tags": []\n}' \
--output-document \
- {{baseUrl}}/dcim/inventory-items/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"asset_tag": "",
"description": "",
"device": 0,
"discovered": false,
"id": 0,
"manufacturer": 0,
"name": "",
"parent": 0,
"part_id": "",
"serial": "",
"tags": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/inventory-items/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_inventory-items_read
{{baseUrl}}/dcim/inventory-items/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/inventory-items/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/inventory-items/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/inventory-items/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/dcim/inventory-items/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/inventory-items/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/inventory-items/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/dcim/inventory-items/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/inventory-items/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/inventory-items/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/inventory-items/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/inventory-items/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/dcim/inventory-items/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/inventory-items/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/inventory-items/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/inventory-items/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/inventory-items/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/inventory-items/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/dcim/inventory-items/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/inventory-items/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/dcim/inventory-items/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/inventory-items/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/inventory-items/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/inventory-items/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/inventory-items/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/dcim/inventory-items/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/inventory-items/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/inventory-items/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/inventory-items/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/inventory-items/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/inventory-items/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/inventory-items/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/inventory-items/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/inventory-items/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/dcim/inventory-items/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/inventory-items/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/dcim/inventory-items/:id/
http GET {{baseUrl}}/dcim/inventory-items/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/inventory-items/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/inventory-items/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
dcim_inventory-items_update
{{baseUrl}}/dcim/inventory-items/:id/
BODY json
{
"asset_tag": "",
"description": "",
"device": 0,
"discovered": false,
"id": 0,
"manufacturer": 0,
"name": "",
"parent": 0,
"part_id": "",
"serial": "",
"tags": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/inventory-items/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/dcim/inventory-items/:id/" {:content-type :json
:form-params {:asset_tag ""
:description ""
:device 0
:discovered false
:id 0
:manufacturer 0
:name ""
:parent 0
:part_id ""
:serial ""
:tags []}})
require "http/client"
url = "{{baseUrl}}/dcim/inventory-items/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\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}}/dcim/inventory-items/:id/"),
Content = new StringContent("{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\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}}/dcim/inventory-items/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/inventory-items/:id/"
payload := strings.NewReader("{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\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/dcim/inventory-items/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 188
{
"asset_tag": "",
"description": "",
"device": 0,
"discovered": false,
"id": 0,
"manufacturer": 0,
"name": "",
"parent": 0,
"part_id": "",
"serial": "",
"tags": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/dcim/inventory-items/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/inventory-items/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\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 \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/inventory-items/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/dcim/inventory-items/:id/")
.header("content-type", "application/json")
.body("{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\n}")
.asString();
const data = JSON.stringify({
asset_tag: '',
description: '',
device: 0,
discovered: false,
id: 0,
manufacturer: 0,
name: '',
parent: 0,
part_id: '',
serial: '',
tags: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/dcim/inventory-items/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/inventory-items/:id/',
headers: {'content-type': 'application/json'},
data: {
asset_tag: '',
description: '',
device: 0,
discovered: false,
id: 0,
manufacturer: 0,
name: '',
parent: 0,
part_id: '',
serial: '',
tags: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/inventory-items/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"asset_tag":"","description":"","device":0,"discovered":false,"id":0,"manufacturer":0,"name":"","parent":0,"part_id":"","serial":"","tags":[]}'
};
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}}/dcim/inventory-items/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "asset_tag": "",\n "description": "",\n "device": 0,\n "discovered": false,\n "id": 0,\n "manufacturer": 0,\n "name": "",\n "parent": 0,\n "part_id": "",\n "serial": "",\n "tags": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/inventory-items/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/inventory-items/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
asset_tag: '',
description: '',
device: 0,
discovered: false,
id: 0,
manufacturer: 0,
name: '',
parent: 0,
part_id: '',
serial: '',
tags: []
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/inventory-items/:id/',
headers: {'content-type': 'application/json'},
body: {
asset_tag: '',
description: '',
device: 0,
discovered: false,
id: 0,
manufacturer: 0,
name: '',
parent: 0,
part_id: '',
serial: '',
tags: []
},
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}}/dcim/inventory-items/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
asset_tag: '',
description: '',
device: 0,
discovered: false,
id: 0,
manufacturer: 0,
name: '',
parent: 0,
part_id: '',
serial: '',
tags: []
});
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}}/dcim/inventory-items/:id/',
headers: {'content-type': 'application/json'},
data: {
asset_tag: '',
description: '',
device: 0,
discovered: false,
id: 0,
manufacturer: 0,
name: '',
parent: 0,
part_id: '',
serial: '',
tags: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/inventory-items/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"asset_tag":"","description":"","device":0,"discovered":false,"id":0,"manufacturer":0,"name":"","parent":0,"part_id":"","serial":"","tags":[]}'
};
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 = @{ @"asset_tag": @"",
@"description": @"",
@"device": @0,
@"discovered": @NO,
@"id": @0,
@"manufacturer": @0,
@"name": @"",
@"parent": @0,
@"part_id": @"",
@"serial": @"",
@"tags": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/inventory-items/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/inventory-items/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/inventory-items/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'asset_tag' => '',
'description' => '',
'device' => 0,
'discovered' => null,
'id' => 0,
'manufacturer' => 0,
'name' => '',
'parent' => 0,
'part_id' => '',
'serial' => '',
'tags' => [
]
]),
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}}/dcim/inventory-items/:id/', [
'body' => '{
"asset_tag": "",
"description": "",
"device": 0,
"discovered": false,
"id": 0,
"manufacturer": 0,
"name": "",
"parent": 0,
"part_id": "",
"serial": "",
"tags": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/inventory-items/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'asset_tag' => '',
'description' => '',
'device' => 0,
'discovered' => null,
'id' => 0,
'manufacturer' => 0,
'name' => '',
'parent' => 0,
'part_id' => '',
'serial' => '',
'tags' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'asset_tag' => '',
'description' => '',
'device' => 0,
'discovered' => null,
'id' => 0,
'manufacturer' => 0,
'name' => '',
'parent' => 0,
'part_id' => '',
'serial' => '',
'tags' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/dcim/inventory-items/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/inventory-items/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"asset_tag": "",
"description": "",
"device": 0,
"discovered": false,
"id": 0,
"manufacturer": 0,
"name": "",
"parent": 0,
"part_id": "",
"serial": "",
"tags": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/inventory-items/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"asset_tag": "",
"description": "",
"device": 0,
"discovered": false,
"id": 0,
"manufacturer": 0,
"name": "",
"parent": 0,
"part_id": "",
"serial": "",
"tags": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/dcim/inventory-items/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/inventory-items/:id/"
payload = {
"asset_tag": "",
"description": "",
"device": 0,
"discovered": False,
"id": 0,
"manufacturer": 0,
"name": "",
"parent": 0,
"part_id": "",
"serial": "",
"tags": []
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/inventory-items/:id/"
payload <- "{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\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}}/dcim/inventory-items/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\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/dcim/inventory-items/:id/') do |req|
req.body = "{\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"device\": 0,\n \"discovered\": false,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"part_id\": \"\",\n \"serial\": \"\",\n \"tags\": []\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}}/dcim/inventory-items/:id/";
let payload = json!({
"asset_tag": "",
"description": "",
"device": 0,
"discovered": false,
"id": 0,
"manufacturer": 0,
"name": "",
"parent": 0,
"part_id": "",
"serial": "",
"tags": ()
});
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}}/dcim/inventory-items/:id/ \
--header 'content-type: application/json' \
--data '{
"asset_tag": "",
"description": "",
"device": 0,
"discovered": false,
"id": 0,
"manufacturer": 0,
"name": "",
"parent": 0,
"part_id": "",
"serial": "",
"tags": []
}'
echo '{
"asset_tag": "",
"description": "",
"device": 0,
"discovered": false,
"id": 0,
"manufacturer": 0,
"name": "",
"parent": 0,
"part_id": "",
"serial": "",
"tags": []
}' | \
http PUT {{baseUrl}}/dcim/inventory-items/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "asset_tag": "",\n "description": "",\n "device": 0,\n "discovered": false,\n "id": 0,\n "manufacturer": 0,\n "name": "",\n "parent": 0,\n "part_id": "",\n "serial": "",\n "tags": []\n}' \
--output-document \
- {{baseUrl}}/dcim/inventory-items/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"asset_tag": "",
"description": "",
"device": 0,
"discovered": false,
"id": 0,
"manufacturer": 0,
"name": "",
"parent": 0,
"part_id": "",
"serial": "",
"tags": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/inventory-items/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
dcim_manufacturers_create
{{baseUrl}}/dcim/manufacturers/
BODY json
{
"description": "",
"devicetype_count": 0,
"id": 0,
"inventoryitem_count": 0,
"name": "",
"platform_count": 0,
"slug": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/manufacturers/");
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 \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/dcim/manufacturers/" {:content-type :json
:form-params {:description ""
:devicetype_count 0
:id 0
:inventoryitem_count 0
:name ""
:platform_count 0
:slug ""}})
require "http/client"
url = "{{baseUrl}}/dcim/manufacturers/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\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}}/dcim/manufacturers/"),
Content = new StringContent("{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\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}}/dcim/manufacturers/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/manufacturers/"
payload := strings.NewReader("{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\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/dcim/manufacturers/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 138
{
"description": "",
"devicetype_count": 0,
"id": 0,
"inventoryitem_count": 0,
"name": "",
"platform_count": 0,
"slug": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/dcim/manufacturers/")
.setHeader("content-type", "application/json")
.setBody("{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/manufacturers/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\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 \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/manufacturers/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/dcim/manufacturers/")
.header("content-type", "application/json")
.body("{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\n}")
.asString();
const data = JSON.stringify({
description: '',
devicetype_count: 0,
id: 0,
inventoryitem_count: 0,
name: '',
platform_count: 0,
slug: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/dcim/manufacturers/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/manufacturers/',
headers: {'content-type': 'application/json'},
data: {
description: '',
devicetype_count: 0,
id: 0,
inventoryitem_count: 0,
name: '',
platform_count: 0,
slug: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/manufacturers/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"description":"","devicetype_count":0,"id":0,"inventoryitem_count":0,"name":"","platform_count":0,"slug":""}'
};
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}}/dcim/manufacturers/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "description": "",\n "devicetype_count": 0,\n "id": 0,\n "inventoryitem_count": 0,\n "name": "",\n "platform_count": 0,\n "slug": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/manufacturers/")
.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/dcim/manufacturers/',
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({
description: '',
devicetype_count: 0,
id: 0,
inventoryitem_count: 0,
name: '',
platform_count: 0,
slug: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/manufacturers/',
headers: {'content-type': 'application/json'},
body: {
description: '',
devicetype_count: 0,
id: 0,
inventoryitem_count: 0,
name: '',
platform_count: 0,
slug: ''
},
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}}/dcim/manufacturers/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
description: '',
devicetype_count: 0,
id: 0,
inventoryitem_count: 0,
name: '',
platform_count: 0,
slug: ''
});
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}}/dcim/manufacturers/',
headers: {'content-type': 'application/json'},
data: {
description: '',
devicetype_count: 0,
id: 0,
inventoryitem_count: 0,
name: '',
platform_count: 0,
slug: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/manufacturers/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"description":"","devicetype_count":0,"id":0,"inventoryitem_count":0,"name":"","platform_count":0,"slug":""}'
};
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 = @{ @"description": @"",
@"devicetype_count": @0,
@"id": @0,
@"inventoryitem_count": @0,
@"name": @"",
@"platform_count": @0,
@"slug": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/manufacturers/"]
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}}/dcim/manufacturers/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/manufacturers/",
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([
'description' => '',
'devicetype_count' => 0,
'id' => 0,
'inventoryitem_count' => 0,
'name' => '',
'platform_count' => 0,
'slug' => ''
]),
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}}/dcim/manufacturers/', [
'body' => '{
"description": "",
"devicetype_count": 0,
"id": 0,
"inventoryitem_count": 0,
"name": "",
"platform_count": 0,
"slug": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/manufacturers/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'description' => '',
'devicetype_count' => 0,
'id' => 0,
'inventoryitem_count' => 0,
'name' => '',
'platform_count' => 0,
'slug' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'description' => '',
'devicetype_count' => 0,
'id' => 0,
'inventoryitem_count' => 0,
'name' => '',
'platform_count' => 0,
'slug' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/manufacturers/');
$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}}/dcim/manufacturers/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"devicetype_count": 0,
"id": 0,
"inventoryitem_count": 0,
"name": "",
"platform_count": 0,
"slug": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/manufacturers/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"devicetype_count": 0,
"id": 0,
"inventoryitem_count": 0,
"name": "",
"platform_count": 0,
"slug": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/dcim/manufacturers/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/manufacturers/"
payload = {
"description": "",
"devicetype_count": 0,
"id": 0,
"inventoryitem_count": 0,
"name": "",
"platform_count": 0,
"slug": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/manufacturers/"
payload <- "{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\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}}/dcim/manufacturers/")
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 \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\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/dcim/manufacturers/') do |req|
req.body = "{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/manufacturers/";
let payload = json!({
"description": "",
"devicetype_count": 0,
"id": 0,
"inventoryitem_count": 0,
"name": "",
"platform_count": 0,
"slug": ""
});
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}}/dcim/manufacturers/ \
--header 'content-type: application/json' \
--data '{
"description": "",
"devicetype_count": 0,
"id": 0,
"inventoryitem_count": 0,
"name": "",
"platform_count": 0,
"slug": ""
}'
echo '{
"description": "",
"devicetype_count": 0,
"id": 0,
"inventoryitem_count": 0,
"name": "",
"platform_count": 0,
"slug": ""
}' | \
http POST {{baseUrl}}/dcim/manufacturers/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "description": "",\n "devicetype_count": 0,\n "id": 0,\n "inventoryitem_count": 0,\n "name": "",\n "platform_count": 0,\n "slug": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/manufacturers/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"description": "",
"devicetype_count": 0,
"id": 0,
"inventoryitem_count": 0,
"name": "",
"platform_count": 0,
"slug": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/manufacturers/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
dcim_manufacturers_delete
{{baseUrl}}/dcim/manufacturers/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/manufacturers/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/dcim/manufacturers/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/manufacturers/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/dcim/manufacturers/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/manufacturers/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/manufacturers/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/dcim/manufacturers/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/dcim/manufacturers/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/manufacturers/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/manufacturers/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/dcim/manufacturers/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/dcim/manufacturers/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/manufacturers/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/manufacturers/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/manufacturers/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/manufacturers/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/manufacturers/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/manufacturers/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/dcim/manufacturers/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/manufacturers/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/manufacturers/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/manufacturers/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/manufacturers/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/manufacturers/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/dcim/manufacturers/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/manufacturers/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/manufacturers/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/manufacturers/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/manufacturers/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/dcim/manufacturers/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/manufacturers/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/manufacturers/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/manufacturers/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/dcim/manufacturers/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/manufacturers/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/dcim/manufacturers/:id/
http DELETE {{baseUrl}}/dcim/manufacturers/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/dcim/manufacturers/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/manufacturers/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_manufacturers_list
{{baseUrl}}/dcim/manufacturers/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/manufacturers/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/manufacturers/")
require "http/client"
url = "{{baseUrl}}/dcim/manufacturers/"
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}}/dcim/manufacturers/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/manufacturers/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/manufacturers/"
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/dcim/manufacturers/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/manufacturers/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/manufacturers/"))
.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}}/dcim/manufacturers/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/manufacturers/")
.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}}/dcim/manufacturers/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/manufacturers/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/manufacturers/';
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}}/dcim/manufacturers/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/manufacturers/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/manufacturers/',
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}}/dcim/manufacturers/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/manufacturers/');
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}}/dcim/manufacturers/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/manufacturers/';
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}}/dcim/manufacturers/"]
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}}/dcim/manufacturers/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/manufacturers/",
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}}/dcim/manufacturers/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/manufacturers/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/manufacturers/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/manufacturers/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/manufacturers/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/manufacturers/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/manufacturers/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/manufacturers/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/manufacturers/")
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/dcim/manufacturers/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/manufacturers/";
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}}/dcim/manufacturers/
http GET {{baseUrl}}/dcim/manufacturers/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/manufacturers/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/manufacturers/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
dcim_manufacturers_partial_update
{{baseUrl}}/dcim/manufacturers/:id/
BODY json
{
"description": "",
"devicetype_count": 0,
"id": 0,
"inventoryitem_count": 0,
"name": "",
"platform_count": 0,
"slug": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/manufacturers/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/dcim/manufacturers/:id/" {:content-type :json
:form-params {:description ""
:devicetype_count 0
:id 0
:inventoryitem_count 0
:name ""
:platform_count 0
:slug ""}})
require "http/client"
url = "{{baseUrl}}/dcim/manufacturers/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\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}}/dcim/manufacturers/:id/"),
Content = new StringContent("{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\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}}/dcim/manufacturers/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/manufacturers/:id/"
payload := strings.NewReader("{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\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/dcim/manufacturers/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 138
{
"description": "",
"devicetype_count": 0,
"id": 0,
"inventoryitem_count": 0,
"name": "",
"platform_count": 0,
"slug": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/dcim/manufacturers/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/manufacturers/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\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 \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/manufacturers/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/dcim/manufacturers/:id/")
.header("content-type", "application/json")
.body("{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\n}")
.asString();
const data = JSON.stringify({
description: '',
devicetype_count: 0,
id: 0,
inventoryitem_count: 0,
name: '',
platform_count: 0,
slug: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/dcim/manufacturers/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/manufacturers/:id/',
headers: {'content-type': 'application/json'},
data: {
description: '',
devicetype_count: 0,
id: 0,
inventoryitem_count: 0,
name: '',
platform_count: 0,
slug: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/manufacturers/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"description":"","devicetype_count":0,"id":0,"inventoryitem_count":0,"name":"","platform_count":0,"slug":""}'
};
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}}/dcim/manufacturers/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "description": "",\n "devicetype_count": 0,\n "id": 0,\n "inventoryitem_count": 0,\n "name": "",\n "platform_count": 0,\n "slug": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/manufacturers/:id/")
.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/dcim/manufacturers/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
description: '',
devicetype_count: 0,
id: 0,
inventoryitem_count: 0,
name: '',
platform_count: 0,
slug: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/manufacturers/:id/',
headers: {'content-type': 'application/json'},
body: {
description: '',
devicetype_count: 0,
id: 0,
inventoryitem_count: 0,
name: '',
platform_count: 0,
slug: ''
},
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}}/dcim/manufacturers/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
description: '',
devicetype_count: 0,
id: 0,
inventoryitem_count: 0,
name: '',
platform_count: 0,
slug: ''
});
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}}/dcim/manufacturers/:id/',
headers: {'content-type': 'application/json'},
data: {
description: '',
devicetype_count: 0,
id: 0,
inventoryitem_count: 0,
name: '',
platform_count: 0,
slug: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/manufacturers/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"description":"","devicetype_count":0,"id":0,"inventoryitem_count":0,"name":"","platform_count":0,"slug":""}'
};
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 = @{ @"description": @"",
@"devicetype_count": @0,
@"id": @0,
@"inventoryitem_count": @0,
@"name": @"",
@"platform_count": @0,
@"slug": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/manufacturers/:id/"]
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}}/dcim/manufacturers/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/manufacturers/:id/",
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([
'description' => '',
'devicetype_count' => 0,
'id' => 0,
'inventoryitem_count' => 0,
'name' => '',
'platform_count' => 0,
'slug' => ''
]),
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}}/dcim/manufacturers/:id/', [
'body' => '{
"description": "",
"devicetype_count": 0,
"id": 0,
"inventoryitem_count": 0,
"name": "",
"platform_count": 0,
"slug": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/manufacturers/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'description' => '',
'devicetype_count' => 0,
'id' => 0,
'inventoryitem_count' => 0,
'name' => '',
'platform_count' => 0,
'slug' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'description' => '',
'devicetype_count' => 0,
'id' => 0,
'inventoryitem_count' => 0,
'name' => '',
'platform_count' => 0,
'slug' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/manufacturers/:id/');
$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}}/dcim/manufacturers/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"devicetype_count": 0,
"id": 0,
"inventoryitem_count": 0,
"name": "",
"platform_count": 0,
"slug": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/manufacturers/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"devicetype_count": 0,
"id": 0,
"inventoryitem_count": 0,
"name": "",
"platform_count": 0,
"slug": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/dcim/manufacturers/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/manufacturers/:id/"
payload = {
"description": "",
"devicetype_count": 0,
"id": 0,
"inventoryitem_count": 0,
"name": "",
"platform_count": 0,
"slug": ""
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/manufacturers/:id/"
payload <- "{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\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}}/dcim/manufacturers/:id/")
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 \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\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/dcim/manufacturers/:id/') do |req|
req.body = "{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\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}}/dcim/manufacturers/:id/";
let payload = json!({
"description": "",
"devicetype_count": 0,
"id": 0,
"inventoryitem_count": 0,
"name": "",
"platform_count": 0,
"slug": ""
});
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}}/dcim/manufacturers/:id/ \
--header 'content-type: application/json' \
--data '{
"description": "",
"devicetype_count": 0,
"id": 0,
"inventoryitem_count": 0,
"name": "",
"platform_count": 0,
"slug": ""
}'
echo '{
"description": "",
"devicetype_count": 0,
"id": 0,
"inventoryitem_count": 0,
"name": "",
"platform_count": 0,
"slug": ""
}' | \
http PATCH {{baseUrl}}/dcim/manufacturers/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "description": "",\n "devicetype_count": 0,\n "id": 0,\n "inventoryitem_count": 0,\n "name": "",\n "platform_count": 0,\n "slug": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/manufacturers/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"description": "",
"devicetype_count": 0,
"id": 0,
"inventoryitem_count": 0,
"name": "",
"platform_count": 0,
"slug": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/manufacturers/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_manufacturers_read
{{baseUrl}}/dcim/manufacturers/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/manufacturers/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/manufacturers/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/manufacturers/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/dcim/manufacturers/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/manufacturers/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/manufacturers/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/dcim/manufacturers/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/manufacturers/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/manufacturers/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/manufacturers/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/manufacturers/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/dcim/manufacturers/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/manufacturers/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/manufacturers/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/manufacturers/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/manufacturers/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/manufacturers/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/dcim/manufacturers/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/manufacturers/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/dcim/manufacturers/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/manufacturers/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/manufacturers/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/manufacturers/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/manufacturers/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/dcim/manufacturers/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/manufacturers/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/manufacturers/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/manufacturers/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/manufacturers/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/manufacturers/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/manufacturers/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/manufacturers/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/manufacturers/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/dcim/manufacturers/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/manufacturers/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/dcim/manufacturers/:id/
http GET {{baseUrl}}/dcim/manufacturers/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/manufacturers/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/manufacturers/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
dcim_manufacturers_update
{{baseUrl}}/dcim/manufacturers/:id/
BODY json
{
"description": "",
"devicetype_count": 0,
"id": 0,
"inventoryitem_count": 0,
"name": "",
"platform_count": 0,
"slug": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/manufacturers/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/dcim/manufacturers/:id/" {:content-type :json
:form-params {:description ""
:devicetype_count 0
:id 0
:inventoryitem_count 0
:name ""
:platform_count 0
:slug ""}})
require "http/client"
url = "{{baseUrl}}/dcim/manufacturers/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\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}}/dcim/manufacturers/:id/"),
Content = new StringContent("{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\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}}/dcim/manufacturers/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/manufacturers/:id/"
payload := strings.NewReader("{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\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/dcim/manufacturers/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 138
{
"description": "",
"devicetype_count": 0,
"id": 0,
"inventoryitem_count": 0,
"name": "",
"platform_count": 0,
"slug": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/dcim/manufacturers/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/manufacturers/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\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 \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/manufacturers/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/dcim/manufacturers/:id/")
.header("content-type", "application/json")
.body("{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\n}")
.asString();
const data = JSON.stringify({
description: '',
devicetype_count: 0,
id: 0,
inventoryitem_count: 0,
name: '',
platform_count: 0,
slug: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/dcim/manufacturers/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/manufacturers/:id/',
headers: {'content-type': 'application/json'},
data: {
description: '',
devicetype_count: 0,
id: 0,
inventoryitem_count: 0,
name: '',
platform_count: 0,
slug: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/manufacturers/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"description":"","devicetype_count":0,"id":0,"inventoryitem_count":0,"name":"","platform_count":0,"slug":""}'
};
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}}/dcim/manufacturers/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "description": "",\n "devicetype_count": 0,\n "id": 0,\n "inventoryitem_count": 0,\n "name": "",\n "platform_count": 0,\n "slug": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/manufacturers/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/manufacturers/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
description: '',
devicetype_count: 0,
id: 0,
inventoryitem_count: 0,
name: '',
platform_count: 0,
slug: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/manufacturers/:id/',
headers: {'content-type': 'application/json'},
body: {
description: '',
devicetype_count: 0,
id: 0,
inventoryitem_count: 0,
name: '',
platform_count: 0,
slug: ''
},
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}}/dcim/manufacturers/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
description: '',
devicetype_count: 0,
id: 0,
inventoryitem_count: 0,
name: '',
platform_count: 0,
slug: ''
});
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}}/dcim/manufacturers/:id/',
headers: {'content-type': 'application/json'},
data: {
description: '',
devicetype_count: 0,
id: 0,
inventoryitem_count: 0,
name: '',
platform_count: 0,
slug: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/manufacturers/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"description":"","devicetype_count":0,"id":0,"inventoryitem_count":0,"name":"","platform_count":0,"slug":""}'
};
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 = @{ @"description": @"",
@"devicetype_count": @0,
@"id": @0,
@"inventoryitem_count": @0,
@"name": @"",
@"platform_count": @0,
@"slug": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/manufacturers/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/manufacturers/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/manufacturers/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'description' => '',
'devicetype_count' => 0,
'id' => 0,
'inventoryitem_count' => 0,
'name' => '',
'platform_count' => 0,
'slug' => ''
]),
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}}/dcim/manufacturers/:id/', [
'body' => '{
"description": "",
"devicetype_count": 0,
"id": 0,
"inventoryitem_count": 0,
"name": "",
"platform_count": 0,
"slug": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/manufacturers/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'description' => '',
'devicetype_count' => 0,
'id' => 0,
'inventoryitem_count' => 0,
'name' => '',
'platform_count' => 0,
'slug' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'description' => '',
'devicetype_count' => 0,
'id' => 0,
'inventoryitem_count' => 0,
'name' => '',
'platform_count' => 0,
'slug' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/manufacturers/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/manufacturers/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"devicetype_count": 0,
"id": 0,
"inventoryitem_count": 0,
"name": "",
"platform_count": 0,
"slug": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/manufacturers/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"devicetype_count": 0,
"id": 0,
"inventoryitem_count": 0,
"name": "",
"platform_count": 0,
"slug": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/dcim/manufacturers/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/manufacturers/:id/"
payload = {
"description": "",
"devicetype_count": 0,
"id": 0,
"inventoryitem_count": 0,
"name": "",
"platform_count": 0,
"slug": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/manufacturers/:id/"
payload <- "{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\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}}/dcim/manufacturers/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\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/dcim/manufacturers/:id/') do |req|
req.body = "{\n \"description\": \"\",\n \"devicetype_count\": 0,\n \"id\": 0,\n \"inventoryitem_count\": 0,\n \"name\": \"\",\n \"platform_count\": 0,\n \"slug\": \"\"\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}}/dcim/manufacturers/:id/";
let payload = json!({
"description": "",
"devicetype_count": 0,
"id": 0,
"inventoryitem_count": 0,
"name": "",
"platform_count": 0,
"slug": ""
});
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}}/dcim/manufacturers/:id/ \
--header 'content-type: application/json' \
--data '{
"description": "",
"devicetype_count": 0,
"id": 0,
"inventoryitem_count": 0,
"name": "",
"platform_count": 0,
"slug": ""
}'
echo '{
"description": "",
"devicetype_count": 0,
"id": 0,
"inventoryitem_count": 0,
"name": "",
"platform_count": 0,
"slug": ""
}' | \
http PUT {{baseUrl}}/dcim/manufacturers/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "description": "",\n "devicetype_count": 0,\n "id": 0,\n "inventoryitem_count": 0,\n "name": "",\n "platform_count": 0,\n "slug": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/manufacturers/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"description": "",
"devicetype_count": 0,
"id": 0,
"inventoryitem_count": 0,
"name": "",
"platform_count": 0,
"slug": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/manufacturers/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
dcim_platforms_create
{{baseUrl}}/dcim/platforms/
BODY json
{
"description": "",
"device_count": 0,
"id": 0,
"manufacturer": 0,
"name": "",
"napalm_args": "",
"napalm_driver": "",
"slug": "",
"virtualmachine_count": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/platforms/");
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 \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/dcim/platforms/" {:content-type :json
:form-params {:description ""
:device_count 0
:id 0
:manufacturer 0
:name ""
:napalm_args ""
:napalm_driver ""
:slug ""
:virtualmachine_count 0}})
require "http/client"
url = "{{baseUrl}}/dcim/platforms/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/dcim/platforms/"),
Content = new StringContent("{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/platforms/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/platforms/"
payload := strings.NewReader("{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/dcim/platforms/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 177
{
"description": "",
"device_count": 0,
"id": 0,
"manufacturer": 0,
"name": "",
"napalm_args": "",
"napalm_driver": "",
"slug": "",
"virtualmachine_count": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/dcim/platforms/")
.setHeader("content-type", "application/json")
.setBody("{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/platforms/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/platforms/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/dcim/platforms/")
.header("content-type", "application/json")
.body("{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\n}")
.asString();
const data = JSON.stringify({
description: '',
device_count: 0,
id: 0,
manufacturer: 0,
name: '',
napalm_args: '',
napalm_driver: '',
slug: '',
virtualmachine_count: 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}}/dcim/platforms/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/platforms/',
headers: {'content-type': 'application/json'},
data: {
description: '',
device_count: 0,
id: 0,
manufacturer: 0,
name: '',
napalm_args: '',
napalm_driver: '',
slug: '',
virtualmachine_count: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/platforms/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"description":"","device_count":0,"id":0,"manufacturer":0,"name":"","napalm_args":"","napalm_driver":"","slug":"","virtualmachine_count":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}}/dcim/platforms/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "description": "",\n "device_count": 0,\n "id": 0,\n "manufacturer": 0,\n "name": "",\n "napalm_args": "",\n "napalm_driver": "",\n "slug": "",\n "virtualmachine_count": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/platforms/")
.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/dcim/platforms/',
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({
description: '',
device_count: 0,
id: 0,
manufacturer: 0,
name: '',
napalm_args: '',
napalm_driver: '',
slug: '',
virtualmachine_count: 0
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/platforms/',
headers: {'content-type': 'application/json'},
body: {
description: '',
device_count: 0,
id: 0,
manufacturer: 0,
name: '',
napalm_args: '',
napalm_driver: '',
slug: '',
virtualmachine_count: 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}}/dcim/platforms/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
description: '',
device_count: 0,
id: 0,
manufacturer: 0,
name: '',
napalm_args: '',
napalm_driver: '',
slug: '',
virtualmachine_count: 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}}/dcim/platforms/',
headers: {'content-type': 'application/json'},
data: {
description: '',
device_count: 0,
id: 0,
manufacturer: 0,
name: '',
napalm_args: '',
napalm_driver: '',
slug: '',
virtualmachine_count: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/platforms/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"description":"","device_count":0,"id":0,"manufacturer":0,"name":"","napalm_args":"","napalm_driver":"","slug":"","virtualmachine_count":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 = @{ @"description": @"",
@"device_count": @0,
@"id": @0,
@"manufacturer": @0,
@"name": @"",
@"napalm_args": @"",
@"napalm_driver": @"",
@"slug": @"",
@"virtualmachine_count": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/platforms/"]
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}}/dcim/platforms/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/platforms/",
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([
'description' => '',
'device_count' => 0,
'id' => 0,
'manufacturer' => 0,
'name' => '',
'napalm_args' => '',
'napalm_driver' => '',
'slug' => '',
'virtualmachine_count' => 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}}/dcim/platforms/', [
'body' => '{
"description": "",
"device_count": 0,
"id": 0,
"manufacturer": 0,
"name": "",
"napalm_args": "",
"napalm_driver": "",
"slug": "",
"virtualmachine_count": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/platforms/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'description' => '',
'device_count' => 0,
'id' => 0,
'manufacturer' => 0,
'name' => '',
'napalm_args' => '',
'napalm_driver' => '',
'slug' => '',
'virtualmachine_count' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'description' => '',
'device_count' => 0,
'id' => 0,
'manufacturer' => 0,
'name' => '',
'napalm_args' => '',
'napalm_driver' => '',
'slug' => '',
'virtualmachine_count' => 0
]));
$request->setRequestUrl('{{baseUrl}}/dcim/platforms/');
$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}}/dcim/platforms/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"device_count": 0,
"id": 0,
"manufacturer": 0,
"name": "",
"napalm_args": "",
"napalm_driver": "",
"slug": "",
"virtualmachine_count": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/platforms/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"device_count": 0,
"id": 0,
"manufacturer": 0,
"name": "",
"napalm_args": "",
"napalm_driver": "",
"slug": "",
"virtualmachine_count": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/dcim/platforms/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/platforms/"
payload = {
"description": "",
"device_count": 0,
"id": 0,
"manufacturer": 0,
"name": "",
"napalm_args": "",
"napalm_driver": "",
"slug": "",
"virtualmachine_count": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/platforms/"
payload <- "{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/platforms/")
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 \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/dcim/platforms/') do |req|
req.body = "{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/platforms/";
let payload = json!({
"description": "",
"device_count": 0,
"id": 0,
"manufacturer": 0,
"name": "",
"napalm_args": "",
"napalm_driver": "",
"slug": "",
"virtualmachine_count": 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}}/dcim/platforms/ \
--header 'content-type: application/json' \
--data '{
"description": "",
"device_count": 0,
"id": 0,
"manufacturer": 0,
"name": "",
"napalm_args": "",
"napalm_driver": "",
"slug": "",
"virtualmachine_count": 0
}'
echo '{
"description": "",
"device_count": 0,
"id": 0,
"manufacturer": 0,
"name": "",
"napalm_args": "",
"napalm_driver": "",
"slug": "",
"virtualmachine_count": 0
}' | \
http POST {{baseUrl}}/dcim/platforms/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "description": "",\n "device_count": 0,\n "id": 0,\n "manufacturer": 0,\n "name": "",\n "napalm_args": "",\n "napalm_driver": "",\n "slug": "",\n "virtualmachine_count": 0\n}' \
--output-document \
- {{baseUrl}}/dcim/platforms/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"description": "",
"device_count": 0,
"id": 0,
"manufacturer": 0,
"name": "",
"napalm_args": "",
"napalm_driver": "",
"slug": "",
"virtualmachine_count": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/platforms/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
dcim_platforms_delete
{{baseUrl}}/dcim/platforms/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/platforms/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/dcim/platforms/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/platforms/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/dcim/platforms/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/platforms/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/platforms/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/dcim/platforms/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/dcim/platforms/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/platforms/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/platforms/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/dcim/platforms/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/dcim/platforms/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/platforms/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/platforms/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/platforms/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/platforms/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/platforms/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/platforms/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/dcim/platforms/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/platforms/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/platforms/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/platforms/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/platforms/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/platforms/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/dcim/platforms/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/platforms/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/platforms/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/platforms/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/platforms/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/dcim/platforms/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/platforms/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/platforms/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/platforms/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/dcim/platforms/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/platforms/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/dcim/platforms/:id/
http DELETE {{baseUrl}}/dcim/platforms/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/dcim/platforms/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/platforms/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_platforms_list
{{baseUrl}}/dcim/platforms/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/platforms/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/platforms/")
require "http/client"
url = "{{baseUrl}}/dcim/platforms/"
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}}/dcim/platforms/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/platforms/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/platforms/"
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/dcim/platforms/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/platforms/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/platforms/"))
.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}}/dcim/platforms/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/platforms/")
.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}}/dcim/platforms/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/platforms/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/platforms/';
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}}/dcim/platforms/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/platforms/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/platforms/',
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}}/dcim/platforms/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/platforms/');
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}}/dcim/platforms/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/platforms/';
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}}/dcim/platforms/"]
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}}/dcim/platforms/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/platforms/",
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}}/dcim/platforms/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/platforms/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/platforms/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/platforms/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/platforms/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/platforms/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/platforms/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/platforms/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/platforms/")
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/dcim/platforms/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/platforms/";
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}}/dcim/platforms/
http GET {{baseUrl}}/dcim/platforms/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/platforms/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/platforms/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
dcim_platforms_partial_update
{{baseUrl}}/dcim/platforms/:id/
BODY json
{
"description": "",
"device_count": 0,
"id": 0,
"manufacturer": 0,
"name": "",
"napalm_args": "",
"napalm_driver": "",
"slug": "",
"virtualmachine_count": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/platforms/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/dcim/platforms/:id/" {:content-type :json
:form-params {:description ""
:device_count 0
:id 0
:manufacturer 0
:name ""
:napalm_args ""
:napalm_driver ""
:slug ""
:virtualmachine_count 0}})
require "http/client"
url = "{{baseUrl}}/dcim/platforms/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\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}}/dcim/platforms/:id/"),
Content = new StringContent("{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/platforms/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/platforms/:id/"
payload := strings.NewReader("{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\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/dcim/platforms/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 177
{
"description": "",
"device_count": 0,
"id": 0,
"manufacturer": 0,
"name": "",
"napalm_args": "",
"napalm_driver": "",
"slug": "",
"virtualmachine_count": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/dcim/platforms/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/platforms/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/platforms/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/dcim/platforms/:id/")
.header("content-type", "application/json")
.body("{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\n}")
.asString();
const data = JSON.stringify({
description: '',
device_count: 0,
id: 0,
manufacturer: 0,
name: '',
napalm_args: '',
napalm_driver: '',
slug: '',
virtualmachine_count: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/dcim/platforms/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/platforms/:id/',
headers: {'content-type': 'application/json'},
data: {
description: '',
device_count: 0,
id: 0,
manufacturer: 0,
name: '',
napalm_args: '',
napalm_driver: '',
slug: '',
virtualmachine_count: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/platforms/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"description":"","device_count":0,"id":0,"manufacturer":0,"name":"","napalm_args":"","napalm_driver":"","slug":"","virtualmachine_count":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}}/dcim/platforms/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "description": "",\n "device_count": 0,\n "id": 0,\n "manufacturer": 0,\n "name": "",\n "napalm_args": "",\n "napalm_driver": "",\n "slug": "",\n "virtualmachine_count": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/platforms/:id/")
.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/dcim/platforms/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
description: '',
device_count: 0,
id: 0,
manufacturer: 0,
name: '',
napalm_args: '',
napalm_driver: '',
slug: '',
virtualmachine_count: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/platforms/:id/',
headers: {'content-type': 'application/json'},
body: {
description: '',
device_count: 0,
id: 0,
manufacturer: 0,
name: '',
napalm_args: '',
napalm_driver: '',
slug: '',
virtualmachine_count: 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('PATCH', '{{baseUrl}}/dcim/platforms/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
description: '',
device_count: 0,
id: 0,
manufacturer: 0,
name: '',
napalm_args: '',
napalm_driver: '',
slug: '',
virtualmachine_count: 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: 'PATCH',
url: '{{baseUrl}}/dcim/platforms/:id/',
headers: {'content-type': 'application/json'},
data: {
description: '',
device_count: 0,
id: 0,
manufacturer: 0,
name: '',
napalm_args: '',
napalm_driver: '',
slug: '',
virtualmachine_count: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/platforms/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"description":"","device_count":0,"id":0,"manufacturer":0,"name":"","napalm_args":"","napalm_driver":"","slug":"","virtualmachine_count":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 = @{ @"description": @"",
@"device_count": @0,
@"id": @0,
@"manufacturer": @0,
@"name": @"",
@"napalm_args": @"",
@"napalm_driver": @"",
@"slug": @"",
@"virtualmachine_count": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/platforms/:id/"]
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}}/dcim/platforms/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/platforms/:id/",
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([
'description' => '',
'device_count' => 0,
'id' => 0,
'manufacturer' => 0,
'name' => '',
'napalm_args' => '',
'napalm_driver' => '',
'slug' => '',
'virtualmachine_count' => 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('PATCH', '{{baseUrl}}/dcim/platforms/:id/', [
'body' => '{
"description": "",
"device_count": 0,
"id": 0,
"manufacturer": 0,
"name": "",
"napalm_args": "",
"napalm_driver": "",
"slug": "",
"virtualmachine_count": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/platforms/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'description' => '',
'device_count' => 0,
'id' => 0,
'manufacturer' => 0,
'name' => '',
'napalm_args' => '',
'napalm_driver' => '',
'slug' => '',
'virtualmachine_count' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'description' => '',
'device_count' => 0,
'id' => 0,
'manufacturer' => 0,
'name' => '',
'napalm_args' => '',
'napalm_driver' => '',
'slug' => '',
'virtualmachine_count' => 0
]));
$request->setRequestUrl('{{baseUrl}}/dcim/platforms/:id/');
$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}}/dcim/platforms/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"device_count": 0,
"id": 0,
"manufacturer": 0,
"name": "",
"napalm_args": "",
"napalm_driver": "",
"slug": "",
"virtualmachine_count": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/platforms/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"device_count": 0,
"id": 0,
"manufacturer": 0,
"name": "",
"napalm_args": "",
"napalm_driver": "",
"slug": "",
"virtualmachine_count": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/dcim/platforms/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/platforms/:id/"
payload = {
"description": "",
"device_count": 0,
"id": 0,
"manufacturer": 0,
"name": "",
"napalm_args": "",
"napalm_driver": "",
"slug": "",
"virtualmachine_count": 0
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/platforms/:id/"
payload <- "{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\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}}/dcim/platforms/:id/")
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 \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/dcim/platforms/:id/') do |req|
req.body = "{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\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}}/dcim/platforms/:id/";
let payload = json!({
"description": "",
"device_count": 0,
"id": 0,
"manufacturer": 0,
"name": "",
"napalm_args": "",
"napalm_driver": "",
"slug": "",
"virtualmachine_count": 0
});
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}}/dcim/platforms/:id/ \
--header 'content-type: application/json' \
--data '{
"description": "",
"device_count": 0,
"id": 0,
"manufacturer": 0,
"name": "",
"napalm_args": "",
"napalm_driver": "",
"slug": "",
"virtualmachine_count": 0
}'
echo '{
"description": "",
"device_count": 0,
"id": 0,
"manufacturer": 0,
"name": "",
"napalm_args": "",
"napalm_driver": "",
"slug": "",
"virtualmachine_count": 0
}' | \
http PATCH {{baseUrl}}/dcim/platforms/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "description": "",\n "device_count": 0,\n "id": 0,\n "manufacturer": 0,\n "name": "",\n "napalm_args": "",\n "napalm_driver": "",\n "slug": "",\n "virtualmachine_count": 0\n}' \
--output-document \
- {{baseUrl}}/dcim/platforms/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"description": "",
"device_count": 0,
"id": 0,
"manufacturer": 0,
"name": "",
"napalm_args": "",
"napalm_driver": "",
"slug": "",
"virtualmachine_count": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/platforms/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_platforms_read
{{baseUrl}}/dcim/platforms/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/platforms/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/platforms/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/platforms/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/dcim/platforms/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/platforms/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/platforms/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/dcim/platforms/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/platforms/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/platforms/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/platforms/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/platforms/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/dcim/platforms/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/platforms/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/platforms/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/platforms/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/platforms/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/platforms/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/dcim/platforms/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/platforms/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/dcim/platforms/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/platforms/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/platforms/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/platforms/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/platforms/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/dcim/platforms/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/platforms/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/platforms/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/platforms/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/platforms/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/platforms/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/platforms/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/platforms/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/platforms/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/dcim/platforms/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/platforms/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/dcim/platforms/:id/
http GET {{baseUrl}}/dcim/platforms/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/platforms/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/platforms/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
dcim_platforms_update
{{baseUrl}}/dcim/platforms/:id/
BODY json
{
"description": "",
"device_count": 0,
"id": 0,
"manufacturer": 0,
"name": "",
"napalm_args": "",
"napalm_driver": "",
"slug": "",
"virtualmachine_count": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/platforms/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/dcim/platforms/:id/" {:content-type :json
:form-params {:description ""
:device_count 0
:id 0
:manufacturer 0
:name ""
:napalm_args ""
:napalm_driver ""
:slug ""
:virtualmachine_count 0}})
require "http/client"
url = "{{baseUrl}}/dcim/platforms/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\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}}/dcim/platforms/:id/"),
Content = new StringContent("{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/platforms/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/platforms/:id/"
payload := strings.NewReader("{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\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/dcim/platforms/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 177
{
"description": "",
"device_count": 0,
"id": 0,
"manufacturer": 0,
"name": "",
"napalm_args": "",
"napalm_driver": "",
"slug": "",
"virtualmachine_count": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/dcim/platforms/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/platforms/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/platforms/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/dcim/platforms/:id/")
.header("content-type", "application/json")
.body("{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\n}")
.asString();
const data = JSON.stringify({
description: '',
device_count: 0,
id: 0,
manufacturer: 0,
name: '',
napalm_args: '',
napalm_driver: '',
slug: '',
virtualmachine_count: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/dcim/platforms/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/platforms/:id/',
headers: {'content-type': 'application/json'},
data: {
description: '',
device_count: 0,
id: 0,
manufacturer: 0,
name: '',
napalm_args: '',
napalm_driver: '',
slug: '',
virtualmachine_count: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/platforms/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"description":"","device_count":0,"id":0,"manufacturer":0,"name":"","napalm_args":"","napalm_driver":"","slug":"","virtualmachine_count":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}}/dcim/platforms/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "description": "",\n "device_count": 0,\n "id": 0,\n "manufacturer": 0,\n "name": "",\n "napalm_args": "",\n "napalm_driver": "",\n "slug": "",\n "virtualmachine_count": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/platforms/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/platforms/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
description: '',
device_count: 0,
id: 0,
manufacturer: 0,
name: '',
napalm_args: '',
napalm_driver: '',
slug: '',
virtualmachine_count: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/platforms/:id/',
headers: {'content-type': 'application/json'},
body: {
description: '',
device_count: 0,
id: 0,
manufacturer: 0,
name: '',
napalm_args: '',
napalm_driver: '',
slug: '',
virtualmachine_count: 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('PUT', '{{baseUrl}}/dcim/platforms/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
description: '',
device_count: 0,
id: 0,
manufacturer: 0,
name: '',
napalm_args: '',
napalm_driver: '',
slug: '',
virtualmachine_count: 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: 'PUT',
url: '{{baseUrl}}/dcim/platforms/:id/',
headers: {'content-type': 'application/json'},
data: {
description: '',
device_count: 0,
id: 0,
manufacturer: 0,
name: '',
napalm_args: '',
napalm_driver: '',
slug: '',
virtualmachine_count: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/platforms/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"description":"","device_count":0,"id":0,"manufacturer":0,"name":"","napalm_args":"","napalm_driver":"","slug":"","virtualmachine_count":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 = @{ @"description": @"",
@"device_count": @0,
@"id": @0,
@"manufacturer": @0,
@"name": @"",
@"napalm_args": @"",
@"napalm_driver": @"",
@"slug": @"",
@"virtualmachine_count": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/platforms/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/platforms/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/platforms/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'description' => '',
'device_count' => 0,
'id' => 0,
'manufacturer' => 0,
'name' => '',
'napalm_args' => '',
'napalm_driver' => '',
'slug' => '',
'virtualmachine_count' => 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('PUT', '{{baseUrl}}/dcim/platforms/:id/', [
'body' => '{
"description": "",
"device_count": 0,
"id": 0,
"manufacturer": 0,
"name": "",
"napalm_args": "",
"napalm_driver": "",
"slug": "",
"virtualmachine_count": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/platforms/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'description' => '',
'device_count' => 0,
'id' => 0,
'manufacturer' => 0,
'name' => '',
'napalm_args' => '',
'napalm_driver' => '',
'slug' => '',
'virtualmachine_count' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'description' => '',
'device_count' => 0,
'id' => 0,
'manufacturer' => 0,
'name' => '',
'napalm_args' => '',
'napalm_driver' => '',
'slug' => '',
'virtualmachine_count' => 0
]));
$request->setRequestUrl('{{baseUrl}}/dcim/platforms/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/platforms/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"device_count": 0,
"id": 0,
"manufacturer": 0,
"name": "",
"napalm_args": "",
"napalm_driver": "",
"slug": "",
"virtualmachine_count": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/platforms/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"device_count": 0,
"id": 0,
"manufacturer": 0,
"name": "",
"napalm_args": "",
"napalm_driver": "",
"slug": "",
"virtualmachine_count": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/dcim/platforms/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/platforms/:id/"
payload = {
"description": "",
"device_count": 0,
"id": 0,
"manufacturer": 0,
"name": "",
"napalm_args": "",
"napalm_driver": "",
"slug": "",
"virtualmachine_count": 0
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/platforms/:id/"
payload <- "{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\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}}/dcim/platforms/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/dcim/platforms/:id/') do |req|
req.body = "{\n \"description\": \"\",\n \"device_count\": 0,\n \"id\": 0,\n \"manufacturer\": 0,\n \"name\": \"\",\n \"napalm_args\": \"\",\n \"napalm_driver\": \"\",\n \"slug\": \"\",\n \"virtualmachine_count\": 0\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}}/dcim/platforms/:id/";
let payload = json!({
"description": "",
"device_count": 0,
"id": 0,
"manufacturer": 0,
"name": "",
"napalm_args": "",
"napalm_driver": "",
"slug": "",
"virtualmachine_count": 0
});
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}}/dcim/platforms/:id/ \
--header 'content-type: application/json' \
--data '{
"description": "",
"device_count": 0,
"id": 0,
"manufacturer": 0,
"name": "",
"napalm_args": "",
"napalm_driver": "",
"slug": "",
"virtualmachine_count": 0
}'
echo '{
"description": "",
"device_count": 0,
"id": 0,
"manufacturer": 0,
"name": "",
"napalm_args": "",
"napalm_driver": "",
"slug": "",
"virtualmachine_count": 0
}' | \
http PUT {{baseUrl}}/dcim/platforms/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "description": "",\n "device_count": 0,\n "id": 0,\n "manufacturer": 0,\n "name": "",\n "napalm_args": "",\n "napalm_driver": "",\n "slug": "",\n "virtualmachine_count": 0\n}' \
--output-document \
- {{baseUrl}}/dcim/platforms/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"description": "",
"device_count": 0,
"id": 0,
"manufacturer": 0,
"name": "",
"napalm_args": "",
"napalm_driver": "",
"slug": "",
"virtualmachine_count": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/platforms/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_power-connections_list
{{baseUrl}}/dcim/power-connections/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-connections/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/power-connections/")
require "http/client"
url = "{{baseUrl}}/dcim/power-connections/"
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}}/dcim/power-connections/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-connections/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-connections/"
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/dcim/power-connections/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/power-connections/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-connections/"))
.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}}/dcim/power-connections/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/power-connections/")
.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}}/dcim/power-connections/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/power-connections/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-connections/';
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}}/dcim/power-connections/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-connections/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/power-connections/',
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}}/dcim/power-connections/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/power-connections/');
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}}/dcim/power-connections/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-connections/';
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}}/dcim/power-connections/"]
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}}/dcim/power-connections/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-connections/",
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}}/dcim/power-connections/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-connections/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/power-connections/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/power-connections/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-connections/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/power-connections/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-connections/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-connections/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/power-connections/")
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/dcim/power-connections/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/power-connections/";
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}}/dcim/power-connections/
http GET {{baseUrl}}/dcim/power-connections/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/power-connections/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-connections/")! 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
dcim_power-feeds_create
{{baseUrl}}/dcim/power-feeds/
BODY json
{
"amperage": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"max_utilization": 0,
"name": "",
"phase": "",
"power_panel": 0,
"rack": 0,
"status": "",
"supply": "",
"tags": [],
"type": "",
"voltage": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-feeds/");
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 \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/dcim/power-feeds/" {:content-type :json
:form-params {:amperage 0
:comments ""
:created ""
:custom_fields {}
:id 0
:last_updated ""
:max_utilization 0
:name ""
:phase ""
:power_panel 0
:rack 0
:status ""
:supply ""
:tags []
:type ""
:voltage 0}})
require "http/client"
url = "{{baseUrl}}/dcim/power-feeds/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/dcim/power-feeds/"),
Content = new StringContent("{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-feeds/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-feeds/"
payload := strings.NewReader("{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/dcim/power-feeds/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 272
{
"amperage": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"max_utilization": 0,
"name": "",
"phase": "",
"power_panel": 0,
"rack": 0,
"status": "",
"supply": "",
"tags": [],
"type": "",
"voltage": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/dcim/power-feeds/")
.setHeader("content-type", "application/json")
.setBody("{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-feeds/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/power-feeds/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/dcim/power-feeds/")
.header("content-type", "application/json")
.body("{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\n}")
.asString();
const data = JSON.stringify({
amperage: 0,
comments: '',
created: '',
custom_fields: {},
id: 0,
last_updated: '',
max_utilization: 0,
name: '',
phase: '',
power_panel: 0,
rack: 0,
status: '',
supply: '',
tags: [],
type: '',
voltage: 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}}/dcim/power-feeds/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/power-feeds/',
headers: {'content-type': 'application/json'},
data: {
amperage: 0,
comments: '',
created: '',
custom_fields: {},
id: 0,
last_updated: '',
max_utilization: 0,
name: '',
phase: '',
power_panel: 0,
rack: 0,
status: '',
supply: '',
tags: [],
type: '',
voltage: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-feeds/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"amperage":0,"comments":"","created":"","custom_fields":{},"id":0,"last_updated":"","max_utilization":0,"name":"","phase":"","power_panel":0,"rack":0,"status":"","supply":"","tags":[],"type":"","voltage":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}}/dcim/power-feeds/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "amperage": 0,\n "comments": "",\n "created": "",\n "custom_fields": {},\n "id": 0,\n "last_updated": "",\n "max_utilization": 0,\n "name": "",\n "phase": "",\n "power_panel": 0,\n "rack": 0,\n "status": "",\n "supply": "",\n "tags": [],\n "type": "",\n "voltage": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-feeds/")
.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/dcim/power-feeds/',
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({
amperage: 0,
comments: '',
created: '',
custom_fields: {},
id: 0,
last_updated: '',
max_utilization: 0,
name: '',
phase: '',
power_panel: 0,
rack: 0,
status: '',
supply: '',
tags: [],
type: '',
voltage: 0
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/power-feeds/',
headers: {'content-type': 'application/json'},
body: {
amperage: 0,
comments: '',
created: '',
custom_fields: {},
id: 0,
last_updated: '',
max_utilization: 0,
name: '',
phase: '',
power_panel: 0,
rack: 0,
status: '',
supply: '',
tags: [],
type: '',
voltage: 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}}/dcim/power-feeds/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
amperage: 0,
comments: '',
created: '',
custom_fields: {},
id: 0,
last_updated: '',
max_utilization: 0,
name: '',
phase: '',
power_panel: 0,
rack: 0,
status: '',
supply: '',
tags: [],
type: '',
voltage: 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}}/dcim/power-feeds/',
headers: {'content-type': 'application/json'},
data: {
amperage: 0,
comments: '',
created: '',
custom_fields: {},
id: 0,
last_updated: '',
max_utilization: 0,
name: '',
phase: '',
power_panel: 0,
rack: 0,
status: '',
supply: '',
tags: [],
type: '',
voltage: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-feeds/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"amperage":0,"comments":"","created":"","custom_fields":{},"id":0,"last_updated":"","max_utilization":0,"name":"","phase":"","power_panel":0,"rack":0,"status":"","supply":"","tags":[],"type":"","voltage":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 = @{ @"amperage": @0,
@"comments": @"",
@"created": @"",
@"custom_fields": @{ },
@"id": @0,
@"last_updated": @"",
@"max_utilization": @0,
@"name": @"",
@"phase": @"",
@"power_panel": @0,
@"rack": @0,
@"status": @"",
@"supply": @"",
@"tags": @[ ],
@"type": @"",
@"voltage": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/power-feeds/"]
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}}/dcim/power-feeds/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-feeds/",
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([
'amperage' => 0,
'comments' => '',
'created' => '',
'custom_fields' => [
],
'id' => 0,
'last_updated' => '',
'max_utilization' => 0,
'name' => '',
'phase' => '',
'power_panel' => 0,
'rack' => 0,
'status' => '',
'supply' => '',
'tags' => [
],
'type' => '',
'voltage' => 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}}/dcim/power-feeds/', [
'body' => '{
"amperage": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"max_utilization": 0,
"name": "",
"phase": "",
"power_panel": 0,
"rack": 0,
"status": "",
"supply": "",
"tags": [],
"type": "",
"voltage": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-feeds/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'amperage' => 0,
'comments' => '',
'created' => '',
'custom_fields' => [
],
'id' => 0,
'last_updated' => '',
'max_utilization' => 0,
'name' => '',
'phase' => '',
'power_panel' => 0,
'rack' => 0,
'status' => '',
'supply' => '',
'tags' => [
],
'type' => '',
'voltage' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'amperage' => 0,
'comments' => '',
'created' => '',
'custom_fields' => [
],
'id' => 0,
'last_updated' => '',
'max_utilization' => 0,
'name' => '',
'phase' => '',
'power_panel' => 0,
'rack' => 0,
'status' => '',
'supply' => '',
'tags' => [
],
'type' => '',
'voltage' => 0
]));
$request->setRequestUrl('{{baseUrl}}/dcim/power-feeds/');
$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}}/dcim/power-feeds/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"amperage": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"max_utilization": 0,
"name": "",
"phase": "",
"power_panel": 0,
"rack": 0,
"status": "",
"supply": "",
"tags": [],
"type": "",
"voltage": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-feeds/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"amperage": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"max_utilization": 0,
"name": "",
"phase": "",
"power_panel": 0,
"rack": 0,
"status": "",
"supply": "",
"tags": [],
"type": "",
"voltage": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/dcim/power-feeds/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-feeds/"
payload = {
"amperage": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"max_utilization": 0,
"name": "",
"phase": "",
"power_panel": 0,
"rack": 0,
"status": "",
"supply": "",
"tags": [],
"type": "",
"voltage": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-feeds/"
payload <- "{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/power-feeds/")
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 \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/dcim/power-feeds/') do |req|
req.body = "{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/power-feeds/";
let payload = json!({
"amperage": 0,
"comments": "",
"created": "",
"custom_fields": json!({}),
"id": 0,
"last_updated": "",
"max_utilization": 0,
"name": "",
"phase": "",
"power_panel": 0,
"rack": 0,
"status": "",
"supply": "",
"tags": (),
"type": "",
"voltage": 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}}/dcim/power-feeds/ \
--header 'content-type: application/json' \
--data '{
"amperage": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"max_utilization": 0,
"name": "",
"phase": "",
"power_panel": 0,
"rack": 0,
"status": "",
"supply": "",
"tags": [],
"type": "",
"voltage": 0
}'
echo '{
"amperage": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"max_utilization": 0,
"name": "",
"phase": "",
"power_panel": 0,
"rack": 0,
"status": "",
"supply": "",
"tags": [],
"type": "",
"voltage": 0
}' | \
http POST {{baseUrl}}/dcim/power-feeds/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "amperage": 0,\n "comments": "",\n "created": "",\n "custom_fields": {},\n "id": 0,\n "last_updated": "",\n "max_utilization": 0,\n "name": "",\n "phase": "",\n "power_panel": 0,\n "rack": 0,\n "status": "",\n "supply": "",\n "tags": [],\n "type": "",\n "voltage": 0\n}' \
--output-document \
- {{baseUrl}}/dcim/power-feeds/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"amperage": 0,
"comments": "",
"created": "",
"custom_fields": [],
"id": 0,
"last_updated": "",
"max_utilization": 0,
"name": "",
"phase": "",
"power_panel": 0,
"rack": 0,
"status": "",
"supply": "",
"tags": [],
"type": "",
"voltage": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-feeds/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
dcim_power-feeds_delete
{{baseUrl}}/dcim/power-feeds/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-feeds/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/dcim/power-feeds/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/power-feeds/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/dcim/power-feeds/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-feeds/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-feeds/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/dcim/power-feeds/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/dcim/power-feeds/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-feeds/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/power-feeds/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/dcim/power-feeds/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/dcim/power-feeds/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/power-feeds/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-feeds/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/power-feeds/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-feeds/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/power-feeds/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/power-feeds/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/dcim/power-feeds/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/power-feeds/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-feeds/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/power-feeds/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/power-feeds/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-feeds/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/dcim/power-feeds/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-feeds/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/power-feeds/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/power-feeds/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-feeds/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/dcim/power-feeds/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-feeds/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-feeds/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/power-feeds/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/dcim/power-feeds/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/power-feeds/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/dcim/power-feeds/:id/
http DELETE {{baseUrl}}/dcim/power-feeds/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/dcim/power-feeds/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-feeds/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_power-feeds_list
{{baseUrl}}/dcim/power-feeds/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-feeds/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/power-feeds/")
require "http/client"
url = "{{baseUrl}}/dcim/power-feeds/"
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}}/dcim/power-feeds/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-feeds/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-feeds/"
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/dcim/power-feeds/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/power-feeds/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-feeds/"))
.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}}/dcim/power-feeds/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/power-feeds/")
.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}}/dcim/power-feeds/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/power-feeds/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-feeds/';
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}}/dcim/power-feeds/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-feeds/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/power-feeds/',
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}}/dcim/power-feeds/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/power-feeds/');
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}}/dcim/power-feeds/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-feeds/';
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}}/dcim/power-feeds/"]
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}}/dcim/power-feeds/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-feeds/",
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}}/dcim/power-feeds/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-feeds/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/power-feeds/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/power-feeds/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-feeds/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/power-feeds/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-feeds/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-feeds/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/power-feeds/")
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/dcim/power-feeds/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/power-feeds/";
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}}/dcim/power-feeds/
http GET {{baseUrl}}/dcim/power-feeds/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/power-feeds/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-feeds/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
dcim_power-feeds_partial_update
{{baseUrl}}/dcim/power-feeds/:id/
BODY json
{
"amperage": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"max_utilization": 0,
"name": "",
"phase": "",
"power_panel": 0,
"rack": 0,
"status": "",
"supply": "",
"tags": [],
"type": "",
"voltage": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-feeds/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/dcim/power-feeds/:id/" {:content-type :json
:form-params {:amperage 0
:comments ""
:created ""
:custom_fields {}
:id 0
:last_updated ""
:max_utilization 0
:name ""
:phase ""
:power_panel 0
:rack 0
:status ""
:supply ""
:tags []
:type ""
:voltage 0}})
require "http/client"
url = "{{baseUrl}}/dcim/power-feeds/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\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}}/dcim/power-feeds/:id/"),
Content = new StringContent("{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-feeds/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-feeds/:id/"
payload := strings.NewReader("{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\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/dcim/power-feeds/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 272
{
"amperage": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"max_utilization": 0,
"name": "",
"phase": "",
"power_panel": 0,
"rack": 0,
"status": "",
"supply": "",
"tags": [],
"type": "",
"voltage": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/dcim/power-feeds/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-feeds/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/power-feeds/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/dcim/power-feeds/:id/")
.header("content-type", "application/json")
.body("{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\n}")
.asString();
const data = JSON.stringify({
amperage: 0,
comments: '',
created: '',
custom_fields: {},
id: 0,
last_updated: '',
max_utilization: 0,
name: '',
phase: '',
power_panel: 0,
rack: 0,
status: '',
supply: '',
tags: [],
type: '',
voltage: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/dcim/power-feeds/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/power-feeds/:id/',
headers: {'content-type': 'application/json'},
data: {
amperage: 0,
comments: '',
created: '',
custom_fields: {},
id: 0,
last_updated: '',
max_utilization: 0,
name: '',
phase: '',
power_panel: 0,
rack: 0,
status: '',
supply: '',
tags: [],
type: '',
voltage: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-feeds/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"amperage":0,"comments":"","created":"","custom_fields":{},"id":0,"last_updated":"","max_utilization":0,"name":"","phase":"","power_panel":0,"rack":0,"status":"","supply":"","tags":[],"type":"","voltage":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}}/dcim/power-feeds/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "amperage": 0,\n "comments": "",\n "created": "",\n "custom_fields": {},\n "id": 0,\n "last_updated": "",\n "max_utilization": 0,\n "name": "",\n "phase": "",\n "power_panel": 0,\n "rack": 0,\n "status": "",\n "supply": "",\n "tags": [],\n "type": "",\n "voltage": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-feeds/:id/")
.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/dcim/power-feeds/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
amperage: 0,
comments: '',
created: '',
custom_fields: {},
id: 0,
last_updated: '',
max_utilization: 0,
name: '',
phase: '',
power_panel: 0,
rack: 0,
status: '',
supply: '',
tags: [],
type: '',
voltage: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/power-feeds/:id/',
headers: {'content-type': 'application/json'},
body: {
amperage: 0,
comments: '',
created: '',
custom_fields: {},
id: 0,
last_updated: '',
max_utilization: 0,
name: '',
phase: '',
power_panel: 0,
rack: 0,
status: '',
supply: '',
tags: [],
type: '',
voltage: 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('PATCH', '{{baseUrl}}/dcim/power-feeds/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
amperage: 0,
comments: '',
created: '',
custom_fields: {},
id: 0,
last_updated: '',
max_utilization: 0,
name: '',
phase: '',
power_panel: 0,
rack: 0,
status: '',
supply: '',
tags: [],
type: '',
voltage: 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: 'PATCH',
url: '{{baseUrl}}/dcim/power-feeds/:id/',
headers: {'content-type': 'application/json'},
data: {
amperage: 0,
comments: '',
created: '',
custom_fields: {},
id: 0,
last_updated: '',
max_utilization: 0,
name: '',
phase: '',
power_panel: 0,
rack: 0,
status: '',
supply: '',
tags: [],
type: '',
voltage: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-feeds/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"amperage":0,"comments":"","created":"","custom_fields":{},"id":0,"last_updated":"","max_utilization":0,"name":"","phase":"","power_panel":0,"rack":0,"status":"","supply":"","tags":[],"type":"","voltage":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 = @{ @"amperage": @0,
@"comments": @"",
@"created": @"",
@"custom_fields": @{ },
@"id": @0,
@"last_updated": @"",
@"max_utilization": @0,
@"name": @"",
@"phase": @"",
@"power_panel": @0,
@"rack": @0,
@"status": @"",
@"supply": @"",
@"tags": @[ ],
@"type": @"",
@"voltage": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/power-feeds/:id/"]
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}}/dcim/power-feeds/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-feeds/:id/",
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([
'amperage' => 0,
'comments' => '',
'created' => '',
'custom_fields' => [
],
'id' => 0,
'last_updated' => '',
'max_utilization' => 0,
'name' => '',
'phase' => '',
'power_panel' => 0,
'rack' => 0,
'status' => '',
'supply' => '',
'tags' => [
],
'type' => '',
'voltage' => 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('PATCH', '{{baseUrl}}/dcim/power-feeds/:id/', [
'body' => '{
"amperage": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"max_utilization": 0,
"name": "",
"phase": "",
"power_panel": 0,
"rack": 0,
"status": "",
"supply": "",
"tags": [],
"type": "",
"voltage": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-feeds/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'amperage' => 0,
'comments' => '',
'created' => '',
'custom_fields' => [
],
'id' => 0,
'last_updated' => '',
'max_utilization' => 0,
'name' => '',
'phase' => '',
'power_panel' => 0,
'rack' => 0,
'status' => '',
'supply' => '',
'tags' => [
],
'type' => '',
'voltage' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'amperage' => 0,
'comments' => '',
'created' => '',
'custom_fields' => [
],
'id' => 0,
'last_updated' => '',
'max_utilization' => 0,
'name' => '',
'phase' => '',
'power_panel' => 0,
'rack' => 0,
'status' => '',
'supply' => '',
'tags' => [
],
'type' => '',
'voltage' => 0
]));
$request->setRequestUrl('{{baseUrl}}/dcim/power-feeds/:id/');
$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}}/dcim/power-feeds/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"amperage": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"max_utilization": 0,
"name": "",
"phase": "",
"power_panel": 0,
"rack": 0,
"status": "",
"supply": "",
"tags": [],
"type": "",
"voltage": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-feeds/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"amperage": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"max_utilization": 0,
"name": "",
"phase": "",
"power_panel": 0,
"rack": 0,
"status": "",
"supply": "",
"tags": [],
"type": "",
"voltage": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/dcim/power-feeds/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-feeds/:id/"
payload = {
"amperage": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"max_utilization": 0,
"name": "",
"phase": "",
"power_panel": 0,
"rack": 0,
"status": "",
"supply": "",
"tags": [],
"type": "",
"voltage": 0
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-feeds/:id/"
payload <- "{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\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}}/dcim/power-feeds/:id/")
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 \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/dcim/power-feeds/:id/') do |req|
req.body = "{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\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}}/dcim/power-feeds/:id/";
let payload = json!({
"amperage": 0,
"comments": "",
"created": "",
"custom_fields": json!({}),
"id": 0,
"last_updated": "",
"max_utilization": 0,
"name": "",
"phase": "",
"power_panel": 0,
"rack": 0,
"status": "",
"supply": "",
"tags": (),
"type": "",
"voltage": 0
});
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}}/dcim/power-feeds/:id/ \
--header 'content-type: application/json' \
--data '{
"amperage": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"max_utilization": 0,
"name": "",
"phase": "",
"power_panel": 0,
"rack": 0,
"status": "",
"supply": "",
"tags": [],
"type": "",
"voltage": 0
}'
echo '{
"amperage": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"max_utilization": 0,
"name": "",
"phase": "",
"power_panel": 0,
"rack": 0,
"status": "",
"supply": "",
"tags": [],
"type": "",
"voltage": 0
}' | \
http PATCH {{baseUrl}}/dcim/power-feeds/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "amperage": 0,\n "comments": "",\n "created": "",\n "custom_fields": {},\n "id": 0,\n "last_updated": "",\n "max_utilization": 0,\n "name": "",\n "phase": "",\n "power_panel": 0,\n "rack": 0,\n "status": "",\n "supply": "",\n "tags": [],\n "type": "",\n "voltage": 0\n}' \
--output-document \
- {{baseUrl}}/dcim/power-feeds/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"amperage": 0,
"comments": "",
"created": "",
"custom_fields": [],
"id": 0,
"last_updated": "",
"max_utilization": 0,
"name": "",
"phase": "",
"power_panel": 0,
"rack": 0,
"status": "",
"supply": "",
"tags": [],
"type": "",
"voltage": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-feeds/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_power-feeds_read
{{baseUrl}}/dcim/power-feeds/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-feeds/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/power-feeds/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/power-feeds/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/dcim/power-feeds/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-feeds/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-feeds/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/dcim/power-feeds/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/power-feeds/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-feeds/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/power-feeds/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/power-feeds/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/dcim/power-feeds/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/power-feeds/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-feeds/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/power-feeds/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-feeds/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/power-feeds/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/dcim/power-feeds/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/power-feeds/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/dcim/power-feeds/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-feeds/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/power-feeds/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/power-feeds/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-feeds/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/dcim/power-feeds/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-feeds/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/power-feeds/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/power-feeds/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-feeds/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/power-feeds/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-feeds/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-feeds/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/power-feeds/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/dcim/power-feeds/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/power-feeds/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/dcim/power-feeds/:id/
http GET {{baseUrl}}/dcim/power-feeds/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/power-feeds/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-feeds/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
dcim_power-feeds_update
{{baseUrl}}/dcim/power-feeds/:id/
BODY json
{
"amperage": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"max_utilization": 0,
"name": "",
"phase": "",
"power_panel": 0,
"rack": 0,
"status": "",
"supply": "",
"tags": [],
"type": "",
"voltage": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-feeds/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/dcim/power-feeds/:id/" {:content-type :json
:form-params {:amperage 0
:comments ""
:created ""
:custom_fields {}
:id 0
:last_updated ""
:max_utilization 0
:name ""
:phase ""
:power_panel 0
:rack 0
:status ""
:supply ""
:tags []
:type ""
:voltage 0}})
require "http/client"
url = "{{baseUrl}}/dcim/power-feeds/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\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}}/dcim/power-feeds/:id/"),
Content = new StringContent("{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-feeds/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-feeds/:id/"
payload := strings.NewReader("{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\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/dcim/power-feeds/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 272
{
"amperage": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"max_utilization": 0,
"name": "",
"phase": "",
"power_panel": 0,
"rack": 0,
"status": "",
"supply": "",
"tags": [],
"type": "",
"voltage": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/dcim/power-feeds/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-feeds/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/power-feeds/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/dcim/power-feeds/:id/")
.header("content-type", "application/json")
.body("{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\n}")
.asString();
const data = JSON.stringify({
amperage: 0,
comments: '',
created: '',
custom_fields: {},
id: 0,
last_updated: '',
max_utilization: 0,
name: '',
phase: '',
power_panel: 0,
rack: 0,
status: '',
supply: '',
tags: [],
type: '',
voltage: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/dcim/power-feeds/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/power-feeds/:id/',
headers: {'content-type': 'application/json'},
data: {
amperage: 0,
comments: '',
created: '',
custom_fields: {},
id: 0,
last_updated: '',
max_utilization: 0,
name: '',
phase: '',
power_panel: 0,
rack: 0,
status: '',
supply: '',
tags: [],
type: '',
voltage: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-feeds/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"amperage":0,"comments":"","created":"","custom_fields":{},"id":0,"last_updated":"","max_utilization":0,"name":"","phase":"","power_panel":0,"rack":0,"status":"","supply":"","tags":[],"type":"","voltage":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}}/dcim/power-feeds/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "amperage": 0,\n "comments": "",\n "created": "",\n "custom_fields": {},\n "id": 0,\n "last_updated": "",\n "max_utilization": 0,\n "name": "",\n "phase": "",\n "power_panel": 0,\n "rack": 0,\n "status": "",\n "supply": "",\n "tags": [],\n "type": "",\n "voltage": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-feeds/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/power-feeds/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
amperage: 0,
comments: '',
created: '',
custom_fields: {},
id: 0,
last_updated: '',
max_utilization: 0,
name: '',
phase: '',
power_panel: 0,
rack: 0,
status: '',
supply: '',
tags: [],
type: '',
voltage: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/power-feeds/:id/',
headers: {'content-type': 'application/json'},
body: {
amperage: 0,
comments: '',
created: '',
custom_fields: {},
id: 0,
last_updated: '',
max_utilization: 0,
name: '',
phase: '',
power_panel: 0,
rack: 0,
status: '',
supply: '',
tags: [],
type: '',
voltage: 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('PUT', '{{baseUrl}}/dcim/power-feeds/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
amperage: 0,
comments: '',
created: '',
custom_fields: {},
id: 0,
last_updated: '',
max_utilization: 0,
name: '',
phase: '',
power_panel: 0,
rack: 0,
status: '',
supply: '',
tags: [],
type: '',
voltage: 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: 'PUT',
url: '{{baseUrl}}/dcim/power-feeds/:id/',
headers: {'content-type': 'application/json'},
data: {
amperage: 0,
comments: '',
created: '',
custom_fields: {},
id: 0,
last_updated: '',
max_utilization: 0,
name: '',
phase: '',
power_panel: 0,
rack: 0,
status: '',
supply: '',
tags: [],
type: '',
voltage: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-feeds/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"amperage":0,"comments":"","created":"","custom_fields":{},"id":0,"last_updated":"","max_utilization":0,"name":"","phase":"","power_panel":0,"rack":0,"status":"","supply":"","tags":[],"type":"","voltage":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 = @{ @"amperage": @0,
@"comments": @"",
@"created": @"",
@"custom_fields": @{ },
@"id": @0,
@"last_updated": @"",
@"max_utilization": @0,
@"name": @"",
@"phase": @"",
@"power_panel": @0,
@"rack": @0,
@"status": @"",
@"supply": @"",
@"tags": @[ ],
@"type": @"",
@"voltage": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/power-feeds/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/power-feeds/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-feeds/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'amperage' => 0,
'comments' => '',
'created' => '',
'custom_fields' => [
],
'id' => 0,
'last_updated' => '',
'max_utilization' => 0,
'name' => '',
'phase' => '',
'power_panel' => 0,
'rack' => 0,
'status' => '',
'supply' => '',
'tags' => [
],
'type' => '',
'voltage' => 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('PUT', '{{baseUrl}}/dcim/power-feeds/:id/', [
'body' => '{
"amperage": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"max_utilization": 0,
"name": "",
"phase": "",
"power_panel": 0,
"rack": 0,
"status": "",
"supply": "",
"tags": [],
"type": "",
"voltage": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-feeds/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'amperage' => 0,
'comments' => '',
'created' => '',
'custom_fields' => [
],
'id' => 0,
'last_updated' => '',
'max_utilization' => 0,
'name' => '',
'phase' => '',
'power_panel' => 0,
'rack' => 0,
'status' => '',
'supply' => '',
'tags' => [
],
'type' => '',
'voltage' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'amperage' => 0,
'comments' => '',
'created' => '',
'custom_fields' => [
],
'id' => 0,
'last_updated' => '',
'max_utilization' => 0,
'name' => '',
'phase' => '',
'power_panel' => 0,
'rack' => 0,
'status' => '',
'supply' => '',
'tags' => [
],
'type' => '',
'voltage' => 0
]));
$request->setRequestUrl('{{baseUrl}}/dcim/power-feeds/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/power-feeds/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"amperage": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"max_utilization": 0,
"name": "",
"phase": "",
"power_panel": 0,
"rack": 0,
"status": "",
"supply": "",
"tags": [],
"type": "",
"voltage": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-feeds/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"amperage": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"max_utilization": 0,
"name": "",
"phase": "",
"power_panel": 0,
"rack": 0,
"status": "",
"supply": "",
"tags": [],
"type": "",
"voltage": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/dcim/power-feeds/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-feeds/:id/"
payload = {
"amperage": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"max_utilization": 0,
"name": "",
"phase": "",
"power_panel": 0,
"rack": 0,
"status": "",
"supply": "",
"tags": [],
"type": "",
"voltage": 0
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-feeds/:id/"
payload <- "{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\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}}/dcim/power-feeds/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/dcim/power-feeds/:id/') do |req|
req.body = "{\n \"amperage\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"id\": 0,\n \"last_updated\": \"\",\n \"max_utilization\": 0,\n \"name\": \"\",\n \"phase\": \"\",\n \"power_panel\": 0,\n \"rack\": 0,\n \"status\": \"\",\n \"supply\": \"\",\n \"tags\": [],\n \"type\": \"\",\n \"voltage\": 0\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}}/dcim/power-feeds/:id/";
let payload = json!({
"amperage": 0,
"comments": "",
"created": "",
"custom_fields": json!({}),
"id": 0,
"last_updated": "",
"max_utilization": 0,
"name": "",
"phase": "",
"power_panel": 0,
"rack": 0,
"status": "",
"supply": "",
"tags": (),
"type": "",
"voltage": 0
});
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}}/dcim/power-feeds/:id/ \
--header 'content-type: application/json' \
--data '{
"amperage": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"max_utilization": 0,
"name": "",
"phase": "",
"power_panel": 0,
"rack": 0,
"status": "",
"supply": "",
"tags": [],
"type": "",
"voltage": 0
}'
echo '{
"amperage": 0,
"comments": "",
"created": "",
"custom_fields": {},
"id": 0,
"last_updated": "",
"max_utilization": 0,
"name": "",
"phase": "",
"power_panel": 0,
"rack": 0,
"status": "",
"supply": "",
"tags": [],
"type": "",
"voltage": 0
}' | \
http PUT {{baseUrl}}/dcim/power-feeds/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "amperage": 0,\n "comments": "",\n "created": "",\n "custom_fields": {},\n "id": 0,\n "last_updated": "",\n "max_utilization": 0,\n "name": "",\n "phase": "",\n "power_panel": 0,\n "rack": 0,\n "status": "",\n "supply": "",\n "tags": [],\n "type": "",\n "voltage": 0\n}' \
--output-document \
- {{baseUrl}}/dcim/power-feeds/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"amperage": 0,
"comments": "",
"created": "",
"custom_fields": [],
"id": 0,
"last_updated": "",
"max_utilization": 0,
"name": "",
"phase": "",
"power_panel": 0,
"rack": 0,
"status": "",
"supply": "",
"tags": [],
"type": "",
"voltage": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-feeds/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
dcim_power-outlet-templates_create
{{baseUrl}}/dcim/power-outlet-templates/
BODY json
{
"device_type": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-outlet-templates/");
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 \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/dcim/power-outlet-templates/" {:content-type :json
:form-params {:device_type 0
:feed_leg ""
:id 0
:name ""
:power_port 0
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/power-outlet-templates/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/dcim/power-outlet-templates/"),
Content = new StringContent("{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-outlet-templates/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-outlet-templates/"
payload := strings.NewReader("{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/dcim/power-outlet-templates/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 98
{
"device_type": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/dcim/power-outlet-templates/")
.setHeader("content-type", "application/json")
.setBody("{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-outlet-templates/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/power-outlet-templates/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/dcim/power-outlet-templates/")
.header("content-type", "application/json")
.body("{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
device_type: 0,
feed_leg: '',
id: 0,
name: '',
power_port: 0,
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/dcim/power-outlet-templates/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/power-outlet-templates/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, feed_leg: '', id: 0, name: '', power_port: 0, type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-outlet-templates/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"feed_leg":"","id":0,"name":"","power_port":0,"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/power-outlet-templates/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "device_type": 0,\n "feed_leg": "",\n "id": 0,\n "name": "",\n "power_port": 0,\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-outlet-templates/")
.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/dcim/power-outlet-templates/',
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({device_type: 0, feed_leg: '', id: 0, name: '', power_port: 0, type: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/power-outlet-templates/',
headers: {'content-type': 'application/json'},
body: {device_type: 0, feed_leg: '', id: 0, name: '', power_port: 0, type: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/dcim/power-outlet-templates/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
device_type: 0,
feed_leg: '',
id: 0,
name: '',
power_port: 0,
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/power-outlet-templates/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, feed_leg: '', id: 0, name: '', power_port: 0, type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-outlet-templates/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"feed_leg":"","id":0,"name":"","power_port":0,"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"device_type": @0,
@"feed_leg": @"",
@"id": @0,
@"name": @"",
@"power_port": @0,
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/power-outlet-templates/"]
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}}/dcim/power-outlet-templates/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-outlet-templates/",
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([
'device_type' => 0,
'feed_leg' => '',
'id' => 0,
'name' => '',
'power_port' => 0,
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/dcim/power-outlet-templates/', [
'body' => '{
"device_type": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-outlet-templates/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'device_type' => 0,
'feed_leg' => '',
'id' => 0,
'name' => '',
'power_port' => 0,
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'device_type' => 0,
'feed_leg' => '',
'id' => 0,
'name' => '',
'power_port' => 0,
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/power-outlet-templates/');
$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}}/dcim/power-outlet-templates/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-outlet-templates/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/dcim/power-outlet-templates/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-outlet-templates/"
payload = {
"device_type": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-outlet-templates/"
payload <- "{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/power-outlet-templates/")
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 \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/dcim/power-outlet-templates/') do |req|
req.body = "{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/power-outlet-templates/";
let payload = json!({
"device_type": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/dcim/power-outlet-templates/ \
--header 'content-type: application/json' \
--data '{
"device_type": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"type": ""
}'
echo '{
"device_type": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"type": ""
}' | \
http POST {{baseUrl}}/dcim/power-outlet-templates/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "device_type": 0,\n "feed_leg": "",\n "id": 0,\n "name": "",\n "power_port": 0,\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/power-outlet-templates/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"device_type": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-outlet-templates/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
dcim_power-outlet-templates_delete
{{baseUrl}}/dcim/power-outlet-templates/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-outlet-templates/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/dcim/power-outlet-templates/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/power-outlet-templates/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/dcim/power-outlet-templates/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-outlet-templates/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-outlet-templates/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/dcim/power-outlet-templates/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/dcim/power-outlet-templates/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-outlet-templates/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/power-outlet-templates/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/dcim/power-outlet-templates/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/dcim/power-outlet-templates/:id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/dcim/power-outlet-templates/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-outlet-templates/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/power-outlet-templates/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-outlet-templates/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/power-outlet-templates/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/dcim/power-outlet-templates/:id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/dcim/power-outlet-templates/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/dcim/power-outlet-templates/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-outlet-templates/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/power-outlet-templates/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/power-outlet-templates/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-outlet-templates/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/dcim/power-outlet-templates/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-outlet-templates/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/power-outlet-templates/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/power-outlet-templates/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-outlet-templates/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/dcim/power-outlet-templates/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-outlet-templates/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-outlet-templates/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/power-outlet-templates/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/dcim/power-outlet-templates/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/power-outlet-templates/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/dcim/power-outlet-templates/:id/
http DELETE {{baseUrl}}/dcim/power-outlet-templates/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/dcim/power-outlet-templates/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-outlet-templates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_power-outlet-templates_list
{{baseUrl}}/dcim/power-outlet-templates/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-outlet-templates/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/power-outlet-templates/")
require "http/client"
url = "{{baseUrl}}/dcim/power-outlet-templates/"
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}}/dcim/power-outlet-templates/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-outlet-templates/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-outlet-templates/"
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/dcim/power-outlet-templates/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/power-outlet-templates/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-outlet-templates/"))
.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}}/dcim/power-outlet-templates/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/power-outlet-templates/")
.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}}/dcim/power-outlet-templates/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/power-outlet-templates/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-outlet-templates/';
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}}/dcim/power-outlet-templates/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-outlet-templates/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/power-outlet-templates/',
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}}/dcim/power-outlet-templates/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/power-outlet-templates/');
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}}/dcim/power-outlet-templates/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-outlet-templates/';
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}}/dcim/power-outlet-templates/"]
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}}/dcim/power-outlet-templates/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-outlet-templates/",
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}}/dcim/power-outlet-templates/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-outlet-templates/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/power-outlet-templates/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/power-outlet-templates/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-outlet-templates/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/power-outlet-templates/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-outlet-templates/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-outlet-templates/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/power-outlet-templates/")
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/dcim/power-outlet-templates/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/power-outlet-templates/";
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}}/dcim/power-outlet-templates/
http GET {{baseUrl}}/dcim/power-outlet-templates/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/power-outlet-templates/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-outlet-templates/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
dcim_power-outlet-templates_partial_update
{{baseUrl}}/dcim/power-outlet-templates/:id/
BODY json
{
"device_type": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-outlet-templates/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/dcim/power-outlet-templates/:id/" {:content-type :json
:form-params {:device_type 0
:feed_leg ""
:id 0
:name ""
:power_port 0
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/power-outlet-templates/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\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}}/dcim/power-outlet-templates/:id/"),
Content = new StringContent("{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-outlet-templates/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-outlet-templates/:id/"
payload := strings.NewReader("{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\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/dcim/power-outlet-templates/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 98
{
"device_type": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/dcim/power-outlet-templates/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-outlet-templates/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/power-outlet-templates/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/dcim/power-outlet-templates/:id/")
.header("content-type", "application/json")
.body("{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
device_type: 0,
feed_leg: '',
id: 0,
name: '',
power_port: 0,
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/dcim/power-outlet-templates/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/power-outlet-templates/:id/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, feed_leg: '', id: 0, name: '', power_port: 0, type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-outlet-templates/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"feed_leg":"","id":0,"name":"","power_port":0,"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/power-outlet-templates/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "device_type": 0,\n "feed_leg": "",\n "id": 0,\n "name": "",\n "power_port": 0,\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-outlet-templates/:id/")
.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/dcim/power-outlet-templates/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({device_type: 0, feed_leg: '', id: 0, name: '', power_port: 0, type: ''}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/power-outlet-templates/:id/',
headers: {'content-type': 'application/json'},
body: {device_type: 0, feed_leg: '', id: 0, name: '', power_port: 0, type: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/dcim/power-outlet-templates/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
device_type: 0,
feed_leg: '',
id: 0,
name: '',
power_port: 0,
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/power-outlet-templates/:id/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, feed_leg: '', id: 0, name: '', power_port: 0, type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-outlet-templates/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"feed_leg":"","id":0,"name":"","power_port":0,"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"device_type": @0,
@"feed_leg": @"",
@"id": @0,
@"name": @"",
@"power_port": @0,
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/power-outlet-templates/:id/"]
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}}/dcim/power-outlet-templates/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-outlet-templates/:id/",
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([
'device_type' => 0,
'feed_leg' => '',
'id' => 0,
'name' => '',
'power_port' => 0,
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/dcim/power-outlet-templates/:id/', [
'body' => '{
"device_type": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-outlet-templates/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'device_type' => 0,
'feed_leg' => '',
'id' => 0,
'name' => '',
'power_port' => 0,
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'device_type' => 0,
'feed_leg' => '',
'id' => 0,
'name' => '',
'power_port' => 0,
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/power-outlet-templates/:id/');
$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}}/dcim/power-outlet-templates/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-outlet-templates/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/dcim/power-outlet-templates/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-outlet-templates/:id/"
payload = {
"device_type": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-outlet-templates/:id/"
payload <- "{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\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}}/dcim/power-outlet-templates/:id/")
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 \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/dcim/power-outlet-templates/:id/') do |req|
req.body = "{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\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}}/dcim/power-outlet-templates/:id/";
let payload = json!({
"device_type": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/dcim/power-outlet-templates/:id/ \
--header 'content-type: application/json' \
--data '{
"device_type": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"type": ""
}'
echo '{
"device_type": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"type": ""
}' | \
http PATCH {{baseUrl}}/dcim/power-outlet-templates/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "device_type": 0,\n "feed_leg": "",\n "id": 0,\n "name": "",\n "power_port": 0,\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/power-outlet-templates/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"device_type": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-outlet-templates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_power-outlet-templates_read
{{baseUrl}}/dcim/power-outlet-templates/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-outlet-templates/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/power-outlet-templates/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/power-outlet-templates/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/dcim/power-outlet-templates/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-outlet-templates/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-outlet-templates/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/dcim/power-outlet-templates/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/power-outlet-templates/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-outlet-templates/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/power-outlet-templates/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/power-outlet-templates/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/dcim/power-outlet-templates/:id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/dcim/power-outlet-templates/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-outlet-templates/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/power-outlet-templates/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-outlet-templates/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/power-outlet-templates/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/dcim/power-outlet-templates/:id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/power-outlet-templates/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/dcim/power-outlet-templates/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-outlet-templates/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/power-outlet-templates/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/power-outlet-templates/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-outlet-templates/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/dcim/power-outlet-templates/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-outlet-templates/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/power-outlet-templates/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/power-outlet-templates/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-outlet-templates/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/power-outlet-templates/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-outlet-templates/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-outlet-templates/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/power-outlet-templates/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/dcim/power-outlet-templates/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/power-outlet-templates/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/dcim/power-outlet-templates/:id/
http GET {{baseUrl}}/dcim/power-outlet-templates/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/power-outlet-templates/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-outlet-templates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
dcim_power-outlet-templates_update
{{baseUrl}}/dcim/power-outlet-templates/:id/
BODY json
{
"device_type": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-outlet-templates/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/dcim/power-outlet-templates/:id/" {:content-type :json
:form-params {:device_type 0
:feed_leg ""
:id 0
:name ""
:power_port 0
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/power-outlet-templates/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\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}}/dcim/power-outlet-templates/:id/"),
Content = new StringContent("{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-outlet-templates/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-outlet-templates/:id/"
payload := strings.NewReader("{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\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/dcim/power-outlet-templates/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 98
{
"device_type": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/dcim/power-outlet-templates/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-outlet-templates/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/power-outlet-templates/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/dcim/power-outlet-templates/:id/")
.header("content-type", "application/json")
.body("{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
device_type: 0,
feed_leg: '',
id: 0,
name: '',
power_port: 0,
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/dcim/power-outlet-templates/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/power-outlet-templates/:id/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, feed_leg: '', id: 0, name: '', power_port: 0, type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-outlet-templates/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"feed_leg":"","id":0,"name":"","power_port":0,"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/power-outlet-templates/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "device_type": 0,\n "feed_leg": "",\n "id": 0,\n "name": "",\n "power_port": 0,\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-outlet-templates/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/power-outlet-templates/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({device_type: 0, feed_leg: '', id: 0, name: '', power_port: 0, type: ''}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/power-outlet-templates/:id/',
headers: {'content-type': 'application/json'},
body: {device_type: 0, feed_leg: '', id: 0, name: '', power_port: 0, type: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/dcim/power-outlet-templates/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
device_type: 0,
feed_leg: '',
id: 0,
name: '',
power_port: 0,
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/power-outlet-templates/:id/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, feed_leg: '', id: 0, name: '', power_port: 0, type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-outlet-templates/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"feed_leg":"","id":0,"name":"","power_port":0,"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"device_type": @0,
@"feed_leg": @"",
@"id": @0,
@"name": @"",
@"power_port": @0,
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/power-outlet-templates/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/power-outlet-templates/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-outlet-templates/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'device_type' => 0,
'feed_leg' => '',
'id' => 0,
'name' => '',
'power_port' => 0,
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/dcim/power-outlet-templates/:id/', [
'body' => '{
"device_type": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-outlet-templates/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'device_type' => 0,
'feed_leg' => '',
'id' => 0,
'name' => '',
'power_port' => 0,
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'device_type' => 0,
'feed_leg' => '',
'id' => 0,
'name' => '',
'power_port' => 0,
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/power-outlet-templates/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/power-outlet-templates/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-outlet-templates/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/dcim/power-outlet-templates/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-outlet-templates/:id/"
payload = {
"device_type": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-outlet-templates/:id/"
payload <- "{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\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}}/dcim/power-outlet-templates/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/dcim/power-outlet-templates/:id/') do |req|
req.body = "{\n \"device_type\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"type\": \"\"\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}}/dcim/power-outlet-templates/:id/";
let payload = json!({
"device_type": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/dcim/power-outlet-templates/:id/ \
--header 'content-type: application/json' \
--data '{
"device_type": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"type": ""
}'
echo '{
"device_type": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"type": ""
}' | \
http PUT {{baseUrl}}/dcim/power-outlet-templates/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "device_type": 0,\n "feed_leg": "",\n "id": 0,\n "name": "",\n "power_port": 0,\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/power-outlet-templates/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"device_type": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-outlet-templates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
dcim_power-outlets_create
{{baseUrl}}/dcim/power-outlets/
BODY json
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"tags": [],
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-outlets/");
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 \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/dcim/power-outlets/" {:content-type :json
:form-params {:cable {:id 0
:label ""
:url ""}
:connected_endpoint {}
:connected_endpoint_type ""
:connection_status false
:description ""
:device 0
:feed_leg ""
:id 0
:name ""
:power_port 0
:tags []
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/power-outlets/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/dcim/power-outlets/"),
Content = new StringContent("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-outlets/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-outlets/"
payload := strings.NewReader("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/dcim/power-outlets/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 281
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"tags": [],
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/dcim/power-outlets/")
.setHeader("content-type", "application/json")
.setBody("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-outlets/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/power-outlets/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/dcim/power-outlets/")
.header("content-type", "application/json")
.body("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
cable: {
id: 0,
label: '',
url: ''
},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
feed_leg: '',
id: 0,
name: '',
power_port: 0,
tags: [],
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/dcim/power-outlets/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/power-outlets/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
feed_leg: '',
id: 0,
name: '',
power_port: 0,
tags: [],
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-outlets/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"connected_endpoint":{},"connected_endpoint_type":"","connection_status":false,"description":"","device":0,"feed_leg":"","id":0,"name":"","power_port":0,"tags":[],"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/power-outlets/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "connected_endpoint": {},\n "connected_endpoint_type": "",\n "connection_status": false,\n "description": "",\n "device": 0,\n "feed_leg": "",\n "id": 0,\n "name": "",\n "power_port": 0,\n "tags": [],\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-outlets/")
.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/dcim/power-outlets/',
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({
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
feed_leg: '',
id: 0,
name: '',
power_port: 0,
tags: [],
type: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/power-outlets/',
headers: {'content-type': 'application/json'},
body: {
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
feed_leg: '',
id: 0,
name: '',
power_port: 0,
tags: [],
type: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/dcim/power-outlets/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cable: {
id: 0,
label: '',
url: ''
},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
feed_leg: '',
id: 0,
name: '',
power_port: 0,
tags: [],
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/power-outlets/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
feed_leg: '',
id: 0,
name: '',
power_port: 0,
tags: [],
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-outlets/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"connected_endpoint":{},"connected_endpoint_type":"","connection_status":false,"description":"","device":0,"feed_leg":"","id":0,"name":"","power_port":0,"tags":[],"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"cable": @{ @"id": @0, @"label": @"", @"url": @"" },
@"connected_endpoint": @{ },
@"connected_endpoint_type": @"",
@"connection_status": @NO,
@"description": @"",
@"device": @0,
@"feed_leg": @"",
@"id": @0,
@"name": @"",
@"power_port": @0,
@"tags": @[ ],
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/power-outlets/"]
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}}/dcim/power-outlets/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-outlets/",
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([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'device' => 0,
'feed_leg' => '',
'id' => 0,
'name' => '',
'power_port' => 0,
'tags' => [
],
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/dcim/power-outlets/', [
'body' => '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"tags": [],
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-outlets/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'device' => 0,
'feed_leg' => '',
'id' => 0,
'name' => '',
'power_port' => 0,
'tags' => [
],
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'device' => 0,
'feed_leg' => '',
'id' => 0,
'name' => '',
'power_port' => 0,
'tags' => [
],
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/power-outlets/');
$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}}/dcim/power-outlets/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"tags": [],
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-outlets/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"tags": [],
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/dcim/power-outlets/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-outlets/"
payload = {
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": False,
"description": "",
"device": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"tags": [],
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-outlets/"
payload <- "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/power-outlets/")
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 \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/dcim/power-outlets/') do |req|
req.body = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/power-outlets/";
let payload = json!({
"cable": json!({
"id": 0,
"label": "",
"url": ""
}),
"connected_endpoint": json!({}),
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"tags": (),
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/dcim/power-outlets/ \
--header 'content-type: application/json' \
--data '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"tags": [],
"type": ""
}'
echo '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"tags": [],
"type": ""
}' | \
http POST {{baseUrl}}/dcim/power-outlets/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "connected_endpoint": {},\n "connected_endpoint_type": "",\n "connection_status": false,\n "description": "",\n "device": 0,\n "feed_leg": "",\n "id": 0,\n "name": "",\n "power_port": 0,\n "tags": [],\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/power-outlets/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cable": [
"id": 0,
"label": "",
"url": ""
],
"connected_endpoint": [],
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"tags": [],
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-outlets/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
dcim_power-outlets_delete
{{baseUrl}}/dcim/power-outlets/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-outlets/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/dcim/power-outlets/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/power-outlets/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/dcim/power-outlets/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-outlets/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-outlets/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/dcim/power-outlets/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/dcim/power-outlets/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-outlets/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/power-outlets/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/dcim/power-outlets/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/dcim/power-outlets/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/power-outlets/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-outlets/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/power-outlets/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-outlets/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/power-outlets/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/power-outlets/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/dcim/power-outlets/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/power-outlets/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-outlets/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/power-outlets/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/power-outlets/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-outlets/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/dcim/power-outlets/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-outlets/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/power-outlets/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/power-outlets/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-outlets/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/dcim/power-outlets/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-outlets/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-outlets/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/power-outlets/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/dcim/power-outlets/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/power-outlets/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/dcim/power-outlets/:id/
http DELETE {{baseUrl}}/dcim/power-outlets/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/dcim/power-outlets/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-outlets/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_power-outlets_list
{{baseUrl}}/dcim/power-outlets/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-outlets/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/power-outlets/")
require "http/client"
url = "{{baseUrl}}/dcim/power-outlets/"
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}}/dcim/power-outlets/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-outlets/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-outlets/"
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/dcim/power-outlets/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/power-outlets/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-outlets/"))
.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}}/dcim/power-outlets/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/power-outlets/")
.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}}/dcim/power-outlets/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/power-outlets/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-outlets/';
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}}/dcim/power-outlets/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-outlets/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/power-outlets/',
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}}/dcim/power-outlets/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/power-outlets/');
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}}/dcim/power-outlets/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-outlets/';
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}}/dcim/power-outlets/"]
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}}/dcim/power-outlets/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-outlets/",
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}}/dcim/power-outlets/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-outlets/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/power-outlets/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/power-outlets/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-outlets/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/power-outlets/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-outlets/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-outlets/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/power-outlets/")
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/dcim/power-outlets/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/power-outlets/";
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}}/dcim/power-outlets/
http GET {{baseUrl}}/dcim/power-outlets/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/power-outlets/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-outlets/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
dcim_power-outlets_partial_update
{{baseUrl}}/dcim/power-outlets/:id/
BODY json
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"tags": [],
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-outlets/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/dcim/power-outlets/:id/" {:content-type :json
:form-params {:cable {:id 0
:label ""
:url ""}
:connected_endpoint {}
:connected_endpoint_type ""
:connection_status false
:description ""
:device 0
:feed_leg ""
:id 0
:name ""
:power_port 0
:tags []
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/power-outlets/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\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}}/dcim/power-outlets/:id/"),
Content = new StringContent("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-outlets/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-outlets/:id/"
payload := strings.NewReader("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\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/dcim/power-outlets/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 281
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"tags": [],
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/dcim/power-outlets/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-outlets/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/power-outlets/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/dcim/power-outlets/:id/")
.header("content-type", "application/json")
.body("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
cable: {
id: 0,
label: '',
url: ''
},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
feed_leg: '',
id: 0,
name: '',
power_port: 0,
tags: [],
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/dcim/power-outlets/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/power-outlets/:id/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
feed_leg: '',
id: 0,
name: '',
power_port: 0,
tags: [],
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-outlets/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"connected_endpoint":{},"connected_endpoint_type":"","connection_status":false,"description":"","device":0,"feed_leg":"","id":0,"name":"","power_port":0,"tags":[],"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/power-outlets/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "connected_endpoint": {},\n "connected_endpoint_type": "",\n "connection_status": false,\n "description": "",\n "device": 0,\n "feed_leg": "",\n "id": 0,\n "name": "",\n "power_port": 0,\n "tags": [],\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-outlets/:id/")
.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/dcim/power-outlets/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
feed_leg: '',
id: 0,
name: '',
power_port: 0,
tags: [],
type: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/power-outlets/:id/',
headers: {'content-type': 'application/json'},
body: {
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
feed_leg: '',
id: 0,
name: '',
power_port: 0,
tags: [],
type: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/dcim/power-outlets/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cable: {
id: 0,
label: '',
url: ''
},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
feed_leg: '',
id: 0,
name: '',
power_port: 0,
tags: [],
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/power-outlets/:id/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
feed_leg: '',
id: 0,
name: '',
power_port: 0,
tags: [],
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-outlets/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"connected_endpoint":{},"connected_endpoint_type":"","connection_status":false,"description":"","device":0,"feed_leg":"","id":0,"name":"","power_port":0,"tags":[],"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"cable": @{ @"id": @0, @"label": @"", @"url": @"" },
@"connected_endpoint": @{ },
@"connected_endpoint_type": @"",
@"connection_status": @NO,
@"description": @"",
@"device": @0,
@"feed_leg": @"",
@"id": @0,
@"name": @"",
@"power_port": @0,
@"tags": @[ ],
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/power-outlets/:id/"]
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}}/dcim/power-outlets/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-outlets/:id/",
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([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'device' => 0,
'feed_leg' => '',
'id' => 0,
'name' => '',
'power_port' => 0,
'tags' => [
],
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/dcim/power-outlets/:id/', [
'body' => '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"tags": [],
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-outlets/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'device' => 0,
'feed_leg' => '',
'id' => 0,
'name' => '',
'power_port' => 0,
'tags' => [
],
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'device' => 0,
'feed_leg' => '',
'id' => 0,
'name' => '',
'power_port' => 0,
'tags' => [
],
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/power-outlets/:id/');
$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}}/dcim/power-outlets/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"tags": [],
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-outlets/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"tags": [],
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/dcim/power-outlets/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-outlets/:id/"
payload = {
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": False,
"description": "",
"device": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"tags": [],
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-outlets/:id/"
payload <- "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\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}}/dcim/power-outlets/:id/")
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 \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/dcim/power-outlets/:id/') do |req|
req.body = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\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}}/dcim/power-outlets/:id/";
let payload = json!({
"cable": json!({
"id": 0,
"label": "",
"url": ""
}),
"connected_endpoint": json!({}),
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"tags": (),
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/dcim/power-outlets/:id/ \
--header 'content-type: application/json' \
--data '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"tags": [],
"type": ""
}'
echo '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"tags": [],
"type": ""
}' | \
http PATCH {{baseUrl}}/dcim/power-outlets/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "connected_endpoint": {},\n "connected_endpoint_type": "",\n "connection_status": false,\n "description": "",\n "device": 0,\n "feed_leg": "",\n "id": 0,\n "name": "",\n "power_port": 0,\n "tags": [],\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/power-outlets/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cable": [
"id": 0,
"label": "",
"url": ""
],
"connected_endpoint": [],
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"tags": [],
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-outlets/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_power-outlets_read
{{baseUrl}}/dcim/power-outlets/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-outlets/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/power-outlets/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/power-outlets/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/dcim/power-outlets/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-outlets/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-outlets/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/dcim/power-outlets/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/power-outlets/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-outlets/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/power-outlets/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/power-outlets/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/dcim/power-outlets/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/power-outlets/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-outlets/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/power-outlets/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-outlets/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/power-outlets/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/dcim/power-outlets/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/power-outlets/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/dcim/power-outlets/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-outlets/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/power-outlets/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/power-outlets/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-outlets/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/dcim/power-outlets/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-outlets/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/power-outlets/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/power-outlets/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-outlets/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/power-outlets/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-outlets/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-outlets/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/power-outlets/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/dcim/power-outlets/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/power-outlets/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/dcim/power-outlets/:id/
http GET {{baseUrl}}/dcim/power-outlets/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/power-outlets/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-outlets/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_power-outlets_trace
{{baseUrl}}/dcim/power-outlets/:id/trace/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-outlets/:id/trace/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/power-outlets/:id/trace/")
require "http/client"
url = "{{baseUrl}}/dcim/power-outlets/:id/trace/"
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}}/dcim/power-outlets/:id/trace/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-outlets/:id/trace/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-outlets/:id/trace/"
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/dcim/power-outlets/:id/trace/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/power-outlets/:id/trace/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-outlets/:id/trace/"))
.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}}/dcim/power-outlets/:id/trace/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/power-outlets/:id/trace/")
.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}}/dcim/power-outlets/:id/trace/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/dcim/power-outlets/:id/trace/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-outlets/:id/trace/';
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}}/dcim/power-outlets/:id/trace/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-outlets/:id/trace/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/power-outlets/:id/trace/',
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}}/dcim/power-outlets/:id/trace/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/power-outlets/:id/trace/');
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}}/dcim/power-outlets/:id/trace/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-outlets/:id/trace/';
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}}/dcim/power-outlets/:id/trace/"]
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}}/dcim/power-outlets/:id/trace/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-outlets/:id/trace/",
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}}/dcim/power-outlets/:id/trace/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-outlets/:id/trace/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/power-outlets/:id/trace/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/power-outlets/:id/trace/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-outlets/:id/trace/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/power-outlets/:id/trace/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-outlets/:id/trace/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-outlets/:id/trace/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/power-outlets/:id/trace/")
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/dcim/power-outlets/:id/trace/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/power-outlets/:id/trace/";
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}}/dcim/power-outlets/:id/trace/
http GET {{baseUrl}}/dcim/power-outlets/:id/trace/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/power-outlets/:id/trace/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-outlets/:id/trace/")! 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()
PUT
dcim_power-outlets_update
{{baseUrl}}/dcim/power-outlets/:id/
BODY json
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"tags": [],
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-outlets/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/dcim/power-outlets/:id/" {:content-type :json
:form-params {:cable {:id 0
:label ""
:url ""}
:connected_endpoint {}
:connected_endpoint_type ""
:connection_status false
:description ""
:device 0
:feed_leg ""
:id 0
:name ""
:power_port 0
:tags []
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/power-outlets/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\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}}/dcim/power-outlets/:id/"),
Content = new StringContent("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-outlets/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-outlets/:id/"
payload := strings.NewReader("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\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/dcim/power-outlets/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 281
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"tags": [],
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/dcim/power-outlets/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-outlets/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/power-outlets/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/dcim/power-outlets/:id/")
.header("content-type", "application/json")
.body("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
cable: {
id: 0,
label: '',
url: ''
},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
feed_leg: '',
id: 0,
name: '',
power_port: 0,
tags: [],
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/dcim/power-outlets/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/power-outlets/:id/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
feed_leg: '',
id: 0,
name: '',
power_port: 0,
tags: [],
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-outlets/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"connected_endpoint":{},"connected_endpoint_type":"","connection_status":false,"description":"","device":0,"feed_leg":"","id":0,"name":"","power_port":0,"tags":[],"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/power-outlets/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "connected_endpoint": {},\n "connected_endpoint_type": "",\n "connection_status": false,\n "description": "",\n "device": 0,\n "feed_leg": "",\n "id": 0,\n "name": "",\n "power_port": 0,\n "tags": [],\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-outlets/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/power-outlets/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
feed_leg: '',
id: 0,
name: '',
power_port: 0,
tags: [],
type: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/power-outlets/:id/',
headers: {'content-type': 'application/json'},
body: {
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
feed_leg: '',
id: 0,
name: '',
power_port: 0,
tags: [],
type: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/dcim/power-outlets/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cable: {
id: 0,
label: '',
url: ''
},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
feed_leg: '',
id: 0,
name: '',
power_port: 0,
tags: [],
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/power-outlets/:id/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
feed_leg: '',
id: 0,
name: '',
power_port: 0,
tags: [],
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-outlets/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"connected_endpoint":{},"connected_endpoint_type":"","connection_status":false,"description":"","device":0,"feed_leg":"","id":0,"name":"","power_port":0,"tags":[],"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"cable": @{ @"id": @0, @"label": @"", @"url": @"" },
@"connected_endpoint": @{ },
@"connected_endpoint_type": @"",
@"connection_status": @NO,
@"description": @"",
@"device": @0,
@"feed_leg": @"",
@"id": @0,
@"name": @"",
@"power_port": @0,
@"tags": @[ ],
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/power-outlets/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/power-outlets/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-outlets/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'device' => 0,
'feed_leg' => '',
'id' => 0,
'name' => '',
'power_port' => 0,
'tags' => [
],
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/dcim/power-outlets/:id/', [
'body' => '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"tags": [],
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-outlets/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'device' => 0,
'feed_leg' => '',
'id' => 0,
'name' => '',
'power_port' => 0,
'tags' => [
],
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'device' => 0,
'feed_leg' => '',
'id' => 0,
'name' => '',
'power_port' => 0,
'tags' => [
],
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/power-outlets/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/power-outlets/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"tags": [],
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-outlets/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"tags": [],
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/dcim/power-outlets/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-outlets/:id/"
payload = {
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": False,
"description": "",
"device": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"tags": [],
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-outlets/:id/"
payload <- "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\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}}/dcim/power-outlets/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/dcim/power-outlets/:id/') do |req|
req.body = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"feed_leg\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"power_port\": 0,\n \"tags\": [],\n \"type\": \"\"\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}}/dcim/power-outlets/:id/";
let payload = json!({
"cable": json!({
"id": 0,
"label": "",
"url": ""
}),
"connected_endpoint": json!({}),
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"tags": (),
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/dcim/power-outlets/:id/ \
--header 'content-type: application/json' \
--data '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"tags": [],
"type": ""
}'
echo '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"tags": [],
"type": ""
}' | \
http PUT {{baseUrl}}/dcim/power-outlets/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "connected_endpoint": {},\n "connected_endpoint_type": "",\n "connection_status": false,\n "description": "",\n "device": 0,\n "feed_leg": "",\n "id": 0,\n "name": "",\n "power_port": 0,\n "tags": [],\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/power-outlets/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cable": [
"id": 0,
"label": "",
"url": ""
],
"connected_endpoint": [],
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"feed_leg": "",
"id": 0,
"name": "",
"power_port": 0,
"tags": [],
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-outlets/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
dcim_power-panels_create
{{baseUrl}}/dcim/power-panels/
BODY json
{
"id": 0,
"name": "",
"powerfeed_count": 0,
"rack_group": 0,
"site": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-panels/");
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\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/dcim/power-panels/" {:content-type :json
:form-params {:id 0
:name ""
:powerfeed_count 0
:rack_group 0
:site 0}})
require "http/client"
url = "{{baseUrl}}/dcim/power-panels/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/dcim/power-panels/"),
Content = new StringContent("{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-panels/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-panels/"
payload := strings.NewReader("{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/dcim/power-panels/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 83
{
"id": 0,
"name": "",
"powerfeed_count": 0,
"rack_group": 0,
"site": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/dcim/power-panels/")
.setHeader("content-type", "application/json")
.setBody("{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-panels/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/power-panels/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/dcim/power-panels/")
.header("content-type", "application/json")
.body("{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\n}")
.asString();
const data = JSON.stringify({
id: 0,
name: '',
powerfeed_count: 0,
rack_group: 0,
site: 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}}/dcim/power-panels/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/power-panels/',
headers: {'content-type': 'application/json'},
data: {id: 0, name: '', powerfeed_count: 0, rack_group: 0, site: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-panels/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"id":0,"name":"","powerfeed_count":0,"rack_group":0,"site":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}}/dcim/power-panels/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "id": 0,\n "name": "",\n "powerfeed_count": 0,\n "rack_group": 0,\n "site": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-panels/")
.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/dcim/power-panels/',
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: 0, name: '', powerfeed_count: 0, rack_group: 0, site: 0}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/power-panels/',
headers: {'content-type': 'application/json'},
body: {id: 0, name: '', powerfeed_count: 0, rack_group: 0, site: 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}}/dcim/power-panels/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
id: 0,
name: '',
powerfeed_count: 0,
rack_group: 0,
site: 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}}/dcim/power-panels/',
headers: {'content-type': 'application/json'},
data: {id: 0, name: '', powerfeed_count: 0, rack_group: 0, site: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-panels/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"id":0,"name":"","powerfeed_count":0,"rack_group":0,"site":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 = @{ @"id": @0,
@"name": @"",
@"powerfeed_count": @0,
@"rack_group": @0,
@"site": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/power-panels/"]
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}}/dcim/power-panels/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-panels/",
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' => 0,
'name' => '',
'powerfeed_count' => 0,
'rack_group' => 0,
'site' => 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}}/dcim/power-panels/', [
'body' => '{
"id": 0,
"name": "",
"powerfeed_count": 0,
"rack_group": 0,
"site": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-panels/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'id' => 0,
'name' => '',
'powerfeed_count' => 0,
'rack_group' => 0,
'site' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'id' => 0,
'name' => '',
'powerfeed_count' => 0,
'rack_group' => 0,
'site' => 0
]));
$request->setRequestUrl('{{baseUrl}}/dcim/power-panels/');
$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}}/dcim/power-panels/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"id": 0,
"name": "",
"powerfeed_count": 0,
"rack_group": 0,
"site": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-panels/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"id": 0,
"name": "",
"powerfeed_count": 0,
"rack_group": 0,
"site": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/dcim/power-panels/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-panels/"
payload = {
"id": 0,
"name": "",
"powerfeed_count": 0,
"rack_group": 0,
"site": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-panels/"
payload <- "{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/power-panels/")
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\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/dcim/power-panels/') do |req|
req.body = "{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/power-panels/";
let payload = json!({
"id": 0,
"name": "",
"powerfeed_count": 0,
"rack_group": 0,
"site": 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}}/dcim/power-panels/ \
--header 'content-type: application/json' \
--data '{
"id": 0,
"name": "",
"powerfeed_count": 0,
"rack_group": 0,
"site": 0
}'
echo '{
"id": 0,
"name": "",
"powerfeed_count": 0,
"rack_group": 0,
"site": 0
}' | \
http POST {{baseUrl}}/dcim/power-panels/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "id": 0,\n "name": "",\n "powerfeed_count": 0,\n "rack_group": 0,\n "site": 0\n}' \
--output-document \
- {{baseUrl}}/dcim/power-panels/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"id": 0,
"name": "",
"powerfeed_count": 0,
"rack_group": 0,
"site": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-panels/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
dcim_power-panels_delete
{{baseUrl}}/dcim/power-panels/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-panels/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/dcim/power-panels/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/power-panels/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/dcim/power-panels/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-panels/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-panels/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/dcim/power-panels/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/dcim/power-panels/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-panels/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/power-panels/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/dcim/power-panels/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/dcim/power-panels/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/power-panels/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-panels/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/power-panels/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-panels/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/power-panels/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/power-panels/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/dcim/power-panels/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/power-panels/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-panels/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/power-panels/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/power-panels/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-panels/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/dcim/power-panels/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-panels/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/power-panels/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/power-panels/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-panels/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/dcim/power-panels/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-panels/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-panels/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/power-panels/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/dcim/power-panels/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/power-panels/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/dcim/power-panels/:id/
http DELETE {{baseUrl}}/dcim/power-panels/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/dcim/power-panels/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-panels/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_power-panels_list
{{baseUrl}}/dcim/power-panels/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-panels/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/power-panels/")
require "http/client"
url = "{{baseUrl}}/dcim/power-panels/"
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}}/dcim/power-panels/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-panels/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-panels/"
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/dcim/power-panels/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/power-panels/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-panels/"))
.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}}/dcim/power-panels/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/power-panels/")
.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}}/dcim/power-panels/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/power-panels/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-panels/';
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}}/dcim/power-panels/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-panels/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/power-panels/',
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}}/dcim/power-panels/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/power-panels/');
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}}/dcim/power-panels/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-panels/';
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}}/dcim/power-panels/"]
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}}/dcim/power-panels/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-panels/",
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}}/dcim/power-panels/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-panels/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/power-panels/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/power-panels/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-panels/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/power-panels/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-panels/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-panels/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/power-panels/")
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/dcim/power-panels/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/power-panels/";
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}}/dcim/power-panels/
http GET {{baseUrl}}/dcim/power-panels/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/power-panels/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-panels/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
dcim_power-panels_partial_update
{{baseUrl}}/dcim/power-panels/:id/
BODY json
{
"id": 0,
"name": "",
"powerfeed_count": 0,
"rack_group": 0,
"site": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-panels/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/dcim/power-panels/:id/" {:content-type :json
:form-params {:id 0
:name ""
:powerfeed_count 0
:rack_group 0
:site 0}})
require "http/client"
url = "{{baseUrl}}/dcim/power-panels/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\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}}/dcim/power-panels/:id/"),
Content = new StringContent("{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-panels/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-panels/:id/"
payload := strings.NewReader("{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\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/dcim/power-panels/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 83
{
"id": 0,
"name": "",
"powerfeed_count": 0,
"rack_group": 0,
"site": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/dcim/power-panels/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-panels/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/power-panels/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/dcim/power-panels/:id/")
.header("content-type", "application/json")
.body("{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\n}")
.asString();
const data = JSON.stringify({
id: 0,
name: '',
powerfeed_count: 0,
rack_group: 0,
site: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/dcim/power-panels/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/power-panels/:id/',
headers: {'content-type': 'application/json'},
data: {id: 0, name: '', powerfeed_count: 0, rack_group: 0, site: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-panels/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"id":0,"name":"","powerfeed_count":0,"rack_group":0,"site":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}}/dcim/power-panels/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "id": 0,\n "name": "",\n "powerfeed_count": 0,\n "rack_group": 0,\n "site": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-panels/:id/")
.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/dcim/power-panels/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({id: 0, name: '', powerfeed_count: 0, rack_group: 0, site: 0}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/power-panels/:id/',
headers: {'content-type': 'application/json'},
body: {id: 0, name: '', powerfeed_count: 0, rack_group: 0, site: 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('PATCH', '{{baseUrl}}/dcim/power-panels/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
id: 0,
name: '',
powerfeed_count: 0,
rack_group: 0,
site: 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: 'PATCH',
url: '{{baseUrl}}/dcim/power-panels/:id/',
headers: {'content-type': 'application/json'},
data: {id: 0, name: '', powerfeed_count: 0, rack_group: 0, site: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-panels/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"id":0,"name":"","powerfeed_count":0,"rack_group":0,"site":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 = @{ @"id": @0,
@"name": @"",
@"powerfeed_count": @0,
@"rack_group": @0,
@"site": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/power-panels/:id/"]
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}}/dcim/power-panels/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-panels/:id/",
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([
'id' => 0,
'name' => '',
'powerfeed_count' => 0,
'rack_group' => 0,
'site' => 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('PATCH', '{{baseUrl}}/dcim/power-panels/:id/', [
'body' => '{
"id": 0,
"name": "",
"powerfeed_count": 0,
"rack_group": 0,
"site": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-panels/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'id' => 0,
'name' => '',
'powerfeed_count' => 0,
'rack_group' => 0,
'site' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'id' => 0,
'name' => '',
'powerfeed_count' => 0,
'rack_group' => 0,
'site' => 0
]));
$request->setRequestUrl('{{baseUrl}}/dcim/power-panels/:id/');
$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}}/dcim/power-panels/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"id": 0,
"name": "",
"powerfeed_count": 0,
"rack_group": 0,
"site": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-panels/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"id": 0,
"name": "",
"powerfeed_count": 0,
"rack_group": 0,
"site": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/dcim/power-panels/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-panels/:id/"
payload = {
"id": 0,
"name": "",
"powerfeed_count": 0,
"rack_group": 0,
"site": 0
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-panels/:id/"
payload <- "{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\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}}/dcim/power-panels/:id/")
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 \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/dcim/power-panels/:id/') do |req|
req.body = "{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\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}}/dcim/power-panels/:id/";
let payload = json!({
"id": 0,
"name": "",
"powerfeed_count": 0,
"rack_group": 0,
"site": 0
});
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}}/dcim/power-panels/:id/ \
--header 'content-type: application/json' \
--data '{
"id": 0,
"name": "",
"powerfeed_count": 0,
"rack_group": 0,
"site": 0
}'
echo '{
"id": 0,
"name": "",
"powerfeed_count": 0,
"rack_group": 0,
"site": 0
}' | \
http PATCH {{baseUrl}}/dcim/power-panels/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "id": 0,\n "name": "",\n "powerfeed_count": 0,\n "rack_group": 0,\n "site": 0\n}' \
--output-document \
- {{baseUrl}}/dcim/power-panels/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"id": 0,
"name": "",
"powerfeed_count": 0,
"rack_group": 0,
"site": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-panels/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_power-panels_read
{{baseUrl}}/dcim/power-panels/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-panels/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/power-panels/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/power-panels/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/dcim/power-panels/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-panels/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-panels/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/dcim/power-panels/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/power-panels/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-panels/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/power-panels/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/power-panels/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/dcim/power-panels/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/power-panels/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-panels/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/power-panels/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-panels/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/power-panels/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/dcim/power-panels/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/power-panels/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/dcim/power-panels/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-panels/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/power-panels/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/power-panels/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-panels/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/dcim/power-panels/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-panels/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/power-panels/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/power-panels/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-panels/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/power-panels/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-panels/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-panels/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/power-panels/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/dcim/power-panels/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/power-panels/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/dcim/power-panels/:id/
http GET {{baseUrl}}/dcim/power-panels/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/power-panels/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-panels/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
dcim_power-panels_update
{{baseUrl}}/dcim/power-panels/:id/
BODY json
{
"id": 0,
"name": "",
"powerfeed_count": 0,
"rack_group": 0,
"site": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-panels/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/dcim/power-panels/:id/" {:content-type :json
:form-params {:id 0
:name ""
:powerfeed_count 0
:rack_group 0
:site 0}})
require "http/client"
url = "{{baseUrl}}/dcim/power-panels/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\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}}/dcim/power-panels/:id/"),
Content = new StringContent("{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-panels/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-panels/:id/"
payload := strings.NewReader("{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\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/dcim/power-panels/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 83
{
"id": 0,
"name": "",
"powerfeed_count": 0,
"rack_group": 0,
"site": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/dcim/power-panels/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-panels/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/power-panels/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/dcim/power-panels/:id/")
.header("content-type", "application/json")
.body("{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\n}")
.asString();
const data = JSON.stringify({
id: 0,
name: '',
powerfeed_count: 0,
rack_group: 0,
site: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/dcim/power-panels/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/power-panels/:id/',
headers: {'content-type': 'application/json'},
data: {id: 0, name: '', powerfeed_count: 0, rack_group: 0, site: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-panels/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"id":0,"name":"","powerfeed_count":0,"rack_group":0,"site":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}}/dcim/power-panels/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "id": 0,\n "name": "",\n "powerfeed_count": 0,\n "rack_group": 0,\n "site": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-panels/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/power-panels/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({id: 0, name: '', powerfeed_count: 0, rack_group: 0, site: 0}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/power-panels/:id/',
headers: {'content-type': 'application/json'},
body: {id: 0, name: '', powerfeed_count: 0, rack_group: 0, site: 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('PUT', '{{baseUrl}}/dcim/power-panels/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
id: 0,
name: '',
powerfeed_count: 0,
rack_group: 0,
site: 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: 'PUT',
url: '{{baseUrl}}/dcim/power-panels/:id/',
headers: {'content-type': 'application/json'},
data: {id: 0, name: '', powerfeed_count: 0, rack_group: 0, site: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-panels/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"id":0,"name":"","powerfeed_count":0,"rack_group":0,"site":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 = @{ @"id": @0,
@"name": @"",
@"powerfeed_count": @0,
@"rack_group": @0,
@"site": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/power-panels/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/power-panels/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-panels/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'id' => 0,
'name' => '',
'powerfeed_count' => 0,
'rack_group' => 0,
'site' => 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('PUT', '{{baseUrl}}/dcim/power-panels/:id/', [
'body' => '{
"id": 0,
"name": "",
"powerfeed_count": 0,
"rack_group": 0,
"site": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-panels/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'id' => 0,
'name' => '',
'powerfeed_count' => 0,
'rack_group' => 0,
'site' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'id' => 0,
'name' => '',
'powerfeed_count' => 0,
'rack_group' => 0,
'site' => 0
]));
$request->setRequestUrl('{{baseUrl}}/dcim/power-panels/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/power-panels/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"id": 0,
"name": "",
"powerfeed_count": 0,
"rack_group": 0,
"site": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-panels/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"id": 0,
"name": "",
"powerfeed_count": 0,
"rack_group": 0,
"site": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/dcim/power-panels/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-panels/:id/"
payload = {
"id": 0,
"name": "",
"powerfeed_count": 0,
"rack_group": 0,
"site": 0
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-panels/:id/"
payload <- "{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\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}}/dcim/power-panels/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/dcim/power-panels/:id/') do |req|
req.body = "{\n \"id\": 0,\n \"name\": \"\",\n \"powerfeed_count\": 0,\n \"rack_group\": 0,\n \"site\": 0\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}}/dcim/power-panels/:id/";
let payload = json!({
"id": 0,
"name": "",
"powerfeed_count": 0,
"rack_group": 0,
"site": 0
});
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}}/dcim/power-panels/:id/ \
--header 'content-type: application/json' \
--data '{
"id": 0,
"name": "",
"powerfeed_count": 0,
"rack_group": 0,
"site": 0
}'
echo '{
"id": 0,
"name": "",
"powerfeed_count": 0,
"rack_group": 0,
"site": 0
}' | \
http PUT {{baseUrl}}/dcim/power-panels/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "id": 0,\n "name": "",\n "powerfeed_count": 0,\n "rack_group": 0,\n "site": 0\n}' \
--output-document \
- {{baseUrl}}/dcim/power-panels/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"id": 0,
"name": "",
"powerfeed_count": 0,
"rack_group": 0,
"site": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-panels/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
dcim_power-port-templates_create
{{baseUrl}}/dcim/power-port-templates/
BODY json
{
"allocated_draw": 0,
"device_type": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-port-templates/");
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 \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/dcim/power-port-templates/" {:content-type :json
:form-params {:allocated_draw 0
:device_type 0
:id 0
:maximum_draw 0
:name ""
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/power-port-templates/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/dcim/power-port-templates/"),
Content = new StringContent("{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-port-templates/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-port-templates/"
payload := strings.NewReader("{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/dcim/power-port-templates/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 105
{
"allocated_draw": 0,
"device_type": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/dcim/power-port-templates/")
.setHeader("content-type", "application/json")
.setBody("{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-port-templates/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/power-port-templates/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/dcim/power-port-templates/")
.header("content-type", "application/json")
.body("{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
allocated_draw: 0,
device_type: 0,
id: 0,
maximum_draw: 0,
name: '',
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/dcim/power-port-templates/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/power-port-templates/',
headers: {'content-type': 'application/json'},
data: {allocated_draw: 0, device_type: 0, id: 0, maximum_draw: 0, name: '', type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-port-templates/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"allocated_draw":0,"device_type":0,"id":0,"maximum_draw":0,"name":"","type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/power-port-templates/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "allocated_draw": 0,\n "device_type": 0,\n "id": 0,\n "maximum_draw": 0,\n "name": "",\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-port-templates/")
.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/dcim/power-port-templates/',
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({allocated_draw: 0, device_type: 0, id: 0, maximum_draw: 0, name: '', type: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/power-port-templates/',
headers: {'content-type': 'application/json'},
body: {allocated_draw: 0, device_type: 0, id: 0, maximum_draw: 0, name: '', type: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/dcim/power-port-templates/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
allocated_draw: 0,
device_type: 0,
id: 0,
maximum_draw: 0,
name: '',
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/power-port-templates/',
headers: {'content-type': 'application/json'},
data: {allocated_draw: 0, device_type: 0, id: 0, maximum_draw: 0, name: '', type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-port-templates/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"allocated_draw":0,"device_type":0,"id":0,"maximum_draw":0,"name":"","type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"allocated_draw": @0,
@"device_type": @0,
@"id": @0,
@"maximum_draw": @0,
@"name": @"",
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/power-port-templates/"]
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}}/dcim/power-port-templates/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-port-templates/",
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([
'allocated_draw' => 0,
'device_type' => 0,
'id' => 0,
'maximum_draw' => 0,
'name' => '',
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/dcim/power-port-templates/', [
'body' => '{
"allocated_draw": 0,
"device_type": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-port-templates/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'allocated_draw' => 0,
'device_type' => 0,
'id' => 0,
'maximum_draw' => 0,
'name' => '',
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'allocated_draw' => 0,
'device_type' => 0,
'id' => 0,
'maximum_draw' => 0,
'name' => '',
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/power-port-templates/');
$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}}/dcim/power-port-templates/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"allocated_draw": 0,
"device_type": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-port-templates/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"allocated_draw": 0,
"device_type": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/dcim/power-port-templates/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-port-templates/"
payload = {
"allocated_draw": 0,
"device_type": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-port-templates/"
payload <- "{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/power-port-templates/")
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 \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/dcim/power-port-templates/') do |req|
req.body = "{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/power-port-templates/";
let payload = json!({
"allocated_draw": 0,
"device_type": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/dcim/power-port-templates/ \
--header 'content-type: application/json' \
--data '{
"allocated_draw": 0,
"device_type": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"type": ""
}'
echo '{
"allocated_draw": 0,
"device_type": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"type": ""
}' | \
http POST {{baseUrl}}/dcim/power-port-templates/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "allocated_draw": 0,\n "device_type": 0,\n "id": 0,\n "maximum_draw": 0,\n "name": "",\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/power-port-templates/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"allocated_draw": 0,
"device_type": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-port-templates/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
dcim_power-port-templates_delete
{{baseUrl}}/dcim/power-port-templates/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-port-templates/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/dcim/power-port-templates/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/power-port-templates/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/dcim/power-port-templates/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-port-templates/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-port-templates/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/dcim/power-port-templates/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/dcim/power-port-templates/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-port-templates/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/power-port-templates/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/dcim/power-port-templates/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/dcim/power-port-templates/:id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/dcim/power-port-templates/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-port-templates/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/power-port-templates/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-port-templates/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/power-port-templates/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/dcim/power-port-templates/:id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/dcim/power-port-templates/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/dcim/power-port-templates/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-port-templates/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/power-port-templates/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/power-port-templates/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-port-templates/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/dcim/power-port-templates/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-port-templates/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/power-port-templates/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/power-port-templates/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-port-templates/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/dcim/power-port-templates/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-port-templates/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-port-templates/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/power-port-templates/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/dcim/power-port-templates/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/power-port-templates/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/dcim/power-port-templates/:id/
http DELETE {{baseUrl}}/dcim/power-port-templates/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/dcim/power-port-templates/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-port-templates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_power-port-templates_list
{{baseUrl}}/dcim/power-port-templates/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-port-templates/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/power-port-templates/")
require "http/client"
url = "{{baseUrl}}/dcim/power-port-templates/"
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}}/dcim/power-port-templates/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-port-templates/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-port-templates/"
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/dcim/power-port-templates/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/power-port-templates/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-port-templates/"))
.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}}/dcim/power-port-templates/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/power-port-templates/")
.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}}/dcim/power-port-templates/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/power-port-templates/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-port-templates/';
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}}/dcim/power-port-templates/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-port-templates/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/power-port-templates/',
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}}/dcim/power-port-templates/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/power-port-templates/');
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}}/dcim/power-port-templates/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-port-templates/';
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}}/dcim/power-port-templates/"]
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}}/dcim/power-port-templates/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-port-templates/",
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}}/dcim/power-port-templates/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-port-templates/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/power-port-templates/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/power-port-templates/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-port-templates/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/power-port-templates/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-port-templates/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-port-templates/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/power-port-templates/")
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/dcim/power-port-templates/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/power-port-templates/";
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}}/dcim/power-port-templates/
http GET {{baseUrl}}/dcim/power-port-templates/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/power-port-templates/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-port-templates/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
dcim_power-port-templates_partial_update
{{baseUrl}}/dcim/power-port-templates/:id/
BODY json
{
"allocated_draw": 0,
"device_type": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-port-templates/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/dcim/power-port-templates/:id/" {:content-type :json
:form-params {:allocated_draw 0
:device_type 0
:id 0
:maximum_draw 0
:name ""
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/power-port-templates/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\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}}/dcim/power-port-templates/:id/"),
Content = new StringContent("{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-port-templates/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-port-templates/:id/"
payload := strings.NewReader("{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\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/dcim/power-port-templates/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 105
{
"allocated_draw": 0,
"device_type": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/dcim/power-port-templates/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-port-templates/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/power-port-templates/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/dcim/power-port-templates/:id/")
.header("content-type", "application/json")
.body("{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
allocated_draw: 0,
device_type: 0,
id: 0,
maximum_draw: 0,
name: '',
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/dcim/power-port-templates/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/power-port-templates/:id/',
headers: {'content-type': 'application/json'},
data: {allocated_draw: 0, device_type: 0, id: 0, maximum_draw: 0, name: '', type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-port-templates/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"allocated_draw":0,"device_type":0,"id":0,"maximum_draw":0,"name":"","type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/power-port-templates/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "allocated_draw": 0,\n "device_type": 0,\n "id": 0,\n "maximum_draw": 0,\n "name": "",\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-port-templates/:id/")
.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/dcim/power-port-templates/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({allocated_draw: 0, device_type: 0, id: 0, maximum_draw: 0, name: '', type: ''}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/power-port-templates/:id/',
headers: {'content-type': 'application/json'},
body: {allocated_draw: 0, device_type: 0, id: 0, maximum_draw: 0, name: '', type: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/dcim/power-port-templates/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
allocated_draw: 0,
device_type: 0,
id: 0,
maximum_draw: 0,
name: '',
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/power-port-templates/:id/',
headers: {'content-type': 'application/json'},
data: {allocated_draw: 0, device_type: 0, id: 0, maximum_draw: 0, name: '', type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-port-templates/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"allocated_draw":0,"device_type":0,"id":0,"maximum_draw":0,"name":"","type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"allocated_draw": @0,
@"device_type": @0,
@"id": @0,
@"maximum_draw": @0,
@"name": @"",
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/power-port-templates/:id/"]
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}}/dcim/power-port-templates/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-port-templates/:id/",
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([
'allocated_draw' => 0,
'device_type' => 0,
'id' => 0,
'maximum_draw' => 0,
'name' => '',
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/dcim/power-port-templates/:id/', [
'body' => '{
"allocated_draw": 0,
"device_type": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-port-templates/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'allocated_draw' => 0,
'device_type' => 0,
'id' => 0,
'maximum_draw' => 0,
'name' => '',
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'allocated_draw' => 0,
'device_type' => 0,
'id' => 0,
'maximum_draw' => 0,
'name' => '',
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/power-port-templates/:id/');
$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}}/dcim/power-port-templates/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"allocated_draw": 0,
"device_type": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-port-templates/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"allocated_draw": 0,
"device_type": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/dcim/power-port-templates/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-port-templates/:id/"
payload = {
"allocated_draw": 0,
"device_type": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-port-templates/:id/"
payload <- "{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\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}}/dcim/power-port-templates/:id/")
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 \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/dcim/power-port-templates/:id/') do |req|
req.body = "{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\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}}/dcim/power-port-templates/:id/";
let payload = json!({
"allocated_draw": 0,
"device_type": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.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}}/dcim/power-port-templates/:id/ \
--header 'content-type: application/json' \
--data '{
"allocated_draw": 0,
"device_type": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"type": ""
}'
echo '{
"allocated_draw": 0,
"device_type": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"type": ""
}' | \
http PATCH {{baseUrl}}/dcim/power-port-templates/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "allocated_draw": 0,\n "device_type": 0,\n "id": 0,\n "maximum_draw": 0,\n "name": "",\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/power-port-templates/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"allocated_draw": 0,
"device_type": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-port-templates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_power-port-templates_read
{{baseUrl}}/dcim/power-port-templates/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-port-templates/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/power-port-templates/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/power-port-templates/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/dcim/power-port-templates/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-port-templates/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-port-templates/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/dcim/power-port-templates/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/power-port-templates/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-port-templates/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/power-port-templates/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/power-port-templates/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/dcim/power-port-templates/:id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/dcim/power-port-templates/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-port-templates/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/power-port-templates/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-port-templates/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/power-port-templates/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/dcim/power-port-templates/:id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/power-port-templates/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/dcim/power-port-templates/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-port-templates/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/power-port-templates/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/power-port-templates/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-port-templates/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/dcim/power-port-templates/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-port-templates/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/power-port-templates/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/power-port-templates/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-port-templates/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/power-port-templates/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-port-templates/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-port-templates/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/power-port-templates/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/dcim/power-port-templates/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/power-port-templates/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/dcim/power-port-templates/:id/
http GET {{baseUrl}}/dcim/power-port-templates/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/power-port-templates/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-port-templates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
dcim_power-port-templates_update
{{baseUrl}}/dcim/power-port-templates/:id/
BODY json
{
"allocated_draw": 0,
"device_type": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-port-templates/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/dcim/power-port-templates/:id/" {:content-type :json
:form-params {:allocated_draw 0
:device_type 0
:id 0
:maximum_draw 0
:name ""
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/power-port-templates/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\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}}/dcim/power-port-templates/:id/"),
Content = new StringContent("{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-port-templates/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-port-templates/:id/"
payload := strings.NewReader("{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\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/dcim/power-port-templates/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 105
{
"allocated_draw": 0,
"device_type": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/dcim/power-port-templates/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-port-templates/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/power-port-templates/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/dcim/power-port-templates/:id/")
.header("content-type", "application/json")
.body("{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
allocated_draw: 0,
device_type: 0,
id: 0,
maximum_draw: 0,
name: '',
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/dcim/power-port-templates/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/power-port-templates/:id/',
headers: {'content-type': 'application/json'},
data: {allocated_draw: 0, device_type: 0, id: 0, maximum_draw: 0, name: '', type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-port-templates/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"allocated_draw":0,"device_type":0,"id":0,"maximum_draw":0,"name":"","type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/power-port-templates/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "allocated_draw": 0,\n "device_type": 0,\n "id": 0,\n "maximum_draw": 0,\n "name": "",\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-port-templates/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/power-port-templates/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({allocated_draw: 0, device_type: 0, id: 0, maximum_draw: 0, name: '', type: ''}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/power-port-templates/:id/',
headers: {'content-type': 'application/json'},
body: {allocated_draw: 0, device_type: 0, id: 0, maximum_draw: 0, name: '', type: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/dcim/power-port-templates/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
allocated_draw: 0,
device_type: 0,
id: 0,
maximum_draw: 0,
name: '',
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/power-port-templates/:id/',
headers: {'content-type': 'application/json'},
data: {allocated_draw: 0, device_type: 0, id: 0, maximum_draw: 0, name: '', type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-port-templates/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"allocated_draw":0,"device_type":0,"id":0,"maximum_draw":0,"name":"","type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"allocated_draw": @0,
@"device_type": @0,
@"id": @0,
@"maximum_draw": @0,
@"name": @"",
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/power-port-templates/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/power-port-templates/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-port-templates/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'allocated_draw' => 0,
'device_type' => 0,
'id' => 0,
'maximum_draw' => 0,
'name' => '',
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/dcim/power-port-templates/:id/', [
'body' => '{
"allocated_draw": 0,
"device_type": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-port-templates/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'allocated_draw' => 0,
'device_type' => 0,
'id' => 0,
'maximum_draw' => 0,
'name' => '',
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'allocated_draw' => 0,
'device_type' => 0,
'id' => 0,
'maximum_draw' => 0,
'name' => '',
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/power-port-templates/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/power-port-templates/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"allocated_draw": 0,
"device_type": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-port-templates/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"allocated_draw": 0,
"device_type": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/dcim/power-port-templates/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-port-templates/:id/"
payload = {
"allocated_draw": 0,
"device_type": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-port-templates/:id/"
payload <- "{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\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}}/dcim/power-port-templates/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/dcim/power-port-templates/:id/') do |req|
req.body = "{\n \"allocated_draw\": 0,\n \"device_type\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"type\": \"\"\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}}/dcim/power-port-templates/:id/";
let payload = json!({
"allocated_draw": 0,
"device_type": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.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}}/dcim/power-port-templates/:id/ \
--header 'content-type: application/json' \
--data '{
"allocated_draw": 0,
"device_type": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"type": ""
}'
echo '{
"allocated_draw": 0,
"device_type": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"type": ""
}' | \
http PUT {{baseUrl}}/dcim/power-port-templates/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "allocated_draw": 0,\n "device_type": 0,\n "id": 0,\n "maximum_draw": 0,\n "name": "",\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/power-port-templates/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"allocated_draw": 0,
"device_type": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-port-templates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
dcim_power-ports_create
{{baseUrl}}/dcim/power-ports/
BODY json
{
"allocated_draw": 0,
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"tags": [],
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-ports/");
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 \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/dcim/power-ports/" {:content-type :json
:form-params {:allocated_draw 0
:cable {:id 0
:label ""
:url ""}
:connected_endpoint {}
:connected_endpoint_type ""
:connection_status false
:description ""
:device 0
:id 0
:maximum_draw 0
:name ""
:tags []
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/power-ports/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/dcim/power-ports/"),
Content = new StringContent("{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-ports/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-ports/"
payload := strings.NewReader("{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/dcim/power-ports/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 288
{
"allocated_draw": 0,
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"tags": [],
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/dcim/power-ports/")
.setHeader("content-type", "application/json")
.setBody("{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-ports/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/power-ports/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/dcim/power-ports/")
.header("content-type", "application/json")
.body("{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
allocated_draw: 0,
cable: {
id: 0,
label: '',
url: ''
},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
maximum_draw: 0,
name: '',
tags: [],
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/dcim/power-ports/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/power-ports/',
headers: {'content-type': 'application/json'},
data: {
allocated_draw: 0,
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
maximum_draw: 0,
name: '',
tags: [],
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-ports/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"allocated_draw":0,"cable":{"id":0,"label":"","url":""},"connected_endpoint":{},"connected_endpoint_type":"","connection_status":false,"description":"","device":0,"id":0,"maximum_draw":0,"name":"","tags":[],"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/power-ports/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "allocated_draw": 0,\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "connected_endpoint": {},\n "connected_endpoint_type": "",\n "connection_status": false,\n "description": "",\n "device": 0,\n "id": 0,\n "maximum_draw": 0,\n "name": "",\n "tags": [],\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-ports/")
.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/dcim/power-ports/',
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({
allocated_draw: 0,
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
maximum_draw: 0,
name: '',
tags: [],
type: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/power-ports/',
headers: {'content-type': 'application/json'},
body: {
allocated_draw: 0,
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
maximum_draw: 0,
name: '',
tags: [],
type: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/dcim/power-ports/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
allocated_draw: 0,
cable: {
id: 0,
label: '',
url: ''
},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
maximum_draw: 0,
name: '',
tags: [],
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/power-ports/',
headers: {'content-type': 'application/json'},
data: {
allocated_draw: 0,
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
maximum_draw: 0,
name: '',
tags: [],
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-ports/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"allocated_draw":0,"cable":{"id":0,"label":"","url":""},"connected_endpoint":{},"connected_endpoint_type":"","connection_status":false,"description":"","device":0,"id":0,"maximum_draw":0,"name":"","tags":[],"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"allocated_draw": @0,
@"cable": @{ @"id": @0, @"label": @"", @"url": @"" },
@"connected_endpoint": @{ },
@"connected_endpoint_type": @"",
@"connection_status": @NO,
@"description": @"",
@"device": @0,
@"id": @0,
@"maximum_draw": @0,
@"name": @"",
@"tags": @[ ],
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/power-ports/"]
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}}/dcim/power-ports/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-ports/",
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([
'allocated_draw' => 0,
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'device' => 0,
'id' => 0,
'maximum_draw' => 0,
'name' => '',
'tags' => [
],
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/dcim/power-ports/', [
'body' => '{
"allocated_draw": 0,
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"tags": [],
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-ports/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'allocated_draw' => 0,
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'device' => 0,
'id' => 0,
'maximum_draw' => 0,
'name' => '',
'tags' => [
],
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'allocated_draw' => 0,
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'device' => 0,
'id' => 0,
'maximum_draw' => 0,
'name' => '',
'tags' => [
],
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/power-ports/');
$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}}/dcim/power-ports/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"allocated_draw": 0,
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"tags": [],
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-ports/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"allocated_draw": 0,
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"tags": [],
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/dcim/power-ports/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-ports/"
payload = {
"allocated_draw": 0,
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": False,
"description": "",
"device": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"tags": [],
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-ports/"
payload <- "{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/power-ports/")
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 \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/dcim/power-ports/') do |req|
req.body = "{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/power-ports/";
let payload = json!({
"allocated_draw": 0,
"cable": json!({
"id": 0,
"label": "",
"url": ""
}),
"connected_endpoint": json!({}),
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"tags": (),
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/dcim/power-ports/ \
--header 'content-type: application/json' \
--data '{
"allocated_draw": 0,
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"tags": [],
"type": ""
}'
echo '{
"allocated_draw": 0,
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"tags": [],
"type": ""
}' | \
http POST {{baseUrl}}/dcim/power-ports/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "allocated_draw": 0,\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "connected_endpoint": {},\n "connected_endpoint_type": "",\n "connection_status": false,\n "description": "",\n "device": 0,\n "id": 0,\n "maximum_draw": 0,\n "name": "",\n "tags": [],\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/power-ports/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"allocated_draw": 0,
"cable": [
"id": 0,
"label": "",
"url": ""
],
"connected_endpoint": [],
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"tags": [],
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-ports/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
dcim_power-ports_delete
{{baseUrl}}/dcim/power-ports/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-ports/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/dcim/power-ports/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/power-ports/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/dcim/power-ports/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-ports/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-ports/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/dcim/power-ports/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/dcim/power-ports/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-ports/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/power-ports/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/dcim/power-ports/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/dcim/power-ports/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/power-ports/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-ports/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/power-ports/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-ports/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/power-ports/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/power-ports/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/dcim/power-ports/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/power-ports/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-ports/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/power-ports/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/power-ports/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-ports/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/dcim/power-ports/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-ports/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/power-ports/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/power-ports/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-ports/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/dcim/power-ports/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-ports/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-ports/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/power-ports/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/dcim/power-ports/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/power-ports/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/dcim/power-ports/:id/
http DELETE {{baseUrl}}/dcim/power-ports/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/dcim/power-ports/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-ports/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_power-ports_list
{{baseUrl}}/dcim/power-ports/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-ports/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/power-ports/")
require "http/client"
url = "{{baseUrl}}/dcim/power-ports/"
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}}/dcim/power-ports/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-ports/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-ports/"
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/dcim/power-ports/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/power-ports/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-ports/"))
.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}}/dcim/power-ports/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/power-ports/")
.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}}/dcim/power-ports/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/power-ports/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-ports/';
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}}/dcim/power-ports/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-ports/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/power-ports/',
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}}/dcim/power-ports/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/power-ports/');
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}}/dcim/power-ports/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-ports/';
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}}/dcim/power-ports/"]
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}}/dcim/power-ports/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-ports/",
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}}/dcim/power-ports/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-ports/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/power-ports/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/power-ports/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-ports/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/power-ports/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-ports/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-ports/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/power-ports/")
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/dcim/power-ports/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/power-ports/";
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}}/dcim/power-ports/
http GET {{baseUrl}}/dcim/power-ports/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/power-ports/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-ports/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
dcim_power-ports_partial_update
{{baseUrl}}/dcim/power-ports/:id/
BODY json
{
"allocated_draw": 0,
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"tags": [],
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-ports/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/dcim/power-ports/:id/" {:content-type :json
:form-params {:allocated_draw 0
:cable {:id 0
:label ""
:url ""}
:connected_endpoint {}
:connected_endpoint_type ""
:connection_status false
:description ""
:device 0
:id 0
:maximum_draw 0
:name ""
:tags []
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/power-ports/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\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}}/dcim/power-ports/:id/"),
Content = new StringContent("{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-ports/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-ports/:id/"
payload := strings.NewReader("{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\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/dcim/power-ports/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 288
{
"allocated_draw": 0,
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"tags": [],
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/dcim/power-ports/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-ports/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/power-ports/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/dcim/power-ports/:id/")
.header("content-type", "application/json")
.body("{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
allocated_draw: 0,
cable: {
id: 0,
label: '',
url: ''
},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
maximum_draw: 0,
name: '',
tags: [],
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/dcim/power-ports/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/power-ports/:id/',
headers: {'content-type': 'application/json'},
data: {
allocated_draw: 0,
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
maximum_draw: 0,
name: '',
tags: [],
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-ports/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"allocated_draw":0,"cable":{"id":0,"label":"","url":""},"connected_endpoint":{},"connected_endpoint_type":"","connection_status":false,"description":"","device":0,"id":0,"maximum_draw":0,"name":"","tags":[],"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/power-ports/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "allocated_draw": 0,\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "connected_endpoint": {},\n "connected_endpoint_type": "",\n "connection_status": false,\n "description": "",\n "device": 0,\n "id": 0,\n "maximum_draw": 0,\n "name": "",\n "tags": [],\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-ports/:id/")
.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/dcim/power-ports/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
allocated_draw: 0,
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
maximum_draw: 0,
name: '',
tags: [],
type: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/power-ports/:id/',
headers: {'content-type': 'application/json'},
body: {
allocated_draw: 0,
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
maximum_draw: 0,
name: '',
tags: [],
type: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/dcim/power-ports/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
allocated_draw: 0,
cable: {
id: 0,
label: '',
url: ''
},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
maximum_draw: 0,
name: '',
tags: [],
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/power-ports/:id/',
headers: {'content-type': 'application/json'},
data: {
allocated_draw: 0,
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
maximum_draw: 0,
name: '',
tags: [],
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-ports/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"allocated_draw":0,"cable":{"id":0,"label":"","url":""},"connected_endpoint":{},"connected_endpoint_type":"","connection_status":false,"description":"","device":0,"id":0,"maximum_draw":0,"name":"","tags":[],"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"allocated_draw": @0,
@"cable": @{ @"id": @0, @"label": @"", @"url": @"" },
@"connected_endpoint": @{ },
@"connected_endpoint_type": @"",
@"connection_status": @NO,
@"description": @"",
@"device": @0,
@"id": @0,
@"maximum_draw": @0,
@"name": @"",
@"tags": @[ ],
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/power-ports/:id/"]
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}}/dcim/power-ports/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-ports/:id/",
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([
'allocated_draw' => 0,
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'device' => 0,
'id' => 0,
'maximum_draw' => 0,
'name' => '',
'tags' => [
],
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/dcim/power-ports/:id/', [
'body' => '{
"allocated_draw": 0,
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"tags": [],
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-ports/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'allocated_draw' => 0,
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'device' => 0,
'id' => 0,
'maximum_draw' => 0,
'name' => '',
'tags' => [
],
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'allocated_draw' => 0,
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'device' => 0,
'id' => 0,
'maximum_draw' => 0,
'name' => '',
'tags' => [
],
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/power-ports/:id/');
$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}}/dcim/power-ports/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"allocated_draw": 0,
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"tags": [],
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-ports/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"allocated_draw": 0,
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"tags": [],
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/dcim/power-ports/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-ports/:id/"
payload = {
"allocated_draw": 0,
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": False,
"description": "",
"device": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"tags": [],
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-ports/:id/"
payload <- "{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\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}}/dcim/power-ports/:id/")
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 \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/dcim/power-ports/:id/') do |req|
req.body = "{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\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}}/dcim/power-ports/:id/";
let payload = json!({
"allocated_draw": 0,
"cable": json!({
"id": 0,
"label": "",
"url": ""
}),
"connected_endpoint": json!({}),
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"tags": (),
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/dcim/power-ports/:id/ \
--header 'content-type: application/json' \
--data '{
"allocated_draw": 0,
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"tags": [],
"type": ""
}'
echo '{
"allocated_draw": 0,
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"tags": [],
"type": ""
}' | \
http PATCH {{baseUrl}}/dcim/power-ports/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "allocated_draw": 0,\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "connected_endpoint": {},\n "connected_endpoint_type": "",\n "connection_status": false,\n "description": "",\n "device": 0,\n "id": 0,\n "maximum_draw": 0,\n "name": "",\n "tags": [],\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/power-ports/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"allocated_draw": 0,
"cable": [
"id": 0,
"label": "",
"url": ""
],
"connected_endpoint": [],
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"tags": [],
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-ports/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_power-ports_read
{{baseUrl}}/dcim/power-ports/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-ports/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/power-ports/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/power-ports/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/dcim/power-ports/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-ports/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-ports/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/dcim/power-ports/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/power-ports/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-ports/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/power-ports/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/power-ports/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/dcim/power-ports/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/power-ports/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-ports/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/power-ports/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-ports/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/power-ports/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/dcim/power-ports/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/power-ports/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/dcim/power-ports/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-ports/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/power-ports/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/power-ports/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-ports/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/dcim/power-ports/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-ports/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/power-ports/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/power-ports/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-ports/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/power-ports/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-ports/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-ports/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/power-ports/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/dcim/power-ports/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/power-ports/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/dcim/power-ports/:id/
http GET {{baseUrl}}/dcim/power-ports/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/power-ports/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-ports/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_power-ports_trace
{{baseUrl}}/dcim/power-ports/:id/trace/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-ports/:id/trace/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/power-ports/:id/trace/")
require "http/client"
url = "{{baseUrl}}/dcim/power-ports/:id/trace/"
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}}/dcim/power-ports/:id/trace/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-ports/:id/trace/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-ports/:id/trace/"
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/dcim/power-ports/:id/trace/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/power-ports/:id/trace/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-ports/:id/trace/"))
.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}}/dcim/power-ports/:id/trace/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/power-ports/:id/trace/")
.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}}/dcim/power-ports/:id/trace/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/power-ports/:id/trace/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-ports/:id/trace/';
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}}/dcim/power-ports/:id/trace/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-ports/:id/trace/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/power-ports/:id/trace/',
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}}/dcim/power-ports/:id/trace/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/power-ports/:id/trace/');
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}}/dcim/power-ports/:id/trace/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-ports/:id/trace/';
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}}/dcim/power-ports/:id/trace/"]
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}}/dcim/power-ports/:id/trace/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-ports/:id/trace/",
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}}/dcim/power-ports/:id/trace/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-ports/:id/trace/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/power-ports/:id/trace/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/power-ports/:id/trace/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-ports/:id/trace/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/power-ports/:id/trace/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-ports/:id/trace/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-ports/:id/trace/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/power-ports/:id/trace/")
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/dcim/power-ports/:id/trace/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/power-ports/:id/trace/";
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}}/dcim/power-ports/:id/trace/
http GET {{baseUrl}}/dcim/power-ports/:id/trace/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/power-ports/:id/trace/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-ports/:id/trace/")! 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()
PUT
dcim_power-ports_update
{{baseUrl}}/dcim/power-ports/:id/
BODY json
{
"allocated_draw": 0,
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"tags": [],
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/power-ports/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/dcim/power-ports/:id/" {:content-type :json
:form-params {:allocated_draw 0
:cable {:id 0
:label ""
:url ""}
:connected_endpoint {}
:connected_endpoint_type ""
:connection_status false
:description ""
:device 0
:id 0
:maximum_draw 0
:name ""
:tags []
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/power-ports/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\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}}/dcim/power-ports/:id/"),
Content = new StringContent("{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/power-ports/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/power-ports/:id/"
payload := strings.NewReader("{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\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/dcim/power-ports/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 288
{
"allocated_draw": 0,
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"tags": [],
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/dcim/power-ports/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/power-ports/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/power-ports/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/dcim/power-ports/:id/")
.header("content-type", "application/json")
.body("{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
allocated_draw: 0,
cable: {
id: 0,
label: '',
url: ''
},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
maximum_draw: 0,
name: '',
tags: [],
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/dcim/power-ports/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/power-ports/:id/',
headers: {'content-type': 'application/json'},
data: {
allocated_draw: 0,
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
maximum_draw: 0,
name: '',
tags: [],
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/power-ports/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"allocated_draw":0,"cable":{"id":0,"label":"","url":""},"connected_endpoint":{},"connected_endpoint_type":"","connection_status":false,"description":"","device":0,"id":0,"maximum_draw":0,"name":"","tags":[],"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/power-ports/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "allocated_draw": 0,\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "connected_endpoint": {},\n "connected_endpoint_type": "",\n "connection_status": false,\n "description": "",\n "device": 0,\n "id": 0,\n "maximum_draw": 0,\n "name": "",\n "tags": [],\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/power-ports/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/power-ports/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
allocated_draw: 0,
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
maximum_draw: 0,
name: '',
tags: [],
type: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/power-ports/:id/',
headers: {'content-type': 'application/json'},
body: {
allocated_draw: 0,
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
maximum_draw: 0,
name: '',
tags: [],
type: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/dcim/power-ports/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
allocated_draw: 0,
cable: {
id: 0,
label: '',
url: ''
},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
maximum_draw: 0,
name: '',
tags: [],
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/power-ports/:id/',
headers: {'content-type': 'application/json'},
data: {
allocated_draw: 0,
cable: {id: 0, label: '', url: ''},
connected_endpoint: {},
connected_endpoint_type: '',
connection_status: false,
description: '',
device: 0,
id: 0,
maximum_draw: 0,
name: '',
tags: [],
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/power-ports/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"allocated_draw":0,"cable":{"id":0,"label":"","url":""},"connected_endpoint":{},"connected_endpoint_type":"","connection_status":false,"description":"","device":0,"id":0,"maximum_draw":0,"name":"","tags":[],"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"allocated_draw": @0,
@"cable": @{ @"id": @0, @"label": @"", @"url": @"" },
@"connected_endpoint": @{ },
@"connected_endpoint_type": @"",
@"connection_status": @NO,
@"description": @"",
@"device": @0,
@"id": @0,
@"maximum_draw": @0,
@"name": @"",
@"tags": @[ ],
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/power-ports/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/power-ports/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/power-ports/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'allocated_draw' => 0,
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'device' => 0,
'id' => 0,
'maximum_draw' => 0,
'name' => '',
'tags' => [
],
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/dcim/power-ports/:id/', [
'body' => '{
"allocated_draw": 0,
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"tags": [],
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/power-ports/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'allocated_draw' => 0,
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'device' => 0,
'id' => 0,
'maximum_draw' => 0,
'name' => '',
'tags' => [
],
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'allocated_draw' => 0,
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'connected_endpoint' => [
],
'connected_endpoint_type' => '',
'connection_status' => null,
'description' => '',
'device' => 0,
'id' => 0,
'maximum_draw' => 0,
'name' => '',
'tags' => [
],
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/power-ports/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/power-ports/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"allocated_draw": 0,
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"tags": [],
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/power-ports/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"allocated_draw": 0,
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"tags": [],
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/dcim/power-ports/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/power-ports/:id/"
payload = {
"allocated_draw": 0,
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": False,
"description": "",
"device": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"tags": [],
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/power-ports/:id/"
payload <- "{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\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}}/dcim/power-ports/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/dcim/power-ports/:id/') do |req|
req.body = "{\n \"allocated_draw\": 0,\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"connected_endpoint\": {},\n \"connected_endpoint_type\": \"\",\n \"connection_status\": false,\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"maximum_draw\": 0,\n \"name\": \"\",\n \"tags\": [],\n \"type\": \"\"\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}}/dcim/power-ports/:id/";
let payload = json!({
"allocated_draw": 0,
"cable": json!({
"id": 0,
"label": "",
"url": ""
}),
"connected_endpoint": json!({}),
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"tags": (),
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/dcim/power-ports/:id/ \
--header 'content-type: application/json' \
--data '{
"allocated_draw": 0,
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"tags": [],
"type": ""
}'
echo '{
"allocated_draw": 0,
"cable": {
"id": 0,
"label": "",
"url": ""
},
"connected_endpoint": {},
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"tags": [],
"type": ""
}' | \
http PUT {{baseUrl}}/dcim/power-ports/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "allocated_draw": 0,\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "connected_endpoint": {},\n "connected_endpoint_type": "",\n "connection_status": false,\n "description": "",\n "device": 0,\n "id": 0,\n "maximum_draw": 0,\n "name": "",\n "tags": [],\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/power-ports/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"allocated_draw": 0,
"cable": [
"id": 0,
"label": "",
"url": ""
],
"connected_endpoint": [],
"connected_endpoint_type": "",
"connection_status": false,
"description": "",
"device": 0,
"id": 0,
"maximum_draw": 0,
"name": "",
"tags": [],
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/power-ports/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
dcim_rack-groups_create
{{baseUrl}}/dcim/rack-groups/
BODY json
{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"rack_count": 0,
"site": 0,
"slug": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/rack-groups/");
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 \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/dcim/rack-groups/" {:content-type :json
:form-params {:description ""
:id 0
:name ""
:parent 0
:rack_count 0
:site 0
:slug ""}})
require "http/client"
url = "{{baseUrl}}/dcim/rack-groups/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\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}}/dcim/rack-groups/"),
Content = new StringContent("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\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}}/dcim/rack-groups/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/rack-groups/"
payload := strings.NewReader("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\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/dcim/rack-groups/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 109
{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"rack_count": 0,
"site": 0,
"slug": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/dcim/rack-groups/")
.setHeader("content-type", "application/json")
.setBody("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/rack-groups/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\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 \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/rack-groups/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/dcim/rack-groups/")
.header("content-type", "application/json")
.body("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\n}")
.asString();
const data = JSON.stringify({
description: '',
id: 0,
name: '',
parent: 0,
rack_count: 0,
site: 0,
slug: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/dcim/rack-groups/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/rack-groups/',
headers: {'content-type': 'application/json'},
data: {description: '', id: 0, name: '', parent: 0, rack_count: 0, site: 0, slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/rack-groups/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"description":"","id":0,"name":"","parent":0,"rack_count":0,"site":0,"slug":""}'
};
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}}/dcim/rack-groups/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "description": "",\n "id": 0,\n "name": "",\n "parent": 0,\n "rack_count": 0,\n "site": 0,\n "slug": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/rack-groups/")
.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/dcim/rack-groups/',
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({description: '', id: 0, name: '', parent: 0, rack_count: 0, site: 0, slug: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/rack-groups/',
headers: {'content-type': 'application/json'},
body: {description: '', id: 0, name: '', parent: 0, rack_count: 0, site: 0, slug: ''},
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}}/dcim/rack-groups/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
description: '',
id: 0,
name: '',
parent: 0,
rack_count: 0,
site: 0,
slug: ''
});
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}}/dcim/rack-groups/',
headers: {'content-type': 'application/json'},
data: {description: '', id: 0, name: '', parent: 0, rack_count: 0, site: 0, slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/rack-groups/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"description":"","id":0,"name":"","parent":0,"rack_count":0,"site":0,"slug":""}'
};
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 = @{ @"description": @"",
@"id": @0,
@"name": @"",
@"parent": @0,
@"rack_count": @0,
@"site": @0,
@"slug": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/rack-groups/"]
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}}/dcim/rack-groups/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/rack-groups/",
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([
'description' => '',
'id' => 0,
'name' => '',
'parent' => 0,
'rack_count' => 0,
'site' => 0,
'slug' => ''
]),
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}}/dcim/rack-groups/', [
'body' => '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"rack_count": 0,
"site": 0,
"slug": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/rack-groups/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'description' => '',
'id' => 0,
'name' => '',
'parent' => 0,
'rack_count' => 0,
'site' => 0,
'slug' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'description' => '',
'id' => 0,
'name' => '',
'parent' => 0,
'rack_count' => 0,
'site' => 0,
'slug' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/rack-groups/');
$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}}/dcim/rack-groups/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"rack_count": 0,
"site": 0,
"slug": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/rack-groups/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"rack_count": 0,
"site": 0,
"slug": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/dcim/rack-groups/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/rack-groups/"
payload = {
"description": "",
"id": 0,
"name": "",
"parent": 0,
"rack_count": 0,
"site": 0,
"slug": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/rack-groups/"
payload <- "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\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}}/dcim/rack-groups/")
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 \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\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/dcim/rack-groups/') do |req|
req.body = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/rack-groups/";
let payload = json!({
"description": "",
"id": 0,
"name": "",
"parent": 0,
"rack_count": 0,
"site": 0,
"slug": ""
});
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}}/dcim/rack-groups/ \
--header 'content-type: application/json' \
--data '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"rack_count": 0,
"site": 0,
"slug": ""
}'
echo '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"rack_count": 0,
"site": 0,
"slug": ""
}' | \
http POST {{baseUrl}}/dcim/rack-groups/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "description": "",\n "id": 0,\n "name": "",\n "parent": 0,\n "rack_count": 0,\n "site": 0,\n "slug": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/rack-groups/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"description": "",
"id": 0,
"name": "",
"parent": 0,
"rack_count": 0,
"site": 0,
"slug": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/rack-groups/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
dcim_rack-groups_delete
{{baseUrl}}/dcim/rack-groups/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/rack-groups/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/dcim/rack-groups/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/rack-groups/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/dcim/rack-groups/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/rack-groups/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/rack-groups/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/dcim/rack-groups/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/dcim/rack-groups/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/rack-groups/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/rack-groups/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/dcim/rack-groups/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/dcim/rack-groups/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/rack-groups/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/rack-groups/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/rack-groups/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/rack-groups/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/rack-groups/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/rack-groups/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/dcim/rack-groups/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/rack-groups/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/rack-groups/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/rack-groups/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/rack-groups/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/rack-groups/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/dcim/rack-groups/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/rack-groups/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/rack-groups/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/rack-groups/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/rack-groups/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/dcim/rack-groups/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/rack-groups/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/rack-groups/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/rack-groups/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/dcim/rack-groups/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/rack-groups/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/dcim/rack-groups/:id/
http DELETE {{baseUrl}}/dcim/rack-groups/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/dcim/rack-groups/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/rack-groups/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_rack-groups_list
{{baseUrl}}/dcim/rack-groups/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/rack-groups/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/rack-groups/")
require "http/client"
url = "{{baseUrl}}/dcim/rack-groups/"
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}}/dcim/rack-groups/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/rack-groups/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/rack-groups/"
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/dcim/rack-groups/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/rack-groups/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/rack-groups/"))
.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}}/dcim/rack-groups/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/rack-groups/")
.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}}/dcim/rack-groups/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/rack-groups/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/rack-groups/';
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}}/dcim/rack-groups/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/rack-groups/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/rack-groups/',
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}}/dcim/rack-groups/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/rack-groups/');
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}}/dcim/rack-groups/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/rack-groups/';
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}}/dcim/rack-groups/"]
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}}/dcim/rack-groups/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/rack-groups/",
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}}/dcim/rack-groups/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/rack-groups/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/rack-groups/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/rack-groups/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/rack-groups/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/rack-groups/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/rack-groups/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/rack-groups/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/rack-groups/")
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/dcim/rack-groups/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/rack-groups/";
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}}/dcim/rack-groups/
http GET {{baseUrl}}/dcim/rack-groups/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/rack-groups/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/rack-groups/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
dcim_rack-groups_partial_update
{{baseUrl}}/dcim/rack-groups/:id/
BODY json
{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"rack_count": 0,
"site": 0,
"slug": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/rack-groups/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/dcim/rack-groups/:id/" {:content-type :json
:form-params {:description ""
:id 0
:name ""
:parent 0
:rack_count 0
:site 0
:slug ""}})
require "http/client"
url = "{{baseUrl}}/dcim/rack-groups/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\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}}/dcim/rack-groups/:id/"),
Content = new StringContent("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\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}}/dcim/rack-groups/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/rack-groups/:id/"
payload := strings.NewReader("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\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/dcim/rack-groups/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 109
{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"rack_count": 0,
"site": 0,
"slug": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/dcim/rack-groups/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/rack-groups/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\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 \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/rack-groups/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/dcim/rack-groups/:id/")
.header("content-type", "application/json")
.body("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\n}")
.asString();
const data = JSON.stringify({
description: '',
id: 0,
name: '',
parent: 0,
rack_count: 0,
site: 0,
slug: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/dcim/rack-groups/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/rack-groups/:id/',
headers: {'content-type': 'application/json'},
data: {description: '', id: 0, name: '', parent: 0, rack_count: 0, site: 0, slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/rack-groups/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"description":"","id":0,"name":"","parent":0,"rack_count":0,"site":0,"slug":""}'
};
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}}/dcim/rack-groups/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "description": "",\n "id": 0,\n "name": "",\n "parent": 0,\n "rack_count": 0,\n "site": 0,\n "slug": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/rack-groups/:id/")
.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/dcim/rack-groups/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({description: '', id: 0, name: '', parent: 0, rack_count: 0, site: 0, slug: ''}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/rack-groups/:id/',
headers: {'content-type': 'application/json'},
body: {description: '', id: 0, name: '', parent: 0, rack_count: 0, site: 0, slug: ''},
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}}/dcim/rack-groups/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
description: '',
id: 0,
name: '',
parent: 0,
rack_count: 0,
site: 0,
slug: ''
});
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}}/dcim/rack-groups/:id/',
headers: {'content-type': 'application/json'},
data: {description: '', id: 0, name: '', parent: 0, rack_count: 0, site: 0, slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/rack-groups/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"description":"","id":0,"name":"","parent":0,"rack_count":0,"site":0,"slug":""}'
};
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 = @{ @"description": @"",
@"id": @0,
@"name": @"",
@"parent": @0,
@"rack_count": @0,
@"site": @0,
@"slug": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/rack-groups/:id/"]
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}}/dcim/rack-groups/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/rack-groups/:id/",
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([
'description' => '',
'id' => 0,
'name' => '',
'parent' => 0,
'rack_count' => 0,
'site' => 0,
'slug' => ''
]),
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}}/dcim/rack-groups/:id/', [
'body' => '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"rack_count": 0,
"site": 0,
"slug": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/rack-groups/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'description' => '',
'id' => 0,
'name' => '',
'parent' => 0,
'rack_count' => 0,
'site' => 0,
'slug' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'description' => '',
'id' => 0,
'name' => '',
'parent' => 0,
'rack_count' => 0,
'site' => 0,
'slug' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/rack-groups/:id/');
$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}}/dcim/rack-groups/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"rack_count": 0,
"site": 0,
"slug": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/rack-groups/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"rack_count": 0,
"site": 0,
"slug": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/dcim/rack-groups/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/rack-groups/:id/"
payload = {
"description": "",
"id": 0,
"name": "",
"parent": 0,
"rack_count": 0,
"site": 0,
"slug": ""
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/rack-groups/:id/"
payload <- "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\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}}/dcim/rack-groups/:id/")
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 \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\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/dcim/rack-groups/:id/') do |req|
req.body = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\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}}/dcim/rack-groups/:id/";
let payload = json!({
"description": "",
"id": 0,
"name": "",
"parent": 0,
"rack_count": 0,
"site": 0,
"slug": ""
});
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}}/dcim/rack-groups/:id/ \
--header 'content-type: application/json' \
--data '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"rack_count": 0,
"site": 0,
"slug": ""
}'
echo '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"rack_count": 0,
"site": 0,
"slug": ""
}' | \
http PATCH {{baseUrl}}/dcim/rack-groups/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "description": "",\n "id": 0,\n "name": "",\n "parent": 0,\n "rack_count": 0,\n "site": 0,\n "slug": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/rack-groups/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"description": "",
"id": 0,
"name": "",
"parent": 0,
"rack_count": 0,
"site": 0,
"slug": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/rack-groups/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_rack-groups_read
{{baseUrl}}/dcim/rack-groups/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/rack-groups/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/rack-groups/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/rack-groups/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/dcim/rack-groups/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/rack-groups/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/rack-groups/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/dcim/rack-groups/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/rack-groups/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/rack-groups/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/rack-groups/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/rack-groups/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/dcim/rack-groups/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/rack-groups/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/rack-groups/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/rack-groups/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/rack-groups/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/rack-groups/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/dcim/rack-groups/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/rack-groups/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/dcim/rack-groups/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/rack-groups/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/rack-groups/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/rack-groups/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/rack-groups/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/dcim/rack-groups/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/rack-groups/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/rack-groups/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/rack-groups/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/rack-groups/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/rack-groups/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/rack-groups/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/rack-groups/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/rack-groups/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/dcim/rack-groups/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/rack-groups/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/dcim/rack-groups/:id/
http GET {{baseUrl}}/dcim/rack-groups/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/rack-groups/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/rack-groups/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
dcim_rack-groups_update
{{baseUrl}}/dcim/rack-groups/:id/
BODY json
{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"rack_count": 0,
"site": 0,
"slug": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/rack-groups/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/dcim/rack-groups/:id/" {:content-type :json
:form-params {:description ""
:id 0
:name ""
:parent 0
:rack_count 0
:site 0
:slug ""}})
require "http/client"
url = "{{baseUrl}}/dcim/rack-groups/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\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}}/dcim/rack-groups/:id/"),
Content = new StringContent("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\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}}/dcim/rack-groups/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/rack-groups/:id/"
payload := strings.NewReader("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\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/dcim/rack-groups/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 109
{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"rack_count": 0,
"site": 0,
"slug": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/dcim/rack-groups/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/rack-groups/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\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 \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/rack-groups/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/dcim/rack-groups/:id/")
.header("content-type", "application/json")
.body("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\n}")
.asString();
const data = JSON.stringify({
description: '',
id: 0,
name: '',
parent: 0,
rack_count: 0,
site: 0,
slug: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/dcim/rack-groups/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/rack-groups/:id/',
headers: {'content-type': 'application/json'},
data: {description: '', id: 0, name: '', parent: 0, rack_count: 0, site: 0, slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/rack-groups/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"description":"","id":0,"name":"","parent":0,"rack_count":0,"site":0,"slug":""}'
};
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}}/dcim/rack-groups/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "description": "",\n "id": 0,\n "name": "",\n "parent": 0,\n "rack_count": 0,\n "site": 0,\n "slug": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/rack-groups/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/rack-groups/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({description: '', id: 0, name: '', parent: 0, rack_count: 0, site: 0, slug: ''}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/rack-groups/:id/',
headers: {'content-type': 'application/json'},
body: {description: '', id: 0, name: '', parent: 0, rack_count: 0, site: 0, slug: ''},
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}}/dcim/rack-groups/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
description: '',
id: 0,
name: '',
parent: 0,
rack_count: 0,
site: 0,
slug: ''
});
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}}/dcim/rack-groups/:id/',
headers: {'content-type': 'application/json'},
data: {description: '', id: 0, name: '', parent: 0, rack_count: 0, site: 0, slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/rack-groups/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"description":"","id":0,"name":"","parent":0,"rack_count":0,"site":0,"slug":""}'
};
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 = @{ @"description": @"",
@"id": @0,
@"name": @"",
@"parent": @0,
@"rack_count": @0,
@"site": @0,
@"slug": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/rack-groups/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/rack-groups/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/rack-groups/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'description' => '',
'id' => 0,
'name' => '',
'parent' => 0,
'rack_count' => 0,
'site' => 0,
'slug' => ''
]),
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}}/dcim/rack-groups/:id/', [
'body' => '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"rack_count": 0,
"site": 0,
"slug": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/rack-groups/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'description' => '',
'id' => 0,
'name' => '',
'parent' => 0,
'rack_count' => 0,
'site' => 0,
'slug' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'description' => '',
'id' => 0,
'name' => '',
'parent' => 0,
'rack_count' => 0,
'site' => 0,
'slug' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/rack-groups/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/rack-groups/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"rack_count": 0,
"site": 0,
"slug": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/rack-groups/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"rack_count": 0,
"site": 0,
"slug": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/dcim/rack-groups/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/rack-groups/:id/"
payload = {
"description": "",
"id": 0,
"name": "",
"parent": 0,
"rack_count": 0,
"site": 0,
"slug": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/rack-groups/:id/"
payload <- "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\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}}/dcim/rack-groups/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\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/dcim/rack-groups/:id/') do |req|
req.body = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"rack_count\": 0,\n \"site\": 0,\n \"slug\": \"\"\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}}/dcim/rack-groups/:id/";
let payload = json!({
"description": "",
"id": 0,
"name": "",
"parent": 0,
"rack_count": 0,
"site": 0,
"slug": ""
});
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}}/dcim/rack-groups/:id/ \
--header 'content-type: application/json' \
--data '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"rack_count": 0,
"site": 0,
"slug": ""
}'
echo '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"rack_count": 0,
"site": 0,
"slug": ""
}' | \
http PUT {{baseUrl}}/dcim/rack-groups/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "description": "",\n "id": 0,\n "name": "",\n "parent": 0,\n "rack_count": 0,\n "site": 0,\n "slug": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/rack-groups/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"description": "",
"id": 0,
"name": "",
"parent": 0,
"rack_count": 0,
"site": 0,
"slug": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/rack-groups/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
dcim_rack-reservations_create
{{baseUrl}}/dcim/rack-reservations/
BODY json
{
"created": "",
"description": "",
"id": 0,
"rack": 0,
"tenant": 0,
"units": [],
"user": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/rack-reservations/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/dcim/rack-reservations/" {:content-type :json
:form-params {:created ""
:description ""
:id 0
:rack 0
:tenant 0
:units []
:user 0}})
require "http/client"
url = "{{baseUrl}}/dcim/rack-reservations/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/dcim/rack-reservations/"),
Content = new StringContent("{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/rack-reservations/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/rack-reservations/"
payload := strings.NewReader("{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/dcim/rack-reservations/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 107
{
"created": "",
"description": "",
"id": 0,
"rack": 0,
"tenant": 0,
"units": [],
"user": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/dcim/rack-reservations/")
.setHeader("content-type", "application/json")
.setBody("{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/rack-reservations/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/rack-reservations/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/dcim/rack-reservations/")
.header("content-type", "application/json")
.body("{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\n}")
.asString();
const data = JSON.stringify({
created: '',
description: '',
id: 0,
rack: 0,
tenant: 0,
units: [],
user: 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}}/dcim/rack-reservations/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/rack-reservations/',
headers: {'content-type': 'application/json'},
data: {created: '', description: '', id: 0, rack: 0, tenant: 0, units: [], user: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/rack-reservations/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"created":"","description":"","id":0,"rack":0,"tenant":0,"units":[],"user":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}}/dcim/rack-reservations/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "created": "",\n "description": "",\n "id": 0,\n "rack": 0,\n "tenant": 0,\n "units": [],\n "user": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/rack-reservations/")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/rack-reservations/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({created: '', description: '', id: 0, rack: 0, tenant: 0, units: [], user: 0}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/rack-reservations/',
headers: {'content-type': 'application/json'},
body: {created: '', description: '', id: 0, rack: 0, tenant: 0, units: [], user: 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}}/dcim/rack-reservations/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
created: '',
description: '',
id: 0,
rack: 0,
tenant: 0,
units: [],
user: 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}}/dcim/rack-reservations/',
headers: {'content-type': 'application/json'},
data: {created: '', description: '', id: 0, rack: 0, tenant: 0, units: [], user: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/rack-reservations/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"created":"","description":"","id":0,"rack":0,"tenant":0,"units":[],"user":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 = @{ @"created": @"",
@"description": @"",
@"id": @0,
@"rack": @0,
@"tenant": @0,
@"units": @[ ],
@"user": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/rack-reservations/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/rack-reservations/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/rack-reservations/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'created' => '',
'description' => '',
'id' => 0,
'rack' => 0,
'tenant' => 0,
'units' => [
],
'user' => 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}}/dcim/rack-reservations/', [
'body' => '{
"created": "",
"description": "",
"id": 0,
"rack": 0,
"tenant": 0,
"units": [],
"user": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/rack-reservations/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'created' => '',
'description' => '',
'id' => 0,
'rack' => 0,
'tenant' => 0,
'units' => [
],
'user' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'created' => '',
'description' => '',
'id' => 0,
'rack' => 0,
'tenant' => 0,
'units' => [
],
'user' => 0
]));
$request->setRequestUrl('{{baseUrl}}/dcim/rack-reservations/');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/rack-reservations/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"description": "",
"id": 0,
"rack": 0,
"tenant": 0,
"units": [],
"user": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/rack-reservations/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"description": "",
"id": 0,
"rack": 0,
"tenant": 0,
"units": [],
"user": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/dcim/rack-reservations/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/rack-reservations/"
payload = {
"created": "",
"description": "",
"id": 0,
"rack": 0,
"tenant": 0,
"units": [],
"user": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/rack-reservations/"
payload <- "{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/rack-reservations/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/dcim/rack-reservations/') do |req|
req.body = "{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/rack-reservations/";
let payload = json!({
"created": "",
"description": "",
"id": 0,
"rack": 0,
"tenant": 0,
"units": (),
"user": 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}}/dcim/rack-reservations/ \
--header 'content-type: application/json' \
--data '{
"created": "",
"description": "",
"id": 0,
"rack": 0,
"tenant": 0,
"units": [],
"user": 0
}'
echo '{
"created": "",
"description": "",
"id": 0,
"rack": 0,
"tenant": 0,
"units": [],
"user": 0
}' | \
http POST {{baseUrl}}/dcim/rack-reservations/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "created": "",\n "description": "",\n "id": 0,\n "rack": 0,\n "tenant": 0,\n "units": [],\n "user": 0\n}' \
--output-document \
- {{baseUrl}}/dcim/rack-reservations/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"created": "",
"description": "",
"id": 0,
"rack": 0,
"tenant": 0,
"units": [],
"user": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/rack-reservations/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
dcim_rack-reservations_delete
{{baseUrl}}/dcim/rack-reservations/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/rack-reservations/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/dcim/rack-reservations/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/rack-reservations/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/dcim/rack-reservations/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/rack-reservations/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/rack-reservations/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/dcim/rack-reservations/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/dcim/rack-reservations/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/rack-reservations/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/rack-reservations/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/dcim/rack-reservations/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/dcim/rack-reservations/:id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/dcim/rack-reservations/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/rack-reservations/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/rack-reservations/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/rack-reservations/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/rack-reservations/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/dcim/rack-reservations/:id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/dcim/rack-reservations/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/dcim/rack-reservations/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/rack-reservations/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/rack-reservations/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/rack-reservations/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/rack-reservations/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/dcim/rack-reservations/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/rack-reservations/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/rack-reservations/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/rack-reservations/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/rack-reservations/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/dcim/rack-reservations/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/rack-reservations/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/rack-reservations/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/rack-reservations/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/dcim/rack-reservations/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/rack-reservations/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/dcim/rack-reservations/:id/
http DELETE {{baseUrl}}/dcim/rack-reservations/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/dcim/rack-reservations/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/rack-reservations/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_rack-reservations_list
{{baseUrl}}/dcim/rack-reservations/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/rack-reservations/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/rack-reservations/")
require "http/client"
url = "{{baseUrl}}/dcim/rack-reservations/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/dcim/rack-reservations/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/rack-reservations/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/rack-reservations/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/dcim/rack-reservations/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/rack-reservations/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/rack-reservations/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/rack-reservations/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/rack-reservations/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/dcim/rack-reservations/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/rack-reservations/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/rack-reservations/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/rack-reservations/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/rack-reservations/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/rack-reservations/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/dcim/rack-reservations/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/rack-reservations/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/dcim/rack-reservations/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/rack-reservations/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/rack-reservations/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/rack-reservations/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/rack-reservations/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/dcim/rack-reservations/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/rack-reservations/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/rack-reservations/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/rack-reservations/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/rack-reservations/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/rack-reservations/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/rack-reservations/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/rack-reservations/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/rack-reservations/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/dcim/rack-reservations/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/rack-reservations/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/dcim/rack-reservations/
http GET {{baseUrl}}/dcim/rack-reservations/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/rack-reservations/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/rack-reservations/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
dcim_rack-reservations_partial_update
{{baseUrl}}/dcim/rack-reservations/:id/
BODY json
{
"created": "",
"description": "",
"id": 0,
"rack": 0,
"tenant": 0,
"units": [],
"user": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/rack-reservations/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/dcim/rack-reservations/:id/" {:content-type :json
:form-params {:created ""
:description ""
:id 0
:rack 0
:tenant 0
:units []
:user 0}})
require "http/client"
url = "{{baseUrl}}/dcim/rack-reservations/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\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}}/dcim/rack-reservations/:id/"),
Content = new StringContent("{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/rack-reservations/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/rack-reservations/:id/"
payload := strings.NewReader("{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\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/dcim/rack-reservations/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 107
{
"created": "",
"description": "",
"id": 0,
"rack": 0,
"tenant": 0,
"units": [],
"user": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/dcim/rack-reservations/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/rack-reservations/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/rack-reservations/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/dcim/rack-reservations/:id/")
.header("content-type", "application/json")
.body("{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\n}")
.asString();
const data = JSON.stringify({
created: '',
description: '',
id: 0,
rack: 0,
tenant: 0,
units: [],
user: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/dcim/rack-reservations/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/rack-reservations/:id/',
headers: {'content-type': 'application/json'},
data: {created: '', description: '', id: 0, rack: 0, tenant: 0, units: [], user: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/rack-reservations/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"created":"","description":"","id":0,"rack":0,"tenant":0,"units":[],"user":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}}/dcim/rack-reservations/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "created": "",\n "description": "",\n "id": 0,\n "rack": 0,\n "tenant": 0,\n "units": [],\n "user": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/rack-reservations/:id/")
.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/dcim/rack-reservations/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({created: '', description: '', id: 0, rack: 0, tenant: 0, units: [], user: 0}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/rack-reservations/:id/',
headers: {'content-type': 'application/json'},
body: {created: '', description: '', id: 0, rack: 0, tenant: 0, units: [], user: 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('PATCH', '{{baseUrl}}/dcim/rack-reservations/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
created: '',
description: '',
id: 0,
rack: 0,
tenant: 0,
units: [],
user: 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: 'PATCH',
url: '{{baseUrl}}/dcim/rack-reservations/:id/',
headers: {'content-type': 'application/json'},
data: {created: '', description: '', id: 0, rack: 0, tenant: 0, units: [], user: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/rack-reservations/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"created":"","description":"","id":0,"rack":0,"tenant":0,"units":[],"user":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 = @{ @"created": @"",
@"description": @"",
@"id": @0,
@"rack": @0,
@"tenant": @0,
@"units": @[ ],
@"user": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/rack-reservations/:id/"]
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}}/dcim/rack-reservations/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/rack-reservations/:id/",
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([
'created' => '',
'description' => '',
'id' => 0,
'rack' => 0,
'tenant' => 0,
'units' => [
],
'user' => 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('PATCH', '{{baseUrl}}/dcim/rack-reservations/:id/', [
'body' => '{
"created": "",
"description": "",
"id": 0,
"rack": 0,
"tenant": 0,
"units": [],
"user": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/rack-reservations/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'created' => '',
'description' => '',
'id' => 0,
'rack' => 0,
'tenant' => 0,
'units' => [
],
'user' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'created' => '',
'description' => '',
'id' => 0,
'rack' => 0,
'tenant' => 0,
'units' => [
],
'user' => 0
]));
$request->setRequestUrl('{{baseUrl}}/dcim/rack-reservations/:id/');
$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}}/dcim/rack-reservations/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"description": "",
"id": 0,
"rack": 0,
"tenant": 0,
"units": [],
"user": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/rack-reservations/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"description": "",
"id": 0,
"rack": 0,
"tenant": 0,
"units": [],
"user": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/dcim/rack-reservations/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/rack-reservations/:id/"
payload = {
"created": "",
"description": "",
"id": 0,
"rack": 0,
"tenant": 0,
"units": [],
"user": 0
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/rack-reservations/:id/"
payload <- "{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\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}}/dcim/rack-reservations/:id/")
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 \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/dcim/rack-reservations/:id/') do |req|
req.body = "{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\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}}/dcim/rack-reservations/:id/";
let payload = json!({
"created": "",
"description": "",
"id": 0,
"rack": 0,
"tenant": 0,
"units": (),
"user": 0
});
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}}/dcim/rack-reservations/:id/ \
--header 'content-type: application/json' \
--data '{
"created": "",
"description": "",
"id": 0,
"rack": 0,
"tenant": 0,
"units": [],
"user": 0
}'
echo '{
"created": "",
"description": "",
"id": 0,
"rack": 0,
"tenant": 0,
"units": [],
"user": 0
}' | \
http PATCH {{baseUrl}}/dcim/rack-reservations/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "created": "",\n "description": "",\n "id": 0,\n "rack": 0,\n "tenant": 0,\n "units": [],\n "user": 0\n}' \
--output-document \
- {{baseUrl}}/dcim/rack-reservations/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"created": "",
"description": "",
"id": 0,
"rack": 0,
"tenant": 0,
"units": [],
"user": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/rack-reservations/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_rack-reservations_read
{{baseUrl}}/dcim/rack-reservations/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/rack-reservations/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/rack-reservations/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/rack-reservations/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/dcim/rack-reservations/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/rack-reservations/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/rack-reservations/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/dcim/rack-reservations/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/rack-reservations/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/rack-reservations/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/rack-reservations/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/rack-reservations/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/dcim/rack-reservations/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/rack-reservations/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/rack-reservations/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/rack-reservations/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/rack-reservations/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/rack-reservations/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/dcim/rack-reservations/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/rack-reservations/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/dcim/rack-reservations/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/rack-reservations/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/rack-reservations/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/rack-reservations/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/rack-reservations/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/dcim/rack-reservations/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/rack-reservations/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/rack-reservations/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/rack-reservations/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/rack-reservations/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/rack-reservations/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/rack-reservations/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/rack-reservations/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/rack-reservations/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/dcim/rack-reservations/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/rack-reservations/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/dcim/rack-reservations/:id/
http GET {{baseUrl}}/dcim/rack-reservations/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/rack-reservations/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/rack-reservations/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
dcim_rack-reservations_update
{{baseUrl}}/dcim/rack-reservations/:id/
BODY json
{
"created": "",
"description": "",
"id": 0,
"rack": 0,
"tenant": 0,
"units": [],
"user": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/rack-reservations/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/dcim/rack-reservations/:id/" {:content-type :json
:form-params {:created ""
:description ""
:id 0
:rack 0
:tenant 0
:units []
:user 0}})
require "http/client"
url = "{{baseUrl}}/dcim/rack-reservations/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\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}}/dcim/rack-reservations/:id/"),
Content = new StringContent("{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/rack-reservations/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/rack-reservations/:id/"
payload := strings.NewReader("{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\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/dcim/rack-reservations/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 107
{
"created": "",
"description": "",
"id": 0,
"rack": 0,
"tenant": 0,
"units": [],
"user": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/dcim/rack-reservations/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/rack-reservations/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/rack-reservations/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/dcim/rack-reservations/:id/")
.header("content-type", "application/json")
.body("{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\n}")
.asString();
const data = JSON.stringify({
created: '',
description: '',
id: 0,
rack: 0,
tenant: 0,
units: [],
user: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/dcim/rack-reservations/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/rack-reservations/:id/',
headers: {'content-type': 'application/json'},
data: {created: '', description: '', id: 0, rack: 0, tenant: 0, units: [], user: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/rack-reservations/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"created":"","description":"","id":0,"rack":0,"tenant":0,"units":[],"user":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}}/dcim/rack-reservations/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "created": "",\n "description": "",\n "id": 0,\n "rack": 0,\n "tenant": 0,\n "units": [],\n "user": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/rack-reservations/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/rack-reservations/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({created: '', description: '', id: 0, rack: 0, tenant: 0, units: [], user: 0}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/rack-reservations/:id/',
headers: {'content-type': 'application/json'},
body: {created: '', description: '', id: 0, rack: 0, tenant: 0, units: [], user: 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('PUT', '{{baseUrl}}/dcim/rack-reservations/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
created: '',
description: '',
id: 0,
rack: 0,
tenant: 0,
units: [],
user: 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: 'PUT',
url: '{{baseUrl}}/dcim/rack-reservations/:id/',
headers: {'content-type': 'application/json'},
data: {created: '', description: '', id: 0, rack: 0, tenant: 0, units: [], user: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/rack-reservations/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"created":"","description":"","id":0,"rack":0,"tenant":0,"units":[],"user":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 = @{ @"created": @"",
@"description": @"",
@"id": @0,
@"rack": @0,
@"tenant": @0,
@"units": @[ ],
@"user": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/rack-reservations/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/rack-reservations/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/rack-reservations/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'created' => '',
'description' => '',
'id' => 0,
'rack' => 0,
'tenant' => 0,
'units' => [
],
'user' => 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('PUT', '{{baseUrl}}/dcim/rack-reservations/:id/', [
'body' => '{
"created": "",
"description": "",
"id": 0,
"rack": 0,
"tenant": 0,
"units": [],
"user": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/rack-reservations/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'created' => '',
'description' => '',
'id' => 0,
'rack' => 0,
'tenant' => 0,
'units' => [
],
'user' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'created' => '',
'description' => '',
'id' => 0,
'rack' => 0,
'tenant' => 0,
'units' => [
],
'user' => 0
]));
$request->setRequestUrl('{{baseUrl}}/dcim/rack-reservations/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/rack-reservations/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"description": "",
"id": 0,
"rack": 0,
"tenant": 0,
"units": [],
"user": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/rack-reservations/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"description": "",
"id": 0,
"rack": 0,
"tenant": 0,
"units": [],
"user": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/dcim/rack-reservations/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/rack-reservations/:id/"
payload = {
"created": "",
"description": "",
"id": 0,
"rack": 0,
"tenant": 0,
"units": [],
"user": 0
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/rack-reservations/:id/"
payload <- "{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\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}}/dcim/rack-reservations/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/dcim/rack-reservations/:id/') do |req|
req.body = "{\n \"created\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"rack\": 0,\n \"tenant\": 0,\n \"units\": [],\n \"user\": 0\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}}/dcim/rack-reservations/:id/";
let payload = json!({
"created": "",
"description": "",
"id": 0,
"rack": 0,
"tenant": 0,
"units": (),
"user": 0
});
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}}/dcim/rack-reservations/:id/ \
--header 'content-type: application/json' \
--data '{
"created": "",
"description": "",
"id": 0,
"rack": 0,
"tenant": 0,
"units": [],
"user": 0
}'
echo '{
"created": "",
"description": "",
"id": 0,
"rack": 0,
"tenant": 0,
"units": [],
"user": 0
}' | \
http PUT {{baseUrl}}/dcim/rack-reservations/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "created": "",\n "description": "",\n "id": 0,\n "rack": 0,\n "tenant": 0,\n "units": [],\n "user": 0\n}' \
--output-document \
- {{baseUrl}}/dcim/rack-reservations/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"created": "",
"description": "",
"id": 0,
"rack": 0,
"tenant": 0,
"units": [],
"user": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/rack-reservations/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
dcim_rack-roles_create
{{baseUrl}}/dcim/rack-roles/
BODY json
{
"color": "",
"description": "",
"id": 0,
"name": "",
"rack_count": 0,
"slug": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/rack-roles/");
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 \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/dcim/rack-roles/" {:content-type :json
:form-params {:color ""
:description ""
:id 0
:name ""
:rack_count 0
:slug ""}})
require "http/client"
url = "{{baseUrl}}/dcim/rack-roles/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\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}}/dcim/rack-roles/"),
Content = new StringContent("{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\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}}/dcim/rack-roles/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/rack-roles/"
payload := strings.NewReader("{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\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/dcim/rack-roles/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 96
{
"color": "",
"description": "",
"id": 0,
"name": "",
"rack_count": 0,
"slug": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/dcim/rack-roles/")
.setHeader("content-type", "application/json")
.setBody("{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/rack-roles/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\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 \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/rack-roles/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/dcim/rack-roles/")
.header("content-type", "application/json")
.body("{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\n}")
.asString();
const data = JSON.stringify({
color: '',
description: '',
id: 0,
name: '',
rack_count: 0,
slug: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/dcim/rack-roles/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/rack-roles/',
headers: {'content-type': 'application/json'},
data: {color: '', description: '', id: 0, name: '', rack_count: 0, slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/rack-roles/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"color":"","description":"","id":0,"name":"","rack_count":0,"slug":""}'
};
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}}/dcim/rack-roles/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "color": "",\n "description": "",\n "id": 0,\n "name": "",\n "rack_count": 0,\n "slug": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/rack-roles/")
.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/dcim/rack-roles/',
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({color: '', description: '', id: 0, name: '', rack_count: 0, slug: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/rack-roles/',
headers: {'content-type': 'application/json'},
body: {color: '', description: '', id: 0, name: '', rack_count: 0, slug: ''},
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}}/dcim/rack-roles/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
color: '',
description: '',
id: 0,
name: '',
rack_count: 0,
slug: ''
});
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}}/dcim/rack-roles/',
headers: {'content-type': 'application/json'},
data: {color: '', description: '', id: 0, name: '', rack_count: 0, slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/rack-roles/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"color":"","description":"","id":0,"name":"","rack_count":0,"slug":""}'
};
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 = @{ @"color": @"",
@"description": @"",
@"id": @0,
@"name": @"",
@"rack_count": @0,
@"slug": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/rack-roles/"]
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}}/dcim/rack-roles/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/rack-roles/",
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([
'color' => '',
'description' => '',
'id' => 0,
'name' => '',
'rack_count' => 0,
'slug' => ''
]),
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}}/dcim/rack-roles/', [
'body' => '{
"color": "",
"description": "",
"id": 0,
"name": "",
"rack_count": 0,
"slug": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/rack-roles/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'color' => '',
'description' => '',
'id' => 0,
'name' => '',
'rack_count' => 0,
'slug' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'color' => '',
'description' => '',
'id' => 0,
'name' => '',
'rack_count' => 0,
'slug' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/rack-roles/');
$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}}/dcim/rack-roles/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"color": "",
"description": "",
"id": 0,
"name": "",
"rack_count": 0,
"slug": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/rack-roles/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"color": "",
"description": "",
"id": 0,
"name": "",
"rack_count": 0,
"slug": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/dcim/rack-roles/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/rack-roles/"
payload = {
"color": "",
"description": "",
"id": 0,
"name": "",
"rack_count": 0,
"slug": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/rack-roles/"
payload <- "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\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}}/dcim/rack-roles/")
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 \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\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/dcim/rack-roles/') do |req|
req.body = "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/rack-roles/";
let payload = json!({
"color": "",
"description": "",
"id": 0,
"name": "",
"rack_count": 0,
"slug": ""
});
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}}/dcim/rack-roles/ \
--header 'content-type: application/json' \
--data '{
"color": "",
"description": "",
"id": 0,
"name": "",
"rack_count": 0,
"slug": ""
}'
echo '{
"color": "",
"description": "",
"id": 0,
"name": "",
"rack_count": 0,
"slug": ""
}' | \
http POST {{baseUrl}}/dcim/rack-roles/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "color": "",\n "description": "",\n "id": 0,\n "name": "",\n "rack_count": 0,\n "slug": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/rack-roles/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"color": "",
"description": "",
"id": 0,
"name": "",
"rack_count": 0,
"slug": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/rack-roles/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
dcim_rack-roles_delete
{{baseUrl}}/dcim/rack-roles/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/rack-roles/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/dcim/rack-roles/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/rack-roles/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/dcim/rack-roles/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/rack-roles/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/rack-roles/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/dcim/rack-roles/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/dcim/rack-roles/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/rack-roles/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/rack-roles/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/dcim/rack-roles/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/dcim/rack-roles/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/rack-roles/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/rack-roles/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/rack-roles/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/rack-roles/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/rack-roles/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/rack-roles/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/dcim/rack-roles/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/rack-roles/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/rack-roles/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/rack-roles/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/rack-roles/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/rack-roles/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/dcim/rack-roles/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/rack-roles/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/rack-roles/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/rack-roles/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/rack-roles/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/dcim/rack-roles/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/rack-roles/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/rack-roles/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/rack-roles/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/dcim/rack-roles/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/rack-roles/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/dcim/rack-roles/:id/
http DELETE {{baseUrl}}/dcim/rack-roles/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/dcim/rack-roles/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/rack-roles/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_rack-roles_list
{{baseUrl}}/dcim/rack-roles/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/rack-roles/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/rack-roles/")
require "http/client"
url = "{{baseUrl}}/dcim/rack-roles/"
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}}/dcim/rack-roles/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/rack-roles/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/rack-roles/"
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/dcim/rack-roles/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/rack-roles/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/rack-roles/"))
.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}}/dcim/rack-roles/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/rack-roles/")
.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}}/dcim/rack-roles/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/rack-roles/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/rack-roles/';
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}}/dcim/rack-roles/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/rack-roles/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/rack-roles/',
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}}/dcim/rack-roles/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/rack-roles/');
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}}/dcim/rack-roles/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/rack-roles/';
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}}/dcim/rack-roles/"]
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}}/dcim/rack-roles/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/rack-roles/",
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}}/dcim/rack-roles/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/rack-roles/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/rack-roles/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/rack-roles/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/rack-roles/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/rack-roles/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/rack-roles/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/rack-roles/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/rack-roles/")
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/dcim/rack-roles/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/rack-roles/";
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}}/dcim/rack-roles/
http GET {{baseUrl}}/dcim/rack-roles/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/rack-roles/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/rack-roles/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
dcim_rack-roles_partial_update
{{baseUrl}}/dcim/rack-roles/:id/
BODY json
{
"color": "",
"description": "",
"id": 0,
"name": "",
"rack_count": 0,
"slug": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/rack-roles/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/dcim/rack-roles/:id/" {:content-type :json
:form-params {:color ""
:description ""
:id 0
:name ""
:rack_count 0
:slug ""}})
require "http/client"
url = "{{baseUrl}}/dcim/rack-roles/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\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}}/dcim/rack-roles/:id/"),
Content = new StringContent("{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\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}}/dcim/rack-roles/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/rack-roles/:id/"
payload := strings.NewReader("{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\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/dcim/rack-roles/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 96
{
"color": "",
"description": "",
"id": 0,
"name": "",
"rack_count": 0,
"slug": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/dcim/rack-roles/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/rack-roles/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\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 \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/rack-roles/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/dcim/rack-roles/:id/")
.header("content-type", "application/json")
.body("{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\n}")
.asString();
const data = JSON.stringify({
color: '',
description: '',
id: 0,
name: '',
rack_count: 0,
slug: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/dcim/rack-roles/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/rack-roles/:id/',
headers: {'content-type': 'application/json'},
data: {color: '', description: '', id: 0, name: '', rack_count: 0, slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/rack-roles/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"color":"","description":"","id":0,"name":"","rack_count":0,"slug":""}'
};
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}}/dcim/rack-roles/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "color": "",\n "description": "",\n "id": 0,\n "name": "",\n "rack_count": 0,\n "slug": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/rack-roles/:id/")
.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/dcim/rack-roles/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({color: '', description: '', id: 0, name: '', rack_count: 0, slug: ''}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/rack-roles/:id/',
headers: {'content-type': 'application/json'},
body: {color: '', description: '', id: 0, name: '', rack_count: 0, slug: ''},
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}}/dcim/rack-roles/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
color: '',
description: '',
id: 0,
name: '',
rack_count: 0,
slug: ''
});
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}}/dcim/rack-roles/:id/',
headers: {'content-type': 'application/json'},
data: {color: '', description: '', id: 0, name: '', rack_count: 0, slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/rack-roles/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"color":"","description":"","id":0,"name":"","rack_count":0,"slug":""}'
};
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 = @{ @"color": @"",
@"description": @"",
@"id": @0,
@"name": @"",
@"rack_count": @0,
@"slug": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/rack-roles/:id/"]
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}}/dcim/rack-roles/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/rack-roles/:id/",
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([
'color' => '',
'description' => '',
'id' => 0,
'name' => '',
'rack_count' => 0,
'slug' => ''
]),
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}}/dcim/rack-roles/:id/', [
'body' => '{
"color": "",
"description": "",
"id": 0,
"name": "",
"rack_count": 0,
"slug": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/rack-roles/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'color' => '',
'description' => '',
'id' => 0,
'name' => '',
'rack_count' => 0,
'slug' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'color' => '',
'description' => '',
'id' => 0,
'name' => '',
'rack_count' => 0,
'slug' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/rack-roles/:id/');
$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}}/dcim/rack-roles/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"color": "",
"description": "",
"id": 0,
"name": "",
"rack_count": 0,
"slug": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/rack-roles/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"color": "",
"description": "",
"id": 0,
"name": "",
"rack_count": 0,
"slug": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/dcim/rack-roles/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/rack-roles/:id/"
payload = {
"color": "",
"description": "",
"id": 0,
"name": "",
"rack_count": 0,
"slug": ""
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/rack-roles/:id/"
payload <- "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\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}}/dcim/rack-roles/:id/")
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 \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\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/dcim/rack-roles/:id/') do |req|
req.body = "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\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}}/dcim/rack-roles/:id/";
let payload = json!({
"color": "",
"description": "",
"id": 0,
"name": "",
"rack_count": 0,
"slug": ""
});
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}}/dcim/rack-roles/:id/ \
--header 'content-type: application/json' \
--data '{
"color": "",
"description": "",
"id": 0,
"name": "",
"rack_count": 0,
"slug": ""
}'
echo '{
"color": "",
"description": "",
"id": 0,
"name": "",
"rack_count": 0,
"slug": ""
}' | \
http PATCH {{baseUrl}}/dcim/rack-roles/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "color": "",\n "description": "",\n "id": 0,\n "name": "",\n "rack_count": 0,\n "slug": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/rack-roles/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"color": "",
"description": "",
"id": 0,
"name": "",
"rack_count": 0,
"slug": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/rack-roles/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_rack-roles_read
{{baseUrl}}/dcim/rack-roles/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/rack-roles/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/rack-roles/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/rack-roles/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/dcim/rack-roles/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/rack-roles/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/rack-roles/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/dcim/rack-roles/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/rack-roles/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/rack-roles/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/rack-roles/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/rack-roles/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/dcim/rack-roles/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/rack-roles/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/rack-roles/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/rack-roles/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/rack-roles/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/rack-roles/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/dcim/rack-roles/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/rack-roles/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/dcim/rack-roles/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/rack-roles/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/rack-roles/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/rack-roles/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/rack-roles/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/dcim/rack-roles/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/rack-roles/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/rack-roles/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/rack-roles/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/rack-roles/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/rack-roles/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/rack-roles/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/rack-roles/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/rack-roles/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/dcim/rack-roles/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/rack-roles/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/dcim/rack-roles/:id/
http GET {{baseUrl}}/dcim/rack-roles/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/rack-roles/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/rack-roles/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
dcim_rack-roles_update
{{baseUrl}}/dcim/rack-roles/:id/
BODY json
{
"color": "",
"description": "",
"id": 0,
"name": "",
"rack_count": 0,
"slug": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/rack-roles/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/dcim/rack-roles/:id/" {:content-type :json
:form-params {:color ""
:description ""
:id 0
:name ""
:rack_count 0
:slug ""}})
require "http/client"
url = "{{baseUrl}}/dcim/rack-roles/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\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}}/dcim/rack-roles/:id/"),
Content = new StringContent("{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\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}}/dcim/rack-roles/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/rack-roles/:id/"
payload := strings.NewReader("{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\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/dcim/rack-roles/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 96
{
"color": "",
"description": "",
"id": 0,
"name": "",
"rack_count": 0,
"slug": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/dcim/rack-roles/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/rack-roles/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\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 \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/rack-roles/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/dcim/rack-roles/:id/")
.header("content-type", "application/json")
.body("{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\n}")
.asString();
const data = JSON.stringify({
color: '',
description: '',
id: 0,
name: '',
rack_count: 0,
slug: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/dcim/rack-roles/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/rack-roles/:id/',
headers: {'content-type': 'application/json'},
data: {color: '', description: '', id: 0, name: '', rack_count: 0, slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/rack-roles/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"color":"","description":"","id":0,"name":"","rack_count":0,"slug":""}'
};
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}}/dcim/rack-roles/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "color": "",\n "description": "",\n "id": 0,\n "name": "",\n "rack_count": 0,\n "slug": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/rack-roles/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/rack-roles/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({color: '', description: '', id: 0, name: '', rack_count: 0, slug: ''}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/rack-roles/:id/',
headers: {'content-type': 'application/json'},
body: {color: '', description: '', id: 0, name: '', rack_count: 0, slug: ''},
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}}/dcim/rack-roles/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
color: '',
description: '',
id: 0,
name: '',
rack_count: 0,
slug: ''
});
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}}/dcim/rack-roles/:id/',
headers: {'content-type': 'application/json'},
data: {color: '', description: '', id: 0, name: '', rack_count: 0, slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/rack-roles/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"color":"","description":"","id":0,"name":"","rack_count":0,"slug":""}'
};
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 = @{ @"color": @"",
@"description": @"",
@"id": @0,
@"name": @"",
@"rack_count": @0,
@"slug": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/rack-roles/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/rack-roles/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/rack-roles/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'color' => '',
'description' => '',
'id' => 0,
'name' => '',
'rack_count' => 0,
'slug' => ''
]),
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}}/dcim/rack-roles/:id/', [
'body' => '{
"color": "",
"description": "",
"id": 0,
"name": "",
"rack_count": 0,
"slug": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/rack-roles/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'color' => '',
'description' => '',
'id' => 0,
'name' => '',
'rack_count' => 0,
'slug' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'color' => '',
'description' => '',
'id' => 0,
'name' => '',
'rack_count' => 0,
'slug' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/rack-roles/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/rack-roles/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"color": "",
"description": "",
"id": 0,
"name": "",
"rack_count": 0,
"slug": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/rack-roles/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"color": "",
"description": "",
"id": 0,
"name": "",
"rack_count": 0,
"slug": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/dcim/rack-roles/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/rack-roles/:id/"
payload = {
"color": "",
"description": "",
"id": 0,
"name": "",
"rack_count": 0,
"slug": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/rack-roles/:id/"
payload <- "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\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}}/dcim/rack-roles/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\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/dcim/rack-roles/:id/') do |req|
req.body = "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"rack_count\": 0,\n \"slug\": \"\"\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}}/dcim/rack-roles/:id/";
let payload = json!({
"color": "",
"description": "",
"id": 0,
"name": "",
"rack_count": 0,
"slug": ""
});
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}}/dcim/rack-roles/:id/ \
--header 'content-type: application/json' \
--data '{
"color": "",
"description": "",
"id": 0,
"name": "",
"rack_count": 0,
"slug": ""
}'
echo '{
"color": "",
"description": "",
"id": 0,
"name": "",
"rack_count": 0,
"slug": ""
}' | \
http PUT {{baseUrl}}/dcim/rack-roles/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "color": "",\n "description": "",\n "id": 0,\n "name": "",\n "rack_count": 0,\n "slug": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/rack-roles/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"color": "",
"description": "",
"id": 0,
"name": "",
"rack_count": 0,
"slug": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/rack-roles/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
dcim_racks_create
{{baseUrl}}/dcim/racks/
BODY json
{
"asset_tag": "",
"comments": "",
"created": "",
"custom_fields": {},
"desc_units": false,
"device_count": 0,
"display_name": "",
"facility_id": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"outer_depth": 0,
"outer_unit": "",
"outer_width": 0,
"powerfeed_count": 0,
"role": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"type": "",
"u_height": 0,
"width": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/racks/");
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 \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/dcim/racks/" {:content-type :json
:form-params {:asset_tag ""
:comments ""
:created ""
:custom_fields {}
:desc_units false
:device_count 0
:display_name ""
:facility_id ""
:group 0
:id 0
:last_updated ""
:name ""
:outer_depth 0
:outer_unit ""
:outer_width 0
:powerfeed_count 0
:role 0
:serial ""
:site 0
:status ""
:tags []
:tenant 0
:type ""
:u_height 0
:width 0}})
require "http/client"
url = "{{baseUrl}}/dcim/racks/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/dcim/racks/"),
Content = new StringContent("{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/racks/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/racks/"
payload := strings.NewReader("{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/dcim/racks/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 443
{
"asset_tag": "",
"comments": "",
"created": "",
"custom_fields": {},
"desc_units": false,
"device_count": 0,
"display_name": "",
"facility_id": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"outer_depth": 0,
"outer_unit": "",
"outer_width": 0,
"powerfeed_count": 0,
"role": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"type": "",
"u_height": 0,
"width": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/dcim/racks/")
.setHeader("content-type", "application/json")
.setBody("{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/racks/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/racks/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/dcim/racks/")
.header("content-type", "application/json")
.body("{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\n}")
.asString();
const data = JSON.stringify({
asset_tag: '',
comments: '',
created: '',
custom_fields: {},
desc_units: false,
device_count: 0,
display_name: '',
facility_id: '',
group: 0,
id: 0,
last_updated: '',
name: '',
outer_depth: 0,
outer_unit: '',
outer_width: 0,
powerfeed_count: 0,
role: 0,
serial: '',
site: 0,
status: '',
tags: [],
tenant: 0,
type: '',
u_height: 0,
width: 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}}/dcim/racks/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/racks/',
headers: {'content-type': 'application/json'},
data: {
asset_tag: '',
comments: '',
created: '',
custom_fields: {},
desc_units: false,
device_count: 0,
display_name: '',
facility_id: '',
group: 0,
id: 0,
last_updated: '',
name: '',
outer_depth: 0,
outer_unit: '',
outer_width: 0,
powerfeed_count: 0,
role: 0,
serial: '',
site: 0,
status: '',
tags: [],
tenant: 0,
type: '',
u_height: 0,
width: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/racks/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"asset_tag":"","comments":"","created":"","custom_fields":{},"desc_units":false,"device_count":0,"display_name":"","facility_id":"","group":0,"id":0,"last_updated":"","name":"","outer_depth":0,"outer_unit":"","outer_width":0,"powerfeed_count":0,"role":0,"serial":"","site":0,"status":"","tags":[],"tenant":0,"type":"","u_height":0,"width":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}}/dcim/racks/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "asset_tag": "",\n "comments": "",\n "created": "",\n "custom_fields": {},\n "desc_units": false,\n "device_count": 0,\n "display_name": "",\n "facility_id": "",\n "group": 0,\n "id": 0,\n "last_updated": "",\n "name": "",\n "outer_depth": 0,\n "outer_unit": "",\n "outer_width": 0,\n "powerfeed_count": 0,\n "role": 0,\n "serial": "",\n "site": 0,\n "status": "",\n "tags": [],\n "tenant": 0,\n "type": "",\n "u_height": 0,\n "width": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/racks/")
.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/dcim/racks/',
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({
asset_tag: '',
comments: '',
created: '',
custom_fields: {},
desc_units: false,
device_count: 0,
display_name: '',
facility_id: '',
group: 0,
id: 0,
last_updated: '',
name: '',
outer_depth: 0,
outer_unit: '',
outer_width: 0,
powerfeed_count: 0,
role: 0,
serial: '',
site: 0,
status: '',
tags: [],
tenant: 0,
type: '',
u_height: 0,
width: 0
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/racks/',
headers: {'content-type': 'application/json'},
body: {
asset_tag: '',
comments: '',
created: '',
custom_fields: {},
desc_units: false,
device_count: 0,
display_name: '',
facility_id: '',
group: 0,
id: 0,
last_updated: '',
name: '',
outer_depth: 0,
outer_unit: '',
outer_width: 0,
powerfeed_count: 0,
role: 0,
serial: '',
site: 0,
status: '',
tags: [],
tenant: 0,
type: '',
u_height: 0,
width: 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}}/dcim/racks/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
asset_tag: '',
comments: '',
created: '',
custom_fields: {},
desc_units: false,
device_count: 0,
display_name: '',
facility_id: '',
group: 0,
id: 0,
last_updated: '',
name: '',
outer_depth: 0,
outer_unit: '',
outer_width: 0,
powerfeed_count: 0,
role: 0,
serial: '',
site: 0,
status: '',
tags: [],
tenant: 0,
type: '',
u_height: 0,
width: 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}}/dcim/racks/',
headers: {'content-type': 'application/json'},
data: {
asset_tag: '',
comments: '',
created: '',
custom_fields: {},
desc_units: false,
device_count: 0,
display_name: '',
facility_id: '',
group: 0,
id: 0,
last_updated: '',
name: '',
outer_depth: 0,
outer_unit: '',
outer_width: 0,
powerfeed_count: 0,
role: 0,
serial: '',
site: 0,
status: '',
tags: [],
tenant: 0,
type: '',
u_height: 0,
width: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/racks/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"asset_tag":"","comments":"","created":"","custom_fields":{},"desc_units":false,"device_count":0,"display_name":"","facility_id":"","group":0,"id":0,"last_updated":"","name":"","outer_depth":0,"outer_unit":"","outer_width":0,"powerfeed_count":0,"role":0,"serial":"","site":0,"status":"","tags":[],"tenant":0,"type":"","u_height":0,"width":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 = @{ @"asset_tag": @"",
@"comments": @"",
@"created": @"",
@"custom_fields": @{ },
@"desc_units": @NO,
@"device_count": @0,
@"display_name": @"",
@"facility_id": @"",
@"group": @0,
@"id": @0,
@"last_updated": @"",
@"name": @"",
@"outer_depth": @0,
@"outer_unit": @"",
@"outer_width": @0,
@"powerfeed_count": @0,
@"role": @0,
@"serial": @"",
@"site": @0,
@"status": @"",
@"tags": @[ ],
@"tenant": @0,
@"type": @"",
@"u_height": @0,
@"width": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/racks/"]
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}}/dcim/racks/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/racks/",
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([
'asset_tag' => '',
'comments' => '',
'created' => '',
'custom_fields' => [
],
'desc_units' => null,
'device_count' => 0,
'display_name' => '',
'facility_id' => '',
'group' => 0,
'id' => 0,
'last_updated' => '',
'name' => '',
'outer_depth' => 0,
'outer_unit' => '',
'outer_width' => 0,
'powerfeed_count' => 0,
'role' => 0,
'serial' => '',
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'type' => '',
'u_height' => 0,
'width' => 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}}/dcim/racks/', [
'body' => '{
"asset_tag": "",
"comments": "",
"created": "",
"custom_fields": {},
"desc_units": false,
"device_count": 0,
"display_name": "",
"facility_id": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"outer_depth": 0,
"outer_unit": "",
"outer_width": 0,
"powerfeed_count": 0,
"role": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"type": "",
"u_height": 0,
"width": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/racks/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'asset_tag' => '',
'comments' => '',
'created' => '',
'custom_fields' => [
],
'desc_units' => null,
'device_count' => 0,
'display_name' => '',
'facility_id' => '',
'group' => 0,
'id' => 0,
'last_updated' => '',
'name' => '',
'outer_depth' => 0,
'outer_unit' => '',
'outer_width' => 0,
'powerfeed_count' => 0,
'role' => 0,
'serial' => '',
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'type' => '',
'u_height' => 0,
'width' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'asset_tag' => '',
'comments' => '',
'created' => '',
'custom_fields' => [
],
'desc_units' => null,
'device_count' => 0,
'display_name' => '',
'facility_id' => '',
'group' => 0,
'id' => 0,
'last_updated' => '',
'name' => '',
'outer_depth' => 0,
'outer_unit' => '',
'outer_width' => 0,
'powerfeed_count' => 0,
'role' => 0,
'serial' => '',
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'type' => '',
'u_height' => 0,
'width' => 0
]));
$request->setRequestUrl('{{baseUrl}}/dcim/racks/');
$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}}/dcim/racks/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"asset_tag": "",
"comments": "",
"created": "",
"custom_fields": {},
"desc_units": false,
"device_count": 0,
"display_name": "",
"facility_id": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"outer_depth": 0,
"outer_unit": "",
"outer_width": 0,
"powerfeed_count": 0,
"role": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"type": "",
"u_height": 0,
"width": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/racks/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"asset_tag": "",
"comments": "",
"created": "",
"custom_fields": {},
"desc_units": false,
"device_count": 0,
"display_name": "",
"facility_id": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"outer_depth": 0,
"outer_unit": "",
"outer_width": 0,
"powerfeed_count": 0,
"role": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"type": "",
"u_height": 0,
"width": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/dcim/racks/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/racks/"
payload = {
"asset_tag": "",
"comments": "",
"created": "",
"custom_fields": {},
"desc_units": False,
"device_count": 0,
"display_name": "",
"facility_id": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"outer_depth": 0,
"outer_unit": "",
"outer_width": 0,
"powerfeed_count": 0,
"role": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"type": "",
"u_height": 0,
"width": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/racks/"
payload <- "{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/racks/")
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 \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/dcim/racks/') do |req|
req.body = "{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/racks/";
let payload = json!({
"asset_tag": "",
"comments": "",
"created": "",
"custom_fields": json!({}),
"desc_units": false,
"device_count": 0,
"display_name": "",
"facility_id": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"outer_depth": 0,
"outer_unit": "",
"outer_width": 0,
"powerfeed_count": 0,
"role": 0,
"serial": "",
"site": 0,
"status": "",
"tags": (),
"tenant": 0,
"type": "",
"u_height": 0,
"width": 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}}/dcim/racks/ \
--header 'content-type: application/json' \
--data '{
"asset_tag": "",
"comments": "",
"created": "",
"custom_fields": {},
"desc_units": false,
"device_count": 0,
"display_name": "",
"facility_id": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"outer_depth": 0,
"outer_unit": "",
"outer_width": 0,
"powerfeed_count": 0,
"role": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"type": "",
"u_height": 0,
"width": 0
}'
echo '{
"asset_tag": "",
"comments": "",
"created": "",
"custom_fields": {},
"desc_units": false,
"device_count": 0,
"display_name": "",
"facility_id": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"outer_depth": 0,
"outer_unit": "",
"outer_width": 0,
"powerfeed_count": 0,
"role": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"type": "",
"u_height": 0,
"width": 0
}' | \
http POST {{baseUrl}}/dcim/racks/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "asset_tag": "",\n "comments": "",\n "created": "",\n "custom_fields": {},\n "desc_units": false,\n "device_count": 0,\n "display_name": "",\n "facility_id": "",\n "group": 0,\n "id": 0,\n "last_updated": "",\n "name": "",\n "outer_depth": 0,\n "outer_unit": "",\n "outer_width": 0,\n "powerfeed_count": 0,\n "role": 0,\n "serial": "",\n "site": 0,\n "status": "",\n "tags": [],\n "tenant": 0,\n "type": "",\n "u_height": 0,\n "width": 0\n}' \
--output-document \
- {{baseUrl}}/dcim/racks/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"asset_tag": "",
"comments": "",
"created": "",
"custom_fields": [],
"desc_units": false,
"device_count": 0,
"display_name": "",
"facility_id": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"outer_depth": 0,
"outer_unit": "",
"outer_width": 0,
"powerfeed_count": 0,
"role": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"type": "",
"u_height": 0,
"width": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/racks/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
dcim_racks_delete
{{baseUrl}}/dcim/racks/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/racks/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/dcim/racks/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/racks/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/dcim/racks/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/racks/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/racks/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/dcim/racks/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/dcim/racks/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/racks/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/racks/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/dcim/racks/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/dcim/racks/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/racks/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/racks/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/racks/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/racks/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/racks/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/racks/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/dcim/racks/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/racks/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/racks/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/racks/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/racks/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/racks/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/dcim/racks/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/racks/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/racks/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/racks/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/racks/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/dcim/racks/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/racks/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/racks/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/racks/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/dcim/racks/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/racks/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/dcim/racks/:id/
http DELETE {{baseUrl}}/dcim/racks/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/dcim/racks/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/racks/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_racks_elevation
{{baseUrl}}/dcim/racks/:id/elevation/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/racks/:id/elevation/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/racks/:id/elevation/")
require "http/client"
url = "{{baseUrl}}/dcim/racks/:id/elevation/"
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}}/dcim/racks/:id/elevation/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/racks/:id/elevation/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/racks/:id/elevation/"
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/dcim/racks/:id/elevation/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/racks/:id/elevation/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/racks/:id/elevation/"))
.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}}/dcim/racks/:id/elevation/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/racks/:id/elevation/")
.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}}/dcim/racks/:id/elevation/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/racks/:id/elevation/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/racks/:id/elevation/';
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}}/dcim/racks/:id/elevation/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/racks/:id/elevation/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/racks/:id/elevation/',
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}}/dcim/racks/:id/elevation/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/racks/:id/elevation/');
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}}/dcim/racks/:id/elevation/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/racks/:id/elevation/';
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}}/dcim/racks/:id/elevation/"]
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}}/dcim/racks/:id/elevation/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/racks/:id/elevation/",
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}}/dcim/racks/:id/elevation/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/racks/:id/elevation/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/racks/:id/elevation/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/racks/:id/elevation/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/racks/:id/elevation/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/racks/:id/elevation/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/racks/:id/elevation/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/racks/:id/elevation/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/racks/:id/elevation/")
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/dcim/racks/:id/elevation/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/racks/:id/elevation/";
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}}/dcim/racks/:id/elevation/
http GET {{baseUrl}}/dcim/racks/:id/elevation/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/racks/:id/elevation/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/racks/:id/elevation/")! 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
dcim_racks_list
{{baseUrl}}/dcim/racks/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/racks/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/racks/")
require "http/client"
url = "{{baseUrl}}/dcim/racks/"
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}}/dcim/racks/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/racks/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/racks/"
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/dcim/racks/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/racks/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/racks/"))
.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}}/dcim/racks/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/racks/")
.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}}/dcim/racks/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/racks/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/racks/';
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}}/dcim/racks/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/racks/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/racks/',
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}}/dcim/racks/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/racks/');
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}}/dcim/racks/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/racks/';
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}}/dcim/racks/"]
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}}/dcim/racks/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/racks/",
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}}/dcim/racks/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/racks/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/racks/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/racks/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/racks/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/racks/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/racks/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/racks/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/racks/")
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/dcim/racks/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/racks/";
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}}/dcim/racks/
http GET {{baseUrl}}/dcim/racks/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/racks/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/racks/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
dcim_racks_partial_update
{{baseUrl}}/dcim/racks/:id/
BODY json
{
"asset_tag": "",
"comments": "",
"created": "",
"custom_fields": {},
"desc_units": false,
"device_count": 0,
"display_name": "",
"facility_id": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"outer_depth": 0,
"outer_unit": "",
"outer_width": 0,
"powerfeed_count": 0,
"role": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"type": "",
"u_height": 0,
"width": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/racks/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/dcim/racks/:id/" {:content-type :json
:form-params {:asset_tag ""
:comments ""
:created ""
:custom_fields {}
:desc_units false
:device_count 0
:display_name ""
:facility_id ""
:group 0
:id 0
:last_updated ""
:name ""
:outer_depth 0
:outer_unit ""
:outer_width 0
:powerfeed_count 0
:role 0
:serial ""
:site 0
:status ""
:tags []
:tenant 0
:type ""
:u_height 0
:width 0}})
require "http/client"
url = "{{baseUrl}}/dcim/racks/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\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}}/dcim/racks/:id/"),
Content = new StringContent("{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/racks/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/racks/:id/"
payload := strings.NewReader("{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\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/dcim/racks/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 443
{
"asset_tag": "",
"comments": "",
"created": "",
"custom_fields": {},
"desc_units": false,
"device_count": 0,
"display_name": "",
"facility_id": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"outer_depth": 0,
"outer_unit": "",
"outer_width": 0,
"powerfeed_count": 0,
"role": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"type": "",
"u_height": 0,
"width": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/dcim/racks/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/racks/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/racks/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/dcim/racks/:id/")
.header("content-type", "application/json")
.body("{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\n}")
.asString();
const data = JSON.stringify({
asset_tag: '',
comments: '',
created: '',
custom_fields: {},
desc_units: false,
device_count: 0,
display_name: '',
facility_id: '',
group: 0,
id: 0,
last_updated: '',
name: '',
outer_depth: 0,
outer_unit: '',
outer_width: 0,
powerfeed_count: 0,
role: 0,
serial: '',
site: 0,
status: '',
tags: [],
tenant: 0,
type: '',
u_height: 0,
width: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/dcim/racks/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/racks/:id/',
headers: {'content-type': 'application/json'},
data: {
asset_tag: '',
comments: '',
created: '',
custom_fields: {},
desc_units: false,
device_count: 0,
display_name: '',
facility_id: '',
group: 0,
id: 0,
last_updated: '',
name: '',
outer_depth: 0,
outer_unit: '',
outer_width: 0,
powerfeed_count: 0,
role: 0,
serial: '',
site: 0,
status: '',
tags: [],
tenant: 0,
type: '',
u_height: 0,
width: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/racks/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"asset_tag":"","comments":"","created":"","custom_fields":{},"desc_units":false,"device_count":0,"display_name":"","facility_id":"","group":0,"id":0,"last_updated":"","name":"","outer_depth":0,"outer_unit":"","outer_width":0,"powerfeed_count":0,"role":0,"serial":"","site":0,"status":"","tags":[],"tenant":0,"type":"","u_height":0,"width":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}}/dcim/racks/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "asset_tag": "",\n "comments": "",\n "created": "",\n "custom_fields": {},\n "desc_units": false,\n "device_count": 0,\n "display_name": "",\n "facility_id": "",\n "group": 0,\n "id": 0,\n "last_updated": "",\n "name": "",\n "outer_depth": 0,\n "outer_unit": "",\n "outer_width": 0,\n "powerfeed_count": 0,\n "role": 0,\n "serial": "",\n "site": 0,\n "status": "",\n "tags": [],\n "tenant": 0,\n "type": "",\n "u_height": 0,\n "width": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/racks/:id/")
.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/dcim/racks/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
asset_tag: '',
comments: '',
created: '',
custom_fields: {},
desc_units: false,
device_count: 0,
display_name: '',
facility_id: '',
group: 0,
id: 0,
last_updated: '',
name: '',
outer_depth: 0,
outer_unit: '',
outer_width: 0,
powerfeed_count: 0,
role: 0,
serial: '',
site: 0,
status: '',
tags: [],
tenant: 0,
type: '',
u_height: 0,
width: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/racks/:id/',
headers: {'content-type': 'application/json'},
body: {
asset_tag: '',
comments: '',
created: '',
custom_fields: {},
desc_units: false,
device_count: 0,
display_name: '',
facility_id: '',
group: 0,
id: 0,
last_updated: '',
name: '',
outer_depth: 0,
outer_unit: '',
outer_width: 0,
powerfeed_count: 0,
role: 0,
serial: '',
site: 0,
status: '',
tags: [],
tenant: 0,
type: '',
u_height: 0,
width: 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('PATCH', '{{baseUrl}}/dcim/racks/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
asset_tag: '',
comments: '',
created: '',
custom_fields: {},
desc_units: false,
device_count: 0,
display_name: '',
facility_id: '',
group: 0,
id: 0,
last_updated: '',
name: '',
outer_depth: 0,
outer_unit: '',
outer_width: 0,
powerfeed_count: 0,
role: 0,
serial: '',
site: 0,
status: '',
tags: [],
tenant: 0,
type: '',
u_height: 0,
width: 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: 'PATCH',
url: '{{baseUrl}}/dcim/racks/:id/',
headers: {'content-type': 'application/json'},
data: {
asset_tag: '',
comments: '',
created: '',
custom_fields: {},
desc_units: false,
device_count: 0,
display_name: '',
facility_id: '',
group: 0,
id: 0,
last_updated: '',
name: '',
outer_depth: 0,
outer_unit: '',
outer_width: 0,
powerfeed_count: 0,
role: 0,
serial: '',
site: 0,
status: '',
tags: [],
tenant: 0,
type: '',
u_height: 0,
width: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/racks/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"asset_tag":"","comments":"","created":"","custom_fields":{},"desc_units":false,"device_count":0,"display_name":"","facility_id":"","group":0,"id":0,"last_updated":"","name":"","outer_depth":0,"outer_unit":"","outer_width":0,"powerfeed_count":0,"role":0,"serial":"","site":0,"status":"","tags":[],"tenant":0,"type":"","u_height":0,"width":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 = @{ @"asset_tag": @"",
@"comments": @"",
@"created": @"",
@"custom_fields": @{ },
@"desc_units": @NO,
@"device_count": @0,
@"display_name": @"",
@"facility_id": @"",
@"group": @0,
@"id": @0,
@"last_updated": @"",
@"name": @"",
@"outer_depth": @0,
@"outer_unit": @"",
@"outer_width": @0,
@"powerfeed_count": @0,
@"role": @0,
@"serial": @"",
@"site": @0,
@"status": @"",
@"tags": @[ ],
@"tenant": @0,
@"type": @"",
@"u_height": @0,
@"width": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/racks/:id/"]
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}}/dcim/racks/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/racks/:id/",
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([
'asset_tag' => '',
'comments' => '',
'created' => '',
'custom_fields' => [
],
'desc_units' => null,
'device_count' => 0,
'display_name' => '',
'facility_id' => '',
'group' => 0,
'id' => 0,
'last_updated' => '',
'name' => '',
'outer_depth' => 0,
'outer_unit' => '',
'outer_width' => 0,
'powerfeed_count' => 0,
'role' => 0,
'serial' => '',
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'type' => '',
'u_height' => 0,
'width' => 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('PATCH', '{{baseUrl}}/dcim/racks/:id/', [
'body' => '{
"asset_tag": "",
"comments": "",
"created": "",
"custom_fields": {},
"desc_units": false,
"device_count": 0,
"display_name": "",
"facility_id": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"outer_depth": 0,
"outer_unit": "",
"outer_width": 0,
"powerfeed_count": 0,
"role": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"type": "",
"u_height": 0,
"width": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/racks/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'asset_tag' => '',
'comments' => '',
'created' => '',
'custom_fields' => [
],
'desc_units' => null,
'device_count' => 0,
'display_name' => '',
'facility_id' => '',
'group' => 0,
'id' => 0,
'last_updated' => '',
'name' => '',
'outer_depth' => 0,
'outer_unit' => '',
'outer_width' => 0,
'powerfeed_count' => 0,
'role' => 0,
'serial' => '',
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'type' => '',
'u_height' => 0,
'width' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'asset_tag' => '',
'comments' => '',
'created' => '',
'custom_fields' => [
],
'desc_units' => null,
'device_count' => 0,
'display_name' => '',
'facility_id' => '',
'group' => 0,
'id' => 0,
'last_updated' => '',
'name' => '',
'outer_depth' => 0,
'outer_unit' => '',
'outer_width' => 0,
'powerfeed_count' => 0,
'role' => 0,
'serial' => '',
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'type' => '',
'u_height' => 0,
'width' => 0
]));
$request->setRequestUrl('{{baseUrl}}/dcim/racks/:id/');
$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}}/dcim/racks/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"asset_tag": "",
"comments": "",
"created": "",
"custom_fields": {},
"desc_units": false,
"device_count": 0,
"display_name": "",
"facility_id": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"outer_depth": 0,
"outer_unit": "",
"outer_width": 0,
"powerfeed_count": 0,
"role": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"type": "",
"u_height": 0,
"width": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/racks/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"asset_tag": "",
"comments": "",
"created": "",
"custom_fields": {},
"desc_units": false,
"device_count": 0,
"display_name": "",
"facility_id": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"outer_depth": 0,
"outer_unit": "",
"outer_width": 0,
"powerfeed_count": 0,
"role": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"type": "",
"u_height": 0,
"width": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/dcim/racks/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/racks/:id/"
payload = {
"asset_tag": "",
"comments": "",
"created": "",
"custom_fields": {},
"desc_units": False,
"device_count": 0,
"display_name": "",
"facility_id": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"outer_depth": 0,
"outer_unit": "",
"outer_width": 0,
"powerfeed_count": 0,
"role": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"type": "",
"u_height": 0,
"width": 0
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/racks/:id/"
payload <- "{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\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}}/dcim/racks/:id/")
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 \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/dcim/racks/:id/') do |req|
req.body = "{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\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}}/dcim/racks/:id/";
let payload = json!({
"asset_tag": "",
"comments": "",
"created": "",
"custom_fields": json!({}),
"desc_units": false,
"device_count": 0,
"display_name": "",
"facility_id": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"outer_depth": 0,
"outer_unit": "",
"outer_width": 0,
"powerfeed_count": 0,
"role": 0,
"serial": "",
"site": 0,
"status": "",
"tags": (),
"tenant": 0,
"type": "",
"u_height": 0,
"width": 0
});
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}}/dcim/racks/:id/ \
--header 'content-type: application/json' \
--data '{
"asset_tag": "",
"comments": "",
"created": "",
"custom_fields": {},
"desc_units": false,
"device_count": 0,
"display_name": "",
"facility_id": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"outer_depth": 0,
"outer_unit": "",
"outer_width": 0,
"powerfeed_count": 0,
"role": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"type": "",
"u_height": 0,
"width": 0
}'
echo '{
"asset_tag": "",
"comments": "",
"created": "",
"custom_fields": {},
"desc_units": false,
"device_count": 0,
"display_name": "",
"facility_id": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"outer_depth": 0,
"outer_unit": "",
"outer_width": 0,
"powerfeed_count": 0,
"role": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"type": "",
"u_height": 0,
"width": 0
}' | \
http PATCH {{baseUrl}}/dcim/racks/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "asset_tag": "",\n "comments": "",\n "created": "",\n "custom_fields": {},\n "desc_units": false,\n "device_count": 0,\n "display_name": "",\n "facility_id": "",\n "group": 0,\n "id": 0,\n "last_updated": "",\n "name": "",\n "outer_depth": 0,\n "outer_unit": "",\n "outer_width": 0,\n "powerfeed_count": 0,\n "role": 0,\n "serial": "",\n "site": 0,\n "status": "",\n "tags": [],\n "tenant": 0,\n "type": "",\n "u_height": 0,\n "width": 0\n}' \
--output-document \
- {{baseUrl}}/dcim/racks/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"asset_tag": "",
"comments": "",
"created": "",
"custom_fields": [],
"desc_units": false,
"device_count": 0,
"display_name": "",
"facility_id": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"outer_depth": 0,
"outer_unit": "",
"outer_width": 0,
"powerfeed_count": 0,
"role": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"type": "",
"u_height": 0,
"width": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/racks/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_racks_read
{{baseUrl}}/dcim/racks/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/racks/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/racks/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/racks/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/dcim/racks/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/racks/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/racks/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/dcim/racks/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/racks/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/racks/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/racks/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/racks/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/dcim/racks/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/racks/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/racks/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/racks/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/racks/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/racks/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/dcim/racks/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/racks/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/dcim/racks/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/racks/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/racks/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/racks/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/racks/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/dcim/racks/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/racks/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/racks/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/racks/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/racks/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/racks/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/racks/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/racks/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/racks/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/dcim/racks/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/racks/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/dcim/racks/:id/
http GET {{baseUrl}}/dcim/racks/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/racks/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/racks/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
dcim_racks_update
{{baseUrl}}/dcim/racks/:id/
BODY json
{
"asset_tag": "",
"comments": "",
"created": "",
"custom_fields": {},
"desc_units": false,
"device_count": 0,
"display_name": "",
"facility_id": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"outer_depth": 0,
"outer_unit": "",
"outer_width": 0,
"powerfeed_count": 0,
"role": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"type": "",
"u_height": 0,
"width": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/racks/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/dcim/racks/:id/" {:content-type :json
:form-params {:asset_tag ""
:comments ""
:created ""
:custom_fields {}
:desc_units false
:device_count 0
:display_name ""
:facility_id ""
:group 0
:id 0
:last_updated ""
:name ""
:outer_depth 0
:outer_unit ""
:outer_width 0
:powerfeed_count 0
:role 0
:serial ""
:site 0
:status ""
:tags []
:tenant 0
:type ""
:u_height 0
:width 0}})
require "http/client"
url = "{{baseUrl}}/dcim/racks/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\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}}/dcim/racks/:id/"),
Content = new StringContent("{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/racks/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/racks/:id/"
payload := strings.NewReader("{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\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/dcim/racks/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 443
{
"asset_tag": "",
"comments": "",
"created": "",
"custom_fields": {},
"desc_units": false,
"device_count": 0,
"display_name": "",
"facility_id": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"outer_depth": 0,
"outer_unit": "",
"outer_width": 0,
"powerfeed_count": 0,
"role": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"type": "",
"u_height": 0,
"width": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/dcim/racks/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/racks/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/racks/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/dcim/racks/:id/")
.header("content-type", "application/json")
.body("{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\n}")
.asString();
const data = JSON.stringify({
asset_tag: '',
comments: '',
created: '',
custom_fields: {},
desc_units: false,
device_count: 0,
display_name: '',
facility_id: '',
group: 0,
id: 0,
last_updated: '',
name: '',
outer_depth: 0,
outer_unit: '',
outer_width: 0,
powerfeed_count: 0,
role: 0,
serial: '',
site: 0,
status: '',
tags: [],
tenant: 0,
type: '',
u_height: 0,
width: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/dcim/racks/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/racks/:id/',
headers: {'content-type': 'application/json'},
data: {
asset_tag: '',
comments: '',
created: '',
custom_fields: {},
desc_units: false,
device_count: 0,
display_name: '',
facility_id: '',
group: 0,
id: 0,
last_updated: '',
name: '',
outer_depth: 0,
outer_unit: '',
outer_width: 0,
powerfeed_count: 0,
role: 0,
serial: '',
site: 0,
status: '',
tags: [],
tenant: 0,
type: '',
u_height: 0,
width: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/racks/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"asset_tag":"","comments":"","created":"","custom_fields":{},"desc_units":false,"device_count":0,"display_name":"","facility_id":"","group":0,"id":0,"last_updated":"","name":"","outer_depth":0,"outer_unit":"","outer_width":0,"powerfeed_count":0,"role":0,"serial":"","site":0,"status":"","tags":[],"tenant":0,"type":"","u_height":0,"width":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}}/dcim/racks/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "asset_tag": "",\n "comments": "",\n "created": "",\n "custom_fields": {},\n "desc_units": false,\n "device_count": 0,\n "display_name": "",\n "facility_id": "",\n "group": 0,\n "id": 0,\n "last_updated": "",\n "name": "",\n "outer_depth": 0,\n "outer_unit": "",\n "outer_width": 0,\n "powerfeed_count": 0,\n "role": 0,\n "serial": "",\n "site": 0,\n "status": "",\n "tags": [],\n "tenant": 0,\n "type": "",\n "u_height": 0,\n "width": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/racks/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/racks/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
asset_tag: '',
comments: '',
created: '',
custom_fields: {},
desc_units: false,
device_count: 0,
display_name: '',
facility_id: '',
group: 0,
id: 0,
last_updated: '',
name: '',
outer_depth: 0,
outer_unit: '',
outer_width: 0,
powerfeed_count: 0,
role: 0,
serial: '',
site: 0,
status: '',
tags: [],
tenant: 0,
type: '',
u_height: 0,
width: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/racks/:id/',
headers: {'content-type': 'application/json'},
body: {
asset_tag: '',
comments: '',
created: '',
custom_fields: {},
desc_units: false,
device_count: 0,
display_name: '',
facility_id: '',
group: 0,
id: 0,
last_updated: '',
name: '',
outer_depth: 0,
outer_unit: '',
outer_width: 0,
powerfeed_count: 0,
role: 0,
serial: '',
site: 0,
status: '',
tags: [],
tenant: 0,
type: '',
u_height: 0,
width: 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('PUT', '{{baseUrl}}/dcim/racks/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
asset_tag: '',
comments: '',
created: '',
custom_fields: {},
desc_units: false,
device_count: 0,
display_name: '',
facility_id: '',
group: 0,
id: 0,
last_updated: '',
name: '',
outer_depth: 0,
outer_unit: '',
outer_width: 0,
powerfeed_count: 0,
role: 0,
serial: '',
site: 0,
status: '',
tags: [],
tenant: 0,
type: '',
u_height: 0,
width: 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: 'PUT',
url: '{{baseUrl}}/dcim/racks/:id/',
headers: {'content-type': 'application/json'},
data: {
asset_tag: '',
comments: '',
created: '',
custom_fields: {},
desc_units: false,
device_count: 0,
display_name: '',
facility_id: '',
group: 0,
id: 0,
last_updated: '',
name: '',
outer_depth: 0,
outer_unit: '',
outer_width: 0,
powerfeed_count: 0,
role: 0,
serial: '',
site: 0,
status: '',
tags: [],
tenant: 0,
type: '',
u_height: 0,
width: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/racks/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"asset_tag":"","comments":"","created":"","custom_fields":{},"desc_units":false,"device_count":0,"display_name":"","facility_id":"","group":0,"id":0,"last_updated":"","name":"","outer_depth":0,"outer_unit":"","outer_width":0,"powerfeed_count":0,"role":0,"serial":"","site":0,"status":"","tags":[],"tenant":0,"type":"","u_height":0,"width":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 = @{ @"asset_tag": @"",
@"comments": @"",
@"created": @"",
@"custom_fields": @{ },
@"desc_units": @NO,
@"device_count": @0,
@"display_name": @"",
@"facility_id": @"",
@"group": @0,
@"id": @0,
@"last_updated": @"",
@"name": @"",
@"outer_depth": @0,
@"outer_unit": @"",
@"outer_width": @0,
@"powerfeed_count": @0,
@"role": @0,
@"serial": @"",
@"site": @0,
@"status": @"",
@"tags": @[ ],
@"tenant": @0,
@"type": @"",
@"u_height": @0,
@"width": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/racks/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/racks/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/racks/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'asset_tag' => '',
'comments' => '',
'created' => '',
'custom_fields' => [
],
'desc_units' => null,
'device_count' => 0,
'display_name' => '',
'facility_id' => '',
'group' => 0,
'id' => 0,
'last_updated' => '',
'name' => '',
'outer_depth' => 0,
'outer_unit' => '',
'outer_width' => 0,
'powerfeed_count' => 0,
'role' => 0,
'serial' => '',
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'type' => '',
'u_height' => 0,
'width' => 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('PUT', '{{baseUrl}}/dcim/racks/:id/', [
'body' => '{
"asset_tag": "",
"comments": "",
"created": "",
"custom_fields": {},
"desc_units": false,
"device_count": 0,
"display_name": "",
"facility_id": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"outer_depth": 0,
"outer_unit": "",
"outer_width": 0,
"powerfeed_count": 0,
"role": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"type": "",
"u_height": 0,
"width": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/racks/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'asset_tag' => '',
'comments' => '',
'created' => '',
'custom_fields' => [
],
'desc_units' => null,
'device_count' => 0,
'display_name' => '',
'facility_id' => '',
'group' => 0,
'id' => 0,
'last_updated' => '',
'name' => '',
'outer_depth' => 0,
'outer_unit' => '',
'outer_width' => 0,
'powerfeed_count' => 0,
'role' => 0,
'serial' => '',
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'type' => '',
'u_height' => 0,
'width' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'asset_tag' => '',
'comments' => '',
'created' => '',
'custom_fields' => [
],
'desc_units' => null,
'device_count' => 0,
'display_name' => '',
'facility_id' => '',
'group' => 0,
'id' => 0,
'last_updated' => '',
'name' => '',
'outer_depth' => 0,
'outer_unit' => '',
'outer_width' => 0,
'powerfeed_count' => 0,
'role' => 0,
'serial' => '',
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'type' => '',
'u_height' => 0,
'width' => 0
]));
$request->setRequestUrl('{{baseUrl}}/dcim/racks/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/racks/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"asset_tag": "",
"comments": "",
"created": "",
"custom_fields": {},
"desc_units": false,
"device_count": 0,
"display_name": "",
"facility_id": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"outer_depth": 0,
"outer_unit": "",
"outer_width": 0,
"powerfeed_count": 0,
"role": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"type": "",
"u_height": 0,
"width": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/racks/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"asset_tag": "",
"comments": "",
"created": "",
"custom_fields": {},
"desc_units": false,
"device_count": 0,
"display_name": "",
"facility_id": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"outer_depth": 0,
"outer_unit": "",
"outer_width": 0,
"powerfeed_count": 0,
"role": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"type": "",
"u_height": 0,
"width": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/dcim/racks/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/racks/:id/"
payload = {
"asset_tag": "",
"comments": "",
"created": "",
"custom_fields": {},
"desc_units": False,
"device_count": 0,
"display_name": "",
"facility_id": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"outer_depth": 0,
"outer_unit": "",
"outer_width": 0,
"powerfeed_count": 0,
"role": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"type": "",
"u_height": 0,
"width": 0
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/racks/:id/"
payload <- "{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\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}}/dcim/racks/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/dcim/racks/:id/') do |req|
req.body = "{\n \"asset_tag\": \"\",\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"desc_units\": false,\n \"device_count\": 0,\n \"display_name\": \"\",\n \"facility_id\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"outer_depth\": 0,\n \"outer_unit\": \"\",\n \"outer_width\": 0,\n \"powerfeed_count\": 0,\n \"role\": 0,\n \"serial\": \"\",\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"type\": \"\",\n \"u_height\": 0,\n \"width\": 0\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}}/dcim/racks/:id/";
let payload = json!({
"asset_tag": "",
"comments": "",
"created": "",
"custom_fields": json!({}),
"desc_units": false,
"device_count": 0,
"display_name": "",
"facility_id": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"outer_depth": 0,
"outer_unit": "",
"outer_width": 0,
"powerfeed_count": 0,
"role": 0,
"serial": "",
"site": 0,
"status": "",
"tags": (),
"tenant": 0,
"type": "",
"u_height": 0,
"width": 0
});
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}}/dcim/racks/:id/ \
--header 'content-type: application/json' \
--data '{
"asset_tag": "",
"comments": "",
"created": "",
"custom_fields": {},
"desc_units": false,
"device_count": 0,
"display_name": "",
"facility_id": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"outer_depth": 0,
"outer_unit": "",
"outer_width": 0,
"powerfeed_count": 0,
"role": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"type": "",
"u_height": 0,
"width": 0
}'
echo '{
"asset_tag": "",
"comments": "",
"created": "",
"custom_fields": {},
"desc_units": false,
"device_count": 0,
"display_name": "",
"facility_id": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"outer_depth": 0,
"outer_unit": "",
"outer_width": 0,
"powerfeed_count": 0,
"role": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"type": "",
"u_height": 0,
"width": 0
}' | \
http PUT {{baseUrl}}/dcim/racks/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "asset_tag": "",\n "comments": "",\n "created": "",\n "custom_fields": {},\n "desc_units": false,\n "device_count": 0,\n "display_name": "",\n "facility_id": "",\n "group": 0,\n "id": 0,\n "last_updated": "",\n "name": "",\n "outer_depth": 0,\n "outer_unit": "",\n "outer_width": 0,\n "powerfeed_count": 0,\n "role": 0,\n "serial": "",\n "site": 0,\n "status": "",\n "tags": [],\n "tenant": 0,\n "type": "",\n "u_height": 0,\n "width": 0\n}' \
--output-document \
- {{baseUrl}}/dcim/racks/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"asset_tag": "",
"comments": "",
"created": "",
"custom_fields": [],
"desc_units": false,
"device_count": 0,
"display_name": "",
"facility_id": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"outer_depth": 0,
"outer_unit": "",
"outer_width": 0,
"powerfeed_count": 0,
"role": 0,
"serial": "",
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"type": "",
"u_height": 0,
"width": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/racks/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
dcim_rear-port-templates_create
{{baseUrl}}/dcim/rear-port-templates/
BODY json
{
"device_type": 0,
"id": 0,
"name": "",
"positions": 0,
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/rear-port-templates/");
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 \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/dcim/rear-port-templates/" {:content-type :json
:form-params {:device_type 0
:id 0
:name ""
:positions 0
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/rear-port-templates/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/dcim/rear-port-templates/"),
Content = new StringContent("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/rear-port-templates/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/rear-port-templates/"
payload := strings.NewReader("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/dcim/rear-port-templates/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 79
{
"device_type": 0,
"id": 0,
"name": "",
"positions": 0,
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/dcim/rear-port-templates/")
.setHeader("content-type", "application/json")
.setBody("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/rear-port-templates/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/rear-port-templates/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/dcim/rear-port-templates/")
.header("content-type", "application/json")
.body("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
device_type: 0,
id: 0,
name: '',
positions: 0,
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/dcim/rear-port-templates/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/rear-port-templates/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, id: 0, name: '', positions: 0, type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/rear-port-templates/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"id":0,"name":"","positions":0,"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/rear-port-templates/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "device_type": 0,\n "id": 0,\n "name": "",\n "positions": 0,\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/rear-port-templates/")
.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/dcim/rear-port-templates/',
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({device_type: 0, id: 0, name: '', positions: 0, type: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/rear-port-templates/',
headers: {'content-type': 'application/json'},
body: {device_type: 0, id: 0, name: '', positions: 0, type: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/dcim/rear-port-templates/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
device_type: 0,
id: 0,
name: '',
positions: 0,
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/rear-port-templates/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, id: 0, name: '', positions: 0, type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/rear-port-templates/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"id":0,"name":"","positions":0,"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"device_type": @0,
@"id": @0,
@"name": @"",
@"positions": @0,
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/rear-port-templates/"]
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}}/dcim/rear-port-templates/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/rear-port-templates/",
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([
'device_type' => 0,
'id' => 0,
'name' => '',
'positions' => 0,
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/dcim/rear-port-templates/', [
'body' => '{
"device_type": 0,
"id": 0,
"name": "",
"positions": 0,
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/rear-port-templates/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'device_type' => 0,
'id' => 0,
'name' => '',
'positions' => 0,
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'device_type' => 0,
'id' => 0,
'name' => '',
'positions' => 0,
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/rear-port-templates/');
$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}}/dcim/rear-port-templates/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"id": 0,
"name": "",
"positions": 0,
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/rear-port-templates/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"id": 0,
"name": "",
"positions": 0,
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/dcim/rear-port-templates/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/rear-port-templates/"
payload = {
"device_type": 0,
"id": 0,
"name": "",
"positions": 0,
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/rear-port-templates/"
payload <- "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/rear-port-templates/")
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 \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/dcim/rear-port-templates/') do |req|
req.body = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/rear-port-templates/";
let payload = json!({
"device_type": 0,
"id": 0,
"name": "",
"positions": 0,
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/dcim/rear-port-templates/ \
--header 'content-type: application/json' \
--data '{
"device_type": 0,
"id": 0,
"name": "",
"positions": 0,
"type": ""
}'
echo '{
"device_type": 0,
"id": 0,
"name": "",
"positions": 0,
"type": ""
}' | \
http POST {{baseUrl}}/dcim/rear-port-templates/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "device_type": 0,\n "id": 0,\n "name": "",\n "positions": 0,\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/rear-port-templates/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"device_type": 0,
"id": 0,
"name": "",
"positions": 0,
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/rear-port-templates/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
dcim_rear-port-templates_delete
{{baseUrl}}/dcim/rear-port-templates/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/rear-port-templates/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/dcim/rear-port-templates/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/rear-port-templates/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/dcim/rear-port-templates/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/rear-port-templates/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/rear-port-templates/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/dcim/rear-port-templates/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/dcim/rear-port-templates/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/rear-port-templates/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/rear-port-templates/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/dcim/rear-port-templates/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/dcim/rear-port-templates/:id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/dcim/rear-port-templates/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/rear-port-templates/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/rear-port-templates/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/rear-port-templates/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/rear-port-templates/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/dcim/rear-port-templates/:id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/dcim/rear-port-templates/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/dcim/rear-port-templates/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/rear-port-templates/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/rear-port-templates/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/rear-port-templates/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/rear-port-templates/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/dcim/rear-port-templates/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/rear-port-templates/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/rear-port-templates/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/rear-port-templates/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/rear-port-templates/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/dcim/rear-port-templates/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/rear-port-templates/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/rear-port-templates/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/rear-port-templates/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/dcim/rear-port-templates/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/rear-port-templates/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/dcim/rear-port-templates/:id/
http DELETE {{baseUrl}}/dcim/rear-port-templates/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/dcim/rear-port-templates/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/rear-port-templates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_rear-port-templates_list
{{baseUrl}}/dcim/rear-port-templates/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/rear-port-templates/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/rear-port-templates/")
require "http/client"
url = "{{baseUrl}}/dcim/rear-port-templates/"
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}}/dcim/rear-port-templates/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/rear-port-templates/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/rear-port-templates/"
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/dcim/rear-port-templates/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/rear-port-templates/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/rear-port-templates/"))
.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}}/dcim/rear-port-templates/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/rear-port-templates/")
.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}}/dcim/rear-port-templates/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/rear-port-templates/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/rear-port-templates/';
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}}/dcim/rear-port-templates/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/rear-port-templates/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/rear-port-templates/',
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}}/dcim/rear-port-templates/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/rear-port-templates/');
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}}/dcim/rear-port-templates/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/rear-port-templates/';
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}}/dcim/rear-port-templates/"]
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}}/dcim/rear-port-templates/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/rear-port-templates/",
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}}/dcim/rear-port-templates/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/rear-port-templates/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/rear-port-templates/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/rear-port-templates/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/rear-port-templates/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/rear-port-templates/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/rear-port-templates/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/rear-port-templates/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/rear-port-templates/")
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/dcim/rear-port-templates/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/rear-port-templates/";
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}}/dcim/rear-port-templates/
http GET {{baseUrl}}/dcim/rear-port-templates/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/rear-port-templates/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/rear-port-templates/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
dcim_rear-port-templates_partial_update
{{baseUrl}}/dcim/rear-port-templates/:id/
BODY json
{
"device_type": 0,
"id": 0,
"name": "",
"positions": 0,
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/rear-port-templates/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/dcim/rear-port-templates/:id/" {:content-type :json
:form-params {:device_type 0
:id 0
:name ""
:positions 0
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/rear-port-templates/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\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}}/dcim/rear-port-templates/:id/"),
Content = new StringContent("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/rear-port-templates/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/rear-port-templates/:id/"
payload := strings.NewReader("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\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/dcim/rear-port-templates/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 79
{
"device_type": 0,
"id": 0,
"name": "",
"positions": 0,
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/dcim/rear-port-templates/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/rear-port-templates/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/rear-port-templates/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/dcim/rear-port-templates/:id/")
.header("content-type", "application/json")
.body("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
device_type: 0,
id: 0,
name: '',
positions: 0,
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/dcim/rear-port-templates/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/rear-port-templates/:id/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, id: 0, name: '', positions: 0, type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/rear-port-templates/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"id":0,"name":"","positions":0,"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/rear-port-templates/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "device_type": 0,\n "id": 0,\n "name": "",\n "positions": 0,\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/rear-port-templates/:id/")
.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/dcim/rear-port-templates/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({device_type: 0, id: 0, name: '', positions: 0, type: ''}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/rear-port-templates/:id/',
headers: {'content-type': 'application/json'},
body: {device_type: 0, id: 0, name: '', positions: 0, type: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/dcim/rear-port-templates/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
device_type: 0,
id: 0,
name: '',
positions: 0,
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/rear-port-templates/:id/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, id: 0, name: '', positions: 0, type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/rear-port-templates/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"id":0,"name":"","positions":0,"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"device_type": @0,
@"id": @0,
@"name": @"",
@"positions": @0,
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/rear-port-templates/:id/"]
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}}/dcim/rear-port-templates/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/rear-port-templates/:id/",
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([
'device_type' => 0,
'id' => 0,
'name' => '',
'positions' => 0,
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/dcim/rear-port-templates/:id/', [
'body' => '{
"device_type": 0,
"id": 0,
"name": "",
"positions": 0,
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/rear-port-templates/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'device_type' => 0,
'id' => 0,
'name' => '',
'positions' => 0,
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'device_type' => 0,
'id' => 0,
'name' => '',
'positions' => 0,
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/rear-port-templates/:id/');
$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}}/dcim/rear-port-templates/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"id": 0,
"name": "",
"positions": 0,
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/rear-port-templates/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"id": 0,
"name": "",
"positions": 0,
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/dcim/rear-port-templates/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/rear-port-templates/:id/"
payload = {
"device_type": 0,
"id": 0,
"name": "",
"positions": 0,
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/rear-port-templates/:id/"
payload <- "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\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}}/dcim/rear-port-templates/:id/")
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 \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/dcim/rear-port-templates/:id/') do |req|
req.body = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\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}}/dcim/rear-port-templates/:id/";
let payload = json!({
"device_type": 0,
"id": 0,
"name": "",
"positions": 0,
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/dcim/rear-port-templates/:id/ \
--header 'content-type: application/json' \
--data '{
"device_type": 0,
"id": 0,
"name": "",
"positions": 0,
"type": ""
}'
echo '{
"device_type": 0,
"id": 0,
"name": "",
"positions": 0,
"type": ""
}' | \
http PATCH {{baseUrl}}/dcim/rear-port-templates/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "device_type": 0,\n "id": 0,\n "name": "",\n "positions": 0,\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/rear-port-templates/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"device_type": 0,
"id": 0,
"name": "",
"positions": 0,
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/rear-port-templates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_rear-port-templates_read
{{baseUrl}}/dcim/rear-port-templates/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/rear-port-templates/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/rear-port-templates/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/rear-port-templates/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/dcim/rear-port-templates/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/rear-port-templates/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/rear-port-templates/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/dcim/rear-port-templates/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/rear-port-templates/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/rear-port-templates/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/rear-port-templates/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/rear-port-templates/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/dcim/rear-port-templates/:id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/dcim/rear-port-templates/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/rear-port-templates/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/rear-port-templates/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/rear-port-templates/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/rear-port-templates/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/dcim/rear-port-templates/:id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/rear-port-templates/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/dcim/rear-port-templates/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/rear-port-templates/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/rear-port-templates/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/rear-port-templates/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/rear-port-templates/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/dcim/rear-port-templates/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/rear-port-templates/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/rear-port-templates/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/rear-port-templates/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/rear-port-templates/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/rear-port-templates/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/rear-port-templates/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/rear-port-templates/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/rear-port-templates/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/dcim/rear-port-templates/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/rear-port-templates/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/dcim/rear-port-templates/:id/
http GET {{baseUrl}}/dcim/rear-port-templates/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/rear-port-templates/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/rear-port-templates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
dcim_rear-port-templates_update
{{baseUrl}}/dcim/rear-port-templates/:id/
BODY json
{
"device_type": 0,
"id": 0,
"name": "",
"positions": 0,
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/rear-port-templates/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/dcim/rear-port-templates/:id/" {:content-type :json
:form-params {:device_type 0
:id 0
:name ""
:positions 0
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/rear-port-templates/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\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}}/dcim/rear-port-templates/:id/"),
Content = new StringContent("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/rear-port-templates/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/rear-port-templates/:id/"
payload := strings.NewReader("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\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/dcim/rear-port-templates/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 79
{
"device_type": 0,
"id": 0,
"name": "",
"positions": 0,
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/dcim/rear-port-templates/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/rear-port-templates/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/rear-port-templates/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/dcim/rear-port-templates/:id/")
.header("content-type", "application/json")
.body("{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
device_type: 0,
id: 0,
name: '',
positions: 0,
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/dcim/rear-port-templates/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/rear-port-templates/:id/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, id: 0, name: '', positions: 0, type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/rear-port-templates/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"id":0,"name":"","positions":0,"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/rear-port-templates/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "device_type": 0,\n "id": 0,\n "name": "",\n "positions": 0,\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/rear-port-templates/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/rear-port-templates/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({device_type: 0, id: 0, name: '', positions: 0, type: ''}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/rear-port-templates/:id/',
headers: {'content-type': 'application/json'},
body: {device_type: 0, id: 0, name: '', positions: 0, type: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/dcim/rear-port-templates/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
device_type: 0,
id: 0,
name: '',
positions: 0,
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/rear-port-templates/:id/',
headers: {'content-type': 'application/json'},
data: {device_type: 0, id: 0, name: '', positions: 0, type: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/rear-port-templates/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"device_type":0,"id":0,"name":"","positions":0,"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"device_type": @0,
@"id": @0,
@"name": @"",
@"positions": @0,
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/rear-port-templates/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/rear-port-templates/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/rear-port-templates/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'device_type' => 0,
'id' => 0,
'name' => '',
'positions' => 0,
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/dcim/rear-port-templates/:id/', [
'body' => '{
"device_type": 0,
"id": 0,
"name": "",
"positions": 0,
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/rear-port-templates/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'device_type' => 0,
'id' => 0,
'name' => '',
'positions' => 0,
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'device_type' => 0,
'id' => 0,
'name' => '',
'positions' => 0,
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/rear-port-templates/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/rear-port-templates/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"id": 0,
"name": "",
"positions": 0,
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/rear-port-templates/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"device_type": 0,
"id": 0,
"name": "",
"positions": 0,
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/dcim/rear-port-templates/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/rear-port-templates/:id/"
payload = {
"device_type": 0,
"id": 0,
"name": "",
"positions": 0,
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/rear-port-templates/:id/"
payload <- "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\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}}/dcim/rear-port-templates/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/dcim/rear-port-templates/:id/') do |req|
req.body = "{\n \"device_type\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"type\": \"\"\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}}/dcim/rear-port-templates/:id/";
let payload = json!({
"device_type": 0,
"id": 0,
"name": "",
"positions": 0,
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/dcim/rear-port-templates/:id/ \
--header 'content-type: application/json' \
--data '{
"device_type": 0,
"id": 0,
"name": "",
"positions": 0,
"type": ""
}'
echo '{
"device_type": 0,
"id": 0,
"name": "",
"positions": 0,
"type": ""
}' | \
http PUT {{baseUrl}}/dcim/rear-port-templates/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "device_type": 0,\n "id": 0,\n "name": "",\n "positions": 0,\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/rear-port-templates/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"device_type": 0,
"id": 0,
"name": "",
"positions": 0,
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/rear-port-templates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
dcim_rear-ports_create
{{baseUrl}}/dcim/rear-ports/
BODY json
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"positions": 0,
"tags": [],
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/rear-ports/");
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 \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/dcim/rear-ports/" {:content-type :json
:form-params {:cable {:id 0
:label ""
:url ""}
:description ""
:device 0
:id 0
:name ""
:positions 0
:tags []
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/rear-ports/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/dcim/rear-ports/"),
Content = new StringContent("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/rear-ports/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/rear-ports/"
payload := strings.NewReader("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/dcim/rear-ports/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 171
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"positions": 0,
"tags": [],
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/dcim/rear-ports/")
.setHeader("content-type", "application/json")
.setBody("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/rear-ports/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/rear-ports/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/dcim/rear-ports/")
.header("content-type", "application/json")
.body("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
cable: {
id: 0,
label: '',
url: ''
},
description: '',
device: 0,
id: 0,
name: '',
positions: 0,
tags: [],
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/dcim/rear-ports/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/rear-ports/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
description: '',
device: 0,
id: 0,
name: '',
positions: 0,
tags: [],
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/rear-ports/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"description":"","device":0,"id":0,"name":"","positions":0,"tags":[],"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/rear-ports/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "description": "",\n "device": 0,\n "id": 0,\n "name": "",\n "positions": 0,\n "tags": [],\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/rear-ports/")
.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/dcim/rear-ports/',
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({
cable: {id: 0, label: '', url: ''},
description: '',
device: 0,
id: 0,
name: '',
positions: 0,
tags: [],
type: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/rear-ports/',
headers: {'content-type': 'application/json'},
body: {
cable: {id: 0, label: '', url: ''},
description: '',
device: 0,
id: 0,
name: '',
positions: 0,
tags: [],
type: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/dcim/rear-ports/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cable: {
id: 0,
label: '',
url: ''
},
description: '',
device: 0,
id: 0,
name: '',
positions: 0,
tags: [],
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/rear-ports/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
description: '',
device: 0,
id: 0,
name: '',
positions: 0,
tags: [],
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/rear-ports/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"description":"","device":0,"id":0,"name":"","positions":0,"tags":[],"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"cable": @{ @"id": @0, @"label": @"", @"url": @"" },
@"description": @"",
@"device": @0,
@"id": @0,
@"name": @"",
@"positions": @0,
@"tags": @[ ],
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/rear-ports/"]
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}}/dcim/rear-ports/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/rear-ports/",
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([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'description' => '',
'device' => 0,
'id' => 0,
'name' => '',
'positions' => 0,
'tags' => [
],
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/dcim/rear-ports/', [
'body' => '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"positions": 0,
"tags": [],
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/rear-ports/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'description' => '',
'device' => 0,
'id' => 0,
'name' => '',
'positions' => 0,
'tags' => [
],
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'description' => '',
'device' => 0,
'id' => 0,
'name' => '',
'positions' => 0,
'tags' => [
],
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/rear-ports/');
$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}}/dcim/rear-ports/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"positions": 0,
"tags": [],
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/rear-ports/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"positions": 0,
"tags": [],
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/dcim/rear-ports/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/rear-ports/"
payload = {
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"positions": 0,
"tags": [],
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/rear-ports/"
payload <- "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/rear-ports/")
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 \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/dcim/rear-ports/') do |req|
req.body = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/rear-ports/";
let payload = json!({
"cable": json!({
"id": 0,
"label": "",
"url": ""
}),
"description": "",
"device": 0,
"id": 0,
"name": "",
"positions": 0,
"tags": (),
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/dcim/rear-ports/ \
--header 'content-type: application/json' \
--data '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"positions": 0,
"tags": [],
"type": ""
}'
echo '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"positions": 0,
"tags": [],
"type": ""
}' | \
http POST {{baseUrl}}/dcim/rear-ports/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "description": "",\n "device": 0,\n "id": 0,\n "name": "",\n "positions": 0,\n "tags": [],\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/rear-ports/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cable": [
"id": 0,
"label": "",
"url": ""
],
"description": "",
"device": 0,
"id": 0,
"name": "",
"positions": 0,
"tags": [],
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/rear-ports/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
dcim_rear-ports_delete
{{baseUrl}}/dcim/rear-ports/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/rear-ports/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/dcim/rear-ports/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/rear-ports/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/dcim/rear-ports/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/rear-ports/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/rear-ports/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/dcim/rear-ports/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/dcim/rear-ports/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/rear-ports/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/rear-ports/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/dcim/rear-ports/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/dcim/rear-ports/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/rear-ports/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/rear-ports/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/rear-ports/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/rear-ports/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/rear-ports/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/rear-ports/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/dcim/rear-ports/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/rear-ports/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/rear-ports/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/rear-ports/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/rear-ports/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/rear-ports/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/dcim/rear-ports/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/rear-ports/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/rear-ports/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/rear-ports/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/rear-ports/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/dcim/rear-ports/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/rear-ports/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/rear-ports/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/rear-ports/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/dcim/rear-ports/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/rear-ports/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/dcim/rear-ports/:id/
http DELETE {{baseUrl}}/dcim/rear-ports/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/dcim/rear-ports/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/rear-ports/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_rear-ports_list
{{baseUrl}}/dcim/rear-ports/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/rear-ports/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/rear-ports/")
require "http/client"
url = "{{baseUrl}}/dcim/rear-ports/"
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}}/dcim/rear-ports/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/rear-ports/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/rear-ports/"
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/dcim/rear-ports/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/rear-ports/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/rear-ports/"))
.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}}/dcim/rear-ports/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/rear-ports/")
.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}}/dcim/rear-ports/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/rear-ports/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/rear-ports/';
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}}/dcim/rear-ports/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/rear-ports/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/rear-ports/',
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}}/dcim/rear-ports/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/rear-ports/');
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}}/dcim/rear-ports/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/rear-ports/';
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}}/dcim/rear-ports/"]
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}}/dcim/rear-ports/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/rear-ports/",
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}}/dcim/rear-ports/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/rear-ports/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/rear-ports/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/rear-ports/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/rear-ports/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/rear-ports/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/rear-ports/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/rear-ports/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/rear-ports/")
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/dcim/rear-ports/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/rear-ports/";
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}}/dcim/rear-ports/
http GET {{baseUrl}}/dcim/rear-ports/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/rear-ports/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/rear-ports/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
dcim_rear-ports_partial_update
{{baseUrl}}/dcim/rear-ports/:id/
BODY json
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"positions": 0,
"tags": [],
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/rear-ports/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/dcim/rear-ports/:id/" {:content-type :json
:form-params {:cable {:id 0
:label ""
:url ""}
:description ""
:device 0
:id 0
:name ""
:positions 0
:tags []
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/rear-ports/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\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}}/dcim/rear-ports/:id/"),
Content = new StringContent("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/rear-ports/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/rear-ports/:id/"
payload := strings.NewReader("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\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/dcim/rear-ports/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 171
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"positions": 0,
"tags": [],
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/dcim/rear-ports/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/rear-ports/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/rear-ports/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/dcim/rear-ports/:id/")
.header("content-type", "application/json")
.body("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
cable: {
id: 0,
label: '',
url: ''
},
description: '',
device: 0,
id: 0,
name: '',
positions: 0,
tags: [],
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/dcim/rear-ports/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/rear-ports/:id/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
description: '',
device: 0,
id: 0,
name: '',
positions: 0,
tags: [],
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/rear-ports/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"description":"","device":0,"id":0,"name":"","positions":0,"tags":[],"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/rear-ports/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "description": "",\n "device": 0,\n "id": 0,\n "name": "",\n "positions": 0,\n "tags": [],\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/rear-ports/:id/")
.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/dcim/rear-ports/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
cable: {id: 0, label: '', url: ''},
description: '',
device: 0,
id: 0,
name: '',
positions: 0,
tags: [],
type: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/rear-ports/:id/',
headers: {'content-type': 'application/json'},
body: {
cable: {id: 0, label: '', url: ''},
description: '',
device: 0,
id: 0,
name: '',
positions: 0,
tags: [],
type: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/dcim/rear-ports/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cable: {
id: 0,
label: '',
url: ''
},
description: '',
device: 0,
id: 0,
name: '',
positions: 0,
tags: [],
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/rear-ports/:id/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
description: '',
device: 0,
id: 0,
name: '',
positions: 0,
tags: [],
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/rear-ports/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"description":"","device":0,"id":0,"name":"","positions":0,"tags":[],"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"cable": @{ @"id": @0, @"label": @"", @"url": @"" },
@"description": @"",
@"device": @0,
@"id": @0,
@"name": @"",
@"positions": @0,
@"tags": @[ ],
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/rear-ports/:id/"]
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}}/dcim/rear-ports/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/rear-ports/:id/",
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([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'description' => '',
'device' => 0,
'id' => 0,
'name' => '',
'positions' => 0,
'tags' => [
],
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/dcim/rear-ports/:id/', [
'body' => '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"positions": 0,
"tags": [],
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/rear-ports/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'description' => '',
'device' => 0,
'id' => 0,
'name' => '',
'positions' => 0,
'tags' => [
],
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'description' => '',
'device' => 0,
'id' => 0,
'name' => '',
'positions' => 0,
'tags' => [
],
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/rear-ports/:id/');
$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}}/dcim/rear-ports/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"positions": 0,
"tags": [],
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/rear-ports/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"positions": 0,
"tags": [],
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/dcim/rear-ports/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/rear-ports/:id/"
payload = {
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"positions": 0,
"tags": [],
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/rear-ports/:id/"
payload <- "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\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}}/dcim/rear-ports/:id/")
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 \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/dcim/rear-ports/:id/') do |req|
req.body = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\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}}/dcim/rear-ports/:id/";
let payload = json!({
"cable": json!({
"id": 0,
"label": "",
"url": ""
}),
"description": "",
"device": 0,
"id": 0,
"name": "",
"positions": 0,
"tags": (),
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/dcim/rear-ports/:id/ \
--header 'content-type: application/json' \
--data '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"positions": 0,
"tags": [],
"type": ""
}'
echo '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"positions": 0,
"tags": [],
"type": ""
}' | \
http PATCH {{baseUrl}}/dcim/rear-ports/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "description": "",\n "device": 0,\n "id": 0,\n "name": "",\n "positions": 0,\n "tags": [],\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/rear-ports/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cable": [
"id": 0,
"label": "",
"url": ""
],
"description": "",
"device": 0,
"id": 0,
"name": "",
"positions": 0,
"tags": [],
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/rear-ports/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_rear-ports_read
{{baseUrl}}/dcim/rear-ports/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/rear-ports/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/rear-ports/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/rear-ports/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/dcim/rear-ports/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/rear-ports/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/rear-ports/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/dcim/rear-ports/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/rear-ports/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/rear-ports/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/rear-ports/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/rear-ports/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/dcim/rear-ports/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/rear-ports/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/rear-ports/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/rear-ports/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/rear-ports/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/rear-ports/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/dcim/rear-ports/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/rear-ports/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/dcim/rear-ports/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/rear-ports/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/rear-ports/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/rear-ports/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/rear-ports/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/dcim/rear-ports/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/rear-ports/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/rear-ports/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/rear-ports/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/rear-ports/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/rear-ports/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/rear-ports/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/rear-ports/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/rear-ports/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/dcim/rear-ports/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/rear-ports/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/dcim/rear-ports/:id/
http GET {{baseUrl}}/dcim/rear-ports/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/rear-ports/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/rear-ports/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_rear-ports_trace
{{baseUrl}}/dcim/rear-ports/:id/trace/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/rear-ports/:id/trace/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/rear-ports/:id/trace/")
require "http/client"
url = "{{baseUrl}}/dcim/rear-ports/:id/trace/"
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}}/dcim/rear-ports/:id/trace/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/rear-ports/:id/trace/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/rear-ports/:id/trace/"
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/dcim/rear-ports/:id/trace/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/rear-ports/:id/trace/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/rear-ports/:id/trace/"))
.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}}/dcim/rear-ports/:id/trace/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/rear-ports/:id/trace/")
.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}}/dcim/rear-ports/:id/trace/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/rear-ports/:id/trace/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/rear-ports/:id/trace/';
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}}/dcim/rear-ports/:id/trace/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/rear-ports/:id/trace/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/rear-ports/:id/trace/',
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}}/dcim/rear-ports/:id/trace/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/rear-ports/:id/trace/');
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}}/dcim/rear-ports/:id/trace/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/rear-ports/:id/trace/';
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}}/dcim/rear-ports/:id/trace/"]
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}}/dcim/rear-ports/:id/trace/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/rear-ports/:id/trace/",
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}}/dcim/rear-ports/:id/trace/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/rear-ports/:id/trace/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/rear-ports/:id/trace/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/rear-ports/:id/trace/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/rear-ports/:id/trace/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/rear-ports/:id/trace/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/rear-ports/:id/trace/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/rear-ports/:id/trace/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/rear-ports/:id/trace/")
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/dcim/rear-ports/:id/trace/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/rear-ports/:id/trace/";
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}}/dcim/rear-ports/:id/trace/
http GET {{baseUrl}}/dcim/rear-ports/:id/trace/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/rear-ports/:id/trace/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/rear-ports/:id/trace/")! 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()
PUT
dcim_rear-ports_update
{{baseUrl}}/dcim/rear-ports/:id/
BODY json
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"positions": 0,
"tags": [],
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/rear-ports/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/dcim/rear-ports/:id/" {:content-type :json
:form-params {:cable {:id 0
:label ""
:url ""}
:description ""
:device 0
:id 0
:name ""
:positions 0
:tags []
:type ""}})
require "http/client"
url = "{{baseUrl}}/dcim/rear-ports/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\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}}/dcim/rear-ports/:id/"),
Content = new StringContent("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/rear-ports/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/rear-ports/:id/"
payload := strings.NewReader("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\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/dcim/rear-ports/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 171
{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"positions": 0,
"tags": [],
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/dcim/rear-ports/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/rear-ports/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/rear-ports/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/dcim/rear-ports/:id/")
.header("content-type", "application/json")
.body("{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
cable: {
id: 0,
label: '',
url: ''
},
description: '',
device: 0,
id: 0,
name: '',
positions: 0,
tags: [],
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/dcim/rear-ports/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/rear-ports/:id/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
description: '',
device: 0,
id: 0,
name: '',
positions: 0,
tags: [],
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/rear-ports/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"description":"","device":0,"id":0,"name":"","positions":0,"tags":[],"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/rear-ports/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "description": "",\n "device": 0,\n "id": 0,\n "name": "",\n "positions": 0,\n "tags": [],\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/rear-ports/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/rear-ports/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
cable: {id: 0, label: '', url: ''},
description: '',
device: 0,
id: 0,
name: '',
positions: 0,
tags: [],
type: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/rear-ports/:id/',
headers: {'content-type': 'application/json'},
body: {
cable: {id: 0, label: '', url: ''},
description: '',
device: 0,
id: 0,
name: '',
positions: 0,
tags: [],
type: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/dcim/rear-ports/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cable: {
id: 0,
label: '',
url: ''
},
description: '',
device: 0,
id: 0,
name: '',
positions: 0,
tags: [],
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/rear-ports/:id/',
headers: {'content-type': 'application/json'},
data: {
cable: {id: 0, label: '', url: ''},
description: '',
device: 0,
id: 0,
name: '',
positions: 0,
tags: [],
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/rear-ports/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"cable":{"id":0,"label":"","url":""},"description":"","device":0,"id":0,"name":"","positions":0,"tags":[],"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"cable": @{ @"id": @0, @"label": @"", @"url": @"" },
@"description": @"",
@"device": @0,
@"id": @0,
@"name": @"",
@"positions": @0,
@"tags": @[ ],
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/rear-ports/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/rear-ports/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/rear-ports/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'description' => '',
'device' => 0,
'id' => 0,
'name' => '',
'positions' => 0,
'tags' => [
],
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/dcim/rear-ports/:id/', [
'body' => '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"positions": 0,
"tags": [],
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/rear-ports/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'description' => '',
'device' => 0,
'id' => 0,
'name' => '',
'positions' => 0,
'tags' => [
],
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cable' => [
'id' => 0,
'label' => '',
'url' => ''
],
'description' => '',
'device' => 0,
'id' => 0,
'name' => '',
'positions' => 0,
'tags' => [
],
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/rear-ports/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/rear-ports/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"positions": 0,
"tags": [],
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/rear-ports/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"positions": 0,
"tags": [],
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/dcim/rear-ports/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/rear-ports/:id/"
payload = {
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"positions": 0,
"tags": [],
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/rear-ports/:id/"
payload <- "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\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}}/dcim/rear-ports/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/dcim/rear-ports/:id/') do |req|
req.body = "{\n \"cable\": {\n \"id\": 0,\n \"label\": \"\",\n \"url\": \"\"\n },\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"name\": \"\",\n \"positions\": 0,\n \"tags\": [],\n \"type\": \"\"\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}}/dcim/rear-ports/:id/";
let payload = json!({
"cable": json!({
"id": 0,
"label": "",
"url": ""
}),
"description": "",
"device": 0,
"id": 0,
"name": "",
"positions": 0,
"tags": (),
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/dcim/rear-ports/:id/ \
--header 'content-type: application/json' \
--data '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"positions": 0,
"tags": [],
"type": ""
}'
echo '{
"cable": {
"id": 0,
"label": "",
"url": ""
},
"description": "",
"device": 0,
"id": 0,
"name": "",
"positions": 0,
"tags": [],
"type": ""
}' | \
http PUT {{baseUrl}}/dcim/rear-ports/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "cable": {\n "id": 0,\n "label": "",\n "url": ""\n },\n "description": "",\n "device": 0,\n "id": 0,\n "name": "",\n "positions": 0,\n "tags": [],\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/rear-ports/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cable": [
"id": 0,
"label": "",
"url": ""
],
"description": "",
"device": 0,
"id": 0,
"name": "",
"positions": 0,
"tags": [],
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/rear-ports/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
dcim_regions_create
{{baseUrl}}/dcim/regions/
BODY json
{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"site_count": 0,
"slug": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/regions/");
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 \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/dcim/regions/" {:content-type :json
:form-params {:description ""
:id 0
:name ""
:parent 0
:site_count 0
:slug ""}})
require "http/client"
url = "{{baseUrl}}/dcim/regions/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\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}}/dcim/regions/"),
Content = new StringContent("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\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}}/dcim/regions/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/regions/"
payload := strings.NewReader("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\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/dcim/regions/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 96
{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"site_count": 0,
"slug": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/dcim/regions/")
.setHeader("content-type", "application/json")
.setBody("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/regions/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\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 \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/regions/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/dcim/regions/")
.header("content-type", "application/json")
.body("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\n}")
.asString();
const data = JSON.stringify({
description: '',
id: 0,
name: '',
parent: 0,
site_count: 0,
slug: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/dcim/regions/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/regions/',
headers: {'content-type': 'application/json'},
data: {description: '', id: 0, name: '', parent: 0, site_count: 0, slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/regions/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"description":"","id":0,"name":"","parent":0,"site_count":0,"slug":""}'
};
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}}/dcim/regions/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "description": "",\n "id": 0,\n "name": "",\n "parent": 0,\n "site_count": 0,\n "slug": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/regions/")
.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/dcim/regions/',
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({description: '', id: 0, name: '', parent: 0, site_count: 0, slug: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/regions/',
headers: {'content-type': 'application/json'},
body: {description: '', id: 0, name: '', parent: 0, site_count: 0, slug: ''},
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}}/dcim/regions/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
description: '',
id: 0,
name: '',
parent: 0,
site_count: 0,
slug: ''
});
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}}/dcim/regions/',
headers: {'content-type': 'application/json'},
data: {description: '', id: 0, name: '', parent: 0, site_count: 0, slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/regions/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"description":"","id":0,"name":"","parent":0,"site_count":0,"slug":""}'
};
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 = @{ @"description": @"",
@"id": @0,
@"name": @"",
@"parent": @0,
@"site_count": @0,
@"slug": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/regions/"]
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}}/dcim/regions/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/regions/",
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([
'description' => '',
'id' => 0,
'name' => '',
'parent' => 0,
'site_count' => 0,
'slug' => ''
]),
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}}/dcim/regions/', [
'body' => '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"site_count": 0,
"slug": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/regions/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'description' => '',
'id' => 0,
'name' => '',
'parent' => 0,
'site_count' => 0,
'slug' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'description' => '',
'id' => 0,
'name' => '',
'parent' => 0,
'site_count' => 0,
'slug' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/regions/');
$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}}/dcim/regions/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"site_count": 0,
"slug": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/regions/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"site_count": 0,
"slug": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/dcim/regions/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/regions/"
payload = {
"description": "",
"id": 0,
"name": "",
"parent": 0,
"site_count": 0,
"slug": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/regions/"
payload <- "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\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}}/dcim/regions/")
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 \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\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/dcim/regions/') do |req|
req.body = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/regions/";
let payload = json!({
"description": "",
"id": 0,
"name": "",
"parent": 0,
"site_count": 0,
"slug": ""
});
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}}/dcim/regions/ \
--header 'content-type: application/json' \
--data '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"site_count": 0,
"slug": ""
}'
echo '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"site_count": 0,
"slug": ""
}' | \
http POST {{baseUrl}}/dcim/regions/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "description": "",\n "id": 0,\n "name": "",\n "parent": 0,\n "site_count": 0,\n "slug": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/regions/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"description": "",
"id": 0,
"name": "",
"parent": 0,
"site_count": 0,
"slug": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/regions/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
dcim_regions_delete
{{baseUrl}}/dcim/regions/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/regions/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/dcim/regions/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/regions/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/dcim/regions/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/regions/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/regions/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/dcim/regions/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/dcim/regions/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/regions/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/regions/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/dcim/regions/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/dcim/regions/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/regions/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/regions/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/regions/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/regions/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/regions/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/regions/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/dcim/regions/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/regions/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/regions/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/regions/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/regions/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/regions/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/dcim/regions/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/regions/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/regions/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/regions/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/regions/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/dcim/regions/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/regions/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/regions/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/regions/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/dcim/regions/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/regions/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/dcim/regions/:id/
http DELETE {{baseUrl}}/dcim/regions/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/dcim/regions/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/regions/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_regions_list
{{baseUrl}}/dcim/regions/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/regions/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/regions/")
require "http/client"
url = "{{baseUrl}}/dcim/regions/"
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}}/dcim/regions/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/regions/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/regions/"
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/dcim/regions/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/regions/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/regions/"))
.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}}/dcim/regions/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/regions/")
.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}}/dcim/regions/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/regions/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/regions/';
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}}/dcim/regions/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/regions/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/regions/',
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}}/dcim/regions/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/regions/');
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}}/dcim/regions/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/regions/';
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}}/dcim/regions/"]
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}}/dcim/regions/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/regions/",
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}}/dcim/regions/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/regions/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/regions/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/regions/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/regions/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/regions/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/regions/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/regions/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/regions/")
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/dcim/regions/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/regions/";
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}}/dcim/regions/
http GET {{baseUrl}}/dcim/regions/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/regions/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/regions/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
dcim_regions_partial_update
{{baseUrl}}/dcim/regions/:id/
BODY json
{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"site_count": 0,
"slug": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/regions/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/dcim/regions/:id/" {:content-type :json
:form-params {:description ""
:id 0
:name ""
:parent 0
:site_count 0
:slug ""}})
require "http/client"
url = "{{baseUrl}}/dcim/regions/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\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}}/dcim/regions/:id/"),
Content = new StringContent("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\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}}/dcim/regions/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/regions/:id/"
payload := strings.NewReader("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\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/dcim/regions/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 96
{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"site_count": 0,
"slug": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/dcim/regions/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/regions/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\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 \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/regions/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/dcim/regions/:id/")
.header("content-type", "application/json")
.body("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\n}")
.asString();
const data = JSON.stringify({
description: '',
id: 0,
name: '',
parent: 0,
site_count: 0,
slug: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/dcim/regions/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/regions/:id/',
headers: {'content-type': 'application/json'},
data: {description: '', id: 0, name: '', parent: 0, site_count: 0, slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/regions/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"description":"","id":0,"name":"","parent":0,"site_count":0,"slug":""}'
};
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}}/dcim/regions/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "description": "",\n "id": 0,\n "name": "",\n "parent": 0,\n "site_count": 0,\n "slug": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/regions/:id/")
.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/dcim/regions/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({description: '', id: 0, name: '', parent: 0, site_count: 0, slug: ''}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/regions/:id/',
headers: {'content-type': 'application/json'},
body: {description: '', id: 0, name: '', parent: 0, site_count: 0, slug: ''},
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}}/dcim/regions/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
description: '',
id: 0,
name: '',
parent: 0,
site_count: 0,
slug: ''
});
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}}/dcim/regions/:id/',
headers: {'content-type': 'application/json'},
data: {description: '', id: 0, name: '', parent: 0, site_count: 0, slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/regions/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"description":"","id":0,"name":"","parent":0,"site_count":0,"slug":""}'
};
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 = @{ @"description": @"",
@"id": @0,
@"name": @"",
@"parent": @0,
@"site_count": @0,
@"slug": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/regions/:id/"]
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}}/dcim/regions/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/regions/:id/",
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([
'description' => '',
'id' => 0,
'name' => '',
'parent' => 0,
'site_count' => 0,
'slug' => ''
]),
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}}/dcim/regions/:id/', [
'body' => '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"site_count": 0,
"slug": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/regions/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'description' => '',
'id' => 0,
'name' => '',
'parent' => 0,
'site_count' => 0,
'slug' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'description' => '',
'id' => 0,
'name' => '',
'parent' => 0,
'site_count' => 0,
'slug' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/regions/:id/');
$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}}/dcim/regions/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"site_count": 0,
"slug": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/regions/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"site_count": 0,
"slug": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/dcim/regions/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/regions/:id/"
payload = {
"description": "",
"id": 0,
"name": "",
"parent": 0,
"site_count": 0,
"slug": ""
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/regions/:id/"
payload <- "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\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}}/dcim/regions/:id/")
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 \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\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/dcim/regions/:id/') do |req|
req.body = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\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}}/dcim/regions/:id/";
let payload = json!({
"description": "",
"id": 0,
"name": "",
"parent": 0,
"site_count": 0,
"slug": ""
});
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}}/dcim/regions/:id/ \
--header 'content-type: application/json' \
--data '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"site_count": 0,
"slug": ""
}'
echo '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"site_count": 0,
"slug": ""
}' | \
http PATCH {{baseUrl}}/dcim/regions/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "description": "",\n "id": 0,\n "name": "",\n "parent": 0,\n "site_count": 0,\n "slug": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/regions/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"description": "",
"id": 0,
"name": "",
"parent": 0,
"site_count": 0,
"slug": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/regions/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_regions_read
{{baseUrl}}/dcim/regions/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/regions/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/regions/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/regions/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/dcim/regions/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/regions/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/regions/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/dcim/regions/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/regions/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/regions/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/regions/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/regions/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/dcim/regions/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/regions/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/regions/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/regions/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/regions/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/regions/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/dcim/regions/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/regions/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/dcim/regions/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/regions/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/regions/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/regions/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/regions/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/dcim/regions/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/regions/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/regions/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/regions/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/regions/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/regions/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/regions/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/regions/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/regions/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/dcim/regions/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/regions/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/dcim/regions/:id/
http GET {{baseUrl}}/dcim/regions/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/regions/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/regions/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
dcim_regions_update
{{baseUrl}}/dcim/regions/:id/
BODY json
{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"site_count": 0,
"slug": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/regions/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/dcim/regions/:id/" {:content-type :json
:form-params {:description ""
:id 0
:name ""
:parent 0
:site_count 0
:slug ""}})
require "http/client"
url = "{{baseUrl}}/dcim/regions/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\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}}/dcim/regions/:id/"),
Content = new StringContent("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\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}}/dcim/regions/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/regions/:id/"
payload := strings.NewReader("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\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/dcim/regions/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 96
{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"site_count": 0,
"slug": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/dcim/regions/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/regions/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\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 \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/regions/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/dcim/regions/:id/")
.header("content-type", "application/json")
.body("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\n}")
.asString();
const data = JSON.stringify({
description: '',
id: 0,
name: '',
parent: 0,
site_count: 0,
slug: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/dcim/regions/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/regions/:id/',
headers: {'content-type': 'application/json'},
data: {description: '', id: 0, name: '', parent: 0, site_count: 0, slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/regions/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"description":"","id":0,"name":"","parent":0,"site_count":0,"slug":""}'
};
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}}/dcim/regions/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "description": "",\n "id": 0,\n "name": "",\n "parent": 0,\n "site_count": 0,\n "slug": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/regions/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/regions/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({description: '', id: 0, name: '', parent: 0, site_count: 0, slug: ''}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/regions/:id/',
headers: {'content-type': 'application/json'},
body: {description: '', id: 0, name: '', parent: 0, site_count: 0, slug: ''},
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}}/dcim/regions/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
description: '',
id: 0,
name: '',
parent: 0,
site_count: 0,
slug: ''
});
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}}/dcim/regions/:id/',
headers: {'content-type': 'application/json'},
data: {description: '', id: 0, name: '', parent: 0, site_count: 0, slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/regions/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"description":"","id":0,"name":"","parent":0,"site_count":0,"slug":""}'
};
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 = @{ @"description": @"",
@"id": @0,
@"name": @"",
@"parent": @0,
@"site_count": @0,
@"slug": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/regions/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/regions/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/regions/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'description' => '',
'id' => 0,
'name' => '',
'parent' => 0,
'site_count' => 0,
'slug' => ''
]),
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}}/dcim/regions/:id/', [
'body' => '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"site_count": 0,
"slug": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/regions/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'description' => '',
'id' => 0,
'name' => '',
'parent' => 0,
'site_count' => 0,
'slug' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'description' => '',
'id' => 0,
'name' => '',
'parent' => 0,
'site_count' => 0,
'slug' => ''
]));
$request->setRequestUrl('{{baseUrl}}/dcim/regions/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/regions/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"site_count": 0,
"slug": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/regions/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"site_count": 0,
"slug": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/dcim/regions/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/regions/:id/"
payload = {
"description": "",
"id": 0,
"name": "",
"parent": 0,
"site_count": 0,
"slug": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/regions/:id/"
payload <- "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\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}}/dcim/regions/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\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/dcim/regions/:id/') do |req|
req.body = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"site_count\": 0,\n \"slug\": \"\"\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}}/dcim/regions/:id/";
let payload = json!({
"description": "",
"id": 0,
"name": "",
"parent": 0,
"site_count": 0,
"slug": ""
});
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}}/dcim/regions/:id/ \
--header 'content-type: application/json' \
--data '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"site_count": 0,
"slug": ""
}'
echo '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"site_count": 0,
"slug": ""
}' | \
http PUT {{baseUrl}}/dcim/regions/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "description": "",\n "id": 0,\n "name": "",\n "parent": 0,\n "site_count": 0,\n "slug": ""\n}' \
--output-document \
- {{baseUrl}}/dcim/regions/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"description": "",
"id": 0,
"name": "",
"parent": 0,
"site_count": 0,
"slug": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/regions/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
dcim_sites_create
{{baseUrl}}/dcim/sites/
BODY json
{
"asn": 0,
"circuit_count": 0,
"comments": "",
"contact_email": "",
"contact_name": "",
"contact_phone": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"facility": "",
"id": 0,
"last_updated": "",
"latitude": "",
"longitude": "",
"name": "",
"physical_address": "",
"prefix_count": 0,
"rack_count": 0,
"region": 0,
"shipping_address": "",
"slug": "",
"status": "",
"tags": [],
"tenant": 0,
"time_zone": "",
"virtualmachine_count": 0,
"vlan_count": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/sites/");
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 \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/dcim/sites/" {:content-type :json
:form-params {:asn 0
:circuit_count 0
:comments ""
:contact_email ""
:contact_name ""
:contact_phone ""
:created ""
:custom_fields {}
:description ""
:device_count 0
:facility ""
:id 0
:last_updated ""
:latitude ""
:longitude ""
:name ""
:physical_address ""
:prefix_count 0
:rack_count 0
:region 0
:shipping_address ""
:slug ""
:status ""
:tags []
:tenant 0
:time_zone ""
:virtualmachine_count 0
:vlan_count 0}})
require "http/client"
url = "{{baseUrl}}/dcim/sites/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/dcim/sites/"),
Content = new StringContent("{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/sites/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/sites/"
payload := strings.NewReader("{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/dcim/sites/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 539
{
"asn": 0,
"circuit_count": 0,
"comments": "",
"contact_email": "",
"contact_name": "",
"contact_phone": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"facility": "",
"id": 0,
"last_updated": "",
"latitude": "",
"longitude": "",
"name": "",
"physical_address": "",
"prefix_count": 0,
"rack_count": 0,
"region": 0,
"shipping_address": "",
"slug": "",
"status": "",
"tags": [],
"tenant": 0,
"time_zone": "",
"virtualmachine_count": 0,
"vlan_count": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/dcim/sites/")
.setHeader("content-type", "application/json")
.setBody("{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/sites/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/sites/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/dcim/sites/")
.header("content-type", "application/json")
.body("{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\n}")
.asString();
const data = JSON.stringify({
asn: 0,
circuit_count: 0,
comments: '',
contact_email: '',
contact_name: '',
contact_phone: '',
created: '',
custom_fields: {},
description: '',
device_count: 0,
facility: '',
id: 0,
last_updated: '',
latitude: '',
longitude: '',
name: '',
physical_address: '',
prefix_count: 0,
rack_count: 0,
region: 0,
shipping_address: '',
slug: '',
status: '',
tags: [],
tenant: 0,
time_zone: '',
virtualmachine_count: 0,
vlan_count: 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}}/dcim/sites/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/sites/',
headers: {'content-type': 'application/json'},
data: {
asn: 0,
circuit_count: 0,
comments: '',
contact_email: '',
contact_name: '',
contact_phone: '',
created: '',
custom_fields: {},
description: '',
device_count: 0,
facility: '',
id: 0,
last_updated: '',
latitude: '',
longitude: '',
name: '',
physical_address: '',
prefix_count: 0,
rack_count: 0,
region: 0,
shipping_address: '',
slug: '',
status: '',
tags: [],
tenant: 0,
time_zone: '',
virtualmachine_count: 0,
vlan_count: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/sites/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"asn":0,"circuit_count":0,"comments":"","contact_email":"","contact_name":"","contact_phone":"","created":"","custom_fields":{},"description":"","device_count":0,"facility":"","id":0,"last_updated":"","latitude":"","longitude":"","name":"","physical_address":"","prefix_count":0,"rack_count":0,"region":0,"shipping_address":"","slug":"","status":"","tags":[],"tenant":0,"time_zone":"","virtualmachine_count":0,"vlan_count":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}}/dcim/sites/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "asn": 0,\n "circuit_count": 0,\n "comments": "",\n "contact_email": "",\n "contact_name": "",\n "contact_phone": "",\n "created": "",\n "custom_fields": {},\n "description": "",\n "device_count": 0,\n "facility": "",\n "id": 0,\n "last_updated": "",\n "latitude": "",\n "longitude": "",\n "name": "",\n "physical_address": "",\n "prefix_count": 0,\n "rack_count": 0,\n "region": 0,\n "shipping_address": "",\n "slug": "",\n "status": "",\n "tags": [],\n "tenant": 0,\n "time_zone": "",\n "virtualmachine_count": 0,\n "vlan_count": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/sites/")
.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/dcim/sites/',
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({
asn: 0,
circuit_count: 0,
comments: '',
contact_email: '',
contact_name: '',
contact_phone: '',
created: '',
custom_fields: {},
description: '',
device_count: 0,
facility: '',
id: 0,
last_updated: '',
latitude: '',
longitude: '',
name: '',
physical_address: '',
prefix_count: 0,
rack_count: 0,
region: 0,
shipping_address: '',
slug: '',
status: '',
tags: [],
tenant: 0,
time_zone: '',
virtualmachine_count: 0,
vlan_count: 0
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/sites/',
headers: {'content-type': 'application/json'},
body: {
asn: 0,
circuit_count: 0,
comments: '',
contact_email: '',
contact_name: '',
contact_phone: '',
created: '',
custom_fields: {},
description: '',
device_count: 0,
facility: '',
id: 0,
last_updated: '',
latitude: '',
longitude: '',
name: '',
physical_address: '',
prefix_count: 0,
rack_count: 0,
region: 0,
shipping_address: '',
slug: '',
status: '',
tags: [],
tenant: 0,
time_zone: '',
virtualmachine_count: 0,
vlan_count: 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}}/dcim/sites/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
asn: 0,
circuit_count: 0,
comments: '',
contact_email: '',
contact_name: '',
contact_phone: '',
created: '',
custom_fields: {},
description: '',
device_count: 0,
facility: '',
id: 0,
last_updated: '',
latitude: '',
longitude: '',
name: '',
physical_address: '',
prefix_count: 0,
rack_count: 0,
region: 0,
shipping_address: '',
slug: '',
status: '',
tags: [],
tenant: 0,
time_zone: '',
virtualmachine_count: 0,
vlan_count: 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}}/dcim/sites/',
headers: {'content-type': 'application/json'},
data: {
asn: 0,
circuit_count: 0,
comments: '',
contact_email: '',
contact_name: '',
contact_phone: '',
created: '',
custom_fields: {},
description: '',
device_count: 0,
facility: '',
id: 0,
last_updated: '',
latitude: '',
longitude: '',
name: '',
physical_address: '',
prefix_count: 0,
rack_count: 0,
region: 0,
shipping_address: '',
slug: '',
status: '',
tags: [],
tenant: 0,
time_zone: '',
virtualmachine_count: 0,
vlan_count: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/sites/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"asn":0,"circuit_count":0,"comments":"","contact_email":"","contact_name":"","contact_phone":"","created":"","custom_fields":{},"description":"","device_count":0,"facility":"","id":0,"last_updated":"","latitude":"","longitude":"","name":"","physical_address":"","prefix_count":0,"rack_count":0,"region":0,"shipping_address":"","slug":"","status":"","tags":[],"tenant":0,"time_zone":"","virtualmachine_count":0,"vlan_count":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 = @{ @"asn": @0,
@"circuit_count": @0,
@"comments": @"",
@"contact_email": @"",
@"contact_name": @"",
@"contact_phone": @"",
@"created": @"",
@"custom_fields": @{ },
@"description": @"",
@"device_count": @0,
@"facility": @"",
@"id": @0,
@"last_updated": @"",
@"latitude": @"",
@"longitude": @"",
@"name": @"",
@"physical_address": @"",
@"prefix_count": @0,
@"rack_count": @0,
@"region": @0,
@"shipping_address": @"",
@"slug": @"",
@"status": @"",
@"tags": @[ ],
@"tenant": @0,
@"time_zone": @"",
@"virtualmachine_count": @0,
@"vlan_count": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/sites/"]
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}}/dcim/sites/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/sites/",
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([
'asn' => 0,
'circuit_count' => 0,
'comments' => '',
'contact_email' => '',
'contact_name' => '',
'contact_phone' => '',
'created' => '',
'custom_fields' => [
],
'description' => '',
'device_count' => 0,
'facility' => '',
'id' => 0,
'last_updated' => '',
'latitude' => '',
'longitude' => '',
'name' => '',
'physical_address' => '',
'prefix_count' => 0,
'rack_count' => 0,
'region' => 0,
'shipping_address' => '',
'slug' => '',
'status' => '',
'tags' => [
],
'tenant' => 0,
'time_zone' => '',
'virtualmachine_count' => 0,
'vlan_count' => 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}}/dcim/sites/', [
'body' => '{
"asn": 0,
"circuit_count": 0,
"comments": "",
"contact_email": "",
"contact_name": "",
"contact_phone": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"facility": "",
"id": 0,
"last_updated": "",
"latitude": "",
"longitude": "",
"name": "",
"physical_address": "",
"prefix_count": 0,
"rack_count": 0,
"region": 0,
"shipping_address": "",
"slug": "",
"status": "",
"tags": [],
"tenant": 0,
"time_zone": "",
"virtualmachine_count": 0,
"vlan_count": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/sites/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'asn' => 0,
'circuit_count' => 0,
'comments' => '',
'contact_email' => '',
'contact_name' => '',
'contact_phone' => '',
'created' => '',
'custom_fields' => [
],
'description' => '',
'device_count' => 0,
'facility' => '',
'id' => 0,
'last_updated' => '',
'latitude' => '',
'longitude' => '',
'name' => '',
'physical_address' => '',
'prefix_count' => 0,
'rack_count' => 0,
'region' => 0,
'shipping_address' => '',
'slug' => '',
'status' => '',
'tags' => [
],
'tenant' => 0,
'time_zone' => '',
'virtualmachine_count' => 0,
'vlan_count' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'asn' => 0,
'circuit_count' => 0,
'comments' => '',
'contact_email' => '',
'contact_name' => '',
'contact_phone' => '',
'created' => '',
'custom_fields' => [
],
'description' => '',
'device_count' => 0,
'facility' => '',
'id' => 0,
'last_updated' => '',
'latitude' => '',
'longitude' => '',
'name' => '',
'physical_address' => '',
'prefix_count' => 0,
'rack_count' => 0,
'region' => 0,
'shipping_address' => '',
'slug' => '',
'status' => '',
'tags' => [
],
'tenant' => 0,
'time_zone' => '',
'virtualmachine_count' => 0,
'vlan_count' => 0
]));
$request->setRequestUrl('{{baseUrl}}/dcim/sites/');
$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}}/dcim/sites/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"asn": 0,
"circuit_count": 0,
"comments": "",
"contact_email": "",
"contact_name": "",
"contact_phone": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"facility": "",
"id": 0,
"last_updated": "",
"latitude": "",
"longitude": "",
"name": "",
"physical_address": "",
"prefix_count": 0,
"rack_count": 0,
"region": 0,
"shipping_address": "",
"slug": "",
"status": "",
"tags": [],
"tenant": 0,
"time_zone": "",
"virtualmachine_count": 0,
"vlan_count": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/sites/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"asn": 0,
"circuit_count": 0,
"comments": "",
"contact_email": "",
"contact_name": "",
"contact_phone": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"facility": "",
"id": 0,
"last_updated": "",
"latitude": "",
"longitude": "",
"name": "",
"physical_address": "",
"prefix_count": 0,
"rack_count": 0,
"region": 0,
"shipping_address": "",
"slug": "",
"status": "",
"tags": [],
"tenant": 0,
"time_zone": "",
"virtualmachine_count": 0,
"vlan_count": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/dcim/sites/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/sites/"
payload = {
"asn": 0,
"circuit_count": 0,
"comments": "",
"contact_email": "",
"contact_name": "",
"contact_phone": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"facility": "",
"id": 0,
"last_updated": "",
"latitude": "",
"longitude": "",
"name": "",
"physical_address": "",
"prefix_count": 0,
"rack_count": 0,
"region": 0,
"shipping_address": "",
"slug": "",
"status": "",
"tags": [],
"tenant": 0,
"time_zone": "",
"virtualmachine_count": 0,
"vlan_count": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/sites/"
payload <- "{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/sites/")
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 \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/dcim/sites/') do |req|
req.body = "{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/sites/";
let payload = json!({
"asn": 0,
"circuit_count": 0,
"comments": "",
"contact_email": "",
"contact_name": "",
"contact_phone": "",
"created": "",
"custom_fields": json!({}),
"description": "",
"device_count": 0,
"facility": "",
"id": 0,
"last_updated": "",
"latitude": "",
"longitude": "",
"name": "",
"physical_address": "",
"prefix_count": 0,
"rack_count": 0,
"region": 0,
"shipping_address": "",
"slug": "",
"status": "",
"tags": (),
"tenant": 0,
"time_zone": "",
"virtualmachine_count": 0,
"vlan_count": 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}}/dcim/sites/ \
--header 'content-type: application/json' \
--data '{
"asn": 0,
"circuit_count": 0,
"comments": "",
"contact_email": "",
"contact_name": "",
"contact_phone": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"facility": "",
"id": 0,
"last_updated": "",
"latitude": "",
"longitude": "",
"name": "",
"physical_address": "",
"prefix_count": 0,
"rack_count": 0,
"region": 0,
"shipping_address": "",
"slug": "",
"status": "",
"tags": [],
"tenant": 0,
"time_zone": "",
"virtualmachine_count": 0,
"vlan_count": 0
}'
echo '{
"asn": 0,
"circuit_count": 0,
"comments": "",
"contact_email": "",
"contact_name": "",
"contact_phone": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"facility": "",
"id": 0,
"last_updated": "",
"latitude": "",
"longitude": "",
"name": "",
"physical_address": "",
"prefix_count": 0,
"rack_count": 0,
"region": 0,
"shipping_address": "",
"slug": "",
"status": "",
"tags": [],
"tenant": 0,
"time_zone": "",
"virtualmachine_count": 0,
"vlan_count": 0
}' | \
http POST {{baseUrl}}/dcim/sites/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "asn": 0,\n "circuit_count": 0,\n "comments": "",\n "contact_email": "",\n "contact_name": "",\n "contact_phone": "",\n "created": "",\n "custom_fields": {},\n "description": "",\n "device_count": 0,\n "facility": "",\n "id": 0,\n "last_updated": "",\n "latitude": "",\n "longitude": "",\n "name": "",\n "physical_address": "",\n "prefix_count": 0,\n "rack_count": 0,\n "region": 0,\n "shipping_address": "",\n "slug": "",\n "status": "",\n "tags": [],\n "tenant": 0,\n "time_zone": "",\n "virtualmachine_count": 0,\n "vlan_count": 0\n}' \
--output-document \
- {{baseUrl}}/dcim/sites/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"asn": 0,
"circuit_count": 0,
"comments": "",
"contact_email": "",
"contact_name": "",
"contact_phone": "",
"created": "",
"custom_fields": [],
"description": "",
"device_count": 0,
"facility": "",
"id": 0,
"last_updated": "",
"latitude": "",
"longitude": "",
"name": "",
"physical_address": "",
"prefix_count": 0,
"rack_count": 0,
"region": 0,
"shipping_address": "",
"slug": "",
"status": "",
"tags": [],
"tenant": 0,
"time_zone": "",
"virtualmachine_count": 0,
"vlan_count": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/sites/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
dcim_sites_delete
{{baseUrl}}/dcim/sites/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/sites/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/dcim/sites/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/sites/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/dcim/sites/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/sites/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/sites/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/dcim/sites/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/dcim/sites/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/sites/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/sites/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/dcim/sites/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/dcim/sites/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/sites/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/sites/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/sites/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/sites/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/sites/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/sites/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/dcim/sites/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/sites/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/sites/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/sites/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/sites/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/sites/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/dcim/sites/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/sites/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/sites/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/sites/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/sites/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/dcim/sites/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/sites/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/sites/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/sites/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/dcim/sites/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/sites/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/dcim/sites/:id/
http DELETE {{baseUrl}}/dcim/sites/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/dcim/sites/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/sites/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_sites_graphs
{{baseUrl}}/dcim/sites/:id/graphs/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/sites/:id/graphs/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/sites/:id/graphs/")
require "http/client"
url = "{{baseUrl}}/dcim/sites/:id/graphs/"
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}}/dcim/sites/:id/graphs/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/sites/:id/graphs/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/sites/:id/graphs/"
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/dcim/sites/:id/graphs/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/sites/:id/graphs/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/sites/:id/graphs/"))
.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}}/dcim/sites/:id/graphs/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/sites/:id/graphs/")
.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}}/dcim/sites/:id/graphs/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/sites/:id/graphs/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/sites/:id/graphs/';
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}}/dcim/sites/:id/graphs/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/sites/:id/graphs/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/sites/:id/graphs/',
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}}/dcim/sites/:id/graphs/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/sites/:id/graphs/');
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}}/dcim/sites/:id/graphs/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/sites/:id/graphs/';
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}}/dcim/sites/:id/graphs/"]
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}}/dcim/sites/:id/graphs/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/sites/:id/graphs/",
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}}/dcim/sites/:id/graphs/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/sites/:id/graphs/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/sites/:id/graphs/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/sites/:id/graphs/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/sites/:id/graphs/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/sites/:id/graphs/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/sites/:id/graphs/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/sites/:id/graphs/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/sites/:id/graphs/")
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/dcim/sites/:id/graphs/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/sites/:id/graphs/";
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}}/dcim/sites/:id/graphs/
http GET {{baseUrl}}/dcim/sites/:id/graphs/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/sites/:id/graphs/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/sites/:id/graphs/")! 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
dcim_sites_list
{{baseUrl}}/dcim/sites/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/sites/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/sites/")
require "http/client"
url = "{{baseUrl}}/dcim/sites/"
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}}/dcim/sites/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/sites/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/sites/"
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/dcim/sites/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/sites/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/sites/"))
.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}}/dcim/sites/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/sites/")
.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}}/dcim/sites/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/sites/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/sites/';
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}}/dcim/sites/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/sites/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/sites/',
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}}/dcim/sites/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/sites/');
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}}/dcim/sites/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/sites/';
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}}/dcim/sites/"]
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}}/dcim/sites/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/sites/",
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}}/dcim/sites/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/sites/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/sites/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/sites/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/sites/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/sites/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/sites/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/sites/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/sites/")
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/dcim/sites/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/sites/";
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}}/dcim/sites/
http GET {{baseUrl}}/dcim/sites/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/sites/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/sites/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
dcim_sites_partial_update
{{baseUrl}}/dcim/sites/:id/
BODY json
{
"asn": 0,
"circuit_count": 0,
"comments": "",
"contact_email": "",
"contact_name": "",
"contact_phone": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"facility": "",
"id": 0,
"last_updated": "",
"latitude": "",
"longitude": "",
"name": "",
"physical_address": "",
"prefix_count": 0,
"rack_count": 0,
"region": 0,
"shipping_address": "",
"slug": "",
"status": "",
"tags": [],
"tenant": 0,
"time_zone": "",
"virtualmachine_count": 0,
"vlan_count": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/sites/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/dcim/sites/:id/" {:content-type :json
:form-params {:asn 0
:circuit_count 0
:comments ""
:contact_email ""
:contact_name ""
:contact_phone ""
:created ""
:custom_fields {}
:description ""
:device_count 0
:facility ""
:id 0
:last_updated ""
:latitude ""
:longitude ""
:name ""
:physical_address ""
:prefix_count 0
:rack_count 0
:region 0
:shipping_address ""
:slug ""
:status ""
:tags []
:tenant 0
:time_zone ""
:virtualmachine_count 0
:vlan_count 0}})
require "http/client"
url = "{{baseUrl}}/dcim/sites/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\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}}/dcim/sites/:id/"),
Content = new StringContent("{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/sites/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/sites/:id/"
payload := strings.NewReader("{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\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/dcim/sites/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 539
{
"asn": 0,
"circuit_count": 0,
"comments": "",
"contact_email": "",
"contact_name": "",
"contact_phone": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"facility": "",
"id": 0,
"last_updated": "",
"latitude": "",
"longitude": "",
"name": "",
"physical_address": "",
"prefix_count": 0,
"rack_count": 0,
"region": 0,
"shipping_address": "",
"slug": "",
"status": "",
"tags": [],
"tenant": 0,
"time_zone": "",
"virtualmachine_count": 0,
"vlan_count": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/dcim/sites/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/sites/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/sites/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/dcim/sites/:id/")
.header("content-type", "application/json")
.body("{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\n}")
.asString();
const data = JSON.stringify({
asn: 0,
circuit_count: 0,
comments: '',
contact_email: '',
contact_name: '',
contact_phone: '',
created: '',
custom_fields: {},
description: '',
device_count: 0,
facility: '',
id: 0,
last_updated: '',
latitude: '',
longitude: '',
name: '',
physical_address: '',
prefix_count: 0,
rack_count: 0,
region: 0,
shipping_address: '',
slug: '',
status: '',
tags: [],
tenant: 0,
time_zone: '',
virtualmachine_count: 0,
vlan_count: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/dcim/sites/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/sites/:id/',
headers: {'content-type': 'application/json'},
data: {
asn: 0,
circuit_count: 0,
comments: '',
contact_email: '',
contact_name: '',
contact_phone: '',
created: '',
custom_fields: {},
description: '',
device_count: 0,
facility: '',
id: 0,
last_updated: '',
latitude: '',
longitude: '',
name: '',
physical_address: '',
prefix_count: 0,
rack_count: 0,
region: 0,
shipping_address: '',
slug: '',
status: '',
tags: [],
tenant: 0,
time_zone: '',
virtualmachine_count: 0,
vlan_count: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/sites/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"asn":0,"circuit_count":0,"comments":"","contact_email":"","contact_name":"","contact_phone":"","created":"","custom_fields":{},"description":"","device_count":0,"facility":"","id":0,"last_updated":"","latitude":"","longitude":"","name":"","physical_address":"","prefix_count":0,"rack_count":0,"region":0,"shipping_address":"","slug":"","status":"","tags":[],"tenant":0,"time_zone":"","virtualmachine_count":0,"vlan_count":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}}/dcim/sites/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "asn": 0,\n "circuit_count": 0,\n "comments": "",\n "contact_email": "",\n "contact_name": "",\n "contact_phone": "",\n "created": "",\n "custom_fields": {},\n "description": "",\n "device_count": 0,\n "facility": "",\n "id": 0,\n "last_updated": "",\n "latitude": "",\n "longitude": "",\n "name": "",\n "physical_address": "",\n "prefix_count": 0,\n "rack_count": 0,\n "region": 0,\n "shipping_address": "",\n "slug": "",\n "status": "",\n "tags": [],\n "tenant": 0,\n "time_zone": "",\n "virtualmachine_count": 0,\n "vlan_count": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/sites/:id/")
.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/dcim/sites/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
asn: 0,
circuit_count: 0,
comments: '',
contact_email: '',
contact_name: '',
contact_phone: '',
created: '',
custom_fields: {},
description: '',
device_count: 0,
facility: '',
id: 0,
last_updated: '',
latitude: '',
longitude: '',
name: '',
physical_address: '',
prefix_count: 0,
rack_count: 0,
region: 0,
shipping_address: '',
slug: '',
status: '',
tags: [],
tenant: 0,
time_zone: '',
virtualmachine_count: 0,
vlan_count: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/sites/:id/',
headers: {'content-type': 'application/json'},
body: {
asn: 0,
circuit_count: 0,
comments: '',
contact_email: '',
contact_name: '',
contact_phone: '',
created: '',
custom_fields: {},
description: '',
device_count: 0,
facility: '',
id: 0,
last_updated: '',
latitude: '',
longitude: '',
name: '',
physical_address: '',
prefix_count: 0,
rack_count: 0,
region: 0,
shipping_address: '',
slug: '',
status: '',
tags: [],
tenant: 0,
time_zone: '',
virtualmachine_count: 0,
vlan_count: 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('PATCH', '{{baseUrl}}/dcim/sites/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
asn: 0,
circuit_count: 0,
comments: '',
contact_email: '',
contact_name: '',
contact_phone: '',
created: '',
custom_fields: {},
description: '',
device_count: 0,
facility: '',
id: 0,
last_updated: '',
latitude: '',
longitude: '',
name: '',
physical_address: '',
prefix_count: 0,
rack_count: 0,
region: 0,
shipping_address: '',
slug: '',
status: '',
tags: [],
tenant: 0,
time_zone: '',
virtualmachine_count: 0,
vlan_count: 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: 'PATCH',
url: '{{baseUrl}}/dcim/sites/:id/',
headers: {'content-type': 'application/json'},
data: {
asn: 0,
circuit_count: 0,
comments: '',
contact_email: '',
contact_name: '',
contact_phone: '',
created: '',
custom_fields: {},
description: '',
device_count: 0,
facility: '',
id: 0,
last_updated: '',
latitude: '',
longitude: '',
name: '',
physical_address: '',
prefix_count: 0,
rack_count: 0,
region: 0,
shipping_address: '',
slug: '',
status: '',
tags: [],
tenant: 0,
time_zone: '',
virtualmachine_count: 0,
vlan_count: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/sites/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"asn":0,"circuit_count":0,"comments":"","contact_email":"","contact_name":"","contact_phone":"","created":"","custom_fields":{},"description":"","device_count":0,"facility":"","id":0,"last_updated":"","latitude":"","longitude":"","name":"","physical_address":"","prefix_count":0,"rack_count":0,"region":0,"shipping_address":"","slug":"","status":"","tags":[],"tenant":0,"time_zone":"","virtualmachine_count":0,"vlan_count":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 = @{ @"asn": @0,
@"circuit_count": @0,
@"comments": @"",
@"contact_email": @"",
@"contact_name": @"",
@"contact_phone": @"",
@"created": @"",
@"custom_fields": @{ },
@"description": @"",
@"device_count": @0,
@"facility": @"",
@"id": @0,
@"last_updated": @"",
@"latitude": @"",
@"longitude": @"",
@"name": @"",
@"physical_address": @"",
@"prefix_count": @0,
@"rack_count": @0,
@"region": @0,
@"shipping_address": @"",
@"slug": @"",
@"status": @"",
@"tags": @[ ],
@"tenant": @0,
@"time_zone": @"",
@"virtualmachine_count": @0,
@"vlan_count": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/sites/:id/"]
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}}/dcim/sites/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/sites/:id/",
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([
'asn' => 0,
'circuit_count' => 0,
'comments' => '',
'contact_email' => '',
'contact_name' => '',
'contact_phone' => '',
'created' => '',
'custom_fields' => [
],
'description' => '',
'device_count' => 0,
'facility' => '',
'id' => 0,
'last_updated' => '',
'latitude' => '',
'longitude' => '',
'name' => '',
'physical_address' => '',
'prefix_count' => 0,
'rack_count' => 0,
'region' => 0,
'shipping_address' => '',
'slug' => '',
'status' => '',
'tags' => [
],
'tenant' => 0,
'time_zone' => '',
'virtualmachine_count' => 0,
'vlan_count' => 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('PATCH', '{{baseUrl}}/dcim/sites/:id/', [
'body' => '{
"asn": 0,
"circuit_count": 0,
"comments": "",
"contact_email": "",
"contact_name": "",
"contact_phone": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"facility": "",
"id": 0,
"last_updated": "",
"latitude": "",
"longitude": "",
"name": "",
"physical_address": "",
"prefix_count": 0,
"rack_count": 0,
"region": 0,
"shipping_address": "",
"slug": "",
"status": "",
"tags": [],
"tenant": 0,
"time_zone": "",
"virtualmachine_count": 0,
"vlan_count": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/sites/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'asn' => 0,
'circuit_count' => 0,
'comments' => '',
'contact_email' => '',
'contact_name' => '',
'contact_phone' => '',
'created' => '',
'custom_fields' => [
],
'description' => '',
'device_count' => 0,
'facility' => '',
'id' => 0,
'last_updated' => '',
'latitude' => '',
'longitude' => '',
'name' => '',
'physical_address' => '',
'prefix_count' => 0,
'rack_count' => 0,
'region' => 0,
'shipping_address' => '',
'slug' => '',
'status' => '',
'tags' => [
],
'tenant' => 0,
'time_zone' => '',
'virtualmachine_count' => 0,
'vlan_count' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'asn' => 0,
'circuit_count' => 0,
'comments' => '',
'contact_email' => '',
'contact_name' => '',
'contact_phone' => '',
'created' => '',
'custom_fields' => [
],
'description' => '',
'device_count' => 0,
'facility' => '',
'id' => 0,
'last_updated' => '',
'latitude' => '',
'longitude' => '',
'name' => '',
'physical_address' => '',
'prefix_count' => 0,
'rack_count' => 0,
'region' => 0,
'shipping_address' => '',
'slug' => '',
'status' => '',
'tags' => [
],
'tenant' => 0,
'time_zone' => '',
'virtualmachine_count' => 0,
'vlan_count' => 0
]));
$request->setRequestUrl('{{baseUrl}}/dcim/sites/:id/');
$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}}/dcim/sites/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"asn": 0,
"circuit_count": 0,
"comments": "",
"contact_email": "",
"contact_name": "",
"contact_phone": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"facility": "",
"id": 0,
"last_updated": "",
"latitude": "",
"longitude": "",
"name": "",
"physical_address": "",
"prefix_count": 0,
"rack_count": 0,
"region": 0,
"shipping_address": "",
"slug": "",
"status": "",
"tags": [],
"tenant": 0,
"time_zone": "",
"virtualmachine_count": 0,
"vlan_count": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/sites/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"asn": 0,
"circuit_count": 0,
"comments": "",
"contact_email": "",
"contact_name": "",
"contact_phone": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"facility": "",
"id": 0,
"last_updated": "",
"latitude": "",
"longitude": "",
"name": "",
"physical_address": "",
"prefix_count": 0,
"rack_count": 0,
"region": 0,
"shipping_address": "",
"slug": "",
"status": "",
"tags": [],
"tenant": 0,
"time_zone": "",
"virtualmachine_count": 0,
"vlan_count": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/dcim/sites/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/sites/:id/"
payload = {
"asn": 0,
"circuit_count": 0,
"comments": "",
"contact_email": "",
"contact_name": "",
"contact_phone": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"facility": "",
"id": 0,
"last_updated": "",
"latitude": "",
"longitude": "",
"name": "",
"physical_address": "",
"prefix_count": 0,
"rack_count": 0,
"region": 0,
"shipping_address": "",
"slug": "",
"status": "",
"tags": [],
"tenant": 0,
"time_zone": "",
"virtualmachine_count": 0,
"vlan_count": 0
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/sites/:id/"
payload <- "{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\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}}/dcim/sites/:id/")
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 \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/dcim/sites/:id/') do |req|
req.body = "{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\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}}/dcim/sites/:id/";
let payload = json!({
"asn": 0,
"circuit_count": 0,
"comments": "",
"contact_email": "",
"contact_name": "",
"contact_phone": "",
"created": "",
"custom_fields": json!({}),
"description": "",
"device_count": 0,
"facility": "",
"id": 0,
"last_updated": "",
"latitude": "",
"longitude": "",
"name": "",
"physical_address": "",
"prefix_count": 0,
"rack_count": 0,
"region": 0,
"shipping_address": "",
"slug": "",
"status": "",
"tags": (),
"tenant": 0,
"time_zone": "",
"virtualmachine_count": 0,
"vlan_count": 0
});
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}}/dcim/sites/:id/ \
--header 'content-type: application/json' \
--data '{
"asn": 0,
"circuit_count": 0,
"comments": "",
"contact_email": "",
"contact_name": "",
"contact_phone": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"facility": "",
"id": 0,
"last_updated": "",
"latitude": "",
"longitude": "",
"name": "",
"physical_address": "",
"prefix_count": 0,
"rack_count": 0,
"region": 0,
"shipping_address": "",
"slug": "",
"status": "",
"tags": [],
"tenant": 0,
"time_zone": "",
"virtualmachine_count": 0,
"vlan_count": 0
}'
echo '{
"asn": 0,
"circuit_count": 0,
"comments": "",
"contact_email": "",
"contact_name": "",
"contact_phone": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"facility": "",
"id": 0,
"last_updated": "",
"latitude": "",
"longitude": "",
"name": "",
"physical_address": "",
"prefix_count": 0,
"rack_count": 0,
"region": 0,
"shipping_address": "",
"slug": "",
"status": "",
"tags": [],
"tenant": 0,
"time_zone": "",
"virtualmachine_count": 0,
"vlan_count": 0
}' | \
http PATCH {{baseUrl}}/dcim/sites/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "asn": 0,\n "circuit_count": 0,\n "comments": "",\n "contact_email": "",\n "contact_name": "",\n "contact_phone": "",\n "created": "",\n "custom_fields": {},\n "description": "",\n "device_count": 0,\n "facility": "",\n "id": 0,\n "last_updated": "",\n "latitude": "",\n "longitude": "",\n "name": "",\n "physical_address": "",\n "prefix_count": 0,\n "rack_count": 0,\n "region": 0,\n "shipping_address": "",\n "slug": "",\n "status": "",\n "tags": [],\n "tenant": 0,\n "time_zone": "",\n "virtualmachine_count": 0,\n "vlan_count": 0\n}' \
--output-document \
- {{baseUrl}}/dcim/sites/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"asn": 0,
"circuit_count": 0,
"comments": "",
"contact_email": "",
"contact_name": "",
"contact_phone": "",
"created": "",
"custom_fields": [],
"description": "",
"device_count": 0,
"facility": "",
"id": 0,
"last_updated": "",
"latitude": "",
"longitude": "",
"name": "",
"physical_address": "",
"prefix_count": 0,
"rack_count": 0,
"region": 0,
"shipping_address": "",
"slug": "",
"status": "",
"tags": [],
"tenant": 0,
"time_zone": "",
"virtualmachine_count": 0,
"vlan_count": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/sites/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_sites_read
{{baseUrl}}/dcim/sites/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/sites/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/sites/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/sites/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/dcim/sites/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/sites/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/sites/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/dcim/sites/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/sites/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/sites/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/sites/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/sites/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/dcim/sites/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/sites/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/sites/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/sites/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/sites/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/sites/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/dcim/sites/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/sites/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/dcim/sites/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/sites/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/sites/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/sites/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/sites/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/dcim/sites/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/sites/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/sites/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/sites/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/sites/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/sites/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/sites/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/sites/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/sites/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/dcim/sites/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/sites/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/dcim/sites/:id/
http GET {{baseUrl}}/dcim/sites/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/sites/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/sites/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
dcim_sites_update
{{baseUrl}}/dcim/sites/:id/
BODY json
{
"asn": 0,
"circuit_count": 0,
"comments": "",
"contact_email": "",
"contact_name": "",
"contact_phone": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"facility": "",
"id": 0,
"last_updated": "",
"latitude": "",
"longitude": "",
"name": "",
"physical_address": "",
"prefix_count": 0,
"rack_count": 0,
"region": 0,
"shipping_address": "",
"slug": "",
"status": "",
"tags": [],
"tenant": 0,
"time_zone": "",
"virtualmachine_count": 0,
"vlan_count": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/sites/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/dcim/sites/:id/" {:content-type :json
:form-params {:asn 0
:circuit_count 0
:comments ""
:contact_email ""
:contact_name ""
:contact_phone ""
:created ""
:custom_fields {}
:description ""
:device_count 0
:facility ""
:id 0
:last_updated ""
:latitude ""
:longitude ""
:name ""
:physical_address ""
:prefix_count 0
:rack_count 0
:region 0
:shipping_address ""
:slug ""
:status ""
:tags []
:tenant 0
:time_zone ""
:virtualmachine_count 0
:vlan_count 0}})
require "http/client"
url = "{{baseUrl}}/dcim/sites/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\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}}/dcim/sites/:id/"),
Content = new StringContent("{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/sites/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/sites/:id/"
payload := strings.NewReader("{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\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/dcim/sites/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 539
{
"asn": 0,
"circuit_count": 0,
"comments": "",
"contact_email": "",
"contact_name": "",
"contact_phone": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"facility": "",
"id": 0,
"last_updated": "",
"latitude": "",
"longitude": "",
"name": "",
"physical_address": "",
"prefix_count": 0,
"rack_count": 0,
"region": 0,
"shipping_address": "",
"slug": "",
"status": "",
"tags": [],
"tenant": 0,
"time_zone": "",
"virtualmachine_count": 0,
"vlan_count": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/dcim/sites/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/sites/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/sites/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/dcim/sites/:id/")
.header("content-type", "application/json")
.body("{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\n}")
.asString();
const data = JSON.stringify({
asn: 0,
circuit_count: 0,
comments: '',
contact_email: '',
contact_name: '',
contact_phone: '',
created: '',
custom_fields: {},
description: '',
device_count: 0,
facility: '',
id: 0,
last_updated: '',
latitude: '',
longitude: '',
name: '',
physical_address: '',
prefix_count: 0,
rack_count: 0,
region: 0,
shipping_address: '',
slug: '',
status: '',
tags: [],
tenant: 0,
time_zone: '',
virtualmachine_count: 0,
vlan_count: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/dcim/sites/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/sites/:id/',
headers: {'content-type': 'application/json'},
data: {
asn: 0,
circuit_count: 0,
comments: '',
contact_email: '',
contact_name: '',
contact_phone: '',
created: '',
custom_fields: {},
description: '',
device_count: 0,
facility: '',
id: 0,
last_updated: '',
latitude: '',
longitude: '',
name: '',
physical_address: '',
prefix_count: 0,
rack_count: 0,
region: 0,
shipping_address: '',
slug: '',
status: '',
tags: [],
tenant: 0,
time_zone: '',
virtualmachine_count: 0,
vlan_count: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/sites/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"asn":0,"circuit_count":0,"comments":"","contact_email":"","contact_name":"","contact_phone":"","created":"","custom_fields":{},"description":"","device_count":0,"facility":"","id":0,"last_updated":"","latitude":"","longitude":"","name":"","physical_address":"","prefix_count":0,"rack_count":0,"region":0,"shipping_address":"","slug":"","status":"","tags":[],"tenant":0,"time_zone":"","virtualmachine_count":0,"vlan_count":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}}/dcim/sites/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "asn": 0,\n "circuit_count": 0,\n "comments": "",\n "contact_email": "",\n "contact_name": "",\n "contact_phone": "",\n "created": "",\n "custom_fields": {},\n "description": "",\n "device_count": 0,\n "facility": "",\n "id": 0,\n "last_updated": "",\n "latitude": "",\n "longitude": "",\n "name": "",\n "physical_address": "",\n "prefix_count": 0,\n "rack_count": 0,\n "region": 0,\n "shipping_address": "",\n "slug": "",\n "status": "",\n "tags": [],\n "tenant": 0,\n "time_zone": "",\n "virtualmachine_count": 0,\n "vlan_count": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/sites/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/sites/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
asn: 0,
circuit_count: 0,
comments: '',
contact_email: '',
contact_name: '',
contact_phone: '',
created: '',
custom_fields: {},
description: '',
device_count: 0,
facility: '',
id: 0,
last_updated: '',
latitude: '',
longitude: '',
name: '',
physical_address: '',
prefix_count: 0,
rack_count: 0,
region: 0,
shipping_address: '',
slug: '',
status: '',
tags: [],
tenant: 0,
time_zone: '',
virtualmachine_count: 0,
vlan_count: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/sites/:id/',
headers: {'content-type': 'application/json'},
body: {
asn: 0,
circuit_count: 0,
comments: '',
contact_email: '',
contact_name: '',
contact_phone: '',
created: '',
custom_fields: {},
description: '',
device_count: 0,
facility: '',
id: 0,
last_updated: '',
latitude: '',
longitude: '',
name: '',
physical_address: '',
prefix_count: 0,
rack_count: 0,
region: 0,
shipping_address: '',
slug: '',
status: '',
tags: [],
tenant: 0,
time_zone: '',
virtualmachine_count: 0,
vlan_count: 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('PUT', '{{baseUrl}}/dcim/sites/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
asn: 0,
circuit_count: 0,
comments: '',
contact_email: '',
contact_name: '',
contact_phone: '',
created: '',
custom_fields: {},
description: '',
device_count: 0,
facility: '',
id: 0,
last_updated: '',
latitude: '',
longitude: '',
name: '',
physical_address: '',
prefix_count: 0,
rack_count: 0,
region: 0,
shipping_address: '',
slug: '',
status: '',
tags: [],
tenant: 0,
time_zone: '',
virtualmachine_count: 0,
vlan_count: 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: 'PUT',
url: '{{baseUrl}}/dcim/sites/:id/',
headers: {'content-type': 'application/json'},
data: {
asn: 0,
circuit_count: 0,
comments: '',
contact_email: '',
contact_name: '',
contact_phone: '',
created: '',
custom_fields: {},
description: '',
device_count: 0,
facility: '',
id: 0,
last_updated: '',
latitude: '',
longitude: '',
name: '',
physical_address: '',
prefix_count: 0,
rack_count: 0,
region: 0,
shipping_address: '',
slug: '',
status: '',
tags: [],
tenant: 0,
time_zone: '',
virtualmachine_count: 0,
vlan_count: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/sites/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"asn":0,"circuit_count":0,"comments":"","contact_email":"","contact_name":"","contact_phone":"","created":"","custom_fields":{},"description":"","device_count":0,"facility":"","id":0,"last_updated":"","latitude":"","longitude":"","name":"","physical_address":"","prefix_count":0,"rack_count":0,"region":0,"shipping_address":"","slug":"","status":"","tags":[],"tenant":0,"time_zone":"","virtualmachine_count":0,"vlan_count":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 = @{ @"asn": @0,
@"circuit_count": @0,
@"comments": @"",
@"contact_email": @"",
@"contact_name": @"",
@"contact_phone": @"",
@"created": @"",
@"custom_fields": @{ },
@"description": @"",
@"device_count": @0,
@"facility": @"",
@"id": @0,
@"last_updated": @"",
@"latitude": @"",
@"longitude": @"",
@"name": @"",
@"physical_address": @"",
@"prefix_count": @0,
@"rack_count": @0,
@"region": @0,
@"shipping_address": @"",
@"slug": @"",
@"status": @"",
@"tags": @[ ],
@"tenant": @0,
@"time_zone": @"",
@"virtualmachine_count": @0,
@"vlan_count": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/sites/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/sites/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/sites/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'asn' => 0,
'circuit_count' => 0,
'comments' => '',
'contact_email' => '',
'contact_name' => '',
'contact_phone' => '',
'created' => '',
'custom_fields' => [
],
'description' => '',
'device_count' => 0,
'facility' => '',
'id' => 0,
'last_updated' => '',
'latitude' => '',
'longitude' => '',
'name' => '',
'physical_address' => '',
'prefix_count' => 0,
'rack_count' => 0,
'region' => 0,
'shipping_address' => '',
'slug' => '',
'status' => '',
'tags' => [
],
'tenant' => 0,
'time_zone' => '',
'virtualmachine_count' => 0,
'vlan_count' => 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('PUT', '{{baseUrl}}/dcim/sites/:id/', [
'body' => '{
"asn": 0,
"circuit_count": 0,
"comments": "",
"contact_email": "",
"contact_name": "",
"contact_phone": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"facility": "",
"id": 0,
"last_updated": "",
"latitude": "",
"longitude": "",
"name": "",
"physical_address": "",
"prefix_count": 0,
"rack_count": 0,
"region": 0,
"shipping_address": "",
"slug": "",
"status": "",
"tags": [],
"tenant": 0,
"time_zone": "",
"virtualmachine_count": 0,
"vlan_count": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/sites/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'asn' => 0,
'circuit_count' => 0,
'comments' => '',
'contact_email' => '',
'contact_name' => '',
'contact_phone' => '',
'created' => '',
'custom_fields' => [
],
'description' => '',
'device_count' => 0,
'facility' => '',
'id' => 0,
'last_updated' => '',
'latitude' => '',
'longitude' => '',
'name' => '',
'physical_address' => '',
'prefix_count' => 0,
'rack_count' => 0,
'region' => 0,
'shipping_address' => '',
'slug' => '',
'status' => '',
'tags' => [
],
'tenant' => 0,
'time_zone' => '',
'virtualmachine_count' => 0,
'vlan_count' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'asn' => 0,
'circuit_count' => 0,
'comments' => '',
'contact_email' => '',
'contact_name' => '',
'contact_phone' => '',
'created' => '',
'custom_fields' => [
],
'description' => '',
'device_count' => 0,
'facility' => '',
'id' => 0,
'last_updated' => '',
'latitude' => '',
'longitude' => '',
'name' => '',
'physical_address' => '',
'prefix_count' => 0,
'rack_count' => 0,
'region' => 0,
'shipping_address' => '',
'slug' => '',
'status' => '',
'tags' => [
],
'tenant' => 0,
'time_zone' => '',
'virtualmachine_count' => 0,
'vlan_count' => 0
]));
$request->setRequestUrl('{{baseUrl}}/dcim/sites/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/sites/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"asn": 0,
"circuit_count": 0,
"comments": "",
"contact_email": "",
"contact_name": "",
"contact_phone": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"facility": "",
"id": 0,
"last_updated": "",
"latitude": "",
"longitude": "",
"name": "",
"physical_address": "",
"prefix_count": 0,
"rack_count": 0,
"region": 0,
"shipping_address": "",
"slug": "",
"status": "",
"tags": [],
"tenant": 0,
"time_zone": "",
"virtualmachine_count": 0,
"vlan_count": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/sites/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"asn": 0,
"circuit_count": 0,
"comments": "",
"contact_email": "",
"contact_name": "",
"contact_phone": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"facility": "",
"id": 0,
"last_updated": "",
"latitude": "",
"longitude": "",
"name": "",
"physical_address": "",
"prefix_count": 0,
"rack_count": 0,
"region": 0,
"shipping_address": "",
"slug": "",
"status": "",
"tags": [],
"tenant": 0,
"time_zone": "",
"virtualmachine_count": 0,
"vlan_count": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/dcim/sites/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/sites/:id/"
payload = {
"asn": 0,
"circuit_count": 0,
"comments": "",
"contact_email": "",
"contact_name": "",
"contact_phone": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"facility": "",
"id": 0,
"last_updated": "",
"latitude": "",
"longitude": "",
"name": "",
"physical_address": "",
"prefix_count": 0,
"rack_count": 0,
"region": 0,
"shipping_address": "",
"slug": "",
"status": "",
"tags": [],
"tenant": 0,
"time_zone": "",
"virtualmachine_count": 0,
"vlan_count": 0
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/sites/:id/"
payload <- "{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\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}}/dcim/sites/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/dcim/sites/:id/') do |req|
req.body = "{\n \"asn\": 0,\n \"circuit_count\": 0,\n \"comments\": \"\",\n \"contact_email\": \"\",\n \"contact_name\": \"\",\n \"contact_phone\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"facility\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"latitude\": \"\",\n \"longitude\": \"\",\n \"name\": \"\",\n \"physical_address\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"region\": 0,\n \"shipping_address\": \"\",\n \"slug\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"time_zone\": \"\",\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0\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}}/dcim/sites/:id/";
let payload = json!({
"asn": 0,
"circuit_count": 0,
"comments": "",
"contact_email": "",
"contact_name": "",
"contact_phone": "",
"created": "",
"custom_fields": json!({}),
"description": "",
"device_count": 0,
"facility": "",
"id": 0,
"last_updated": "",
"latitude": "",
"longitude": "",
"name": "",
"physical_address": "",
"prefix_count": 0,
"rack_count": 0,
"region": 0,
"shipping_address": "",
"slug": "",
"status": "",
"tags": (),
"tenant": 0,
"time_zone": "",
"virtualmachine_count": 0,
"vlan_count": 0
});
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}}/dcim/sites/:id/ \
--header 'content-type: application/json' \
--data '{
"asn": 0,
"circuit_count": 0,
"comments": "",
"contact_email": "",
"contact_name": "",
"contact_phone": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"facility": "",
"id": 0,
"last_updated": "",
"latitude": "",
"longitude": "",
"name": "",
"physical_address": "",
"prefix_count": 0,
"rack_count": 0,
"region": 0,
"shipping_address": "",
"slug": "",
"status": "",
"tags": [],
"tenant": 0,
"time_zone": "",
"virtualmachine_count": 0,
"vlan_count": 0
}'
echo '{
"asn": 0,
"circuit_count": 0,
"comments": "",
"contact_email": "",
"contact_name": "",
"contact_phone": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"facility": "",
"id": 0,
"last_updated": "",
"latitude": "",
"longitude": "",
"name": "",
"physical_address": "",
"prefix_count": 0,
"rack_count": 0,
"region": 0,
"shipping_address": "",
"slug": "",
"status": "",
"tags": [],
"tenant": 0,
"time_zone": "",
"virtualmachine_count": 0,
"vlan_count": 0
}' | \
http PUT {{baseUrl}}/dcim/sites/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "asn": 0,\n "circuit_count": 0,\n "comments": "",\n "contact_email": "",\n "contact_name": "",\n "contact_phone": "",\n "created": "",\n "custom_fields": {},\n "description": "",\n "device_count": 0,\n "facility": "",\n "id": 0,\n "last_updated": "",\n "latitude": "",\n "longitude": "",\n "name": "",\n "physical_address": "",\n "prefix_count": 0,\n "rack_count": 0,\n "region": 0,\n "shipping_address": "",\n "slug": "",\n "status": "",\n "tags": [],\n "tenant": 0,\n "time_zone": "",\n "virtualmachine_count": 0,\n "vlan_count": 0\n}' \
--output-document \
- {{baseUrl}}/dcim/sites/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"asn": 0,
"circuit_count": 0,
"comments": "",
"contact_email": "",
"contact_name": "",
"contact_phone": "",
"created": "",
"custom_fields": [],
"description": "",
"device_count": 0,
"facility": "",
"id": 0,
"last_updated": "",
"latitude": "",
"longitude": "",
"name": "",
"physical_address": "",
"prefix_count": 0,
"rack_count": 0,
"region": 0,
"shipping_address": "",
"slug": "",
"status": "",
"tags": [],
"tenant": 0,
"time_zone": "",
"virtualmachine_count": 0,
"vlan_count": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/sites/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
dcim_virtual-chassis_create
{{baseUrl}}/dcim/virtual-chassis/
BODY json
{
"domain": "",
"id": 0,
"master": 0,
"member_count": 0,
"tags": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/virtual-chassis/");
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 \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/dcim/virtual-chassis/" {:content-type :json
:form-params {:domain ""
:id 0
:master 0
:member_count 0
:tags []}})
require "http/client"
url = "{{baseUrl}}/dcim/virtual-chassis/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\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}}/dcim/virtual-chassis/"),
Content = new StringContent("{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\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}}/dcim/virtual-chassis/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/virtual-chassis/"
payload := strings.NewReader("{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\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/dcim/virtual-chassis/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 79
{
"domain": "",
"id": 0,
"master": 0,
"member_count": 0,
"tags": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/dcim/virtual-chassis/")
.setHeader("content-type", "application/json")
.setBody("{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/virtual-chassis/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\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 \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/virtual-chassis/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/dcim/virtual-chassis/")
.header("content-type", "application/json")
.body("{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\n}")
.asString();
const data = JSON.stringify({
domain: '',
id: 0,
master: 0,
member_count: 0,
tags: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/dcim/virtual-chassis/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/virtual-chassis/',
headers: {'content-type': 'application/json'},
data: {domain: '', id: 0, master: 0, member_count: 0, tags: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/virtual-chassis/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"domain":"","id":0,"master":0,"member_count":0,"tags":[]}'
};
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}}/dcim/virtual-chassis/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "domain": "",\n "id": 0,\n "master": 0,\n "member_count": 0,\n "tags": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/virtual-chassis/")
.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/dcim/virtual-chassis/',
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({domain: '', id: 0, master: 0, member_count: 0, tags: []}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/dcim/virtual-chassis/',
headers: {'content-type': 'application/json'},
body: {domain: '', id: 0, master: 0, member_count: 0, tags: []},
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}}/dcim/virtual-chassis/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
domain: '',
id: 0,
master: 0,
member_count: 0,
tags: []
});
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}}/dcim/virtual-chassis/',
headers: {'content-type': 'application/json'},
data: {domain: '', id: 0, master: 0, member_count: 0, tags: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/virtual-chassis/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"domain":"","id":0,"master":0,"member_count":0,"tags":[]}'
};
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 = @{ @"domain": @"",
@"id": @0,
@"master": @0,
@"member_count": @0,
@"tags": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/virtual-chassis/"]
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}}/dcim/virtual-chassis/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/virtual-chassis/",
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([
'domain' => '',
'id' => 0,
'master' => 0,
'member_count' => 0,
'tags' => [
]
]),
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}}/dcim/virtual-chassis/', [
'body' => '{
"domain": "",
"id": 0,
"master": 0,
"member_count": 0,
"tags": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/virtual-chassis/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'domain' => '',
'id' => 0,
'master' => 0,
'member_count' => 0,
'tags' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'domain' => '',
'id' => 0,
'master' => 0,
'member_count' => 0,
'tags' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/dcim/virtual-chassis/');
$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}}/dcim/virtual-chassis/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"domain": "",
"id": 0,
"master": 0,
"member_count": 0,
"tags": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/virtual-chassis/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"domain": "",
"id": 0,
"master": 0,
"member_count": 0,
"tags": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/dcim/virtual-chassis/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/virtual-chassis/"
payload = {
"domain": "",
"id": 0,
"master": 0,
"member_count": 0,
"tags": []
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/virtual-chassis/"
payload <- "{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\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}}/dcim/virtual-chassis/")
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 \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\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/dcim/virtual-chassis/') do |req|
req.body = "{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/virtual-chassis/";
let payload = json!({
"domain": "",
"id": 0,
"master": 0,
"member_count": 0,
"tags": ()
});
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}}/dcim/virtual-chassis/ \
--header 'content-type: application/json' \
--data '{
"domain": "",
"id": 0,
"master": 0,
"member_count": 0,
"tags": []
}'
echo '{
"domain": "",
"id": 0,
"master": 0,
"member_count": 0,
"tags": []
}' | \
http POST {{baseUrl}}/dcim/virtual-chassis/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "domain": "",\n "id": 0,\n "master": 0,\n "member_count": 0,\n "tags": []\n}' \
--output-document \
- {{baseUrl}}/dcim/virtual-chassis/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"domain": "",
"id": 0,
"master": 0,
"member_count": 0,
"tags": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/virtual-chassis/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
dcim_virtual-chassis_delete
{{baseUrl}}/dcim/virtual-chassis/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/virtual-chassis/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/dcim/virtual-chassis/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/virtual-chassis/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/dcim/virtual-chassis/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/virtual-chassis/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/virtual-chassis/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/dcim/virtual-chassis/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/dcim/virtual-chassis/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/virtual-chassis/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/virtual-chassis/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/dcim/virtual-chassis/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/dcim/virtual-chassis/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/virtual-chassis/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/virtual-chassis/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/virtual-chassis/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/virtual-chassis/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/virtual-chassis/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/virtual-chassis/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/dcim/virtual-chassis/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/dcim/virtual-chassis/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/virtual-chassis/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/virtual-chassis/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/virtual-chassis/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/virtual-chassis/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/dcim/virtual-chassis/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/virtual-chassis/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/virtual-chassis/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/virtual-chassis/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/virtual-chassis/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/dcim/virtual-chassis/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/virtual-chassis/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/virtual-chassis/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/virtual-chassis/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/dcim/virtual-chassis/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/virtual-chassis/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/dcim/virtual-chassis/:id/
http DELETE {{baseUrl}}/dcim/virtual-chassis/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/dcim/virtual-chassis/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/virtual-chassis/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_virtual-chassis_list
{{baseUrl}}/dcim/virtual-chassis/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/virtual-chassis/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/virtual-chassis/")
require "http/client"
url = "{{baseUrl}}/dcim/virtual-chassis/"
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}}/dcim/virtual-chassis/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/virtual-chassis/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/virtual-chassis/"
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/dcim/virtual-chassis/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/virtual-chassis/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/virtual-chassis/"))
.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}}/dcim/virtual-chassis/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/virtual-chassis/")
.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}}/dcim/virtual-chassis/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/virtual-chassis/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/virtual-chassis/';
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}}/dcim/virtual-chassis/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/virtual-chassis/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/virtual-chassis/',
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}}/dcim/virtual-chassis/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/virtual-chassis/');
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}}/dcim/virtual-chassis/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/virtual-chassis/';
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}}/dcim/virtual-chassis/"]
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}}/dcim/virtual-chassis/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/virtual-chassis/",
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}}/dcim/virtual-chassis/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/virtual-chassis/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/virtual-chassis/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/virtual-chassis/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/virtual-chassis/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/virtual-chassis/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/virtual-chassis/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/virtual-chassis/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/virtual-chassis/")
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/dcim/virtual-chassis/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/virtual-chassis/";
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}}/dcim/virtual-chassis/
http GET {{baseUrl}}/dcim/virtual-chassis/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/virtual-chassis/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/virtual-chassis/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
dcim_virtual-chassis_partial_update
{{baseUrl}}/dcim/virtual-chassis/:id/
BODY json
{
"domain": "",
"id": 0,
"master": 0,
"member_count": 0,
"tags": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/virtual-chassis/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/dcim/virtual-chassis/:id/" {:content-type :json
:form-params {:domain ""
:id 0
:master 0
:member_count 0
:tags []}})
require "http/client"
url = "{{baseUrl}}/dcim/virtual-chassis/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\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}}/dcim/virtual-chassis/:id/"),
Content = new StringContent("{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\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}}/dcim/virtual-chassis/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/virtual-chassis/:id/"
payload := strings.NewReader("{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\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/dcim/virtual-chassis/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 79
{
"domain": "",
"id": 0,
"master": 0,
"member_count": 0,
"tags": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/dcim/virtual-chassis/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/virtual-chassis/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\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 \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/virtual-chassis/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/dcim/virtual-chassis/:id/")
.header("content-type", "application/json")
.body("{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\n}")
.asString();
const data = JSON.stringify({
domain: '',
id: 0,
master: 0,
member_count: 0,
tags: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/dcim/virtual-chassis/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/virtual-chassis/:id/',
headers: {'content-type': 'application/json'},
data: {domain: '', id: 0, master: 0, member_count: 0, tags: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/virtual-chassis/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"domain":"","id":0,"master":0,"member_count":0,"tags":[]}'
};
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}}/dcim/virtual-chassis/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "domain": "",\n "id": 0,\n "master": 0,\n "member_count": 0,\n "tags": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/virtual-chassis/:id/")
.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/dcim/virtual-chassis/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({domain: '', id: 0, master: 0, member_count: 0, tags: []}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/dcim/virtual-chassis/:id/',
headers: {'content-type': 'application/json'},
body: {domain: '', id: 0, master: 0, member_count: 0, tags: []},
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}}/dcim/virtual-chassis/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
domain: '',
id: 0,
master: 0,
member_count: 0,
tags: []
});
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}}/dcim/virtual-chassis/:id/',
headers: {'content-type': 'application/json'},
data: {domain: '', id: 0, master: 0, member_count: 0, tags: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/virtual-chassis/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"domain":"","id":0,"master":0,"member_count":0,"tags":[]}'
};
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 = @{ @"domain": @"",
@"id": @0,
@"master": @0,
@"member_count": @0,
@"tags": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/virtual-chassis/:id/"]
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}}/dcim/virtual-chassis/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/virtual-chassis/:id/",
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([
'domain' => '',
'id' => 0,
'master' => 0,
'member_count' => 0,
'tags' => [
]
]),
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}}/dcim/virtual-chassis/:id/', [
'body' => '{
"domain": "",
"id": 0,
"master": 0,
"member_count": 0,
"tags": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/virtual-chassis/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'domain' => '',
'id' => 0,
'master' => 0,
'member_count' => 0,
'tags' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'domain' => '',
'id' => 0,
'master' => 0,
'member_count' => 0,
'tags' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/dcim/virtual-chassis/:id/');
$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}}/dcim/virtual-chassis/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"domain": "",
"id": 0,
"master": 0,
"member_count": 0,
"tags": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/virtual-chassis/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"domain": "",
"id": 0,
"master": 0,
"member_count": 0,
"tags": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/dcim/virtual-chassis/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/virtual-chassis/:id/"
payload = {
"domain": "",
"id": 0,
"master": 0,
"member_count": 0,
"tags": []
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/virtual-chassis/:id/"
payload <- "{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\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}}/dcim/virtual-chassis/:id/")
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 \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\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/dcim/virtual-chassis/:id/') do |req|
req.body = "{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\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}}/dcim/virtual-chassis/:id/";
let payload = json!({
"domain": "",
"id": 0,
"master": 0,
"member_count": 0,
"tags": ()
});
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}}/dcim/virtual-chassis/:id/ \
--header 'content-type: application/json' \
--data '{
"domain": "",
"id": 0,
"master": 0,
"member_count": 0,
"tags": []
}'
echo '{
"domain": "",
"id": 0,
"master": 0,
"member_count": 0,
"tags": []
}' | \
http PATCH {{baseUrl}}/dcim/virtual-chassis/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "domain": "",\n "id": 0,\n "master": 0,\n "member_count": 0,\n "tags": []\n}' \
--output-document \
- {{baseUrl}}/dcim/virtual-chassis/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"domain": "",
"id": 0,
"master": 0,
"member_count": 0,
"tags": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/virtual-chassis/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
dcim_virtual-chassis_read
{{baseUrl}}/dcim/virtual-chassis/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/virtual-chassis/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/dcim/virtual-chassis/:id/")
require "http/client"
url = "{{baseUrl}}/dcim/virtual-chassis/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/dcim/virtual-chassis/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/dcim/virtual-chassis/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/virtual-chassis/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/dcim/virtual-chassis/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/dcim/virtual-chassis/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/virtual-chassis/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/virtual-chassis/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/dcim/virtual-chassis/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/dcim/virtual-chassis/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/dcim/virtual-chassis/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/virtual-chassis/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/dcim/virtual-chassis/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/dcim/virtual-chassis/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/virtual-chassis/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/dcim/virtual-chassis/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/dcim/virtual-chassis/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/dcim/virtual-chassis/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/virtual-chassis/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/virtual-chassis/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/virtual-chassis/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/virtual-chassis/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/dcim/virtual-chassis/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/virtual-chassis/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/dcim/virtual-chassis/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/virtual-chassis/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/virtual-chassis/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/dcim/virtual-chassis/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/virtual-chassis/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/virtual-chassis/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/dcim/virtual-chassis/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/dcim/virtual-chassis/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/dcim/virtual-chassis/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/dcim/virtual-chassis/:id/
http GET {{baseUrl}}/dcim/virtual-chassis/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/dcim/virtual-chassis/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/virtual-chassis/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
dcim_virtual-chassis_update
{{baseUrl}}/dcim/virtual-chassis/:id/
BODY json
{
"domain": "",
"id": 0,
"master": 0,
"member_count": 0,
"tags": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/dcim/virtual-chassis/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/dcim/virtual-chassis/:id/" {:content-type :json
:form-params {:domain ""
:id 0
:master 0
:member_count 0
:tags []}})
require "http/client"
url = "{{baseUrl}}/dcim/virtual-chassis/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\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}}/dcim/virtual-chassis/:id/"),
Content = new StringContent("{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\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}}/dcim/virtual-chassis/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/dcim/virtual-chassis/:id/"
payload := strings.NewReader("{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\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/dcim/virtual-chassis/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 79
{
"domain": "",
"id": 0,
"master": 0,
"member_count": 0,
"tags": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/dcim/virtual-chassis/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/dcim/virtual-chassis/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\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 \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/dcim/virtual-chassis/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/dcim/virtual-chassis/:id/")
.header("content-type", "application/json")
.body("{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\n}")
.asString();
const data = JSON.stringify({
domain: '',
id: 0,
master: 0,
member_count: 0,
tags: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/dcim/virtual-chassis/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/virtual-chassis/:id/',
headers: {'content-type': 'application/json'},
data: {domain: '', id: 0, master: 0, member_count: 0, tags: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/dcim/virtual-chassis/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"domain":"","id":0,"master":0,"member_count":0,"tags":[]}'
};
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}}/dcim/virtual-chassis/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "domain": "",\n "id": 0,\n "master": 0,\n "member_count": 0,\n "tags": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/dcim/virtual-chassis/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/dcim/virtual-chassis/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({domain: '', id: 0, master: 0, member_count: 0, tags: []}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/dcim/virtual-chassis/:id/',
headers: {'content-type': 'application/json'},
body: {domain: '', id: 0, master: 0, member_count: 0, tags: []},
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}}/dcim/virtual-chassis/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
domain: '',
id: 0,
master: 0,
member_count: 0,
tags: []
});
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}}/dcim/virtual-chassis/:id/',
headers: {'content-type': 'application/json'},
data: {domain: '', id: 0, master: 0, member_count: 0, tags: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/dcim/virtual-chassis/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"domain":"","id":0,"master":0,"member_count":0,"tags":[]}'
};
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 = @{ @"domain": @"",
@"id": @0,
@"master": @0,
@"member_count": @0,
@"tags": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/dcim/virtual-chassis/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/dcim/virtual-chassis/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/dcim/virtual-chassis/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'domain' => '',
'id' => 0,
'master' => 0,
'member_count' => 0,
'tags' => [
]
]),
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}}/dcim/virtual-chassis/:id/', [
'body' => '{
"domain": "",
"id": 0,
"master": 0,
"member_count": 0,
"tags": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/dcim/virtual-chassis/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'domain' => '',
'id' => 0,
'master' => 0,
'member_count' => 0,
'tags' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'domain' => '',
'id' => 0,
'master' => 0,
'member_count' => 0,
'tags' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/dcim/virtual-chassis/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/dcim/virtual-chassis/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"domain": "",
"id": 0,
"master": 0,
"member_count": 0,
"tags": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/dcim/virtual-chassis/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"domain": "",
"id": 0,
"master": 0,
"member_count": 0,
"tags": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/dcim/virtual-chassis/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/dcim/virtual-chassis/:id/"
payload = {
"domain": "",
"id": 0,
"master": 0,
"member_count": 0,
"tags": []
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/dcim/virtual-chassis/:id/"
payload <- "{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\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}}/dcim/virtual-chassis/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\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/dcim/virtual-chassis/:id/') do |req|
req.body = "{\n \"domain\": \"\",\n \"id\": 0,\n \"master\": 0,\n \"member_count\": 0,\n \"tags\": []\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}}/dcim/virtual-chassis/:id/";
let payload = json!({
"domain": "",
"id": 0,
"master": 0,
"member_count": 0,
"tags": ()
});
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}}/dcim/virtual-chassis/:id/ \
--header 'content-type: application/json' \
--data '{
"domain": "",
"id": 0,
"master": 0,
"member_count": 0,
"tags": []
}'
echo '{
"domain": "",
"id": 0,
"master": 0,
"member_count": 0,
"tags": []
}' | \
http PUT {{baseUrl}}/dcim/virtual-chassis/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "domain": "",\n "id": 0,\n "master": 0,\n "member_count": 0,\n "tags": []\n}' \
--output-document \
- {{baseUrl}}/dcim/virtual-chassis/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"domain": "",
"id": 0,
"master": 0,
"member_count": 0,
"tags": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/dcim/virtual-chassis/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
extras__custom_field_choices_list
{{baseUrl}}/extras/_custom_field_choices/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/_custom_field_choices/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/extras/_custom_field_choices/")
require "http/client"
url = "{{baseUrl}}/extras/_custom_field_choices/"
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}}/extras/_custom_field_choices/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/extras/_custom_field_choices/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/_custom_field_choices/"
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/extras/_custom_field_choices/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/extras/_custom_field_choices/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/_custom_field_choices/"))
.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}}/extras/_custom_field_choices/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/extras/_custom_field_choices/")
.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}}/extras/_custom_field_choices/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/extras/_custom_field_choices/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/_custom_field_choices/';
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}}/extras/_custom_field_choices/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/extras/_custom_field_choices/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/extras/_custom_field_choices/',
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}}/extras/_custom_field_choices/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/extras/_custom_field_choices/');
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}}/extras/_custom_field_choices/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/_custom_field_choices/';
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}}/extras/_custom_field_choices/"]
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}}/extras/_custom_field_choices/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/_custom_field_choices/",
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}}/extras/_custom_field_choices/');
echo $response->getBody();
setUrl('{{baseUrl}}/extras/_custom_field_choices/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/extras/_custom_field_choices/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/extras/_custom_field_choices/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/_custom_field_choices/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/extras/_custom_field_choices/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/_custom_field_choices/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/_custom_field_choices/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/extras/_custom_field_choices/")
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/extras/_custom_field_choices/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/extras/_custom_field_choices/";
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}}/extras/_custom_field_choices/
http GET {{baseUrl}}/extras/_custom_field_choices/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/extras/_custom_field_choices/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/_custom_field_choices/")! 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
extras__custom_field_choices_read
{{baseUrl}}/extras/_custom_field_choices/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/_custom_field_choices/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/extras/_custom_field_choices/:id/")
require "http/client"
url = "{{baseUrl}}/extras/_custom_field_choices/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/extras/_custom_field_choices/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/extras/_custom_field_choices/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/_custom_field_choices/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/extras/_custom_field_choices/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/extras/_custom_field_choices/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/_custom_field_choices/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/extras/_custom_field_choices/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/extras/_custom_field_choices/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/extras/_custom_field_choices/:id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/extras/_custom_field_choices/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/_custom_field_choices/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/extras/_custom_field_choices/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/extras/_custom_field_choices/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/extras/_custom_field_choices/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/extras/_custom_field_choices/:id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/extras/_custom_field_choices/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/extras/_custom_field_choices/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/_custom_field_choices/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/extras/_custom_field_choices/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/extras/_custom_field_choices/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/_custom_field_choices/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/extras/_custom_field_choices/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/extras/_custom_field_choices/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/extras/_custom_field_choices/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/extras/_custom_field_choices/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/_custom_field_choices/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/extras/_custom_field_choices/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/_custom_field_choices/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/_custom_field_choices/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/extras/_custom_field_choices/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/extras/_custom_field_choices/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/extras/_custom_field_choices/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/extras/_custom_field_choices/:id/
http GET {{baseUrl}}/extras/_custom_field_choices/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/extras/_custom_field_choices/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/_custom_field_choices/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
extras_config-contexts_create
{{baseUrl}}/extras/config-contexts/
BODY json
{
"cluster_groups": [],
"clusters": [],
"data": "",
"description": "",
"id": 0,
"is_active": false,
"name": "",
"platforms": [],
"regions": [],
"roles": [],
"sites": [],
"tags": [],
"tenant_groups": [],
"tenants": [],
"weight": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/config-contexts/");
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 \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/extras/config-contexts/" {:content-type :json
:form-params {:cluster_groups []
:clusters []
:data ""
:description ""
:id 0
:is_active false
:name ""
:platforms []
:regions []
:roles []
:sites []
:tags []
:tenant_groups []
:tenants []
:weight 0}})
require "http/client"
url = "{{baseUrl}}/extras/config-contexts/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/extras/config-contexts/"),
Content = new StringContent("{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/extras/config-contexts/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/config-contexts/"
payload := strings.NewReader("{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/extras/config-contexts/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 261
{
"cluster_groups": [],
"clusters": [],
"data": "",
"description": "",
"id": 0,
"is_active": false,
"name": "",
"platforms": [],
"regions": [],
"roles": [],
"sites": [],
"tags": [],
"tenant_groups": [],
"tenants": [],
"weight": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/extras/config-contexts/")
.setHeader("content-type", "application/json")
.setBody("{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/config-contexts/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/extras/config-contexts/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/extras/config-contexts/")
.header("content-type", "application/json")
.body("{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\n}")
.asString();
const data = JSON.stringify({
cluster_groups: [],
clusters: [],
data: '',
description: '',
id: 0,
is_active: false,
name: '',
platforms: [],
regions: [],
roles: [],
sites: [],
tags: [],
tenant_groups: [],
tenants: [],
weight: 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}}/extras/config-contexts/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/extras/config-contexts/',
headers: {'content-type': 'application/json'},
data: {
cluster_groups: [],
clusters: [],
data: '',
description: '',
id: 0,
is_active: false,
name: '',
platforms: [],
regions: [],
roles: [],
sites: [],
tags: [],
tenant_groups: [],
tenants: [],
weight: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/config-contexts/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cluster_groups":[],"clusters":[],"data":"","description":"","id":0,"is_active":false,"name":"","platforms":[],"regions":[],"roles":[],"sites":[],"tags":[],"tenant_groups":[],"tenants":[],"weight":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}}/extras/config-contexts/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cluster_groups": [],\n "clusters": [],\n "data": "",\n "description": "",\n "id": 0,\n "is_active": false,\n "name": "",\n "platforms": [],\n "regions": [],\n "roles": [],\n "sites": [],\n "tags": [],\n "tenant_groups": [],\n "tenants": [],\n "weight": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/extras/config-contexts/")
.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/extras/config-contexts/',
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({
cluster_groups: [],
clusters: [],
data: '',
description: '',
id: 0,
is_active: false,
name: '',
platforms: [],
regions: [],
roles: [],
sites: [],
tags: [],
tenant_groups: [],
tenants: [],
weight: 0
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/extras/config-contexts/',
headers: {'content-type': 'application/json'},
body: {
cluster_groups: [],
clusters: [],
data: '',
description: '',
id: 0,
is_active: false,
name: '',
platforms: [],
regions: [],
roles: [],
sites: [],
tags: [],
tenant_groups: [],
tenants: [],
weight: 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}}/extras/config-contexts/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cluster_groups: [],
clusters: [],
data: '',
description: '',
id: 0,
is_active: false,
name: '',
platforms: [],
regions: [],
roles: [],
sites: [],
tags: [],
tenant_groups: [],
tenants: [],
weight: 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}}/extras/config-contexts/',
headers: {'content-type': 'application/json'},
data: {
cluster_groups: [],
clusters: [],
data: '',
description: '',
id: 0,
is_active: false,
name: '',
platforms: [],
regions: [],
roles: [],
sites: [],
tags: [],
tenant_groups: [],
tenants: [],
weight: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/config-contexts/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cluster_groups":[],"clusters":[],"data":"","description":"","id":0,"is_active":false,"name":"","platforms":[],"regions":[],"roles":[],"sites":[],"tags":[],"tenant_groups":[],"tenants":[],"weight":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 = @{ @"cluster_groups": @[ ],
@"clusters": @[ ],
@"data": @"",
@"description": @"",
@"id": @0,
@"is_active": @NO,
@"name": @"",
@"platforms": @[ ],
@"regions": @[ ],
@"roles": @[ ],
@"sites": @[ ],
@"tags": @[ ],
@"tenant_groups": @[ ],
@"tenants": @[ ],
@"weight": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/extras/config-contexts/"]
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}}/extras/config-contexts/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/config-contexts/",
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([
'cluster_groups' => [
],
'clusters' => [
],
'data' => '',
'description' => '',
'id' => 0,
'is_active' => null,
'name' => '',
'platforms' => [
],
'regions' => [
],
'roles' => [
],
'sites' => [
],
'tags' => [
],
'tenant_groups' => [
],
'tenants' => [
],
'weight' => 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}}/extras/config-contexts/', [
'body' => '{
"cluster_groups": [],
"clusters": [],
"data": "",
"description": "",
"id": 0,
"is_active": false,
"name": "",
"platforms": [],
"regions": [],
"roles": [],
"sites": [],
"tags": [],
"tenant_groups": [],
"tenants": [],
"weight": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/extras/config-contexts/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cluster_groups' => [
],
'clusters' => [
],
'data' => '',
'description' => '',
'id' => 0,
'is_active' => null,
'name' => '',
'platforms' => [
],
'regions' => [
],
'roles' => [
],
'sites' => [
],
'tags' => [
],
'tenant_groups' => [
],
'tenants' => [
],
'weight' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cluster_groups' => [
],
'clusters' => [
],
'data' => '',
'description' => '',
'id' => 0,
'is_active' => null,
'name' => '',
'platforms' => [
],
'regions' => [
],
'roles' => [
],
'sites' => [
],
'tags' => [
],
'tenant_groups' => [
],
'tenants' => [
],
'weight' => 0
]));
$request->setRequestUrl('{{baseUrl}}/extras/config-contexts/');
$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}}/extras/config-contexts/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cluster_groups": [],
"clusters": [],
"data": "",
"description": "",
"id": 0,
"is_active": false,
"name": "",
"platforms": [],
"regions": [],
"roles": [],
"sites": [],
"tags": [],
"tenant_groups": [],
"tenants": [],
"weight": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/config-contexts/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cluster_groups": [],
"clusters": [],
"data": "",
"description": "",
"id": 0,
"is_active": false,
"name": "",
"platforms": [],
"regions": [],
"roles": [],
"sites": [],
"tags": [],
"tenant_groups": [],
"tenants": [],
"weight": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/extras/config-contexts/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/config-contexts/"
payload = {
"cluster_groups": [],
"clusters": [],
"data": "",
"description": "",
"id": 0,
"is_active": False,
"name": "",
"platforms": [],
"regions": [],
"roles": [],
"sites": [],
"tags": [],
"tenant_groups": [],
"tenants": [],
"weight": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/config-contexts/"
payload <- "{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/extras/config-contexts/")
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 \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/extras/config-contexts/') do |req|
req.body = "{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/extras/config-contexts/";
let payload = json!({
"cluster_groups": (),
"clusters": (),
"data": "",
"description": "",
"id": 0,
"is_active": false,
"name": "",
"platforms": (),
"regions": (),
"roles": (),
"sites": (),
"tags": (),
"tenant_groups": (),
"tenants": (),
"weight": 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}}/extras/config-contexts/ \
--header 'content-type: application/json' \
--data '{
"cluster_groups": [],
"clusters": [],
"data": "",
"description": "",
"id": 0,
"is_active": false,
"name": "",
"platforms": [],
"regions": [],
"roles": [],
"sites": [],
"tags": [],
"tenant_groups": [],
"tenants": [],
"weight": 0
}'
echo '{
"cluster_groups": [],
"clusters": [],
"data": "",
"description": "",
"id": 0,
"is_active": false,
"name": "",
"platforms": [],
"regions": [],
"roles": [],
"sites": [],
"tags": [],
"tenant_groups": [],
"tenants": [],
"weight": 0
}' | \
http POST {{baseUrl}}/extras/config-contexts/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "cluster_groups": [],\n "clusters": [],\n "data": "",\n "description": "",\n "id": 0,\n "is_active": false,\n "name": "",\n "platforms": [],\n "regions": [],\n "roles": [],\n "sites": [],\n "tags": [],\n "tenant_groups": [],\n "tenants": [],\n "weight": 0\n}' \
--output-document \
- {{baseUrl}}/extras/config-contexts/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cluster_groups": [],
"clusters": [],
"data": "",
"description": "",
"id": 0,
"is_active": false,
"name": "",
"platforms": [],
"regions": [],
"roles": [],
"sites": [],
"tags": [],
"tenant_groups": [],
"tenants": [],
"weight": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/config-contexts/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
extras_config-contexts_delete
{{baseUrl}}/extras/config-contexts/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/config-contexts/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/extras/config-contexts/:id/")
require "http/client"
url = "{{baseUrl}}/extras/config-contexts/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/extras/config-contexts/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/extras/config-contexts/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/config-contexts/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/extras/config-contexts/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/extras/config-contexts/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/config-contexts/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/extras/config-contexts/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/extras/config-contexts/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/extras/config-contexts/:id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/extras/config-contexts/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/config-contexts/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/extras/config-contexts/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/extras/config-contexts/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/extras/config-contexts/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/extras/config-contexts/:id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/extras/config-contexts/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/extras/config-contexts/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/config-contexts/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/extras/config-contexts/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/extras/config-contexts/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/config-contexts/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/extras/config-contexts/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/extras/config-contexts/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/extras/config-contexts/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/extras/config-contexts/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/config-contexts/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/extras/config-contexts/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/config-contexts/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/config-contexts/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/extras/config-contexts/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/extras/config-contexts/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/extras/config-contexts/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/extras/config-contexts/:id/
http DELETE {{baseUrl}}/extras/config-contexts/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/extras/config-contexts/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/config-contexts/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
extras_config-contexts_list
{{baseUrl}}/extras/config-contexts/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/config-contexts/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/extras/config-contexts/")
require "http/client"
url = "{{baseUrl}}/extras/config-contexts/"
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}}/extras/config-contexts/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/extras/config-contexts/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/config-contexts/"
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/extras/config-contexts/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/extras/config-contexts/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/config-contexts/"))
.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}}/extras/config-contexts/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/extras/config-contexts/")
.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}}/extras/config-contexts/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/extras/config-contexts/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/config-contexts/';
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}}/extras/config-contexts/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/extras/config-contexts/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/extras/config-contexts/',
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}}/extras/config-contexts/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/extras/config-contexts/');
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}}/extras/config-contexts/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/config-contexts/';
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}}/extras/config-contexts/"]
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}}/extras/config-contexts/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/config-contexts/",
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}}/extras/config-contexts/');
echo $response->getBody();
setUrl('{{baseUrl}}/extras/config-contexts/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/extras/config-contexts/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/extras/config-contexts/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/config-contexts/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/extras/config-contexts/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/config-contexts/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/config-contexts/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/extras/config-contexts/")
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/extras/config-contexts/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/extras/config-contexts/";
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}}/extras/config-contexts/
http GET {{baseUrl}}/extras/config-contexts/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/extras/config-contexts/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/config-contexts/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
extras_config-contexts_partial_update
{{baseUrl}}/extras/config-contexts/:id/
BODY json
{
"cluster_groups": [],
"clusters": [],
"data": "",
"description": "",
"id": 0,
"is_active": false,
"name": "",
"platforms": [],
"regions": [],
"roles": [],
"sites": [],
"tags": [],
"tenant_groups": [],
"tenants": [],
"weight": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/config-contexts/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/extras/config-contexts/:id/" {:content-type :json
:form-params {:cluster_groups []
:clusters []
:data ""
:description ""
:id 0
:is_active false
:name ""
:platforms []
:regions []
:roles []
:sites []
:tags []
:tenant_groups []
:tenants []
:weight 0}})
require "http/client"
url = "{{baseUrl}}/extras/config-contexts/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\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}}/extras/config-contexts/:id/"),
Content = new StringContent("{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/extras/config-contexts/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/config-contexts/:id/"
payload := strings.NewReader("{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\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/extras/config-contexts/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 261
{
"cluster_groups": [],
"clusters": [],
"data": "",
"description": "",
"id": 0,
"is_active": false,
"name": "",
"platforms": [],
"regions": [],
"roles": [],
"sites": [],
"tags": [],
"tenant_groups": [],
"tenants": [],
"weight": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/extras/config-contexts/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/config-contexts/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/extras/config-contexts/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/extras/config-contexts/:id/")
.header("content-type", "application/json")
.body("{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\n}")
.asString();
const data = JSON.stringify({
cluster_groups: [],
clusters: [],
data: '',
description: '',
id: 0,
is_active: false,
name: '',
platforms: [],
regions: [],
roles: [],
sites: [],
tags: [],
tenant_groups: [],
tenants: [],
weight: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/extras/config-contexts/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/extras/config-contexts/:id/',
headers: {'content-type': 'application/json'},
data: {
cluster_groups: [],
clusters: [],
data: '',
description: '',
id: 0,
is_active: false,
name: '',
platforms: [],
regions: [],
roles: [],
sites: [],
tags: [],
tenant_groups: [],
tenants: [],
weight: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/config-contexts/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"cluster_groups":[],"clusters":[],"data":"","description":"","id":0,"is_active":false,"name":"","platforms":[],"regions":[],"roles":[],"sites":[],"tags":[],"tenant_groups":[],"tenants":[],"weight":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}}/extras/config-contexts/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cluster_groups": [],\n "clusters": [],\n "data": "",\n "description": "",\n "id": 0,\n "is_active": false,\n "name": "",\n "platforms": [],\n "regions": [],\n "roles": [],\n "sites": [],\n "tags": [],\n "tenant_groups": [],\n "tenants": [],\n "weight": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/extras/config-contexts/:id/")
.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/extras/config-contexts/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
cluster_groups: [],
clusters: [],
data: '',
description: '',
id: 0,
is_active: false,
name: '',
platforms: [],
regions: [],
roles: [],
sites: [],
tags: [],
tenant_groups: [],
tenants: [],
weight: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/extras/config-contexts/:id/',
headers: {'content-type': 'application/json'},
body: {
cluster_groups: [],
clusters: [],
data: '',
description: '',
id: 0,
is_active: false,
name: '',
platforms: [],
regions: [],
roles: [],
sites: [],
tags: [],
tenant_groups: [],
tenants: [],
weight: 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('PATCH', '{{baseUrl}}/extras/config-contexts/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cluster_groups: [],
clusters: [],
data: '',
description: '',
id: 0,
is_active: false,
name: '',
platforms: [],
regions: [],
roles: [],
sites: [],
tags: [],
tenant_groups: [],
tenants: [],
weight: 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: 'PATCH',
url: '{{baseUrl}}/extras/config-contexts/:id/',
headers: {'content-type': 'application/json'},
data: {
cluster_groups: [],
clusters: [],
data: '',
description: '',
id: 0,
is_active: false,
name: '',
platforms: [],
regions: [],
roles: [],
sites: [],
tags: [],
tenant_groups: [],
tenants: [],
weight: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/config-contexts/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"cluster_groups":[],"clusters":[],"data":"","description":"","id":0,"is_active":false,"name":"","platforms":[],"regions":[],"roles":[],"sites":[],"tags":[],"tenant_groups":[],"tenants":[],"weight":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 = @{ @"cluster_groups": @[ ],
@"clusters": @[ ],
@"data": @"",
@"description": @"",
@"id": @0,
@"is_active": @NO,
@"name": @"",
@"platforms": @[ ],
@"regions": @[ ],
@"roles": @[ ],
@"sites": @[ ],
@"tags": @[ ],
@"tenant_groups": @[ ],
@"tenants": @[ ],
@"weight": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/extras/config-contexts/:id/"]
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}}/extras/config-contexts/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/config-contexts/:id/",
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([
'cluster_groups' => [
],
'clusters' => [
],
'data' => '',
'description' => '',
'id' => 0,
'is_active' => null,
'name' => '',
'platforms' => [
],
'regions' => [
],
'roles' => [
],
'sites' => [
],
'tags' => [
],
'tenant_groups' => [
],
'tenants' => [
],
'weight' => 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('PATCH', '{{baseUrl}}/extras/config-contexts/:id/', [
'body' => '{
"cluster_groups": [],
"clusters": [],
"data": "",
"description": "",
"id": 0,
"is_active": false,
"name": "",
"platforms": [],
"regions": [],
"roles": [],
"sites": [],
"tags": [],
"tenant_groups": [],
"tenants": [],
"weight": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/extras/config-contexts/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cluster_groups' => [
],
'clusters' => [
],
'data' => '',
'description' => '',
'id' => 0,
'is_active' => null,
'name' => '',
'platforms' => [
],
'regions' => [
],
'roles' => [
],
'sites' => [
],
'tags' => [
],
'tenant_groups' => [
],
'tenants' => [
],
'weight' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cluster_groups' => [
],
'clusters' => [
],
'data' => '',
'description' => '',
'id' => 0,
'is_active' => null,
'name' => '',
'platforms' => [
],
'regions' => [
],
'roles' => [
],
'sites' => [
],
'tags' => [
],
'tenant_groups' => [
],
'tenants' => [
],
'weight' => 0
]));
$request->setRequestUrl('{{baseUrl}}/extras/config-contexts/:id/');
$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}}/extras/config-contexts/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"cluster_groups": [],
"clusters": [],
"data": "",
"description": "",
"id": 0,
"is_active": false,
"name": "",
"platforms": [],
"regions": [],
"roles": [],
"sites": [],
"tags": [],
"tenant_groups": [],
"tenants": [],
"weight": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/config-contexts/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"cluster_groups": [],
"clusters": [],
"data": "",
"description": "",
"id": 0,
"is_active": false,
"name": "",
"platforms": [],
"regions": [],
"roles": [],
"sites": [],
"tags": [],
"tenant_groups": [],
"tenants": [],
"weight": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/extras/config-contexts/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/config-contexts/:id/"
payload = {
"cluster_groups": [],
"clusters": [],
"data": "",
"description": "",
"id": 0,
"is_active": False,
"name": "",
"platforms": [],
"regions": [],
"roles": [],
"sites": [],
"tags": [],
"tenant_groups": [],
"tenants": [],
"weight": 0
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/config-contexts/:id/"
payload <- "{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\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}}/extras/config-contexts/:id/")
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 \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/extras/config-contexts/:id/') do |req|
req.body = "{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\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}}/extras/config-contexts/:id/";
let payload = json!({
"cluster_groups": (),
"clusters": (),
"data": "",
"description": "",
"id": 0,
"is_active": false,
"name": "",
"platforms": (),
"regions": (),
"roles": (),
"sites": (),
"tags": (),
"tenant_groups": (),
"tenants": (),
"weight": 0
});
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}}/extras/config-contexts/:id/ \
--header 'content-type: application/json' \
--data '{
"cluster_groups": [],
"clusters": [],
"data": "",
"description": "",
"id": 0,
"is_active": false,
"name": "",
"platforms": [],
"regions": [],
"roles": [],
"sites": [],
"tags": [],
"tenant_groups": [],
"tenants": [],
"weight": 0
}'
echo '{
"cluster_groups": [],
"clusters": [],
"data": "",
"description": "",
"id": 0,
"is_active": false,
"name": "",
"platforms": [],
"regions": [],
"roles": [],
"sites": [],
"tags": [],
"tenant_groups": [],
"tenants": [],
"weight": 0
}' | \
http PATCH {{baseUrl}}/extras/config-contexts/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "cluster_groups": [],\n "clusters": [],\n "data": "",\n "description": "",\n "id": 0,\n "is_active": false,\n "name": "",\n "platforms": [],\n "regions": [],\n "roles": [],\n "sites": [],\n "tags": [],\n "tenant_groups": [],\n "tenants": [],\n "weight": 0\n}' \
--output-document \
- {{baseUrl}}/extras/config-contexts/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cluster_groups": [],
"clusters": [],
"data": "",
"description": "",
"id": 0,
"is_active": false,
"name": "",
"platforms": [],
"regions": [],
"roles": [],
"sites": [],
"tags": [],
"tenant_groups": [],
"tenants": [],
"weight": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/config-contexts/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
extras_config-contexts_read
{{baseUrl}}/extras/config-contexts/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/config-contexts/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/extras/config-contexts/:id/")
require "http/client"
url = "{{baseUrl}}/extras/config-contexts/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/extras/config-contexts/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/extras/config-contexts/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/config-contexts/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/extras/config-contexts/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/extras/config-contexts/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/config-contexts/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/extras/config-contexts/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/extras/config-contexts/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/extras/config-contexts/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/extras/config-contexts/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/config-contexts/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/extras/config-contexts/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/extras/config-contexts/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/extras/config-contexts/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/extras/config-contexts/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/extras/config-contexts/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/extras/config-contexts/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/config-contexts/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/extras/config-contexts/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/extras/config-contexts/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/config-contexts/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/extras/config-contexts/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/extras/config-contexts/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/extras/config-contexts/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/extras/config-contexts/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/config-contexts/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/extras/config-contexts/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/config-contexts/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/config-contexts/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/extras/config-contexts/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/extras/config-contexts/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/extras/config-contexts/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/extras/config-contexts/:id/
http GET {{baseUrl}}/extras/config-contexts/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/extras/config-contexts/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/config-contexts/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
extras_config-contexts_update
{{baseUrl}}/extras/config-contexts/:id/
BODY json
{
"cluster_groups": [],
"clusters": [],
"data": "",
"description": "",
"id": 0,
"is_active": false,
"name": "",
"platforms": [],
"regions": [],
"roles": [],
"sites": [],
"tags": [],
"tenant_groups": [],
"tenants": [],
"weight": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/config-contexts/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/extras/config-contexts/:id/" {:content-type :json
:form-params {:cluster_groups []
:clusters []
:data ""
:description ""
:id 0
:is_active false
:name ""
:platforms []
:regions []
:roles []
:sites []
:tags []
:tenant_groups []
:tenants []
:weight 0}})
require "http/client"
url = "{{baseUrl}}/extras/config-contexts/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\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}}/extras/config-contexts/:id/"),
Content = new StringContent("{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/extras/config-contexts/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/config-contexts/:id/"
payload := strings.NewReader("{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\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/extras/config-contexts/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 261
{
"cluster_groups": [],
"clusters": [],
"data": "",
"description": "",
"id": 0,
"is_active": false,
"name": "",
"platforms": [],
"regions": [],
"roles": [],
"sites": [],
"tags": [],
"tenant_groups": [],
"tenants": [],
"weight": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/extras/config-contexts/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/config-contexts/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/extras/config-contexts/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/extras/config-contexts/:id/")
.header("content-type", "application/json")
.body("{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\n}")
.asString();
const data = JSON.stringify({
cluster_groups: [],
clusters: [],
data: '',
description: '',
id: 0,
is_active: false,
name: '',
platforms: [],
regions: [],
roles: [],
sites: [],
tags: [],
tenant_groups: [],
tenants: [],
weight: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/extras/config-contexts/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/extras/config-contexts/:id/',
headers: {'content-type': 'application/json'},
data: {
cluster_groups: [],
clusters: [],
data: '',
description: '',
id: 0,
is_active: false,
name: '',
platforms: [],
regions: [],
roles: [],
sites: [],
tags: [],
tenant_groups: [],
tenants: [],
weight: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/config-contexts/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"cluster_groups":[],"clusters":[],"data":"","description":"","id":0,"is_active":false,"name":"","platforms":[],"regions":[],"roles":[],"sites":[],"tags":[],"tenant_groups":[],"tenants":[],"weight":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}}/extras/config-contexts/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cluster_groups": [],\n "clusters": [],\n "data": "",\n "description": "",\n "id": 0,\n "is_active": false,\n "name": "",\n "platforms": [],\n "regions": [],\n "roles": [],\n "sites": [],\n "tags": [],\n "tenant_groups": [],\n "tenants": [],\n "weight": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/extras/config-contexts/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/extras/config-contexts/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
cluster_groups: [],
clusters: [],
data: '',
description: '',
id: 0,
is_active: false,
name: '',
platforms: [],
regions: [],
roles: [],
sites: [],
tags: [],
tenant_groups: [],
tenants: [],
weight: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/extras/config-contexts/:id/',
headers: {'content-type': 'application/json'},
body: {
cluster_groups: [],
clusters: [],
data: '',
description: '',
id: 0,
is_active: false,
name: '',
platforms: [],
regions: [],
roles: [],
sites: [],
tags: [],
tenant_groups: [],
tenants: [],
weight: 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('PUT', '{{baseUrl}}/extras/config-contexts/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cluster_groups: [],
clusters: [],
data: '',
description: '',
id: 0,
is_active: false,
name: '',
platforms: [],
regions: [],
roles: [],
sites: [],
tags: [],
tenant_groups: [],
tenants: [],
weight: 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: 'PUT',
url: '{{baseUrl}}/extras/config-contexts/:id/',
headers: {'content-type': 'application/json'},
data: {
cluster_groups: [],
clusters: [],
data: '',
description: '',
id: 0,
is_active: false,
name: '',
platforms: [],
regions: [],
roles: [],
sites: [],
tags: [],
tenant_groups: [],
tenants: [],
weight: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/config-contexts/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"cluster_groups":[],"clusters":[],"data":"","description":"","id":0,"is_active":false,"name":"","platforms":[],"regions":[],"roles":[],"sites":[],"tags":[],"tenant_groups":[],"tenants":[],"weight":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 = @{ @"cluster_groups": @[ ],
@"clusters": @[ ],
@"data": @"",
@"description": @"",
@"id": @0,
@"is_active": @NO,
@"name": @"",
@"platforms": @[ ],
@"regions": @[ ],
@"roles": @[ ],
@"sites": @[ ],
@"tags": @[ ],
@"tenant_groups": @[ ],
@"tenants": @[ ],
@"weight": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/extras/config-contexts/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/extras/config-contexts/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/config-contexts/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'cluster_groups' => [
],
'clusters' => [
],
'data' => '',
'description' => '',
'id' => 0,
'is_active' => null,
'name' => '',
'platforms' => [
],
'regions' => [
],
'roles' => [
],
'sites' => [
],
'tags' => [
],
'tenant_groups' => [
],
'tenants' => [
],
'weight' => 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('PUT', '{{baseUrl}}/extras/config-contexts/:id/', [
'body' => '{
"cluster_groups": [],
"clusters": [],
"data": "",
"description": "",
"id": 0,
"is_active": false,
"name": "",
"platforms": [],
"regions": [],
"roles": [],
"sites": [],
"tags": [],
"tenant_groups": [],
"tenants": [],
"weight": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/extras/config-contexts/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cluster_groups' => [
],
'clusters' => [
],
'data' => '',
'description' => '',
'id' => 0,
'is_active' => null,
'name' => '',
'platforms' => [
],
'regions' => [
],
'roles' => [
],
'sites' => [
],
'tags' => [
],
'tenant_groups' => [
],
'tenants' => [
],
'weight' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cluster_groups' => [
],
'clusters' => [
],
'data' => '',
'description' => '',
'id' => 0,
'is_active' => null,
'name' => '',
'platforms' => [
],
'regions' => [
],
'roles' => [
],
'sites' => [
],
'tags' => [
],
'tenant_groups' => [
],
'tenants' => [
],
'weight' => 0
]));
$request->setRequestUrl('{{baseUrl}}/extras/config-contexts/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/extras/config-contexts/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"cluster_groups": [],
"clusters": [],
"data": "",
"description": "",
"id": 0,
"is_active": false,
"name": "",
"platforms": [],
"regions": [],
"roles": [],
"sites": [],
"tags": [],
"tenant_groups": [],
"tenants": [],
"weight": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/config-contexts/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"cluster_groups": [],
"clusters": [],
"data": "",
"description": "",
"id": 0,
"is_active": false,
"name": "",
"platforms": [],
"regions": [],
"roles": [],
"sites": [],
"tags": [],
"tenant_groups": [],
"tenants": [],
"weight": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/extras/config-contexts/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/config-contexts/:id/"
payload = {
"cluster_groups": [],
"clusters": [],
"data": "",
"description": "",
"id": 0,
"is_active": False,
"name": "",
"platforms": [],
"regions": [],
"roles": [],
"sites": [],
"tags": [],
"tenant_groups": [],
"tenants": [],
"weight": 0
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/config-contexts/:id/"
payload <- "{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\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}}/extras/config-contexts/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/extras/config-contexts/:id/') do |req|
req.body = "{\n \"cluster_groups\": [],\n \"clusters\": [],\n \"data\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"is_active\": false,\n \"name\": \"\",\n \"platforms\": [],\n \"regions\": [],\n \"roles\": [],\n \"sites\": [],\n \"tags\": [],\n \"tenant_groups\": [],\n \"tenants\": [],\n \"weight\": 0\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}}/extras/config-contexts/:id/";
let payload = json!({
"cluster_groups": (),
"clusters": (),
"data": "",
"description": "",
"id": 0,
"is_active": false,
"name": "",
"platforms": (),
"regions": (),
"roles": (),
"sites": (),
"tags": (),
"tenant_groups": (),
"tenants": (),
"weight": 0
});
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}}/extras/config-contexts/:id/ \
--header 'content-type: application/json' \
--data '{
"cluster_groups": [],
"clusters": [],
"data": "",
"description": "",
"id": 0,
"is_active": false,
"name": "",
"platforms": [],
"regions": [],
"roles": [],
"sites": [],
"tags": [],
"tenant_groups": [],
"tenants": [],
"weight": 0
}'
echo '{
"cluster_groups": [],
"clusters": [],
"data": "",
"description": "",
"id": 0,
"is_active": false,
"name": "",
"platforms": [],
"regions": [],
"roles": [],
"sites": [],
"tags": [],
"tenant_groups": [],
"tenants": [],
"weight": 0
}' | \
http PUT {{baseUrl}}/extras/config-contexts/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "cluster_groups": [],\n "clusters": [],\n "data": "",\n "description": "",\n "id": 0,\n "is_active": false,\n "name": "",\n "platforms": [],\n "regions": [],\n "roles": [],\n "sites": [],\n "tags": [],\n "tenant_groups": [],\n "tenants": [],\n "weight": 0\n}' \
--output-document \
- {{baseUrl}}/extras/config-contexts/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cluster_groups": [],
"clusters": [],
"data": "",
"description": "",
"id": 0,
"is_active": false,
"name": "",
"platforms": [],
"regions": [],
"roles": [],
"sites": [],
"tags": [],
"tenant_groups": [],
"tenants": [],
"weight": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/config-contexts/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
extras_export-templates_create
{{baseUrl}}/extras/export-templates/
BODY json
{
"content_type": "",
"description": "",
"file_extension": "",
"id": 0,
"mime_type": "",
"name": "",
"template_code": "",
"template_language": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/export-templates/");
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 \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/extras/export-templates/" {:content-type :json
:form-params {:content_type ""
:description ""
:file_extension ""
:id 0
:mime_type ""
:name ""
:template_code ""
:template_language ""}})
require "http/client"
url = "{{baseUrl}}/extras/export-templates/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\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}}/extras/export-templates/"),
Content = new StringContent("{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\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}}/extras/export-templates/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/export-templates/"
payload := strings.NewReader("{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\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/extras/export-templates/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 163
{
"content_type": "",
"description": "",
"file_extension": "",
"id": 0,
"mime_type": "",
"name": "",
"template_code": "",
"template_language": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/extras/export-templates/")
.setHeader("content-type", "application/json")
.setBody("{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/export-templates/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\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 \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/extras/export-templates/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/extras/export-templates/")
.header("content-type", "application/json")
.body("{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\n}")
.asString();
const data = JSON.stringify({
content_type: '',
description: '',
file_extension: '',
id: 0,
mime_type: '',
name: '',
template_code: '',
template_language: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/extras/export-templates/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/extras/export-templates/',
headers: {'content-type': 'application/json'},
data: {
content_type: '',
description: '',
file_extension: '',
id: 0,
mime_type: '',
name: '',
template_code: '',
template_language: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/export-templates/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"content_type":"","description":"","file_extension":"","id":0,"mime_type":"","name":"","template_code":"","template_language":""}'
};
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}}/extras/export-templates/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "content_type": "",\n "description": "",\n "file_extension": "",\n "id": 0,\n "mime_type": "",\n "name": "",\n "template_code": "",\n "template_language": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/extras/export-templates/")
.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/extras/export-templates/',
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({
content_type: '',
description: '',
file_extension: '',
id: 0,
mime_type: '',
name: '',
template_code: '',
template_language: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/extras/export-templates/',
headers: {'content-type': 'application/json'},
body: {
content_type: '',
description: '',
file_extension: '',
id: 0,
mime_type: '',
name: '',
template_code: '',
template_language: ''
},
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}}/extras/export-templates/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
content_type: '',
description: '',
file_extension: '',
id: 0,
mime_type: '',
name: '',
template_code: '',
template_language: ''
});
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}}/extras/export-templates/',
headers: {'content-type': 'application/json'},
data: {
content_type: '',
description: '',
file_extension: '',
id: 0,
mime_type: '',
name: '',
template_code: '',
template_language: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/export-templates/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"content_type":"","description":"","file_extension":"","id":0,"mime_type":"","name":"","template_code":"","template_language":""}'
};
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 = @{ @"content_type": @"",
@"description": @"",
@"file_extension": @"",
@"id": @0,
@"mime_type": @"",
@"name": @"",
@"template_code": @"",
@"template_language": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/extras/export-templates/"]
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}}/extras/export-templates/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/export-templates/",
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([
'content_type' => '',
'description' => '',
'file_extension' => '',
'id' => 0,
'mime_type' => '',
'name' => '',
'template_code' => '',
'template_language' => ''
]),
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}}/extras/export-templates/', [
'body' => '{
"content_type": "",
"description": "",
"file_extension": "",
"id": 0,
"mime_type": "",
"name": "",
"template_code": "",
"template_language": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/extras/export-templates/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'content_type' => '',
'description' => '',
'file_extension' => '',
'id' => 0,
'mime_type' => '',
'name' => '',
'template_code' => '',
'template_language' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'content_type' => '',
'description' => '',
'file_extension' => '',
'id' => 0,
'mime_type' => '',
'name' => '',
'template_code' => '',
'template_language' => ''
]));
$request->setRequestUrl('{{baseUrl}}/extras/export-templates/');
$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}}/extras/export-templates/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"content_type": "",
"description": "",
"file_extension": "",
"id": 0,
"mime_type": "",
"name": "",
"template_code": "",
"template_language": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/export-templates/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"content_type": "",
"description": "",
"file_extension": "",
"id": 0,
"mime_type": "",
"name": "",
"template_code": "",
"template_language": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/extras/export-templates/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/export-templates/"
payload = {
"content_type": "",
"description": "",
"file_extension": "",
"id": 0,
"mime_type": "",
"name": "",
"template_code": "",
"template_language": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/export-templates/"
payload <- "{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\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}}/extras/export-templates/")
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 \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\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/extras/export-templates/') do |req|
req.body = "{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/extras/export-templates/";
let payload = json!({
"content_type": "",
"description": "",
"file_extension": "",
"id": 0,
"mime_type": "",
"name": "",
"template_code": "",
"template_language": ""
});
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}}/extras/export-templates/ \
--header 'content-type: application/json' \
--data '{
"content_type": "",
"description": "",
"file_extension": "",
"id": 0,
"mime_type": "",
"name": "",
"template_code": "",
"template_language": ""
}'
echo '{
"content_type": "",
"description": "",
"file_extension": "",
"id": 0,
"mime_type": "",
"name": "",
"template_code": "",
"template_language": ""
}' | \
http POST {{baseUrl}}/extras/export-templates/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "content_type": "",\n "description": "",\n "file_extension": "",\n "id": 0,\n "mime_type": "",\n "name": "",\n "template_code": "",\n "template_language": ""\n}' \
--output-document \
- {{baseUrl}}/extras/export-templates/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"content_type": "",
"description": "",
"file_extension": "",
"id": 0,
"mime_type": "",
"name": "",
"template_code": "",
"template_language": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/export-templates/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
extras_export-templates_delete
{{baseUrl}}/extras/export-templates/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/export-templates/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/extras/export-templates/:id/")
require "http/client"
url = "{{baseUrl}}/extras/export-templates/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/extras/export-templates/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/extras/export-templates/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/export-templates/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/extras/export-templates/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/extras/export-templates/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/export-templates/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/extras/export-templates/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/extras/export-templates/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/extras/export-templates/:id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/extras/export-templates/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/export-templates/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/extras/export-templates/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/extras/export-templates/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/extras/export-templates/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/extras/export-templates/:id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/extras/export-templates/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/extras/export-templates/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/export-templates/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/extras/export-templates/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/extras/export-templates/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/export-templates/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/extras/export-templates/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/extras/export-templates/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/extras/export-templates/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/extras/export-templates/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/export-templates/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/extras/export-templates/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/export-templates/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/export-templates/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/extras/export-templates/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/extras/export-templates/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/extras/export-templates/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/extras/export-templates/:id/
http DELETE {{baseUrl}}/extras/export-templates/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/extras/export-templates/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/export-templates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
extras_export-templates_list
{{baseUrl}}/extras/export-templates/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/export-templates/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/extras/export-templates/")
require "http/client"
url = "{{baseUrl}}/extras/export-templates/"
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}}/extras/export-templates/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/extras/export-templates/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/export-templates/"
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/extras/export-templates/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/extras/export-templates/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/export-templates/"))
.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}}/extras/export-templates/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/extras/export-templates/")
.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}}/extras/export-templates/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/extras/export-templates/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/export-templates/';
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}}/extras/export-templates/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/extras/export-templates/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/extras/export-templates/',
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}}/extras/export-templates/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/extras/export-templates/');
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}}/extras/export-templates/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/export-templates/';
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}}/extras/export-templates/"]
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}}/extras/export-templates/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/export-templates/",
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}}/extras/export-templates/');
echo $response->getBody();
setUrl('{{baseUrl}}/extras/export-templates/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/extras/export-templates/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/extras/export-templates/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/export-templates/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/extras/export-templates/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/export-templates/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/export-templates/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/extras/export-templates/")
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/extras/export-templates/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/extras/export-templates/";
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}}/extras/export-templates/
http GET {{baseUrl}}/extras/export-templates/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/extras/export-templates/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/export-templates/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
extras_export-templates_partial_update
{{baseUrl}}/extras/export-templates/:id/
BODY json
{
"content_type": "",
"description": "",
"file_extension": "",
"id": 0,
"mime_type": "",
"name": "",
"template_code": "",
"template_language": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/export-templates/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/extras/export-templates/:id/" {:content-type :json
:form-params {:content_type ""
:description ""
:file_extension ""
:id 0
:mime_type ""
:name ""
:template_code ""
:template_language ""}})
require "http/client"
url = "{{baseUrl}}/extras/export-templates/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\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}}/extras/export-templates/:id/"),
Content = new StringContent("{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\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}}/extras/export-templates/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/export-templates/:id/"
payload := strings.NewReader("{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\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/extras/export-templates/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 163
{
"content_type": "",
"description": "",
"file_extension": "",
"id": 0,
"mime_type": "",
"name": "",
"template_code": "",
"template_language": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/extras/export-templates/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/export-templates/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\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 \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/extras/export-templates/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/extras/export-templates/:id/")
.header("content-type", "application/json")
.body("{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\n}")
.asString();
const data = JSON.stringify({
content_type: '',
description: '',
file_extension: '',
id: 0,
mime_type: '',
name: '',
template_code: '',
template_language: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/extras/export-templates/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/extras/export-templates/:id/',
headers: {'content-type': 'application/json'},
data: {
content_type: '',
description: '',
file_extension: '',
id: 0,
mime_type: '',
name: '',
template_code: '',
template_language: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/export-templates/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"content_type":"","description":"","file_extension":"","id":0,"mime_type":"","name":"","template_code":"","template_language":""}'
};
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}}/extras/export-templates/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "content_type": "",\n "description": "",\n "file_extension": "",\n "id": 0,\n "mime_type": "",\n "name": "",\n "template_code": "",\n "template_language": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/extras/export-templates/:id/")
.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/extras/export-templates/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
content_type: '',
description: '',
file_extension: '',
id: 0,
mime_type: '',
name: '',
template_code: '',
template_language: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/extras/export-templates/:id/',
headers: {'content-type': 'application/json'},
body: {
content_type: '',
description: '',
file_extension: '',
id: 0,
mime_type: '',
name: '',
template_code: '',
template_language: ''
},
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}}/extras/export-templates/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
content_type: '',
description: '',
file_extension: '',
id: 0,
mime_type: '',
name: '',
template_code: '',
template_language: ''
});
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}}/extras/export-templates/:id/',
headers: {'content-type': 'application/json'},
data: {
content_type: '',
description: '',
file_extension: '',
id: 0,
mime_type: '',
name: '',
template_code: '',
template_language: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/export-templates/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"content_type":"","description":"","file_extension":"","id":0,"mime_type":"","name":"","template_code":"","template_language":""}'
};
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 = @{ @"content_type": @"",
@"description": @"",
@"file_extension": @"",
@"id": @0,
@"mime_type": @"",
@"name": @"",
@"template_code": @"",
@"template_language": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/extras/export-templates/:id/"]
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}}/extras/export-templates/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/export-templates/:id/",
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([
'content_type' => '',
'description' => '',
'file_extension' => '',
'id' => 0,
'mime_type' => '',
'name' => '',
'template_code' => '',
'template_language' => ''
]),
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}}/extras/export-templates/:id/', [
'body' => '{
"content_type": "",
"description": "",
"file_extension": "",
"id": 0,
"mime_type": "",
"name": "",
"template_code": "",
"template_language": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/extras/export-templates/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'content_type' => '',
'description' => '',
'file_extension' => '',
'id' => 0,
'mime_type' => '',
'name' => '',
'template_code' => '',
'template_language' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'content_type' => '',
'description' => '',
'file_extension' => '',
'id' => 0,
'mime_type' => '',
'name' => '',
'template_code' => '',
'template_language' => ''
]));
$request->setRequestUrl('{{baseUrl}}/extras/export-templates/:id/');
$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}}/extras/export-templates/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"content_type": "",
"description": "",
"file_extension": "",
"id": 0,
"mime_type": "",
"name": "",
"template_code": "",
"template_language": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/export-templates/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"content_type": "",
"description": "",
"file_extension": "",
"id": 0,
"mime_type": "",
"name": "",
"template_code": "",
"template_language": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/extras/export-templates/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/export-templates/:id/"
payload = {
"content_type": "",
"description": "",
"file_extension": "",
"id": 0,
"mime_type": "",
"name": "",
"template_code": "",
"template_language": ""
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/export-templates/:id/"
payload <- "{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\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}}/extras/export-templates/:id/")
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 \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\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/extras/export-templates/:id/') do |req|
req.body = "{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\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}}/extras/export-templates/:id/";
let payload = json!({
"content_type": "",
"description": "",
"file_extension": "",
"id": 0,
"mime_type": "",
"name": "",
"template_code": "",
"template_language": ""
});
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}}/extras/export-templates/:id/ \
--header 'content-type: application/json' \
--data '{
"content_type": "",
"description": "",
"file_extension": "",
"id": 0,
"mime_type": "",
"name": "",
"template_code": "",
"template_language": ""
}'
echo '{
"content_type": "",
"description": "",
"file_extension": "",
"id": 0,
"mime_type": "",
"name": "",
"template_code": "",
"template_language": ""
}' | \
http PATCH {{baseUrl}}/extras/export-templates/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "content_type": "",\n "description": "",\n "file_extension": "",\n "id": 0,\n "mime_type": "",\n "name": "",\n "template_code": "",\n "template_language": ""\n}' \
--output-document \
- {{baseUrl}}/extras/export-templates/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"content_type": "",
"description": "",
"file_extension": "",
"id": 0,
"mime_type": "",
"name": "",
"template_code": "",
"template_language": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/export-templates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
extras_export-templates_read
{{baseUrl}}/extras/export-templates/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/export-templates/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/extras/export-templates/:id/")
require "http/client"
url = "{{baseUrl}}/extras/export-templates/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/extras/export-templates/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/extras/export-templates/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/export-templates/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/extras/export-templates/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/extras/export-templates/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/export-templates/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/extras/export-templates/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/extras/export-templates/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/extras/export-templates/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/extras/export-templates/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/export-templates/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/extras/export-templates/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/extras/export-templates/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/extras/export-templates/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/extras/export-templates/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/extras/export-templates/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/extras/export-templates/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/export-templates/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/extras/export-templates/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/extras/export-templates/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/export-templates/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/extras/export-templates/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/extras/export-templates/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/extras/export-templates/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/extras/export-templates/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/export-templates/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/extras/export-templates/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/export-templates/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/export-templates/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/extras/export-templates/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/extras/export-templates/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/extras/export-templates/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/extras/export-templates/:id/
http GET {{baseUrl}}/extras/export-templates/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/extras/export-templates/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/export-templates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
extras_export-templates_update
{{baseUrl}}/extras/export-templates/:id/
BODY json
{
"content_type": "",
"description": "",
"file_extension": "",
"id": 0,
"mime_type": "",
"name": "",
"template_code": "",
"template_language": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/export-templates/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/extras/export-templates/:id/" {:content-type :json
:form-params {:content_type ""
:description ""
:file_extension ""
:id 0
:mime_type ""
:name ""
:template_code ""
:template_language ""}})
require "http/client"
url = "{{baseUrl}}/extras/export-templates/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\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}}/extras/export-templates/:id/"),
Content = new StringContent("{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\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}}/extras/export-templates/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/export-templates/:id/"
payload := strings.NewReader("{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\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/extras/export-templates/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 163
{
"content_type": "",
"description": "",
"file_extension": "",
"id": 0,
"mime_type": "",
"name": "",
"template_code": "",
"template_language": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/extras/export-templates/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/export-templates/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\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 \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/extras/export-templates/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/extras/export-templates/:id/")
.header("content-type", "application/json")
.body("{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\n}")
.asString();
const data = JSON.stringify({
content_type: '',
description: '',
file_extension: '',
id: 0,
mime_type: '',
name: '',
template_code: '',
template_language: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/extras/export-templates/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/extras/export-templates/:id/',
headers: {'content-type': 'application/json'},
data: {
content_type: '',
description: '',
file_extension: '',
id: 0,
mime_type: '',
name: '',
template_code: '',
template_language: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/export-templates/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"content_type":"","description":"","file_extension":"","id":0,"mime_type":"","name":"","template_code":"","template_language":""}'
};
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}}/extras/export-templates/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "content_type": "",\n "description": "",\n "file_extension": "",\n "id": 0,\n "mime_type": "",\n "name": "",\n "template_code": "",\n "template_language": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/extras/export-templates/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/extras/export-templates/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
content_type: '',
description: '',
file_extension: '',
id: 0,
mime_type: '',
name: '',
template_code: '',
template_language: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/extras/export-templates/:id/',
headers: {'content-type': 'application/json'},
body: {
content_type: '',
description: '',
file_extension: '',
id: 0,
mime_type: '',
name: '',
template_code: '',
template_language: ''
},
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}}/extras/export-templates/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
content_type: '',
description: '',
file_extension: '',
id: 0,
mime_type: '',
name: '',
template_code: '',
template_language: ''
});
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}}/extras/export-templates/:id/',
headers: {'content-type': 'application/json'},
data: {
content_type: '',
description: '',
file_extension: '',
id: 0,
mime_type: '',
name: '',
template_code: '',
template_language: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/export-templates/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"content_type":"","description":"","file_extension":"","id":0,"mime_type":"","name":"","template_code":"","template_language":""}'
};
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 = @{ @"content_type": @"",
@"description": @"",
@"file_extension": @"",
@"id": @0,
@"mime_type": @"",
@"name": @"",
@"template_code": @"",
@"template_language": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/extras/export-templates/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/extras/export-templates/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/export-templates/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'content_type' => '',
'description' => '',
'file_extension' => '',
'id' => 0,
'mime_type' => '',
'name' => '',
'template_code' => '',
'template_language' => ''
]),
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}}/extras/export-templates/:id/', [
'body' => '{
"content_type": "",
"description": "",
"file_extension": "",
"id": 0,
"mime_type": "",
"name": "",
"template_code": "",
"template_language": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/extras/export-templates/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'content_type' => '',
'description' => '',
'file_extension' => '',
'id' => 0,
'mime_type' => '',
'name' => '',
'template_code' => '',
'template_language' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'content_type' => '',
'description' => '',
'file_extension' => '',
'id' => 0,
'mime_type' => '',
'name' => '',
'template_code' => '',
'template_language' => ''
]));
$request->setRequestUrl('{{baseUrl}}/extras/export-templates/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/extras/export-templates/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"content_type": "",
"description": "",
"file_extension": "",
"id": 0,
"mime_type": "",
"name": "",
"template_code": "",
"template_language": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/export-templates/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"content_type": "",
"description": "",
"file_extension": "",
"id": 0,
"mime_type": "",
"name": "",
"template_code": "",
"template_language": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/extras/export-templates/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/export-templates/:id/"
payload = {
"content_type": "",
"description": "",
"file_extension": "",
"id": 0,
"mime_type": "",
"name": "",
"template_code": "",
"template_language": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/export-templates/:id/"
payload <- "{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\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}}/extras/export-templates/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\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/extras/export-templates/:id/') do |req|
req.body = "{\n \"content_type\": \"\",\n \"description\": \"\",\n \"file_extension\": \"\",\n \"id\": 0,\n \"mime_type\": \"\",\n \"name\": \"\",\n \"template_code\": \"\",\n \"template_language\": \"\"\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}}/extras/export-templates/:id/";
let payload = json!({
"content_type": "",
"description": "",
"file_extension": "",
"id": 0,
"mime_type": "",
"name": "",
"template_code": "",
"template_language": ""
});
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}}/extras/export-templates/:id/ \
--header 'content-type: application/json' \
--data '{
"content_type": "",
"description": "",
"file_extension": "",
"id": 0,
"mime_type": "",
"name": "",
"template_code": "",
"template_language": ""
}'
echo '{
"content_type": "",
"description": "",
"file_extension": "",
"id": 0,
"mime_type": "",
"name": "",
"template_code": "",
"template_language": ""
}' | \
http PUT {{baseUrl}}/extras/export-templates/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "content_type": "",\n "description": "",\n "file_extension": "",\n "id": 0,\n "mime_type": "",\n "name": "",\n "template_code": "",\n "template_language": ""\n}' \
--output-document \
- {{baseUrl}}/extras/export-templates/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"content_type": "",
"description": "",
"file_extension": "",
"id": 0,
"mime_type": "",
"name": "",
"template_code": "",
"template_language": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/export-templates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
extras_graphs_create
{{baseUrl}}/extras/graphs/
BODY json
{
"id": 0,
"link": "",
"name": "",
"source": "",
"template_language": "",
"type": "",
"weight": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/graphs/");
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\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/extras/graphs/" {:content-type :json
:form-params {:id 0
:link ""
:name ""
:source ""
:template_language ""
:type ""
:weight 0}})
require "http/client"
url = "{{baseUrl}}/extras/graphs/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/extras/graphs/"),
Content = new StringContent("{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/extras/graphs/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/graphs/"
payload := strings.NewReader("{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/extras/graphs/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 113
{
"id": 0,
"link": "",
"name": "",
"source": "",
"template_language": "",
"type": "",
"weight": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/extras/graphs/")
.setHeader("content-type", "application/json")
.setBody("{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/graphs/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/extras/graphs/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/extras/graphs/")
.header("content-type", "application/json")
.body("{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\n}")
.asString();
const data = JSON.stringify({
id: 0,
link: '',
name: '',
source: '',
template_language: '',
type: '',
weight: 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}}/extras/graphs/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/extras/graphs/',
headers: {'content-type': 'application/json'},
data: {
id: 0,
link: '',
name: '',
source: '',
template_language: '',
type: '',
weight: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/graphs/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"id":0,"link":"","name":"","source":"","template_language":"","type":"","weight":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}}/extras/graphs/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "id": 0,\n "link": "",\n "name": "",\n "source": "",\n "template_language": "",\n "type": "",\n "weight": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/extras/graphs/")
.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/extras/graphs/',
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: 0,
link: '',
name: '',
source: '',
template_language: '',
type: '',
weight: 0
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/extras/graphs/',
headers: {'content-type': 'application/json'},
body: {
id: 0,
link: '',
name: '',
source: '',
template_language: '',
type: '',
weight: 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}}/extras/graphs/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
id: 0,
link: '',
name: '',
source: '',
template_language: '',
type: '',
weight: 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}}/extras/graphs/',
headers: {'content-type': 'application/json'},
data: {
id: 0,
link: '',
name: '',
source: '',
template_language: '',
type: '',
weight: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/graphs/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"id":0,"link":"","name":"","source":"","template_language":"","type":"","weight":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 = @{ @"id": @0,
@"link": @"",
@"name": @"",
@"source": @"",
@"template_language": @"",
@"type": @"",
@"weight": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/extras/graphs/"]
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}}/extras/graphs/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/graphs/",
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' => 0,
'link' => '',
'name' => '',
'source' => '',
'template_language' => '',
'type' => '',
'weight' => 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}}/extras/graphs/', [
'body' => '{
"id": 0,
"link": "",
"name": "",
"source": "",
"template_language": "",
"type": "",
"weight": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/extras/graphs/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'id' => 0,
'link' => '',
'name' => '',
'source' => '',
'template_language' => '',
'type' => '',
'weight' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'id' => 0,
'link' => '',
'name' => '',
'source' => '',
'template_language' => '',
'type' => '',
'weight' => 0
]));
$request->setRequestUrl('{{baseUrl}}/extras/graphs/');
$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}}/extras/graphs/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"id": 0,
"link": "",
"name": "",
"source": "",
"template_language": "",
"type": "",
"weight": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/graphs/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"id": 0,
"link": "",
"name": "",
"source": "",
"template_language": "",
"type": "",
"weight": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/extras/graphs/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/graphs/"
payload = {
"id": 0,
"link": "",
"name": "",
"source": "",
"template_language": "",
"type": "",
"weight": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/graphs/"
payload <- "{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/extras/graphs/")
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\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/extras/graphs/') do |req|
req.body = "{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/extras/graphs/";
let payload = json!({
"id": 0,
"link": "",
"name": "",
"source": "",
"template_language": "",
"type": "",
"weight": 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}}/extras/graphs/ \
--header 'content-type: application/json' \
--data '{
"id": 0,
"link": "",
"name": "",
"source": "",
"template_language": "",
"type": "",
"weight": 0
}'
echo '{
"id": 0,
"link": "",
"name": "",
"source": "",
"template_language": "",
"type": "",
"weight": 0
}' | \
http POST {{baseUrl}}/extras/graphs/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "id": 0,\n "link": "",\n "name": "",\n "source": "",\n "template_language": "",\n "type": "",\n "weight": 0\n}' \
--output-document \
- {{baseUrl}}/extras/graphs/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"id": 0,
"link": "",
"name": "",
"source": "",
"template_language": "",
"type": "",
"weight": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/graphs/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
extras_graphs_delete
{{baseUrl}}/extras/graphs/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/graphs/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/extras/graphs/:id/")
require "http/client"
url = "{{baseUrl}}/extras/graphs/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/extras/graphs/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/extras/graphs/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/graphs/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/extras/graphs/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/extras/graphs/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/graphs/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/extras/graphs/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/extras/graphs/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/extras/graphs/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/extras/graphs/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/graphs/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/extras/graphs/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/extras/graphs/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/extras/graphs/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/extras/graphs/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/extras/graphs/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/extras/graphs/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/graphs/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/extras/graphs/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/extras/graphs/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/graphs/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/extras/graphs/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/extras/graphs/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/extras/graphs/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/extras/graphs/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/graphs/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/extras/graphs/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/graphs/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/graphs/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/extras/graphs/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/extras/graphs/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/extras/graphs/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/extras/graphs/:id/
http DELETE {{baseUrl}}/extras/graphs/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/extras/graphs/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/graphs/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
extras_graphs_list
{{baseUrl}}/extras/graphs/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/graphs/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/extras/graphs/")
require "http/client"
url = "{{baseUrl}}/extras/graphs/"
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}}/extras/graphs/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/extras/graphs/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/graphs/"
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/extras/graphs/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/extras/graphs/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/graphs/"))
.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}}/extras/graphs/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/extras/graphs/")
.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}}/extras/graphs/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/extras/graphs/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/graphs/';
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}}/extras/graphs/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/extras/graphs/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/extras/graphs/',
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}}/extras/graphs/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/extras/graphs/');
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}}/extras/graphs/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/graphs/';
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}}/extras/graphs/"]
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}}/extras/graphs/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/graphs/",
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}}/extras/graphs/');
echo $response->getBody();
setUrl('{{baseUrl}}/extras/graphs/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/extras/graphs/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/extras/graphs/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/graphs/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/extras/graphs/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/graphs/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/graphs/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/extras/graphs/")
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/extras/graphs/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/extras/graphs/";
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}}/extras/graphs/
http GET {{baseUrl}}/extras/graphs/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/extras/graphs/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/graphs/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
extras_graphs_partial_update
{{baseUrl}}/extras/graphs/:id/
BODY json
{
"id": 0,
"link": "",
"name": "",
"source": "",
"template_language": "",
"type": "",
"weight": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/graphs/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/extras/graphs/:id/" {:content-type :json
:form-params {:id 0
:link ""
:name ""
:source ""
:template_language ""
:type ""
:weight 0}})
require "http/client"
url = "{{baseUrl}}/extras/graphs/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\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}}/extras/graphs/:id/"),
Content = new StringContent("{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/extras/graphs/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/graphs/:id/"
payload := strings.NewReader("{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\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/extras/graphs/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 113
{
"id": 0,
"link": "",
"name": "",
"source": "",
"template_language": "",
"type": "",
"weight": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/extras/graphs/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/graphs/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/extras/graphs/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/extras/graphs/:id/")
.header("content-type", "application/json")
.body("{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\n}")
.asString();
const data = JSON.stringify({
id: 0,
link: '',
name: '',
source: '',
template_language: '',
type: '',
weight: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/extras/graphs/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/extras/graphs/:id/',
headers: {'content-type': 'application/json'},
data: {
id: 0,
link: '',
name: '',
source: '',
template_language: '',
type: '',
weight: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/graphs/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"id":0,"link":"","name":"","source":"","template_language":"","type":"","weight":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}}/extras/graphs/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "id": 0,\n "link": "",\n "name": "",\n "source": "",\n "template_language": "",\n "type": "",\n "weight": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/extras/graphs/:id/")
.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/extras/graphs/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
id: 0,
link: '',
name: '',
source: '',
template_language: '',
type: '',
weight: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/extras/graphs/:id/',
headers: {'content-type': 'application/json'},
body: {
id: 0,
link: '',
name: '',
source: '',
template_language: '',
type: '',
weight: 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('PATCH', '{{baseUrl}}/extras/graphs/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
id: 0,
link: '',
name: '',
source: '',
template_language: '',
type: '',
weight: 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: 'PATCH',
url: '{{baseUrl}}/extras/graphs/:id/',
headers: {'content-type': 'application/json'},
data: {
id: 0,
link: '',
name: '',
source: '',
template_language: '',
type: '',
weight: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/graphs/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"id":0,"link":"","name":"","source":"","template_language":"","type":"","weight":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 = @{ @"id": @0,
@"link": @"",
@"name": @"",
@"source": @"",
@"template_language": @"",
@"type": @"",
@"weight": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/extras/graphs/:id/"]
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}}/extras/graphs/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/graphs/:id/",
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([
'id' => 0,
'link' => '',
'name' => '',
'source' => '',
'template_language' => '',
'type' => '',
'weight' => 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('PATCH', '{{baseUrl}}/extras/graphs/:id/', [
'body' => '{
"id": 0,
"link": "",
"name": "",
"source": "",
"template_language": "",
"type": "",
"weight": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/extras/graphs/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'id' => 0,
'link' => '',
'name' => '',
'source' => '',
'template_language' => '',
'type' => '',
'weight' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'id' => 0,
'link' => '',
'name' => '',
'source' => '',
'template_language' => '',
'type' => '',
'weight' => 0
]));
$request->setRequestUrl('{{baseUrl}}/extras/graphs/:id/');
$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}}/extras/graphs/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"id": 0,
"link": "",
"name": "",
"source": "",
"template_language": "",
"type": "",
"weight": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/graphs/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"id": 0,
"link": "",
"name": "",
"source": "",
"template_language": "",
"type": "",
"weight": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/extras/graphs/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/graphs/:id/"
payload = {
"id": 0,
"link": "",
"name": "",
"source": "",
"template_language": "",
"type": "",
"weight": 0
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/graphs/:id/"
payload <- "{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\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}}/extras/graphs/:id/")
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 \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/extras/graphs/:id/') do |req|
req.body = "{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\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}}/extras/graphs/:id/";
let payload = json!({
"id": 0,
"link": "",
"name": "",
"source": "",
"template_language": "",
"type": "",
"weight": 0
});
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}}/extras/graphs/:id/ \
--header 'content-type: application/json' \
--data '{
"id": 0,
"link": "",
"name": "",
"source": "",
"template_language": "",
"type": "",
"weight": 0
}'
echo '{
"id": 0,
"link": "",
"name": "",
"source": "",
"template_language": "",
"type": "",
"weight": 0
}' | \
http PATCH {{baseUrl}}/extras/graphs/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "id": 0,\n "link": "",\n "name": "",\n "source": "",\n "template_language": "",\n "type": "",\n "weight": 0\n}' \
--output-document \
- {{baseUrl}}/extras/graphs/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"id": 0,
"link": "",
"name": "",
"source": "",
"template_language": "",
"type": "",
"weight": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/graphs/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
extras_graphs_read
{{baseUrl}}/extras/graphs/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/graphs/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/extras/graphs/:id/")
require "http/client"
url = "{{baseUrl}}/extras/graphs/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/extras/graphs/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/extras/graphs/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/graphs/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/extras/graphs/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/extras/graphs/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/graphs/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/extras/graphs/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/extras/graphs/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/extras/graphs/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/extras/graphs/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/graphs/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/extras/graphs/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/extras/graphs/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/extras/graphs/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/extras/graphs/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/extras/graphs/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/extras/graphs/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/graphs/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/extras/graphs/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/extras/graphs/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/graphs/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/extras/graphs/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/extras/graphs/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/extras/graphs/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/extras/graphs/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/graphs/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/extras/graphs/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/graphs/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/graphs/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/extras/graphs/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/extras/graphs/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/extras/graphs/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/extras/graphs/:id/
http GET {{baseUrl}}/extras/graphs/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/extras/graphs/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/graphs/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
extras_graphs_update
{{baseUrl}}/extras/graphs/:id/
BODY json
{
"id": 0,
"link": "",
"name": "",
"source": "",
"template_language": "",
"type": "",
"weight": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/graphs/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/extras/graphs/:id/" {:content-type :json
:form-params {:id 0
:link ""
:name ""
:source ""
:template_language ""
:type ""
:weight 0}})
require "http/client"
url = "{{baseUrl}}/extras/graphs/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\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}}/extras/graphs/:id/"),
Content = new StringContent("{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/extras/graphs/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/graphs/:id/"
payload := strings.NewReader("{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\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/extras/graphs/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 113
{
"id": 0,
"link": "",
"name": "",
"source": "",
"template_language": "",
"type": "",
"weight": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/extras/graphs/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/graphs/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/extras/graphs/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/extras/graphs/:id/")
.header("content-type", "application/json")
.body("{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\n}")
.asString();
const data = JSON.stringify({
id: 0,
link: '',
name: '',
source: '',
template_language: '',
type: '',
weight: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/extras/graphs/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/extras/graphs/:id/',
headers: {'content-type': 'application/json'},
data: {
id: 0,
link: '',
name: '',
source: '',
template_language: '',
type: '',
weight: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/graphs/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"id":0,"link":"","name":"","source":"","template_language":"","type":"","weight":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}}/extras/graphs/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "id": 0,\n "link": "",\n "name": "",\n "source": "",\n "template_language": "",\n "type": "",\n "weight": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/extras/graphs/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/extras/graphs/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
id: 0,
link: '',
name: '',
source: '',
template_language: '',
type: '',
weight: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/extras/graphs/:id/',
headers: {'content-type': 'application/json'},
body: {
id: 0,
link: '',
name: '',
source: '',
template_language: '',
type: '',
weight: 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('PUT', '{{baseUrl}}/extras/graphs/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
id: 0,
link: '',
name: '',
source: '',
template_language: '',
type: '',
weight: 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: 'PUT',
url: '{{baseUrl}}/extras/graphs/:id/',
headers: {'content-type': 'application/json'},
data: {
id: 0,
link: '',
name: '',
source: '',
template_language: '',
type: '',
weight: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/graphs/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"id":0,"link":"","name":"","source":"","template_language":"","type":"","weight":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 = @{ @"id": @0,
@"link": @"",
@"name": @"",
@"source": @"",
@"template_language": @"",
@"type": @"",
@"weight": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/extras/graphs/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/extras/graphs/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/graphs/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'id' => 0,
'link' => '',
'name' => '',
'source' => '',
'template_language' => '',
'type' => '',
'weight' => 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('PUT', '{{baseUrl}}/extras/graphs/:id/', [
'body' => '{
"id": 0,
"link": "",
"name": "",
"source": "",
"template_language": "",
"type": "",
"weight": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/extras/graphs/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'id' => 0,
'link' => '',
'name' => '',
'source' => '',
'template_language' => '',
'type' => '',
'weight' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'id' => 0,
'link' => '',
'name' => '',
'source' => '',
'template_language' => '',
'type' => '',
'weight' => 0
]));
$request->setRequestUrl('{{baseUrl}}/extras/graphs/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/extras/graphs/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"id": 0,
"link": "",
"name": "",
"source": "",
"template_language": "",
"type": "",
"weight": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/graphs/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"id": 0,
"link": "",
"name": "",
"source": "",
"template_language": "",
"type": "",
"weight": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/extras/graphs/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/graphs/:id/"
payload = {
"id": 0,
"link": "",
"name": "",
"source": "",
"template_language": "",
"type": "",
"weight": 0
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/graphs/:id/"
payload <- "{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\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}}/extras/graphs/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/extras/graphs/:id/') do |req|
req.body = "{\n \"id\": 0,\n \"link\": \"\",\n \"name\": \"\",\n \"source\": \"\",\n \"template_language\": \"\",\n \"type\": \"\",\n \"weight\": 0\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}}/extras/graphs/:id/";
let payload = json!({
"id": 0,
"link": "",
"name": "",
"source": "",
"template_language": "",
"type": "",
"weight": 0
});
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}}/extras/graphs/:id/ \
--header 'content-type: application/json' \
--data '{
"id": 0,
"link": "",
"name": "",
"source": "",
"template_language": "",
"type": "",
"weight": 0
}'
echo '{
"id": 0,
"link": "",
"name": "",
"source": "",
"template_language": "",
"type": "",
"weight": 0
}' | \
http PUT {{baseUrl}}/extras/graphs/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "id": 0,\n "link": "",\n "name": "",\n "source": "",\n "template_language": "",\n "type": "",\n "weight": 0\n}' \
--output-document \
- {{baseUrl}}/extras/graphs/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"id": 0,
"link": "",
"name": "",
"source": "",
"template_language": "",
"type": "",
"weight": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/graphs/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
extras_image-attachments_create
{{baseUrl}}/extras/image-attachments/
BODY json
{
"content_type": "",
"created": "",
"id": 0,
"image": "",
"image_height": 0,
"image_width": 0,
"name": "",
"object_id": 0,
"parent": {}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/image-attachments/");
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 \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/extras/image-attachments/" {:content-type :json
:form-params {:content_type ""
:created ""
:id 0
:image ""
:image_height 0
:image_width 0
:name ""
:object_id 0
:parent {}}})
require "http/client"
url = "{{baseUrl}}/extras/image-attachments/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\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}}/extras/image-attachments/"),
Content = new StringContent("{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\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}}/extras/image-attachments/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/image-attachments/"
payload := strings.NewReader("{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\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/extras/image-attachments/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 156
{
"content_type": "",
"created": "",
"id": 0,
"image": "",
"image_height": 0,
"image_width": 0,
"name": "",
"object_id": 0,
"parent": {}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/extras/image-attachments/")
.setHeader("content-type", "application/json")
.setBody("{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/image-attachments/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\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 \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/extras/image-attachments/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/extras/image-attachments/")
.header("content-type", "application/json")
.body("{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\n}")
.asString();
const data = JSON.stringify({
content_type: '',
created: '',
id: 0,
image: '',
image_height: 0,
image_width: 0,
name: '',
object_id: 0,
parent: {}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/extras/image-attachments/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/extras/image-attachments/',
headers: {'content-type': 'application/json'},
data: {
content_type: '',
created: '',
id: 0,
image: '',
image_height: 0,
image_width: 0,
name: '',
object_id: 0,
parent: {}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/image-attachments/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"content_type":"","created":"","id":0,"image":"","image_height":0,"image_width":0,"name":"","object_id":0,"parent":{}}'
};
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}}/extras/image-attachments/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "content_type": "",\n "created": "",\n "id": 0,\n "image": "",\n "image_height": 0,\n "image_width": 0,\n "name": "",\n "object_id": 0,\n "parent": {}\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\n}")
val request = Request.Builder()
.url("{{baseUrl}}/extras/image-attachments/")
.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/extras/image-attachments/',
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({
content_type: '',
created: '',
id: 0,
image: '',
image_height: 0,
image_width: 0,
name: '',
object_id: 0,
parent: {}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/extras/image-attachments/',
headers: {'content-type': 'application/json'},
body: {
content_type: '',
created: '',
id: 0,
image: '',
image_height: 0,
image_width: 0,
name: '',
object_id: 0,
parent: {}
},
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}}/extras/image-attachments/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
content_type: '',
created: '',
id: 0,
image: '',
image_height: 0,
image_width: 0,
name: '',
object_id: 0,
parent: {}
});
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}}/extras/image-attachments/',
headers: {'content-type': 'application/json'},
data: {
content_type: '',
created: '',
id: 0,
image: '',
image_height: 0,
image_width: 0,
name: '',
object_id: 0,
parent: {}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/image-attachments/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"content_type":"","created":"","id":0,"image":"","image_height":0,"image_width":0,"name":"","object_id":0,"parent":{}}'
};
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 = @{ @"content_type": @"",
@"created": @"",
@"id": @0,
@"image": @"",
@"image_height": @0,
@"image_width": @0,
@"name": @"",
@"object_id": @0,
@"parent": @{ } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/extras/image-attachments/"]
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}}/extras/image-attachments/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/image-attachments/",
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([
'content_type' => '',
'created' => '',
'id' => 0,
'image' => '',
'image_height' => 0,
'image_width' => 0,
'name' => '',
'object_id' => 0,
'parent' => [
]
]),
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}}/extras/image-attachments/', [
'body' => '{
"content_type": "",
"created": "",
"id": 0,
"image": "",
"image_height": 0,
"image_width": 0,
"name": "",
"object_id": 0,
"parent": {}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/extras/image-attachments/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'content_type' => '',
'created' => '',
'id' => 0,
'image' => '',
'image_height' => 0,
'image_width' => 0,
'name' => '',
'object_id' => 0,
'parent' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'content_type' => '',
'created' => '',
'id' => 0,
'image' => '',
'image_height' => 0,
'image_width' => 0,
'name' => '',
'object_id' => 0,
'parent' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/extras/image-attachments/');
$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}}/extras/image-attachments/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"content_type": "",
"created": "",
"id": 0,
"image": "",
"image_height": 0,
"image_width": 0,
"name": "",
"object_id": 0,
"parent": {}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/image-attachments/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"content_type": "",
"created": "",
"id": 0,
"image": "",
"image_height": 0,
"image_width": 0,
"name": "",
"object_id": 0,
"parent": {}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/extras/image-attachments/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/image-attachments/"
payload = {
"content_type": "",
"created": "",
"id": 0,
"image": "",
"image_height": 0,
"image_width": 0,
"name": "",
"object_id": 0,
"parent": {}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/image-attachments/"
payload <- "{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\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}}/extras/image-attachments/")
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 \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\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/extras/image-attachments/') do |req|
req.body = "{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/extras/image-attachments/";
let payload = json!({
"content_type": "",
"created": "",
"id": 0,
"image": "",
"image_height": 0,
"image_width": 0,
"name": "",
"object_id": 0,
"parent": 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}}/extras/image-attachments/ \
--header 'content-type: application/json' \
--data '{
"content_type": "",
"created": "",
"id": 0,
"image": "",
"image_height": 0,
"image_width": 0,
"name": "",
"object_id": 0,
"parent": {}
}'
echo '{
"content_type": "",
"created": "",
"id": 0,
"image": "",
"image_height": 0,
"image_width": 0,
"name": "",
"object_id": 0,
"parent": {}
}' | \
http POST {{baseUrl}}/extras/image-attachments/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "content_type": "",\n "created": "",\n "id": 0,\n "image": "",\n "image_height": 0,\n "image_width": 0,\n "name": "",\n "object_id": 0,\n "parent": {}\n}' \
--output-document \
- {{baseUrl}}/extras/image-attachments/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"content_type": "",
"created": "",
"id": 0,
"image": "",
"image_height": 0,
"image_width": 0,
"name": "",
"object_id": 0,
"parent": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/image-attachments/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
extras_image-attachments_delete
{{baseUrl}}/extras/image-attachments/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/image-attachments/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/extras/image-attachments/:id/")
require "http/client"
url = "{{baseUrl}}/extras/image-attachments/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/extras/image-attachments/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/extras/image-attachments/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/image-attachments/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/extras/image-attachments/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/extras/image-attachments/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/image-attachments/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/extras/image-attachments/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/extras/image-attachments/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/extras/image-attachments/:id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/extras/image-attachments/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/image-attachments/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/extras/image-attachments/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/extras/image-attachments/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/extras/image-attachments/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/extras/image-attachments/:id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/extras/image-attachments/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/extras/image-attachments/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/image-attachments/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/extras/image-attachments/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/extras/image-attachments/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/image-attachments/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/extras/image-attachments/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/extras/image-attachments/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/extras/image-attachments/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/extras/image-attachments/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/image-attachments/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/extras/image-attachments/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/image-attachments/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/image-attachments/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/extras/image-attachments/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/extras/image-attachments/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/extras/image-attachments/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/extras/image-attachments/:id/
http DELETE {{baseUrl}}/extras/image-attachments/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/extras/image-attachments/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/image-attachments/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
extras_image-attachments_list
{{baseUrl}}/extras/image-attachments/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/image-attachments/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/extras/image-attachments/")
require "http/client"
url = "{{baseUrl}}/extras/image-attachments/"
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}}/extras/image-attachments/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/extras/image-attachments/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/image-attachments/"
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/extras/image-attachments/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/extras/image-attachments/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/image-attachments/"))
.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}}/extras/image-attachments/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/extras/image-attachments/")
.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}}/extras/image-attachments/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/extras/image-attachments/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/image-attachments/';
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}}/extras/image-attachments/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/extras/image-attachments/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/extras/image-attachments/',
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}}/extras/image-attachments/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/extras/image-attachments/');
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}}/extras/image-attachments/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/image-attachments/';
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}}/extras/image-attachments/"]
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}}/extras/image-attachments/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/image-attachments/",
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}}/extras/image-attachments/');
echo $response->getBody();
setUrl('{{baseUrl}}/extras/image-attachments/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/extras/image-attachments/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/extras/image-attachments/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/image-attachments/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/extras/image-attachments/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/image-attachments/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/image-attachments/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/extras/image-attachments/")
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/extras/image-attachments/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/extras/image-attachments/";
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}}/extras/image-attachments/
http GET {{baseUrl}}/extras/image-attachments/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/extras/image-attachments/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/image-attachments/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
extras_image-attachments_partial_update
{{baseUrl}}/extras/image-attachments/:id/
BODY json
{
"content_type": "",
"created": "",
"id": 0,
"image": "",
"image_height": 0,
"image_width": 0,
"name": "",
"object_id": 0,
"parent": {}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/image-attachments/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/extras/image-attachments/:id/" {:content-type :json
:form-params {:content_type ""
:created ""
:id 0
:image ""
:image_height 0
:image_width 0
:name ""
:object_id 0
:parent {}}})
require "http/client"
url = "{{baseUrl}}/extras/image-attachments/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\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}}/extras/image-attachments/:id/"),
Content = new StringContent("{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\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}}/extras/image-attachments/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/image-attachments/:id/"
payload := strings.NewReader("{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\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/extras/image-attachments/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 156
{
"content_type": "",
"created": "",
"id": 0,
"image": "",
"image_height": 0,
"image_width": 0,
"name": "",
"object_id": 0,
"parent": {}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/extras/image-attachments/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/image-attachments/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\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 \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/extras/image-attachments/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/extras/image-attachments/:id/")
.header("content-type", "application/json")
.body("{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\n}")
.asString();
const data = JSON.stringify({
content_type: '',
created: '',
id: 0,
image: '',
image_height: 0,
image_width: 0,
name: '',
object_id: 0,
parent: {}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/extras/image-attachments/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/extras/image-attachments/:id/',
headers: {'content-type': 'application/json'},
data: {
content_type: '',
created: '',
id: 0,
image: '',
image_height: 0,
image_width: 0,
name: '',
object_id: 0,
parent: {}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/image-attachments/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"content_type":"","created":"","id":0,"image":"","image_height":0,"image_width":0,"name":"","object_id":0,"parent":{}}'
};
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}}/extras/image-attachments/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "content_type": "",\n "created": "",\n "id": 0,\n "image": "",\n "image_height": 0,\n "image_width": 0,\n "name": "",\n "object_id": 0,\n "parent": {}\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\n}")
val request = Request.Builder()
.url("{{baseUrl}}/extras/image-attachments/:id/")
.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/extras/image-attachments/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
content_type: '',
created: '',
id: 0,
image: '',
image_height: 0,
image_width: 0,
name: '',
object_id: 0,
parent: {}
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/extras/image-attachments/:id/',
headers: {'content-type': 'application/json'},
body: {
content_type: '',
created: '',
id: 0,
image: '',
image_height: 0,
image_width: 0,
name: '',
object_id: 0,
parent: {}
},
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}}/extras/image-attachments/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
content_type: '',
created: '',
id: 0,
image: '',
image_height: 0,
image_width: 0,
name: '',
object_id: 0,
parent: {}
});
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}}/extras/image-attachments/:id/',
headers: {'content-type': 'application/json'},
data: {
content_type: '',
created: '',
id: 0,
image: '',
image_height: 0,
image_width: 0,
name: '',
object_id: 0,
parent: {}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/image-attachments/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"content_type":"","created":"","id":0,"image":"","image_height":0,"image_width":0,"name":"","object_id":0,"parent":{}}'
};
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 = @{ @"content_type": @"",
@"created": @"",
@"id": @0,
@"image": @"",
@"image_height": @0,
@"image_width": @0,
@"name": @"",
@"object_id": @0,
@"parent": @{ } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/extras/image-attachments/:id/"]
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}}/extras/image-attachments/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/image-attachments/:id/",
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([
'content_type' => '',
'created' => '',
'id' => 0,
'image' => '',
'image_height' => 0,
'image_width' => 0,
'name' => '',
'object_id' => 0,
'parent' => [
]
]),
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}}/extras/image-attachments/:id/', [
'body' => '{
"content_type": "",
"created": "",
"id": 0,
"image": "",
"image_height": 0,
"image_width": 0,
"name": "",
"object_id": 0,
"parent": {}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/extras/image-attachments/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'content_type' => '',
'created' => '',
'id' => 0,
'image' => '',
'image_height' => 0,
'image_width' => 0,
'name' => '',
'object_id' => 0,
'parent' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'content_type' => '',
'created' => '',
'id' => 0,
'image' => '',
'image_height' => 0,
'image_width' => 0,
'name' => '',
'object_id' => 0,
'parent' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/extras/image-attachments/:id/');
$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}}/extras/image-attachments/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"content_type": "",
"created": "",
"id": 0,
"image": "",
"image_height": 0,
"image_width": 0,
"name": "",
"object_id": 0,
"parent": {}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/image-attachments/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"content_type": "",
"created": "",
"id": 0,
"image": "",
"image_height": 0,
"image_width": 0,
"name": "",
"object_id": 0,
"parent": {}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/extras/image-attachments/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/image-attachments/:id/"
payload = {
"content_type": "",
"created": "",
"id": 0,
"image": "",
"image_height": 0,
"image_width": 0,
"name": "",
"object_id": 0,
"parent": {}
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/image-attachments/:id/"
payload <- "{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\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}}/extras/image-attachments/:id/")
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 \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\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/extras/image-attachments/:id/') do |req|
req.body = "{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\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}}/extras/image-attachments/:id/";
let payload = json!({
"content_type": "",
"created": "",
"id": 0,
"image": "",
"image_height": 0,
"image_width": 0,
"name": "",
"object_id": 0,
"parent": json!({})
});
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}}/extras/image-attachments/:id/ \
--header 'content-type: application/json' \
--data '{
"content_type": "",
"created": "",
"id": 0,
"image": "",
"image_height": 0,
"image_width": 0,
"name": "",
"object_id": 0,
"parent": {}
}'
echo '{
"content_type": "",
"created": "",
"id": 0,
"image": "",
"image_height": 0,
"image_width": 0,
"name": "",
"object_id": 0,
"parent": {}
}' | \
http PATCH {{baseUrl}}/extras/image-attachments/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "content_type": "",\n "created": "",\n "id": 0,\n "image": "",\n "image_height": 0,\n "image_width": 0,\n "name": "",\n "object_id": 0,\n "parent": {}\n}' \
--output-document \
- {{baseUrl}}/extras/image-attachments/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"content_type": "",
"created": "",
"id": 0,
"image": "",
"image_height": 0,
"image_width": 0,
"name": "",
"object_id": 0,
"parent": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/image-attachments/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
extras_image-attachments_read
{{baseUrl}}/extras/image-attachments/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/image-attachments/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/extras/image-attachments/:id/")
require "http/client"
url = "{{baseUrl}}/extras/image-attachments/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/extras/image-attachments/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/extras/image-attachments/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/image-attachments/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/extras/image-attachments/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/extras/image-attachments/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/image-attachments/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/extras/image-attachments/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/extras/image-attachments/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/extras/image-attachments/:id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/extras/image-attachments/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/image-attachments/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/extras/image-attachments/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/extras/image-attachments/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/extras/image-attachments/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/extras/image-attachments/:id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/extras/image-attachments/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/extras/image-attachments/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/image-attachments/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/extras/image-attachments/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/extras/image-attachments/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/image-attachments/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/extras/image-attachments/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/extras/image-attachments/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/extras/image-attachments/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/extras/image-attachments/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/image-attachments/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/extras/image-attachments/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/image-attachments/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/image-attachments/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/extras/image-attachments/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/extras/image-attachments/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/extras/image-attachments/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/extras/image-attachments/:id/
http GET {{baseUrl}}/extras/image-attachments/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/extras/image-attachments/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/image-attachments/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
extras_image-attachments_update
{{baseUrl}}/extras/image-attachments/:id/
BODY json
{
"content_type": "",
"created": "",
"id": 0,
"image": "",
"image_height": 0,
"image_width": 0,
"name": "",
"object_id": 0,
"parent": {}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/image-attachments/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/extras/image-attachments/:id/" {:content-type :json
:form-params {:content_type ""
:created ""
:id 0
:image ""
:image_height 0
:image_width 0
:name ""
:object_id 0
:parent {}}})
require "http/client"
url = "{{baseUrl}}/extras/image-attachments/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\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}}/extras/image-attachments/:id/"),
Content = new StringContent("{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\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}}/extras/image-attachments/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/image-attachments/:id/"
payload := strings.NewReader("{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\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/extras/image-attachments/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 156
{
"content_type": "",
"created": "",
"id": 0,
"image": "",
"image_height": 0,
"image_width": 0,
"name": "",
"object_id": 0,
"parent": {}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/extras/image-attachments/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/image-attachments/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\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 \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/extras/image-attachments/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/extras/image-attachments/:id/")
.header("content-type", "application/json")
.body("{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\n}")
.asString();
const data = JSON.stringify({
content_type: '',
created: '',
id: 0,
image: '',
image_height: 0,
image_width: 0,
name: '',
object_id: 0,
parent: {}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/extras/image-attachments/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/extras/image-attachments/:id/',
headers: {'content-type': 'application/json'},
data: {
content_type: '',
created: '',
id: 0,
image: '',
image_height: 0,
image_width: 0,
name: '',
object_id: 0,
parent: {}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/image-attachments/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"content_type":"","created":"","id":0,"image":"","image_height":0,"image_width":0,"name":"","object_id":0,"parent":{}}'
};
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}}/extras/image-attachments/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "content_type": "",\n "created": "",\n "id": 0,\n "image": "",\n "image_height": 0,\n "image_width": 0,\n "name": "",\n "object_id": 0,\n "parent": {}\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\n}")
val request = Request.Builder()
.url("{{baseUrl}}/extras/image-attachments/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/extras/image-attachments/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
content_type: '',
created: '',
id: 0,
image: '',
image_height: 0,
image_width: 0,
name: '',
object_id: 0,
parent: {}
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/extras/image-attachments/:id/',
headers: {'content-type': 'application/json'},
body: {
content_type: '',
created: '',
id: 0,
image: '',
image_height: 0,
image_width: 0,
name: '',
object_id: 0,
parent: {}
},
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}}/extras/image-attachments/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
content_type: '',
created: '',
id: 0,
image: '',
image_height: 0,
image_width: 0,
name: '',
object_id: 0,
parent: {}
});
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}}/extras/image-attachments/:id/',
headers: {'content-type': 'application/json'},
data: {
content_type: '',
created: '',
id: 0,
image: '',
image_height: 0,
image_width: 0,
name: '',
object_id: 0,
parent: {}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/image-attachments/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"content_type":"","created":"","id":0,"image":"","image_height":0,"image_width":0,"name":"","object_id":0,"parent":{}}'
};
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 = @{ @"content_type": @"",
@"created": @"",
@"id": @0,
@"image": @"",
@"image_height": @0,
@"image_width": @0,
@"name": @"",
@"object_id": @0,
@"parent": @{ } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/extras/image-attachments/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/extras/image-attachments/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/image-attachments/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'content_type' => '',
'created' => '',
'id' => 0,
'image' => '',
'image_height' => 0,
'image_width' => 0,
'name' => '',
'object_id' => 0,
'parent' => [
]
]),
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}}/extras/image-attachments/:id/', [
'body' => '{
"content_type": "",
"created": "",
"id": 0,
"image": "",
"image_height": 0,
"image_width": 0,
"name": "",
"object_id": 0,
"parent": {}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/extras/image-attachments/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'content_type' => '',
'created' => '',
'id' => 0,
'image' => '',
'image_height' => 0,
'image_width' => 0,
'name' => '',
'object_id' => 0,
'parent' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'content_type' => '',
'created' => '',
'id' => 0,
'image' => '',
'image_height' => 0,
'image_width' => 0,
'name' => '',
'object_id' => 0,
'parent' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/extras/image-attachments/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/extras/image-attachments/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"content_type": "",
"created": "",
"id": 0,
"image": "",
"image_height": 0,
"image_width": 0,
"name": "",
"object_id": 0,
"parent": {}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/image-attachments/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"content_type": "",
"created": "",
"id": 0,
"image": "",
"image_height": 0,
"image_width": 0,
"name": "",
"object_id": 0,
"parent": {}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/extras/image-attachments/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/image-attachments/:id/"
payload = {
"content_type": "",
"created": "",
"id": 0,
"image": "",
"image_height": 0,
"image_width": 0,
"name": "",
"object_id": 0,
"parent": {}
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/image-attachments/:id/"
payload <- "{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\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}}/extras/image-attachments/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\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/extras/image-attachments/:id/') do |req|
req.body = "{\n \"content_type\": \"\",\n \"created\": \"\",\n \"id\": 0,\n \"image\": \"\",\n \"image_height\": 0,\n \"image_width\": 0,\n \"name\": \"\",\n \"object_id\": 0,\n \"parent\": {}\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}}/extras/image-attachments/:id/";
let payload = json!({
"content_type": "",
"created": "",
"id": 0,
"image": "",
"image_height": 0,
"image_width": 0,
"name": "",
"object_id": 0,
"parent": json!({})
});
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}}/extras/image-attachments/:id/ \
--header 'content-type: application/json' \
--data '{
"content_type": "",
"created": "",
"id": 0,
"image": "",
"image_height": 0,
"image_width": 0,
"name": "",
"object_id": 0,
"parent": {}
}'
echo '{
"content_type": "",
"created": "",
"id": 0,
"image": "",
"image_height": 0,
"image_width": 0,
"name": "",
"object_id": 0,
"parent": {}
}' | \
http PUT {{baseUrl}}/extras/image-attachments/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "content_type": "",\n "created": "",\n "id": 0,\n "image": "",\n "image_height": 0,\n "image_width": 0,\n "name": "",\n "object_id": 0,\n "parent": {}\n}' \
--output-document \
- {{baseUrl}}/extras/image-attachments/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"content_type": "",
"created": "",
"id": 0,
"image": "",
"image_height": 0,
"image_width": 0,
"name": "",
"object_id": 0,
"parent": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/image-attachments/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
extras_object-changes_list
{{baseUrl}}/extras/object-changes/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/object-changes/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/extras/object-changes/")
require "http/client"
url = "{{baseUrl}}/extras/object-changes/"
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}}/extras/object-changes/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/extras/object-changes/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/object-changes/"
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/extras/object-changes/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/extras/object-changes/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/object-changes/"))
.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}}/extras/object-changes/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/extras/object-changes/")
.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}}/extras/object-changes/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/extras/object-changes/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/object-changes/';
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}}/extras/object-changes/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/extras/object-changes/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/extras/object-changes/',
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}}/extras/object-changes/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/extras/object-changes/');
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}}/extras/object-changes/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/object-changes/';
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}}/extras/object-changes/"]
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}}/extras/object-changes/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/object-changes/",
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}}/extras/object-changes/');
echo $response->getBody();
setUrl('{{baseUrl}}/extras/object-changes/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/extras/object-changes/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/extras/object-changes/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/object-changes/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/extras/object-changes/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/object-changes/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/object-changes/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/extras/object-changes/")
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/extras/object-changes/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/extras/object-changes/";
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}}/extras/object-changes/
http GET {{baseUrl}}/extras/object-changes/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/extras/object-changes/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/object-changes/")! 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
extras_object-changes_read
{{baseUrl}}/extras/object-changes/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/object-changes/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/extras/object-changes/:id/")
require "http/client"
url = "{{baseUrl}}/extras/object-changes/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/extras/object-changes/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/extras/object-changes/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/object-changes/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/extras/object-changes/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/extras/object-changes/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/object-changes/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/extras/object-changes/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/extras/object-changes/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/extras/object-changes/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/extras/object-changes/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/object-changes/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/extras/object-changes/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/extras/object-changes/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/extras/object-changes/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/extras/object-changes/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/extras/object-changes/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/extras/object-changes/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/object-changes/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/extras/object-changes/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/extras/object-changes/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/object-changes/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/extras/object-changes/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/extras/object-changes/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/extras/object-changes/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/extras/object-changes/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/object-changes/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/extras/object-changes/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/object-changes/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/object-changes/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/extras/object-changes/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/extras/object-changes/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/extras/object-changes/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/extras/object-changes/:id/
http GET {{baseUrl}}/extras/object-changes/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/extras/object-changes/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/object-changes/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
extras_reports_list
{{baseUrl}}/extras/reports/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/reports/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/extras/reports/")
require "http/client"
url = "{{baseUrl}}/extras/reports/"
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}}/extras/reports/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/extras/reports/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/reports/"
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/extras/reports/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/extras/reports/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/reports/"))
.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}}/extras/reports/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/extras/reports/")
.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}}/extras/reports/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/extras/reports/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/reports/';
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}}/extras/reports/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/extras/reports/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/extras/reports/',
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}}/extras/reports/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/extras/reports/');
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}}/extras/reports/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/reports/';
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}}/extras/reports/"]
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}}/extras/reports/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/reports/",
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}}/extras/reports/');
echo $response->getBody();
setUrl('{{baseUrl}}/extras/reports/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/extras/reports/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/extras/reports/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/reports/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/extras/reports/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/reports/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/reports/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/extras/reports/")
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/extras/reports/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/extras/reports/";
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}}/extras/reports/
http GET {{baseUrl}}/extras/reports/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/extras/reports/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/reports/")! 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
extras_reports_read
{{baseUrl}}/extras/reports/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/reports/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/extras/reports/:id/")
require "http/client"
url = "{{baseUrl}}/extras/reports/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/extras/reports/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/extras/reports/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/reports/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/extras/reports/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/extras/reports/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/reports/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/extras/reports/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/extras/reports/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/extras/reports/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/extras/reports/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/reports/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/extras/reports/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/extras/reports/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/extras/reports/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/extras/reports/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/extras/reports/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/extras/reports/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/reports/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/extras/reports/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/extras/reports/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/reports/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/extras/reports/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/extras/reports/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/extras/reports/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/extras/reports/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/reports/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/extras/reports/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/reports/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/reports/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/extras/reports/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/extras/reports/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/extras/reports/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/extras/reports/:id/
http GET {{baseUrl}}/extras/reports/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/extras/reports/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/reports/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
extras_reports_run
{{baseUrl}}/extras/reports/:id/run/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/reports/:id/run/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/extras/reports/:id/run/")
require "http/client"
url = "{{baseUrl}}/extras/reports/:id/run/"
response = HTTP::Client.post url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/extras/reports/:id/run/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/extras/reports/:id/run/");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/reports/:id/run/"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/extras/reports/:id/run/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/extras/reports/:id/run/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/reports/:id/run/"))
.method("POST", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/extras/reports/:id/run/")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/extras/reports/:id/run/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/extras/reports/:id/run/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'POST', url: '{{baseUrl}}/extras/reports/:id/run/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/reports/:id/run/';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/extras/reports/:id/run/',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/extras/reports/:id/run/")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/extras/reports/:id/run/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'POST', url: '{{baseUrl}}/extras/reports/:id/run/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/extras/reports/:id/run/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'POST', url: '{{baseUrl}}/extras/reports/:id/run/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/reports/:id/run/';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/extras/reports/:id/run/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/extras/reports/:id/run/" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/reports/:id/run/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/extras/reports/:id/run/');
echo $response->getBody();
setUrl('{{baseUrl}}/extras/reports/:id/run/');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/extras/reports/:id/run/');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/extras/reports/:id/run/' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/reports/:id/run/' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/extras/reports/:id/run/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/reports/:id/run/"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/reports/:id/run/"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/extras/reports/:id/run/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.post('/baseUrl/extras/reports/:id/run/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/extras/reports/:id/run/";
let client = reqwest::Client::new();
let response = client.post(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/extras/reports/:id/run/
http POST {{baseUrl}}/extras/reports/:id/run/
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/extras/reports/:id/run/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/reports/:id/run/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
extras_scripts_list
{{baseUrl}}/extras/scripts/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/scripts/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/extras/scripts/")
require "http/client"
url = "{{baseUrl}}/extras/scripts/"
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}}/extras/scripts/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/extras/scripts/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/scripts/"
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/extras/scripts/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/extras/scripts/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/scripts/"))
.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}}/extras/scripts/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/extras/scripts/")
.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}}/extras/scripts/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/extras/scripts/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/scripts/';
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}}/extras/scripts/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/extras/scripts/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/extras/scripts/',
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}}/extras/scripts/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/extras/scripts/');
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}}/extras/scripts/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/scripts/';
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}}/extras/scripts/"]
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}}/extras/scripts/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/scripts/",
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}}/extras/scripts/');
echo $response->getBody();
setUrl('{{baseUrl}}/extras/scripts/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/extras/scripts/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/extras/scripts/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/scripts/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/extras/scripts/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/scripts/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/scripts/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/extras/scripts/")
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/extras/scripts/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/extras/scripts/";
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}}/extras/scripts/
http GET {{baseUrl}}/extras/scripts/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/extras/scripts/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/scripts/")! 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
extras_scripts_read
{{baseUrl}}/extras/scripts/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/scripts/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/extras/scripts/:id/")
require "http/client"
url = "{{baseUrl}}/extras/scripts/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/extras/scripts/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/extras/scripts/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/scripts/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/extras/scripts/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/extras/scripts/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/scripts/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/extras/scripts/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/extras/scripts/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/extras/scripts/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/extras/scripts/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/scripts/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/extras/scripts/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/extras/scripts/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/extras/scripts/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/extras/scripts/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/extras/scripts/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/extras/scripts/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/scripts/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/extras/scripts/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/extras/scripts/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/scripts/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/extras/scripts/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/extras/scripts/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/extras/scripts/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/extras/scripts/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/scripts/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/extras/scripts/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/scripts/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/scripts/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/extras/scripts/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/extras/scripts/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/extras/scripts/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/extras/scripts/:id/
http GET {{baseUrl}}/extras/scripts/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/extras/scripts/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/scripts/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
extras_tags_create
{{baseUrl}}/extras/tags/
BODY json
{
"color": "",
"description": "",
"id": 0,
"name": "",
"slug": "",
"tagged_items": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/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 \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/extras/tags/" {:content-type :json
:form-params {:color ""
:description ""
:id 0
:name ""
:slug ""
:tagged_items 0}})
require "http/client"
url = "{{baseUrl}}/extras/tags/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/extras/tags/"),
Content = new StringContent("{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/extras/tags/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/tags/"
payload := strings.NewReader("{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/extras/tags/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 98
{
"color": "",
"description": "",
"id": 0,
"name": "",
"slug": "",
"tagged_items": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/extras/tags/")
.setHeader("content-type", "application/json")
.setBody("{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/tags/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/extras/tags/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/extras/tags/")
.header("content-type", "application/json")
.body("{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\n}")
.asString();
const data = JSON.stringify({
color: '',
description: '',
id: 0,
name: '',
slug: '',
tagged_items: 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}}/extras/tags/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/extras/tags/',
headers: {'content-type': 'application/json'},
data: {color: '', description: '', id: 0, name: '', slug: '', tagged_items: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/tags/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"color":"","description":"","id":0,"name":"","slug":"","tagged_items":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}}/extras/tags/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "color": "",\n "description": "",\n "id": 0,\n "name": "",\n "slug": "",\n "tagged_items": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/extras/tags/")
.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/extras/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({color: '', description: '', id: 0, name: '', slug: '', tagged_items: 0}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/extras/tags/',
headers: {'content-type': 'application/json'},
body: {color: '', description: '', id: 0, name: '', slug: '', tagged_items: 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}}/extras/tags/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
color: '',
description: '',
id: 0,
name: '',
slug: '',
tagged_items: 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}}/extras/tags/',
headers: {'content-type': 'application/json'},
data: {color: '', description: '', id: 0, name: '', slug: '', tagged_items: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/tags/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"color":"","description":"","id":0,"name":"","slug":"","tagged_items":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 = @{ @"color": @"",
@"description": @"",
@"id": @0,
@"name": @"",
@"slug": @"",
@"tagged_items": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/extras/tags/"]
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}}/extras/tags/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/tags/",
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([
'color' => '',
'description' => '',
'id' => 0,
'name' => '',
'slug' => '',
'tagged_items' => 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}}/extras/tags/', [
'body' => '{
"color": "",
"description": "",
"id": 0,
"name": "",
"slug": "",
"tagged_items": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/extras/tags/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'color' => '',
'description' => '',
'id' => 0,
'name' => '',
'slug' => '',
'tagged_items' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'color' => '',
'description' => '',
'id' => 0,
'name' => '',
'slug' => '',
'tagged_items' => 0
]));
$request->setRequestUrl('{{baseUrl}}/extras/tags/');
$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}}/extras/tags/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"color": "",
"description": "",
"id": 0,
"name": "",
"slug": "",
"tagged_items": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/tags/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"color": "",
"description": "",
"id": 0,
"name": "",
"slug": "",
"tagged_items": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/extras/tags/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/tags/"
payload = {
"color": "",
"description": "",
"id": 0,
"name": "",
"slug": "",
"tagged_items": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/tags/"
payload <- "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/extras/tags/")
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 \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/extras/tags/') do |req|
req.body = "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/extras/tags/";
let payload = json!({
"color": "",
"description": "",
"id": 0,
"name": "",
"slug": "",
"tagged_items": 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}}/extras/tags/ \
--header 'content-type: application/json' \
--data '{
"color": "",
"description": "",
"id": 0,
"name": "",
"slug": "",
"tagged_items": 0
}'
echo '{
"color": "",
"description": "",
"id": 0,
"name": "",
"slug": "",
"tagged_items": 0
}' | \
http POST {{baseUrl}}/extras/tags/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "color": "",\n "description": "",\n "id": 0,\n "name": "",\n "slug": "",\n "tagged_items": 0\n}' \
--output-document \
- {{baseUrl}}/extras/tags/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"color": "",
"description": "",
"id": 0,
"name": "",
"slug": "",
"tagged_items": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/tags/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
extras_tags_delete
{{baseUrl}}/extras/tags/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/tags/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/extras/tags/:id/")
require "http/client"
url = "{{baseUrl}}/extras/tags/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/extras/tags/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/extras/tags/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/tags/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/extras/tags/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/extras/tags/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/tags/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/extras/tags/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/extras/tags/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/extras/tags/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/extras/tags/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/tags/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/extras/tags/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/extras/tags/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/extras/tags/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/extras/tags/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/extras/tags/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/extras/tags/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/tags/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/extras/tags/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/extras/tags/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/tags/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/extras/tags/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/extras/tags/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/extras/tags/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/extras/tags/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/tags/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/extras/tags/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/tags/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/tags/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/extras/tags/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/extras/tags/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/extras/tags/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/extras/tags/:id/
http DELETE {{baseUrl}}/extras/tags/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/extras/tags/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/tags/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
extras_tags_list
{{baseUrl}}/extras/tags/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/tags/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/extras/tags/")
require "http/client"
url = "{{baseUrl}}/extras/tags/"
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}}/extras/tags/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/extras/tags/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/tags/"
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/extras/tags/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/extras/tags/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/tags/"))
.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}}/extras/tags/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/extras/tags/")
.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}}/extras/tags/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/extras/tags/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/tags/';
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}}/extras/tags/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/extras/tags/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/extras/tags/',
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}}/extras/tags/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/extras/tags/');
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}}/extras/tags/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/tags/';
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}}/extras/tags/"]
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}}/extras/tags/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/tags/",
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}}/extras/tags/');
echo $response->getBody();
setUrl('{{baseUrl}}/extras/tags/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/extras/tags/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/extras/tags/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/tags/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/extras/tags/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/tags/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/tags/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/extras/tags/")
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/extras/tags/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/extras/tags/";
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}}/extras/tags/
http GET {{baseUrl}}/extras/tags/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/extras/tags/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/tags/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
extras_tags_partial_update
{{baseUrl}}/extras/tags/:id/
BODY json
{
"color": "",
"description": "",
"id": 0,
"name": "",
"slug": "",
"tagged_items": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/tags/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/extras/tags/:id/" {:content-type :json
:form-params {:color ""
:description ""
:id 0
:name ""
:slug ""
:tagged_items 0}})
require "http/client"
url = "{{baseUrl}}/extras/tags/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\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}}/extras/tags/:id/"),
Content = new StringContent("{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/extras/tags/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/tags/:id/"
payload := strings.NewReader("{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\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/extras/tags/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 98
{
"color": "",
"description": "",
"id": 0,
"name": "",
"slug": "",
"tagged_items": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/extras/tags/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/tags/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/extras/tags/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/extras/tags/:id/")
.header("content-type", "application/json")
.body("{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\n}")
.asString();
const data = JSON.stringify({
color: '',
description: '',
id: 0,
name: '',
slug: '',
tagged_items: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/extras/tags/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/extras/tags/:id/',
headers: {'content-type': 'application/json'},
data: {color: '', description: '', id: 0, name: '', slug: '', tagged_items: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/tags/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"color":"","description":"","id":0,"name":"","slug":"","tagged_items":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}}/extras/tags/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "color": "",\n "description": "",\n "id": 0,\n "name": "",\n "slug": "",\n "tagged_items": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/extras/tags/:id/")
.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/extras/tags/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({color: '', description: '', id: 0, name: '', slug: '', tagged_items: 0}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/extras/tags/:id/',
headers: {'content-type': 'application/json'},
body: {color: '', description: '', id: 0, name: '', slug: '', tagged_items: 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('PATCH', '{{baseUrl}}/extras/tags/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
color: '',
description: '',
id: 0,
name: '',
slug: '',
tagged_items: 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: 'PATCH',
url: '{{baseUrl}}/extras/tags/:id/',
headers: {'content-type': 'application/json'},
data: {color: '', description: '', id: 0, name: '', slug: '', tagged_items: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/tags/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"color":"","description":"","id":0,"name":"","slug":"","tagged_items":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 = @{ @"color": @"",
@"description": @"",
@"id": @0,
@"name": @"",
@"slug": @"",
@"tagged_items": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/extras/tags/:id/"]
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}}/extras/tags/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/tags/:id/",
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([
'color' => '',
'description' => '',
'id' => 0,
'name' => '',
'slug' => '',
'tagged_items' => 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('PATCH', '{{baseUrl}}/extras/tags/:id/', [
'body' => '{
"color": "",
"description": "",
"id": 0,
"name": "",
"slug": "",
"tagged_items": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/extras/tags/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'color' => '',
'description' => '',
'id' => 0,
'name' => '',
'slug' => '',
'tagged_items' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'color' => '',
'description' => '',
'id' => 0,
'name' => '',
'slug' => '',
'tagged_items' => 0
]));
$request->setRequestUrl('{{baseUrl}}/extras/tags/:id/');
$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}}/extras/tags/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"color": "",
"description": "",
"id": 0,
"name": "",
"slug": "",
"tagged_items": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/tags/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"color": "",
"description": "",
"id": 0,
"name": "",
"slug": "",
"tagged_items": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/extras/tags/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/tags/:id/"
payload = {
"color": "",
"description": "",
"id": 0,
"name": "",
"slug": "",
"tagged_items": 0
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/tags/:id/"
payload <- "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\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}}/extras/tags/:id/")
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 \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/extras/tags/:id/') do |req|
req.body = "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\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}}/extras/tags/:id/";
let payload = json!({
"color": "",
"description": "",
"id": 0,
"name": "",
"slug": "",
"tagged_items": 0
});
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}}/extras/tags/:id/ \
--header 'content-type: application/json' \
--data '{
"color": "",
"description": "",
"id": 0,
"name": "",
"slug": "",
"tagged_items": 0
}'
echo '{
"color": "",
"description": "",
"id": 0,
"name": "",
"slug": "",
"tagged_items": 0
}' | \
http PATCH {{baseUrl}}/extras/tags/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "color": "",\n "description": "",\n "id": 0,\n "name": "",\n "slug": "",\n "tagged_items": 0\n}' \
--output-document \
- {{baseUrl}}/extras/tags/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"color": "",
"description": "",
"id": 0,
"name": "",
"slug": "",
"tagged_items": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/tags/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
extras_tags_read
{{baseUrl}}/extras/tags/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/tags/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/extras/tags/:id/")
require "http/client"
url = "{{baseUrl}}/extras/tags/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/extras/tags/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/extras/tags/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/tags/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/extras/tags/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/extras/tags/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/tags/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/extras/tags/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/extras/tags/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/extras/tags/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/extras/tags/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/tags/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/extras/tags/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/extras/tags/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/extras/tags/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/extras/tags/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/extras/tags/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/extras/tags/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/tags/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/extras/tags/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/extras/tags/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/tags/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/extras/tags/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/extras/tags/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/extras/tags/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/extras/tags/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/tags/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/extras/tags/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/tags/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/tags/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/extras/tags/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/extras/tags/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/extras/tags/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/extras/tags/:id/
http GET {{baseUrl}}/extras/tags/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/extras/tags/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/tags/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
extras_tags_update
{{baseUrl}}/extras/tags/:id/
BODY json
{
"color": "",
"description": "",
"id": 0,
"name": "",
"slug": "",
"tagged_items": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/extras/tags/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/extras/tags/:id/" {:content-type :json
:form-params {:color ""
:description ""
:id 0
:name ""
:slug ""
:tagged_items 0}})
require "http/client"
url = "{{baseUrl}}/extras/tags/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\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}}/extras/tags/:id/"),
Content = new StringContent("{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/extras/tags/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/extras/tags/:id/"
payload := strings.NewReader("{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\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/extras/tags/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 98
{
"color": "",
"description": "",
"id": 0,
"name": "",
"slug": "",
"tagged_items": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/extras/tags/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/extras/tags/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/extras/tags/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/extras/tags/:id/")
.header("content-type", "application/json")
.body("{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\n}")
.asString();
const data = JSON.stringify({
color: '',
description: '',
id: 0,
name: '',
slug: '',
tagged_items: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/extras/tags/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/extras/tags/:id/',
headers: {'content-type': 'application/json'},
data: {color: '', description: '', id: 0, name: '', slug: '', tagged_items: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/extras/tags/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"color":"","description":"","id":0,"name":"","slug":"","tagged_items":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}}/extras/tags/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "color": "",\n "description": "",\n "id": 0,\n "name": "",\n "slug": "",\n "tagged_items": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/extras/tags/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/extras/tags/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({color: '', description: '', id: 0, name: '', slug: '', tagged_items: 0}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/extras/tags/:id/',
headers: {'content-type': 'application/json'},
body: {color: '', description: '', id: 0, name: '', slug: '', tagged_items: 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('PUT', '{{baseUrl}}/extras/tags/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
color: '',
description: '',
id: 0,
name: '',
slug: '',
tagged_items: 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: 'PUT',
url: '{{baseUrl}}/extras/tags/:id/',
headers: {'content-type': 'application/json'},
data: {color: '', description: '', id: 0, name: '', slug: '', tagged_items: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/extras/tags/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"color":"","description":"","id":0,"name":"","slug":"","tagged_items":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 = @{ @"color": @"",
@"description": @"",
@"id": @0,
@"name": @"",
@"slug": @"",
@"tagged_items": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/extras/tags/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/extras/tags/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/extras/tags/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'color' => '',
'description' => '',
'id' => 0,
'name' => '',
'slug' => '',
'tagged_items' => 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('PUT', '{{baseUrl}}/extras/tags/:id/', [
'body' => '{
"color": "",
"description": "",
"id": 0,
"name": "",
"slug": "",
"tagged_items": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/extras/tags/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'color' => '',
'description' => '',
'id' => 0,
'name' => '',
'slug' => '',
'tagged_items' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'color' => '',
'description' => '',
'id' => 0,
'name' => '',
'slug' => '',
'tagged_items' => 0
]));
$request->setRequestUrl('{{baseUrl}}/extras/tags/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/extras/tags/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"color": "",
"description": "",
"id": 0,
"name": "",
"slug": "",
"tagged_items": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/extras/tags/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"color": "",
"description": "",
"id": 0,
"name": "",
"slug": "",
"tagged_items": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/extras/tags/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/extras/tags/:id/"
payload = {
"color": "",
"description": "",
"id": 0,
"name": "",
"slug": "",
"tagged_items": 0
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/extras/tags/:id/"
payload <- "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\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}}/extras/tags/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/extras/tags/:id/') do |req|
req.body = "{\n \"color\": \"\",\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"tagged_items\": 0\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}}/extras/tags/:id/";
let payload = json!({
"color": "",
"description": "",
"id": 0,
"name": "",
"slug": "",
"tagged_items": 0
});
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}}/extras/tags/:id/ \
--header 'content-type: application/json' \
--data '{
"color": "",
"description": "",
"id": 0,
"name": "",
"slug": "",
"tagged_items": 0
}'
echo '{
"color": "",
"description": "",
"id": 0,
"name": "",
"slug": "",
"tagged_items": 0
}' | \
http PUT {{baseUrl}}/extras/tags/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "color": "",\n "description": "",\n "id": 0,\n "name": "",\n "slug": "",\n "tagged_items": 0\n}' \
--output-document \
- {{baseUrl}}/extras/tags/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"color": "",
"description": "",
"id": 0,
"name": "",
"slug": "",
"tagged_items": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/extras/tags/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
A convenience method for returning available child prefixes within a parent. (POST)
{{baseUrl}}/ipam/prefixes/:id/available-prefixes/
BODY json
{
"created": "",
"custom_fields": {},
"description": "",
"family": "",
"id": 0,
"is_pool": false,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vlan": 0,
"vrf": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/prefixes/:id/available-prefixes/");
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 \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/ipam/prefixes/:id/available-prefixes/" {:content-type :json
:form-params {:created ""
:custom_fields {}
:description ""
:family ""
:id 0
:is_pool false
:last_updated ""
:prefix ""
:role 0
:site 0
:status ""
:tags []
:tenant 0
:vlan 0
:vrf 0}})
require "http/client"
url = "{{baseUrl}}/ipam/prefixes/:id/available-prefixes/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/ipam/prefixes/:id/available-prefixes/"),
Content = new StringContent("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/prefixes/:id/available-prefixes/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/prefixes/:id/available-prefixes/"
payload := strings.NewReader("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ipam/prefixes/:id/available-prefixes/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 244
{
"created": "",
"custom_fields": {},
"description": "",
"family": "",
"id": 0,
"is_pool": false,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vlan": 0,
"vrf": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/ipam/prefixes/:id/available-prefixes/")
.setHeader("content-type", "application/json")
.setBody("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/prefixes/:id/available-prefixes/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/prefixes/:id/available-prefixes/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/ipam/prefixes/:id/available-prefixes/")
.header("content-type", "application/json")
.body("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}")
.asString();
const data = JSON.stringify({
created: '',
custom_fields: {},
description: '',
family: '',
id: 0,
is_pool: false,
last_updated: '',
prefix: '',
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vlan: 0,
vrf: 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}}/ipam/prefixes/:id/available-prefixes/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/ipam/prefixes/:id/available-prefixes/',
headers: {'content-type': 'application/json'},
data: {
created: '',
custom_fields: {},
description: '',
family: '',
id: 0,
is_pool: false,
last_updated: '',
prefix: '',
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vlan: 0,
vrf: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/prefixes/:id/available-prefixes/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"created":"","custom_fields":{},"description":"","family":"","id":0,"is_pool":false,"last_updated":"","prefix":"","role":0,"site":0,"status":"","tags":[],"tenant":0,"vlan":0,"vrf":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}}/ipam/prefixes/:id/available-prefixes/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "created": "",\n "custom_fields": {},\n "description": "",\n "family": "",\n "id": 0,\n "is_pool": false,\n "last_updated": "",\n "prefix": "",\n "role": 0,\n "site": 0,\n "status": "",\n "tags": [],\n "tenant": 0,\n "vlan": 0,\n "vrf": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/ipam/prefixes/:id/available-prefixes/")
.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/ipam/prefixes/:id/available-prefixes/',
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({
created: '',
custom_fields: {},
description: '',
family: '',
id: 0,
is_pool: false,
last_updated: '',
prefix: '',
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vlan: 0,
vrf: 0
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/ipam/prefixes/:id/available-prefixes/',
headers: {'content-type': 'application/json'},
body: {
created: '',
custom_fields: {},
description: '',
family: '',
id: 0,
is_pool: false,
last_updated: '',
prefix: '',
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vlan: 0,
vrf: 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}}/ipam/prefixes/:id/available-prefixes/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
created: '',
custom_fields: {},
description: '',
family: '',
id: 0,
is_pool: false,
last_updated: '',
prefix: '',
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vlan: 0,
vrf: 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}}/ipam/prefixes/:id/available-prefixes/',
headers: {'content-type': 'application/json'},
data: {
created: '',
custom_fields: {},
description: '',
family: '',
id: 0,
is_pool: false,
last_updated: '',
prefix: '',
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vlan: 0,
vrf: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/prefixes/:id/available-prefixes/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"created":"","custom_fields":{},"description":"","family":"","id":0,"is_pool":false,"last_updated":"","prefix":"","role":0,"site":0,"status":"","tags":[],"tenant":0,"vlan":0,"vrf":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 = @{ @"created": @"",
@"custom_fields": @{ },
@"description": @"",
@"family": @"",
@"id": @0,
@"is_pool": @NO,
@"last_updated": @"",
@"prefix": @"",
@"role": @0,
@"site": @0,
@"status": @"",
@"tags": @[ ],
@"tenant": @0,
@"vlan": @0,
@"vrf": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/prefixes/:id/available-prefixes/"]
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}}/ipam/prefixes/:id/available-prefixes/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/prefixes/:id/available-prefixes/",
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([
'created' => '',
'custom_fields' => [
],
'description' => '',
'family' => '',
'id' => 0,
'is_pool' => null,
'last_updated' => '',
'prefix' => '',
'role' => 0,
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'vlan' => 0,
'vrf' => 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}}/ipam/prefixes/:id/available-prefixes/', [
'body' => '{
"created": "",
"custom_fields": {},
"description": "",
"family": "",
"id": 0,
"is_pool": false,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vlan": 0,
"vrf": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/prefixes/:id/available-prefixes/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'created' => '',
'custom_fields' => [
],
'description' => '',
'family' => '',
'id' => 0,
'is_pool' => null,
'last_updated' => '',
'prefix' => '',
'role' => 0,
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'vlan' => 0,
'vrf' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'created' => '',
'custom_fields' => [
],
'description' => '',
'family' => '',
'id' => 0,
'is_pool' => null,
'last_updated' => '',
'prefix' => '',
'role' => 0,
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'vlan' => 0,
'vrf' => 0
]));
$request->setRequestUrl('{{baseUrl}}/ipam/prefixes/:id/available-prefixes/');
$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}}/ipam/prefixes/:id/available-prefixes/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"custom_fields": {},
"description": "",
"family": "",
"id": 0,
"is_pool": false,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vlan": 0,
"vrf": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/prefixes/:id/available-prefixes/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"custom_fields": {},
"description": "",
"family": "",
"id": 0,
"is_pool": false,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vlan": 0,
"vrf": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/ipam/prefixes/:id/available-prefixes/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/prefixes/:id/available-prefixes/"
payload = {
"created": "",
"custom_fields": {},
"description": "",
"family": "",
"id": 0,
"is_pool": False,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vlan": 0,
"vrf": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/prefixes/:id/available-prefixes/"
payload <- "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/ipam/prefixes/:id/available-prefixes/")
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 \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/ipam/prefixes/:id/available-prefixes/') do |req|
req.body = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/prefixes/:id/available-prefixes/";
let payload = json!({
"created": "",
"custom_fields": json!({}),
"description": "",
"family": "",
"id": 0,
"is_pool": false,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": (),
"tenant": 0,
"vlan": 0,
"vrf": 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}}/ipam/prefixes/:id/available-prefixes/ \
--header 'content-type: application/json' \
--data '{
"created": "",
"custom_fields": {},
"description": "",
"family": "",
"id": 0,
"is_pool": false,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vlan": 0,
"vrf": 0
}'
echo '{
"created": "",
"custom_fields": {},
"description": "",
"family": "",
"id": 0,
"is_pool": false,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vlan": 0,
"vrf": 0
}' | \
http POST {{baseUrl}}/ipam/prefixes/:id/available-prefixes/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "created": "",\n "custom_fields": {},\n "description": "",\n "family": "",\n "id": 0,\n "is_pool": false,\n "last_updated": "",\n "prefix": "",\n "role": 0,\n "site": 0,\n "status": "",\n "tags": [],\n "tenant": 0,\n "vlan": 0,\n "vrf": 0\n}' \
--output-document \
- {{baseUrl}}/ipam/prefixes/:id/available-prefixes/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"created": "",
"custom_fields": [],
"description": "",
"family": "",
"id": 0,
"is_pool": false,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vlan": 0,
"vrf": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/prefixes/:id/available-prefixes/")! 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
A convenience method for returning available child prefixes within a parent.
{{baseUrl}}/ipam/prefixes/:id/available-prefixes/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/prefixes/:id/available-prefixes/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/ipam/prefixes/:id/available-prefixes/")
require "http/client"
url = "{{baseUrl}}/ipam/prefixes/:id/available-prefixes/"
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}}/ipam/prefixes/:id/available-prefixes/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/prefixes/:id/available-prefixes/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/prefixes/:id/available-prefixes/"
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/ipam/prefixes/:id/available-prefixes/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/ipam/prefixes/:id/available-prefixes/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/prefixes/:id/available-prefixes/"))
.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}}/ipam/prefixes/:id/available-prefixes/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/ipam/prefixes/:id/available-prefixes/")
.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}}/ipam/prefixes/:id/available-prefixes/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/ipam/prefixes/:id/available-prefixes/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/prefixes/:id/available-prefixes/';
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}}/ipam/prefixes/:id/available-prefixes/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/ipam/prefixes/:id/available-prefixes/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/ipam/prefixes/:id/available-prefixes/',
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}}/ipam/prefixes/:id/available-prefixes/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/ipam/prefixes/:id/available-prefixes/');
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}}/ipam/prefixes/:id/available-prefixes/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/prefixes/:id/available-prefixes/';
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}}/ipam/prefixes/:id/available-prefixes/"]
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}}/ipam/prefixes/:id/available-prefixes/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/prefixes/:id/available-prefixes/",
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}}/ipam/prefixes/:id/available-prefixes/');
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/prefixes/:id/available-prefixes/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/ipam/prefixes/:id/available-prefixes/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/ipam/prefixes/:id/available-prefixes/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/prefixes/:id/available-prefixes/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/ipam/prefixes/:id/available-prefixes/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/prefixes/:id/available-prefixes/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/prefixes/:id/available-prefixes/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/ipam/prefixes/:id/available-prefixes/")
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/ipam/prefixes/:id/available-prefixes/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/prefixes/:id/available-prefixes/";
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}}/ipam/prefixes/:id/available-prefixes/
http GET {{baseUrl}}/ipam/prefixes/:id/available-prefixes/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/ipam/prefixes/:id/available-prefixes/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/prefixes/:id/available-prefixes/")! 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
ipam_aggregates_create
{{baseUrl}}/ipam/aggregates/
BODY json
{
"created": "",
"custom_fields": {},
"date_added": "",
"description": "",
"family": "",
"id": 0,
"last_updated": "",
"prefix": "",
"rir": 0,
"tags": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/aggregates/");
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 \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/ipam/aggregates/" {:content-type :json
:form-params {:created ""
:custom_fields {}
:date_added ""
:description ""
:family ""
:id 0
:last_updated ""
:prefix ""
:rir 0
:tags []}})
require "http/client"
url = "{{baseUrl}}/ipam/aggregates/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\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}}/ipam/aggregates/"),
Content = new StringContent("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\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}}/ipam/aggregates/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/aggregates/"
payload := strings.NewReader("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\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/ipam/aggregates/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 174
{
"created": "",
"custom_fields": {},
"date_added": "",
"description": "",
"family": "",
"id": 0,
"last_updated": "",
"prefix": "",
"rir": 0,
"tags": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/ipam/aggregates/")
.setHeader("content-type", "application/json")
.setBody("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/aggregates/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\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 \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/aggregates/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/ipam/aggregates/")
.header("content-type", "application/json")
.body("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\n}")
.asString();
const data = JSON.stringify({
created: '',
custom_fields: {},
date_added: '',
description: '',
family: '',
id: 0,
last_updated: '',
prefix: '',
rir: 0,
tags: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/ipam/aggregates/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/ipam/aggregates/',
headers: {'content-type': 'application/json'},
data: {
created: '',
custom_fields: {},
date_added: '',
description: '',
family: '',
id: 0,
last_updated: '',
prefix: '',
rir: 0,
tags: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/aggregates/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"created":"","custom_fields":{},"date_added":"","description":"","family":"","id":0,"last_updated":"","prefix":"","rir":0,"tags":[]}'
};
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}}/ipam/aggregates/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "created": "",\n "custom_fields": {},\n "date_added": "",\n "description": "",\n "family": "",\n "id": 0,\n "last_updated": "",\n "prefix": "",\n "rir": 0,\n "tags": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/ipam/aggregates/")
.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/ipam/aggregates/',
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({
created: '',
custom_fields: {},
date_added: '',
description: '',
family: '',
id: 0,
last_updated: '',
prefix: '',
rir: 0,
tags: []
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/ipam/aggregates/',
headers: {'content-type': 'application/json'},
body: {
created: '',
custom_fields: {},
date_added: '',
description: '',
family: '',
id: 0,
last_updated: '',
prefix: '',
rir: 0,
tags: []
},
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}}/ipam/aggregates/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
created: '',
custom_fields: {},
date_added: '',
description: '',
family: '',
id: 0,
last_updated: '',
prefix: '',
rir: 0,
tags: []
});
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}}/ipam/aggregates/',
headers: {'content-type': 'application/json'},
data: {
created: '',
custom_fields: {},
date_added: '',
description: '',
family: '',
id: 0,
last_updated: '',
prefix: '',
rir: 0,
tags: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/aggregates/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"created":"","custom_fields":{},"date_added":"","description":"","family":"","id":0,"last_updated":"","prefix":"","rir":0,"tags":[]}'
};
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 = @{ @"created": @"",
@"custom_fields": @{ },
@"date_added": @"",
@"description": @"",
@"family": @"",
@"id": @0,
@"last_updated": @"",
@"prefix": @"",
@"rir": @0,
@"tags": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/aggregates/"]
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}}/ipam/aggregates/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/aggregates/",
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([
'created' => '',
'custom_fields' => [
],
'date_added' => '',
'description' => '',
'family' => '',
'id' => 0,
'last_updated' => '',
'prefix' => '',
'rir' => 0,
'tags' => [
]
]),
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}}/ipam/aggregates/', [
'body' => '{
"created": "",
"custom_fields": {},
"date_added": "",
"description": "",
"family": "",
"id": 0,
"last_updated": "",
"prefix": "",
"rir": 0,
"tags": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/aggregates/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'created' => '',
'custom_fields' => [
],
'date_added' => '',
'description' => '',
'family' => '',
'id' => 0,
'last_updated' => '',
'prefix' => '',
'rir' => 0,
'tags' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'created' => '',
'custom_fields' => [
],
'date_added' => '',
'description' => '',
'family' => '',
'id' => 0,
'last_updated' => '',
'prefix' => '',
'rir' => 0,
'tags' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/ipam/aggregates/');
$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}}/ipam/aggregates/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"custom_fields": {},
"date_added": "",
"description": "",
"family": "",
"id": 0,
"last_updated": "",
"prefix": "",
"rir": 0,
"tags": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/aggregates/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"custom_fields": {},
"date_added": "",
"description": "",
"family": "",
"id": 0,
"last_updated": "",
"prefix": "",
"rir": 0,
"tags": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/ipam/aggregates/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/aggregates/"
payload = {
"created": "",
"custom_fields": {},
"date_added": "",
"description": "",
"family": "",
"id": 0,
"last_updated": "",
"prefix": "",
"rir": 0,
"tags": []
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/aggregates/"
payload <- "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\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}}/ipam/aggregates/")
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 \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\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/ipam/aggregates/') do |req|
req.body = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/aggregates/";
let payload = json!({
"created": "",
"custom_fields": json!({}),
"date_added": "",
"description": "",
"family": "",
"id": 0,
"last_updated": "",
"prefix": "",
"rir": 0,
"tags": ()
});
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}}/ipam/aggregates/ \
--header 'content-type: application/json' \
--data '{
"created": "",
"custom_fields": {},
"date_added": "",
"description": "",
"family": "",
"id": 0,
"last_updated": "",
"prefix": "",
"rir": 0,
"tags": []
}'
echo '{
"created": "",
"custom_fields": {},
"date_added": "",
"description": "",
"family": "",
"id": 0,
"last_updated": "",
"prefix": "",
"rir": 0,
"tags": []
}' | \
http POST {{baseUrl}}/ipam/aggregates/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "created": "",\n "custom_fields": {},\n "date_added": "",\n "description": "",\n "family": "",\n "id": 0,\n "last_updated": "",\n "prefix": "",\n "rir": 0,\n "tags": []\n}' \
--output-document \
- {{baseUrl}}/ipam/aggregates/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"created": "",
"custom_fields": [],
"date_added": "",
"description": "",
"family": "",
"id": 0,
"last_updated": "",
"prefix": "",
"rir": 0,
"tags": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/aggregates/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
ipam_aggregates_delete
{{baseUrl}}/ipam/aggregates/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/aggregates/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/ipam/aggregates/:id/")
require "http/client"
url = "{{baseUrl}}/ipam/aggregates/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/ipam/aggregates/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/aggregates/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/aggregates/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/ipam/aggregates/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/ipam/aggregates/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/aggregates/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/aggregates/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/ipam/aggregates/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/ipam/aggregates/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/ipam/aggregates/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/aggregates/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/ipam/aggregates/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/ipam/aggregates/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/ipam/aggregates/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/ipam/aggregates/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/ipam/aggregates/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/ipam/aggregates/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/aggregates/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/aggregates/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/ipam/aggregates/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/aggregates/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/ipam/aggregates/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/aggregates/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/ipam/aggregates/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/ipam/aggregates/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/aggregates/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/ipam/aggregates/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/aggregates/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/aggregates/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/ipam/aggregates/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/ipam/aggregates/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/aggregates/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/ipam/aggregates/:id/
http DELETE {{baseUrl}}/ipam/aggregates/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/ipam/aggregates/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/aggregates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
ipam_aggregates_list
{{baseUrl}}/ipam/aggregates/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/aggregates/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/ipam/aggregates/")
require "http/client"
url = "{{baseUrl}}/ipam/aggregates/"
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}}/ipam/aggregates/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/aggregates/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/aggregates/"
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/ipam/aggregates/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/ipam/aggregates/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/aggregates/"))
.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}}/ipam/aggregates/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/ipam/aggregates/")
.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}}/ipam/aggregates/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/ipam/aggregates/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/aggregates/';
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}}/ipam/aggregates/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/ipam/aggregates/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/ipam/aggregates/',
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}}/ipam/aggregates/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/ipam/aggregates/');
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}}/ipam/aggregates/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/aggregates/';
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}}/ipam/aggregates/"]
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}}/ipam/aggregates/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/aggregates/",
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}}/ipam/aggregates/');
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/aggregates/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/ipam/aggregates/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/ipam/aggregates/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/aggregates/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/ipam/aggregates/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/aggregates/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/aggregates/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/ipam/aggregates/")
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/ipam/aggregates/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/aggregates/";
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}}/ipam/aggregates/
http GET {{baseUrl}}/ipam/aggregates/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/ipam/aggregates/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/aggregates/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
ipam_aggregates_partial_update
{{baseUrl}}/ipam/aggregates/:id/
BODY json
{
"created": "",
"custom_fields": {},
"date_added": "",
"description": "",
"family": "",
"id": 0,
"last_updated": "",
"prefix": "",
"rir": 0,
"tags": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/aggregates/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/ipam/aggregates/:id/" {:content-type :json
:form-params {:created ""
:custom_fields {}
:date_added ""
:description ""
:family ""
:id 0
:last_updated ""
:prefix ""
:rir 0
:tags []}})
require "http/client"
url = "{{baseUrl}}/ipam/aggregates/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\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}}/ipam/aggregates/:id/"),
Content = new StringContent("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\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}}/ipam/aggregates/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/aggregates/:id/"
payload := strings.NewReader("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\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/ipam/aggregates/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 174
{
"created": "",
"custom_fields": {},
"date_added": "",
"description": "",
"family": "",
"id": 0,
"last_updated": "",
"prefix": "",
"rir": 0,
"tags": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/ipam/aggregates/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/aggregates/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\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 \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/aggregates/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/ipam/aggregates/:id/")
.header("content-type", "application/json")
.body("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\n}")
.asString();
const data = JSON.stringify({
created: '',
custom_fields: {},
date_added: '',
description: '',
family: '',
id: 0,
last_updated: '',
prefix: '',
rir: 0,
tags: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/ipam/aggregates/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/ipam/aggregates/:id/',
headers: {'content-type': 'application/json'},
data: {
created: '',
custom_fields: {},
date_added: '',
description: '',
family: '',
id: 0,
last_updated: '',
prefix: '',
rir: 0,
tags: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/aggregates/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"created":"","custom_fields":{},"date_added":"","description":"","family":"","id":0,"last_updated":"","prefix":"","rir":0,"tags":[]}'
};
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}}/ipam/aggregates/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "created": "",\n "custom_fields": {},\n "date_added": "",\n "description": "",\n "family": "",\n "id": 0,\n "last_updated": "",\n "prefix": "",\n "rir": 0,\n "tags": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/ipam/aggregates/:id/")
.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/ipam/aggregates/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
created: '',
custom_fields: {},
date_added: '',
description: '',
family: '',
id: 0,
last_updated: '',
prefix: '',
rir: 0,
tags: []
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/ipam/aggregates/:id/',
headers: {'content-type': 'application/json'},
body: {
created: '',
custom_fields: {},
date_added: '',
description: '',
family: '',
id: 0,
last_updated: '',
prefix: '',
rir: 0,
tags: []
},
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}}/ipam/aggregates/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
created: '',
custom_fields: {},
date_added: '',
description: '',
family: '',
id: 0,
last_updated: '',
prefix: '',
rir: 0,
tags: []
});
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}}/ipam/aggregates/:id/',
headers: {'content-type': 'application/json'},
data: {
created: '',
custom_fields: {},
date_added: '',
description: '',
family: '',
id: 0,
last_updated: '',
prefix: '',
rir: 0,
tags: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/aggregates/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"created":"","custom_fields":{},"date_added":"","description":"","family":"","id":0,"last_updated":"","prefix":"","rir":0,"tags":[]}'
};
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 = @{ @"created": @"",
@"custom_fields": @{ },
@"date_added": @"",
@"description": @"",
@"family": @"",
@"id": @0,
@"last_updated": @"",
@"prefix": @"",
@"rir": @0,
@"tags": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/aggregates/:id/"]
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}}/ipam/aggregates/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/aggregates/:id/",
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([
'created' => '',
'custom_fields' => [
],
'date_added' => '',
'description' => '',
'family' => '',
'id' => 0,
'last_updated' => '',
'prefix' => '',
'rir' => 0,
'tags' => [
]
]),
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}}/ipam/aggregates/:id/', [
'body' => '{
"created": "",
"custom_fields": {},
"date_added": "",
"description": "",
"family": "",
"id": 0,
"last_updated": "",
"prefix": "",
"rir": 0,
"tags": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/aggregates/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'created' => '',
'custom_fields' => [
],
'date_added' => '',
'description' => '',
'family' => '',
'id' => 0,
'last_updated' => '',
'prefix' => '',
'rir' => 0,
'tags' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'created' => '',
'custom_fields' => [
],
'date_added' => '',
'description' => '',
'family' => '',
'id' => 0,
'last_updated' => '',
'prefix' => '',
'rir' => 0,
'tags' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/ipam/aggregates/:id/');
$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}}/ipam/aggregates/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"custom_fields": {},
"date_added": "",
"description": "",
"family": "",
"id": 0,
"last_updated": "",
"prefix": "",
"rir": 0,
"tags": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/aggregates/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"custom_fields": {},
"date_added": "",
"description": "",
"family": "",
"id": 0,
"last_updated": "",
"prefix": "",
"rir": 0,
"tags": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/ipam/aggregates/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/aggregates/:id/"
payload = {
"created": "",
"custom_fields": {},
"date_added": "",
"description": "",
"family": "",
"id": 0,
"last_updated": "",
"prefix": "",
"rir": 0,
"tags": []
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/aggregates/:id/"
payload <- "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\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}}/ipam/aggregates/:id/")
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 \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\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/ipam/aggregates/:id/') do |req|
req.body = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\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}}/ipam/aggregates/:id/";
let payload = json!({
"created": "",
"custom_fields": json!({}),
"date_added": "",
"description": "",
"family": "",
"id": 0,
"last_updated": "",
"prefix": "",
"rir": 0,
"tags": ()
});
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}}/ipam/aggregates/:id/ \
--header 'content-type: application/json' \
--data '{
"created": "",
"custom_fields": {},
"date_added": "",
"description": "",
"family": "",
"id": 0,
"last_updated": "",
"prefix": "",
"rir": 0,
"tags": []
}'
echo '{
"created": "",
"custom_fields": {},
"date_added": "",
"description": "",
"family": "",
"id": 0,
"last_updated": "",
"prefix": "",
"rir": 0,
"tags": []
}' | \
http PATCH {{baseUrl}}/ipam/aggregates/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "created": "",\n "custom_fields": {},\n "date_added": "",\n "description": "",\n "family": "",\n "id": 0,\n "last_updated": "",\n "prefix": "",\n "rir": 0,\n "tags": []\n}' \
--output-document \
- {{baseUrl}}/ipam/aggregates/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"created": "",
"custom_fields": [],
"date_added": "",
"description": "",
"family": "",
"id": 0,
"last_updated": "",
"prefix": "",
"rir": 0,
"tags": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/aggregates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
ipam_aggregates_read
{{baseUrl}}/ipam/aggregates/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/aggregates/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/ipam/aggregates/:id/")
require "http/client"
url = "{{baseUrl}}/ipam/aggregates/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/ipam/aggregates/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/aggregates/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/aggregates/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/ipam/aggregates/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/ipam/aggregates/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/aggregates/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/aggregates/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/ipam/aggregates/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/ipam/aggregates/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/ipam/aggregates/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/aggregates/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/ipam/aggregates/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/ipam/aggregates/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/ipam/aggregates/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/ipam/aggregates/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/ipam/aggregates/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/ipam/aggregates/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/aggregates/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/aggregates/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/ipam/aggregates/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/aggregates/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/ipam/aggregates/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/aggregates/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/ipam/aggregates/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/ipam/aggregates/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/aggregates/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/ipam/aggregates/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/aggregates/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/aggregates/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/ipam/aggregates/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/ipam/aggregates/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/aggregates/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/ipam/aggregates/:id/
http GET {{baseUrl}}/ipam/aggregates/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/ipam/aggregates/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/aggregates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
ipam_aggregates_update
{{baseUrl}}/ipam/aggregates/:id/
BODY json
{
"created": "",
"custom_fields": {},
"date_added": "",
"description": "",
"family": "",
"id": 0,
"last_updated": "",
"prefix": "",
"rir": 0,
"tags": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/aggregates/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/ipam/aggregates/:id/" {:content-type :json
:form-params {:created ""
:custom_fields {}
:date_added ""
:description ""
:family ""
:id 0
:last_updated ""
:prefix ""
:rir 0
:tags []}})
require "http/client"
url = "{{baseUrl}}/ipam/aggregates/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\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}}/ipam/aggregates/:id/"),
Content = new StringContent("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\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}}/ipam/aggregates/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/aggregates/:id/"
payload := strings.NewReader("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\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/ipam/aggregates/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 174
{
"created": "",
"custom_fields": {},
"date_added": "",
"description": "",
"family": "",
"id": 0,
"last_updated": "",
"prefix": "",
"rir": 0,
"tags": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/ipam/aggregates/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/aggregates/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\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 \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/aggregates/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/ipam/aggregates/:id/")
.header("content-type", "application/json")
.body("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\n}")
.asString();
const data = JSON.stringify({
created: '',
custom_fields: {},
date_added: '',
description: '',
family: '',
id: 0,
last_updated: '',
prefix: '',
rir: 0,
tags: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/ipam/aggregates/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/ipam/aggregates/:id/',
headers: {'content-type': 'application/json'},
data: {
created: '',
custom_fields: {},
date_added: '',
description: '',
family: '',
id: 0,
last_updated: '',
prefix: '',
rir: 0,
tags: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/aggregates/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"created":"","custom_fields":{},"date_added":"","description":"","family":"","id":0,"last_updated":"","prefix":"","rir":0,"tags":[]}'
};
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}}/ipam/aggregates/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "created": "",\n "custom_fields": {},\n "date_added": "",\n "description": "",\n "family": "",\n "id": 0,\n "last_updated": "",\n "prefix": "",\n "rir": 0,\n "tags": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/ipam/aggregates/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/ipam/aggregates/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
created: '',
custom_fields: {},
date_added: '',
description: '',
family: '',
id: 0,
last_updated: '',
prefix: '',
rir: 0,
tags: []
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/ipam/aggregates/:id/',
headers: {'content-type': 'application/json'},
body: {
created: '',
custom_fields: {},
date_added: '',
description: '',
family: '',
id: 0,
last_updated: '',
prefix: '',
rir: 0,
tags: []
},
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}}/ipam/aggregates/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
created: '',
custom_fields: {},
date_added: '',
description: '',
family: '',
id: 0,
last_updated: '',
prefix: '',
rir: 0,
tags: []
});
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}}/ipam/aggregates/:id/',
headers: {'content-type': 'application/json'},
data: {
created: '',
custom_fields: {},
date_added: '',
description: '',
family: '',
id: 0,
last_updated: '',
prefix: '',
rir: 0,
tags: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/aggregates/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"created":"","custom_fields":{},"date_added":"","description":"","family":"","id":0,"last_updated":"","prefix":"","rir":0,"tags":[]}'
};
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 = @{ @"created": @"",
@"custom_fields": @{ },
@"date_added": @"",
@"description": @"",
@"family": @"",
@"id": @0,
@"last_updated": @"",
@"prefix": @"",
@"rir": @0,
@"tags": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/aggregates/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/ipam/aggregates/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/aggregates/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'created' => '',
'custom_fields' => [
],
'date_added' => '',
'description' => '',
'family' => '',
'id' => 0,
'last_updated' => '',
'prefix' => '',
'rir' => 0,
'tags' => [
]
]),
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}}/ipam/aggregates/:id/', [
'body' => '{
"created": "",
"custom_fields": {},
"date_added": "",
"description": "",
"family": "",
"id": 0,
"last_updated": "",
"prefix": "",
"rir": 0,
"tags": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/aggregates/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'created' => '',
'custom_fields' => [
],
'date_added' => '',
'description' => '',
'family' => '',
'id' => 0,
'last_updated' => '',
'prefix' => '',
'rir' => 0,
'tags' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'created' => '',
'custom_fields' => [
],
'date_added' => '',
'description' => '',
'family' => '',
'id' => 0,
'last_updated' => '',
'prefix' => '',
'rir' => 0,
'tags' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/ipam/aggregates/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/ipam/aggregates/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"custom_fields": {},
"date_added": "",
"description": "",
"family": "",
"id": 0,
"last_updated": "",
"prefix": "",
"rir": 0,
"tags": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/aggregates/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"custom_fields": {},
"date_added": "",
"description": "",
"family": "",
"id": 0,
"last_updated": "",
"prefix": "",
"rir": 0,
"tags": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/ipam/aggregates/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/aggregates/:id/"
payload = {
"created": "",
"custom_fields": {},
"date_added": "",
"description": "",
"family": "",
"id": 0,
"last_updated": "",
"prefix": "",
"rir": 0,
"tags": []
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/aggregates/:id/"
payload <- "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\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}}/ipam/aggregates/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\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/ipam/aggregates/:id/') do |req|
req.body = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"date_added\": \"\",\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"rir\": 0,\n \"tags\": []\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}}/ipam/aggregates/:id/";
let payload = json!({
"created": "",
"custom_fields": json!({}),
"date_added": "",
"description": "",
"family": "",
"id": 0,
"last_updated": "",
"prefix": "",
"rir": 0,
"tags": ()
});
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}}/ipam/aggregates/:id/ \
--header 'content-type: application/json' \
--data '{
"created": "",
"custom_fields": {},
"date_added": "",
"description": "",
"family": "",
"id": 0,
"last_updated": "",
"prefix": "",
"rir": 0,
"tags": []
}'
echo '{
"created": "",
"custom_fields": {},
"date_added": "",
"description": "",
"family": "",
"id": 0,
"last_updated": "",
"prefix": "",
"rir": 0,
"tags": []
}' | \
http PUT {{baseUrl}}/ipam/aggregates/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "created": "",\n "custom_fields": {},\n "date_added": "",\n "description": "",\n "family": "",\n "id": 0,\n "last_updated": "",\n "prefix": "",\n "rir": 0,\n "tags": []\n}' \
--output-document \
- {{baseUrl}}/ipam/aggregates/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"created": "",
"custom_fields": [],
"date_added": "",
"description": "",
"family": "",
"id": 0,
"last_updated": "",
"prefix": "",
"rir": 0,
"tags": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/aggregates/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
ipam_ip-addresses_create
{{baseUrl}}/ipam/ip-addresses/
BODY json
{
"address": "",
"created": "",
"custom_fields": {},
"description": "",
"dns_name": "",
"family": "",
"id": 0,
"interface": 0,
"last_updated": "",
"nat_inside": 0,
"nat_outside": 0,
"role": "",
"status": "",
"tags": [],
"tenant": 0,
"vrf": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/ip-addresses/");
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 \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/ipam/ip-addresses/" {:content-type :json
:form-params {:address ""
:created ""
:custom_fields {}
:description ""
:dns_name ""
:family ""
:id 0
:interface 0
:last_updated ""
:nat_inside 0
:nat_outside 0
:role ""
:status ""
:tags []
:tenant 0
:vrf 0}})
require "http/client"
url = "{{baseUrl}}/ipam/ip-addresses/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/ipam/ip-addresses/"),
Content = new StringContent("{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/ip-addresses/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/ip-addresses/"
payload := strings.NewReader("{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ipam/ip-addresses/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 275
{
"address": "",
"created": "",
"custom_fields": {},
"description": "",
"dns_name": "",
"family": "",
"id": 0,
"interface": 0,
"last_updated": "",
"nat_inside": 0,
"nat_outside": 0,
"role": "",
"status": "",
"tags": [],
"tenant": 0,
"vrf": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/ipam/ip-addresses/")
.setHeader("content-type", "application/json")
.setBody("{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/ip-addresses/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/ip-addresses/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/ipam/ip-addresses/")
.header("content-type", "application/json")
.body("{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\n}")
.asString();
const data = JSON.stringify({
address: '',
created: '',
custom_fields: {},
description: '',
dns_name: '',
family: '',
id: 0,
interface: 0,
last_updated: '',
nat_inside: 0,
nat_outside: 0,
role: '',
status: '',
tags: [],
tenant: 0,
vrf: 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}}/ipam/ip-addresses/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/ipam/ip-addresses/',
headers: {'content-type': 'application/json'},
data: {
address: '',
created: '',
custom_fields: {},
description: '',
dns_name: '',
family: '',
id: 0,
interface: 0,
last_updated: '',
nat_inside: 0,
nat_outside: 0,
role: '',
status: '',
tags: [],
tenant: 0,
vrf: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/ip-addresses/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"address":"","created":"","custom_fields":{},"description":"","dns_name":"","family":"","id":0,"interface":0,"last_updated":"","nat_inside":0,"nat_outside":0,"role":"","status":"","tags":[],"tenant":0,"vrf":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}}/ipam/ip-addresses/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "address": "",\n "created": "",\n "custom_fields": {},\n "description": "",\n "dns_name": "",\n "family": "",\n "id": 0,\n "interface": 0,\n "last_updated": "",\n "nat_inside": 0,\n "nat_outside": 0,\n "role": "",\n "status": "",\n "tags": [],\n "tenant": 0,\n "vrf": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/ipam/ip-addresses/")
.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/ipam/ip-addresses/',
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({
address: '',
created: '',
custom_fields: {},
description: '',
dns_name: '',
family: '',
id: 0,
interface: 0,
last_updated: '',
nat_inside: 0,
nat_outside: 0,
role: '',
status: '',
tags: [],
tenant: 0,
vrf: 0
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/ipam/ip-addresses/',
headers: {'content-type': 'application/json'},
body: {
address: '',
created: '',
custom_fields: {},
description: '',
dns_name: '',
family: '',
id: 0,
interface: 0,
last_updated: '',
nat_inside: 0,
nat_outside: 0,
role: '',
status: '',
tags: [],
tenant: 0,
vrf: 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}}/ipam/ip-addresses/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
address: '',
created: '',
custom_fields: {},
description: '',
dns_name: '',
family: '',
id: 0,
interface: 0,
last_updated: '',
nat_inside: 0,
nat_outside: 0,
role: '',
status: '',
tags: [],
tenant: 0,
vrf: 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}}/ipam/ip-addresses/',
headers: {'content-type': 'application/json'},
data: {
address: '',
created: '',
custom_fields: {},
description: '',
dns_name: '',
family: '',
id: 0,
interface: 0,
last_updated: '',
nat_inside: 0,
nat_outside: 0,
role: '',
status: '',
tags: [],
tenant: 0,
vrf: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/ip-addresses/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"address":"","created":"","custom_fields":{},"description":"","dns_name":"","family":"","id":0,"interface":0,"last_updated":"","nat_inside":0,"nat_outside":0,"role":"","status":"","tags":[],"tenant":0,"vrf":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 = @{ @"address": @"",
@"created": @"",
@"custom_fields": @{ },
@"description": @"",
@"dns_name": @"",
@"family": @"",
@"id": @0,
@"interface": @0,
@"last_updated": @"",
@"nat_inside": @0,
@"nat_outside": @0,
@"role": @"",
@"status": @"",
@"tags": @[ ],
@"tenant": @0,
@"vrf": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/ip-addresses/"]
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}}/ipam/ip-addresses/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/ip-addresses/",
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([
'address' => '',
'created' => '',
'custom_fields' => [
],
'description' => '',
'dns_name' => '',
'family' => '',
'id' => 0,
'interface' => 0,
'last_updated' => '',
'nat_inside' => 0,
'nat_outside' => 0,
'role' => '',
'status' => '',
'tags' => [
],
'tenant' => 0,
'vrf' => 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}}/ipam/ip-addresses/', [
'body' => '{
"address": "",
"created": "",
"custom_fields": {},
"description": "",
"dns_name": "",
"family": "",
"id": 0,
"interface": 0,
"last_updated": "",
"nat_inside": 0,
"nat_outside": 0,
"role": "",
"status": "",
"tags": [],
"tenant": 0,
"vrf": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/ip-addresses/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'address' => '',
'created' => '',
'custom_fields' => [
],
'description' => '',
'dns_name' => '',
'family' => '',
'id' => 0,
'interface' => 0,
'last_updated' => '',
'nat_inside' => 0,
'nat_outside' => 0,
'role' => '',
'status' => '',
'tags' => [
],
'tenant' => 0,
'vrf' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'address' => '',
'created' => '',
'custom_fields' => [
],
'description' => '',
'dns_name' => '',
'family' => '',
'id' => 0,
'interface' => 0,
'last_updated' => '',
'nat_inside' => 0,
'nat_outside' => 0,
'role' => '',
'status' => '',
'tags' => [
],
'tenant' => 0,
'vrf' => 0
]));
$request->setRequestUrl('{{baseUrl}}/ipam/ip-addresses/');
$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}}/ipam/ip-addresses/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"address": "",
"created": "",
"custom_fields": {},
"description": "",
"dns_name": "",
"family": "",
"id": 0,
"interface": 0,
"last_updated": "",
"nat_inside": 0,
"nat_outside": 0,
"role": "",
"status": "",
"tags": [],
"tenant": 0,
"vrf": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/ip-addresses/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"address": "",
"created": "",
"custom_fields": {},
"description": "",
"dns_name": "",
"family": "",
"id": 0,
"interface": 0,
"last_updated": "",
"nat_inside": 0,
"nat_outside": 0,
"role": "",
"status": "",
"tags": [],
"tenant": 0,
"vrf": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/ipam/ip-addresses/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/ip-addresses/"
payload = {
"address": "",
"created": "",
"custom_fields": {},
"description": "",
"dns_name": "",
"family": "",
"id": 0,
"interface": 0,
"last_updated": "",
"nat_inside": 0,
"nat_outside": 0,
"role": "",
"status": "",
"tags": [],
"tenant": 0,
"vrf": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/ip-addresses/"
payload <- "{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/ipam/ip-addresses/")
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 \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/ipam/ip-addresses/') do |req|
req.body = "{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/ip-addresses/";
let payload = json!({
"address": "",
"created": "",
"custom_fields": json!({}),
"description": "",
"dns_name": "",
"family": "",
"id": 0,
"interface": 0,
"last_updated": "",
"nat_inside": 0,
"nat_outside": 0,
"role": "",
"status": "",
"tags": (),
"tenant": 0,
"vrf": 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}}/ipam/ip-addresses/ \
--header 'content-type: application/json' \
--data '{
"address": "",
"created": "",
"custom_fields": {},
"description": "",
"dns_name": "",
"family": "",
"id": 0,
"interface": 0,
"last_updated": "",
"nat_inside": 0,
"nat_outside": 0,
"role": "",
"status": "",
"tags": [],
"tenant": 0,
"vrf": 0
}'
echo '{
"address": "",
"created": "",
"custom_fields": {},
"description": "",
"dns_name": "",
"family": "",
"id": 0,
"interface": 0,
"last_updated": "",
"nat_inside": 0,
"nat_outside": 0,
"role": "",
"status": "",
"tags": [],
"tenant": 0,
"vrf": 0
}' | \
http POST {{baseUrl}}/ipam/ip-addresses/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "address": "",\n "created": "",\n "custom_fields": {},\n "description": "",\n "dns_name": "",\n "family": "",\n "id": 0,\n "interface": 0,\n "last_updated": "",\n "nat_inside": 0,\n "nat_outside": 0,\n "role": "",\n "status": "",\n "tags": [],\n "tenant": 0,\n "vrf": 0\n}' \
--output-document \
- {{baseUrl}}/ipam/ip-addresses/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"address": "",
"created": "",
"custom_fields": [],
"description": "",
"dns_name": "",
"family": "",
"id": 0,
"interface": 0,
"last_updated": "",
"nat_inside": 0,
"nat_outside": 0,
"role": "",
"status": "",
"tags": [],
"tenant": 0,
"vrf": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/ip-addresses/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
ipam_ip-addresses_delete
{{baseUrl}}/ipam/ip-addresses/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/ip-addresses/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/ipam/ip-addresses/:id/")
require "http/client"
url = "{{baseUrl}}/ipam/ip-addresses/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/ipam/ip-addresses/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/ip-addresses/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/ip-addresses/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/ipam/ip-addresses/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/ipam/ip-addresses/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/ip-addresses/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/ip-addresses/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/ipam/ip-addresses/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/ipam/ip-addresses/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/ipam/ip-addresses/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/ip-addresses/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/ipam/ip-addresses/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/ipam/ip-addresses/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/ipam/ip-addresses/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/ipam/ip-addresses/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/ipam/ip-addresses/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/ipam/ip-addresses/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/ip-addresses/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/ip-addresses/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/ipam/ip-addresses/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/ip-addresses/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/ipam/ip-addresses/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/ip-addresses/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/ipam/ip-addresses/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/ipam/ip-addresses/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/ip-addresses/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/ipam/ip-addresses/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/ip-addresses/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/ip-addresses/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/ipam/ip-addresses/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/ipam/ip-addresses/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/ip-addresses/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/ipam/ip-addresses/:id/
http DELETE {{baseUrl}}/ipam/ip-addresses/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/ipam/ip-addresses/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/ip-addresses/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
ipam_ip-addresses_list
{{baseUrl}}/ipam/ip-addresses/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/ip-addresses/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/ipam/ip-addresses/")
require "http/client"
url = "{{baseUrl}}/ipam/ip-addresses/"
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}}/ipam/ip-addresses/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/ip-addresses/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/ip-addresses/"
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/ipam/ip-addresses/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/ipam/ip-addresses/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/ip-addresses/"))
.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}}/ipam/ip-addresses/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/ipam/ip-addresses/")
.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}}/ipam/ip-addresses/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/ipam/ip-addresses/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/ip-addresses/';
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}}/ipam/ip-addresses/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/ipam/ip-addresses/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/ipam/ip-addresses/',
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}}/ipam/ip-addresses/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/ipam/ip-addresses/');
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}}/ipam/ip-addresses/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/ip-addresses/';
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}}/ipam/ip-addresses/"]
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}}/ipam/ip-addresses/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/ip-addresses/",
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}}/ipam/ip-addresses/');
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/ip-addresses/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/ipam/ip-addresses/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/ipam/ip-addresses/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/ip-addresses/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/ipam/ip-addresses/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/ip-addresses/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/ip-addresses/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/ipam/ip-addresses/")
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/ipam/ip-addresses/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/ip-addresses/";
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}}/ipam/ip-addresses/
http GET {{baseUrl}}/ipam/ip-addresses/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/ipam/ip-addresses/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/ip-addresses/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
ipam_ip-addresses_partial_update
{{baseUrl}}/ipam/ip-addresses/:id/
BODY json
{
"address": "",
"created": "",
"custom_fields": {},
"description": "",
"dns_name": "",
"family": "",
"id": 0,
"interface": 0,
"last_updated": "",
"nat_inside": 0,
"nat_outside": 0,
"role": "",
"status": "",
"tags": [],
"tenant": 0,
"vrf": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/ip-addresses/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/ipam/ip-addresses/:id/" {:content-type :json
:form-params {:address ""
:created ""
:custom_fields {}
:description ""
:dns_name ""
:family ""
:id 0
:interface 0
:last_updated ""
:nat_inside 0
:nat_outside 0
:role ""
:status ""
:tags []
:tenant 0
:vrf 0}})
require "http/client"
url = "{{baseUrl}}/ipam/ip-addresses/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\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}}/ipam/ip-addresses/:id/"),
Content = new StringContent("{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/ip-addresses/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/ip-addresses/:id/"
payload := strings.NewReader("{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\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/ipam/ip-addresses/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 275
{
"address": "",
"created": "",
"custom_fields": {},
"description": "",
"dns_name": "",
"family": "",
"id": 0,
"interface": 0,
"last_updated": "",
"nat_inside": 0,
"nat_outside": 0,
"role": "",
"status": "",
"tags": [],
"tenant": 0,
"vrf": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/ipam/ip-addresses/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/ip-addresses/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/ip-addresses/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/ipam/ip-addresses/:id/")
.header("content-type", "application/json")
.body("{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\n}")
.asString();
const data = JSON.stringify({
address: '',
created: '',
custom_fields: {},
description: '',
dns_name: '',
family: '',
id: 0,
interface: 0,
last_updated: '',
nat_inside: 0,
nat_outside: 0,
role: '',
status: '',
tags: [],
tenant: 0,
vrf: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/ipam/ip-addresses/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/ipam/ip-addresses/:id/',
headers: {'content-type': 'application/json'},
data: {
address: '',
created: '',
custom_fields: {},
description: '',
dns_name: '',
family: '',
id: 0,
interface: 0,
last_updated: '',
nat_inside: 0,
nat_outside: 0,
role: '',
status: '',
tags: [],
tenant: 0,
vrf: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/ip-addresses/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"address":"","created":"","custom_fields":{},"description":"","dns_name":"","family":"","id":0,"interface":0,"last_updated":"","nat_inside":0,"nat_outside":0,"role":"","status":"","tags":[],"tenant":0,"vrf":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}}/ipam/ip-addresses/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "address": "",\n "created": "",\n "custom_fields": {},\n "description": "",\n "dns_name": "",\n "family": "",\n "id": 0,\n "interface": 0,\n "last_updated": "",\n "nat_inside": 0,\n "nat_outside": 0,\n "role": "",\n "status": "",\n "tags": [],\n "tenant": 0,\n "vrf": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/ipam/ip-addresses/:id/")
.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/ipam/ip-addresses/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
address: '',
created: '',
custom_fields: {},
description: '',
dns_name: '',
family: '',
id: 0,
interface: 0,
last_updated: '',
nat_inside: 0,
nat_outside: 0,
role: '',
status: '',
tags: [],
tenant: 0,
vrf: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/ipam/ip-addresses/:id/',
headers: {'content-type': 'application/json'},
body: {
address: '',
created: '',
custom_fields: {},
description: '',
dns_name: '',
family: '',
id: 0,
interface: 0,
last_updated: '',
nat_inside: 0,
nat_outside: 0,
role: '',
status: '',
tags: [],
tenant: 0,
vrf: 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('PATCH', '{{baseUrl}}/ipam/ip-addresses/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
address: '',
created: '',
custom_fields: {},
description: '',
dns_name: '',
family: '',
id: 0,
interface: 0,
last_updated: '',
nat_inside: 0,
nat_outside: 0,
role: '',
status: '',
tags: [],
tenant: 0,
vrf: 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: 'PATCH',
url: '{{baseUrl}}/ipam/ip-addresses/:id/',
headers: {'content-type': 'application/json'},
data: {
address: '',
created: '',
custom_fields: {},
description: '',
dns_name: '',
family: '',
id: 0,
interface: 0,
last_updated: '',
nat_inside: 0,
nat_outside: 0,
role: '',
status: '',
tags: [],
tenant: 0,
vrf: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/ip-addresses/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"address":"","created":"","custom_fields":{},"description":"","dns_name":"","family":"","id":0,"interface":0,"last_updated":"","nat_inside":0,"nat_outside":0,"role":"","status":"","tags":[],"tenant":0,"vrf":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 = @{ @"address": @"",
@"created": @"",
@"custom_fields": @{ },
@"description": @"",
@"dns_name": @"",
@"family": @"",
@"id": @0,
@"interface": @0,
@"last_updated": @"",
@"nat_inside": @0,
@"nat_outside": @0,
@"role": @"",
@"status": @"",
@"tags": @[ ],
@"tenant": @0,
@"vrf": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/ip-addresses/:id/"]
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}}/ipam/ip-addresses/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/ip-addresses/:id/",
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([
'address' => '',
'created' => '',
'custom_fields' => [
],
'description' => '',
'dns_name' => '',
'family' => '',
'id' => 0,
'interface' => 0,
'last_updated' => '',
'nat_inside' => 0,
'nat_outside' => 0,
'role' => '',
'status' => '',
'tags' => [
],
'tenant' => 0,
'vrf' => 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('PATCH', '{{baseUrl}}/ipam/ip-addresses/:id/', [
'body' => '{
"address": "",
"created": "",
"custom_fields": {},
"description": "",
"dns_name": "",
"family": "",
"id": 0,
"interface": 0,
"last_updated": "",
"nat_inside": 0,
"nat_outside": 0,
"role": "",
"status": "",
"tags": [],
"tenant": 0,
"vrf": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/ip-addresses/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'address' => '',
'created' => '',
'custom_fields' => [
],
'description' => '',
'dns_name' => '',
'family' => '',
'id' => 0,
'interface' => 0,
'last_updated' => '',
'nat_inside' => 0,
'nat_outside' => 0,
'role' => '',
'status' => '',
'tags' => [
],
'tenant' => 0,
'vrf' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'address' => '',
'created' => '',
'custom_fields' => [
],
'description' => '',
'dns_name' => '',
'family' => '',
'id' => 0,
'interface' => 0,
'last_updated' => '',
'nat_inside' => 0,
'nat_outside' => 0,
'role' => '',
'status' => '',
'tags' => [
],
'tenant' => 0,
'vrf' => 0
]));
$request->setRequestUrl('{{baseUrl}}/ipam/ip-addresses/:id/');
$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}}/ipam/ip-addresses/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"address": "",
"created": "",
"custom_fields": {},
"description": "",
"dns_name": "",
"family": "",
"id": 0,
"interface": 0,
"last_updated": "",
"nat_inside": 0,
"nat_outside": 0,
"role": "",
"status": "",
"tags": [],
"tenant": 0,
"vrf": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/ip-addresses/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"address": "",
"created": "",
"custom_fields": {},
"description": "",
"dns_name": "",
"family": "",
"id": 0,
"interface": 0,
"last_updated": "",
"nat_inside": 0,
"nat_outside": 0,
"role": "",
"status": "",
"tags": [],
"tenant": 0,
"vrf": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/ipam/ip-addresses/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/ip-addresses/:id/"
payload = {
"address": "",
"created": "",
"custom_fields": {},
"description": "",
"dns_name": "",
"family": "",
"id": 0,
"interface": 0,
"last_updated": "",
"nat_inside": 0,
"nat_outside": 0,
"role": "",
"status": "",
"tags": [],
"tenant": 0,
"vrf": 0
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/ip-addresses/:id/"
payload <- "{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\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}}/ipam/ip-addresses/:id/")
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 \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/ipam/ip-addresses/:id/') do |req|
req.body = "{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\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}}/ipam/ip-addresses/:id/";
let payload = json!({
"address": "",
"created": "",
"custom_fields": json!({}),
"description": "",
"dns_name": "",
"family": "",
"id": 0,
"interface": 0,
"last_updated": "",
"nat_inside": 0,
"nat_outside": 0,
"role": "",
"status": "",
"tags": (),
"tenant": 0,
"vrf": 0
});
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}}/ipam/ip-addresses/:id/ \
--header 'content-type: application/json' \
--data '{
"address": "",
"created": "",
"custom_fields": {},
"description": "",
"dns_name": "",
"family": "",
"id": 0,
"interface": 0,
"last_updated": "",
"nat_inside": 0,
"nat_outside": 0,
"role": "",
"status": "",
"tags": [],
"tenant": 0,
"vrf": 0
}'
echo '{
"address": "",
"created": "",
"custom_fields": {},
"description": "",
"dns_name": "",
"family": "",
"id": 0,
"interface": 0,
"last_updated": "",
"nat_inside": 0,
"nat_outside": 0,
"role": "",
"status": "",
"tags": [],
"tenant": 0,
"vrf": 0
}' | \
http PATCH {{baseUrl}}/ipam/ip-addresses/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "address": "",\n "created": "",\n "custom_fields": {},\n "description": "",\n "dns_name": "",\n "family": "",\n "id": 0,\n "interface": 0,\n "last_updated": "",\n "nat_inside": 0,\n "nat_outside": 0,\n "role": "",\n "status": "",\n "tags": [],\n "tenant": 0,\n "vrf": 0\n}' \
--output-document \
- {{baseUrl}}/ipam/ip-addresses/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"address": "",
"created": "",
"custom_fields": [],
"description": "",
"dns_name": "",
"family": "",
"id": 0,
"interface": 0,
"last_updated": "",
"nat_inside": 0,
"nat_outside": 0,
"role": "",
"status": "",
"tags": [],
"tenant": 0,
"vrf": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/ip-addresses/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
ipam_ip-addresses_read
{{baseUrl}}/ipam/ip-addresses/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/ip-addresses/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/ipam/ip-addresses/:id/")
require "http/client"
url = "{{baseUrl}}/ipam/ip-addresses/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/ipam/ip-addresses/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/ip-addresses/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/ip-addresses/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/ipam/ip-addresses/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/ipam/ip-addresses/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/ip-addresses/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/ip-addresses/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/ipam/ip-addresses/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/ipam/ip-addresses/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/ipam/ip-addresses/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/ip-addresses/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/ipam/ip-addresses/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/ipam/ip-addresses/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/ipam/ip-addresses/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/ipam/ip-addresses/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/ipam/ip-addresses/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/ipam/ip-addresses/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/ip-addresses/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/ip-addresses/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/ipam/ip-addresses/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/ip-addresses/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/ipam/ip-addresses/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/ip-addresses/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/ipam/ip-addresses/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/ipam/ip-addresses/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/ip-addresses/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/ipam/ip-addresses/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/ip-addresses/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/ip-addresses/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/ipam/ip-addresses/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/ipam/ip-addresses/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/ip-addresses/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/ipam/ip-addresses/:id/
http GET {{baseUrl}}/ipam/ip-addresses/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/ipam/ip-addresses/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/ip-addresses/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
ipam_ip-addresses_update
{{baseUrl}}/ipam/ip-addresses/:id/
BODY json
{
"address": "",
"created": "",
"custom_fields": {},
"description": "",
"dns_name": "",
"family": "",
"id": 0,
"interface": 0,
"last_updated": "",
"nat_inside": 0,
"nat_outside": 0,
"role": "",
"status": "",
"tags": [],
"tenant": 0,
"vrf": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/ip-addresses/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/ipam/ip-addresses/:id/" {:content-type :json
:form-params {:address ""
:created ""
:custom_fields {}
:description ""
:dns_name ""
:family ""
:id 0
:interface 0
:last_updated ""
:nat_inside 0
:nat_outside 0
:role ""
:status ""
:tags []
:tenant 0
:vrf 0}})
require "http/client"
url = "{{baseUrl}}/ipam/ip-addresses/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\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}}/ipam/ip-addresses/:id/"),
Content = new StringContent("{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/ip-addresses/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/ip-addresses/:id/"
payload := strings.NewReader("{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\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/ipam/ip-addresses/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 275
{
"address": "",
"created": "",
"custom_fields": {},
"description": "",
"dns_name": "",
"family": "",
"id": 0,
"interface": 0,
"last_updated": "",
"nat_inside": 0,
"nat_outside": 0,
"role": "",
"status": "",
"tags": [],
"tenant": 0,
"vrf": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/ipam/ip-addresses/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/ip-addresses/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/ip-addresses/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/ipam/ip-addresses/:id/")
.header("content-type", "application/json")
.body("{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\n}")
.asString();
const data = JSON.stringify({
address: '',
created: '',
custom_fields: {},
description: '',
dns_name: '',
family: '',
id: 0,
interface: 0,
last_updated: '',
nat_inside: 0,
nat_outside: 0,
role: '',
status: '',
tags: [],
tenant: 0,
vrf: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/ipam/ip-addresses/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/ipam/ip-addresses/:id/',
headers: {'content-type': 'application/json'},
data: {
address: '',
created: '',
custom_fields: {},
description: '',
dns_name: '',
family: '',
id: 0,
interface: 0,
last_updated: '',
nat_inside: 0,
nat_outside: 0,
role: '',
status: '',
tags: [],
tenant: 0,
vrf: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/ip-addresses/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"address":"","created":"","custom_fields":{},"description":"","dns_name":"","family":"","id":0,"interface":0,"last_updated":"","nat_inside":0,"nat_outside":0,"role":"","status":"","tags":[],"tenant":0,"vrf":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}}/ipam/ip-addresses/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "address": "",\n "created": "",\n "custom_fields": {},\n "description": "",\n "dns_name": "",\n "family": "",\n "id": 0,\n "interface": 0,\n "last_updated": "",\n "nat_inside": 0,\n "nat_outside": 0,\n "role": "",\n "status": "",\n "tags": [],\n "tenant": 0,\n "vrf": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/ipam/ip-addresses/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/ipam/ip-addresses/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
address: '',
created: '',
custom_fields: {},
description: '',
dns_name: '',
family: '',
id: 0,
interface: 0,
last_updated: '',
nat_inside: 0,
nat_outside: 0,
role: '',
status: '',
tags: [],
tenant: 0,
vrf: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/ipam/ip-addresses/:id/',
headers: {'content-type': 'application/json'},
body: {
address: '',
created: '',
custom_fields: {},
description: '',
dns_name: '',
family: '',
id: 0,
interface: 0,
last_updated: '',
nat_inside: 0,
nat_outside: 0,
role: '',
status: '',
tags: [],
tenant: 0,
vrf: 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('PUT', '{{baseUrl}}/ipam/ip-addresses/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
address: '',
created: '',
custom_fields: {},
description: '',
dns_name: '',
family: '',
id: 0,
interface: 0,
last_updated: '',
nat_inside: 0,
nat_outside: 0,
role: '',
status: '',
tags: [],
tenant: 0,
vrf: 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: 'PUT',
url: '{{baseUrl}}/ipam/ip-addresses/:id/',
headers: {'content-type': 'application/json'},
data: {
address: '',
created: '',
custom_fields: {},
description: '',
dns_name: '',
family: '',
id: 0,
interface: 0,
last_updated: '',
nat_inside: 0,
nat_outside: 0,
role: '',
status: '',
tags: [],
tenant: 0,
vrf: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/ip-addresses/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"address":"","created":"","custom_fields":{},"description":"","dns_name":"","family":"","id":0,"interface":0,"last_updated":"","nat_inside":0,"nat_outside":0,"role":"","status":"","tags":[],"tenant":0,"vrf":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 = @{ @"address": @"",
@"created": @"",
@"custom_fields": @{ },
@"description": @"",
@"dns_name": @"",
@"family": @"",
@"id": @0,
@"interface": @0,
@"last_updated": @"",
@"nat_inside": @0,
@"nat_outside": @0,
@"role": @"",
@"status": @"",
@"tags": @[ ],
@"tenant": @0,
@"vrf": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/ip-addresses/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/ipam/ip-addresses/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/ip-addresses/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'address' => '',
'created' => '',
'custom_fields' => [
],
'description' => '',
'dns_name' => '',
'family' => '',
'id' => 0,
'interface' => 0,
'last_updated' => '',
'nat_inside' => 0,
'nat_outside' => 0,
'role' => '',
'status' => '',
'tags' => [
],
'tenant' => 0,
'vrf' => 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('PUT', '{{baseUrl}}/ipam/ip-addresses/:id/', [
'body' => '{
"address": "",
"created": "",
"custom_fields": {},
"description": "",
"dns_name": "",
"family": "",
"id": 0,
"interface": 0,
"last_updated": "",
"nat_inside": 0,
"nat_outside": 0,
"role": "",
"status": "",
"tags": [],
"tenant": 0,
"vrf": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/ip-addresses/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'address' => '',
'created' => '',
'custom_fields' => [
],
'description' => '',
'dns_name' => '',
'family' => '',
'id' => 0,
'interface' => 0,
'last_updated' => '',
'nat_inside' => 0,
'nat_outside' => 0,
'role' => '',
'status' => '',
'tags' => [
],
'tenant' => 0,
'vrf' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'address' => '',
'created' => '',
'custom_fields' => [
],
'description' => '',
'dns_name' => '',
'family' => '',
'id' => 0,
'interface' => 0,
'last_updated' => '',
'nat_inside' => 0,
'nat_outside' => 0,
'role' => '',
'status' => '',
'tags' => [
],
'tenant' => 0,
'vrf' => 0
]));
$request->setRequestUrl('{{baseUrl}}/ipam/ip-addresses/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/ipam/ip-addresses/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"address": "",
"created": "",
"custom_fields": {},
"description": "",
"dns_name": "",
"family": "",
"id": 0,
"interface": 0,
"last_updated": "",
"nat_inside": 0,
"nat_outside": 0,
"role": "",
"status": "",
"tags": [],
"tenant": 0,
"vrf": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/ip-addresses/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"address": "",
"created": "",
"custom_fields": {},
"description": "",
"dns_name": "",
"family": "",
"id": 0,
"interface": 0,
"last_updated": "",
"nat_inside": 0,
"nat_outside": 0,
"role": "",
"status": "",
"tags": [],
"tenant": 0,
"vrf": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/ipam/ip-addresses/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/ip-addresses/:id/"
payload = {
"address": "",
"created": "",
"custom_fields": {},
"description": "",
"dns_name": "",
"family": "",
"id": 0,
"interface": 0,
"last_updated": "",
"nat_inside": 0,
"nat_outside": 0,
"role": "",
"status": "",
"tags": [],
"tenant": 0,
"vrf": 0
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/ip-addresses/:id/"
payload <- "{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\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}}/ipam/ip-addresses/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/ipam/ip-addresses/:id/') do |req|
req.body = "{\n \"address\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"dns_name\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"interface\": 0,\n \"last_updated\": \"\",\n \"nat_inside\": 0,\n \"nat_outside\": 0,\n \"role\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vrf\": 0\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}}/ipam/ip-addresses/:id/";
let payload = json!({
"address": "",
"created": "",
"custom_fields": json!({}),
"description": "",
"dns_name": "",
"family": "",
"id": 0,
"interface": 0,
"last_updated": "",
"nat_inside": 0,
"nat_outside": 0,
"role": "",
"status": "",
"tags": (),
"tenant": 0,
"vrf": 0
});
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}}/ipam/ip-addresses/:id/ \
--header 'content-type: application/json' \
--data '{
"address": "",
"created": "",
"custom_fields": {},
"description": "",
"dns_name": "",
"family": "",
"id": 0,
"interface": 0,
"last_updated": "",
"nat_inside": 0,
"nat_outside": 0,
"role": "",
"status": "",
"tags": [],
"tenant": 0,
"vrf": 0
}'
echo '{
"address": "",
"created": "",
"custom_fields": {},
"description": "",
"dns_name": "",
"family": "",
"id": 0,
"interface": 0,
"last_updated": "",
"nat_inside": 0,
"nat_outside": 0,
"role": "",
"status": "",
"tags": [],
"tenant": 0,
"vrf": 0
}' | \
http PUT {{baseUrl}}/ipam/ip-addresses/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "address": "",\n "created": "",\n "custom_fields": {},\n "description": "",\n "dns_name": "",\n "family": "",\n "id": 0,\n "interface": 0,\n "last_updated": "",\n "nat_inside": 0,\n "nat_outside": 0,\n "role": "",\n "status": "",\n "tags": [],\n "tenant": 0,\n "vrf": 0\n}' \
--output-document \
- {{baseUrl}}/ipam/ip-addresses/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"address": "",
"created": "",
"custom_fields": [],
"description": "",
"dns_name": "",
"family": "",
"id": 0,
"interface": 0,
"last_updated": "",
"nat_inside": 0,
"nat_outside": 0,
"role": "",
"status": "",
"tags": [],
"tenant": 0,
"vrf": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/ip-addresses/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
ipam_prefixes_available-ips_create
{{baseUrl}}/ipam/prefixes/:id/available-ips/
BODY json
{
"address": "",
"family": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/prefixes/:id/available-ips/");
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 \"address\": \"\",\n \"family\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/ipam/prefixes/:id/available-ips/" {:content-type :json
:form-params {:address ""
:family 0}})
require "http/client"
url = "{{baseUrl}}/ipam/prefixes/:id/available-ips/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"address\": \"\",\n \"family\": 0\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/ipam/prefixes/:id/available-ips/"),
Content = new StringContent("{\n \"address\": \"\",\n \"family\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/prefixes/:id/available-ips/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"address\": \"\",\n \"family\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/prefixes/:id/available-ips/"
payload := strings.NewReader("{\n \"address\": \"\",\n \"family\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ipam/prefixes/:id/available-ips/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 34
{
"address": "",
"family": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/ipam/prefixes/:id/available-ips/")
.setHeader("content-type", "application/json")
.setBody("{\n \"address\": \"\",\n \"family\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/prefixes/:id/available-ips/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"address\": \"\",\n \"family\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"address\": \"\",\n \"family\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/prefixes/:id/available-ips/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/ipam/prefixes/:id/available-ips/")
.header("content-type", "application/json")
.body("{\n \"address\": \"\",\n \"family\": 0\n}")
.asString();
const data = JSON.stringify({
address: '',
family: 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}}/ipam/prefixes/:id/available-ips/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/ipam/prefixes/:id/available-ips/',
headers: {'content-type': 'application/json'},
data: {address: '', family: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/prefixes/:id/available-ips/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"address":"","family":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}}/ipam/prefixes/:id/available-ips/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "address": "",\n "family": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"address\": \"\",\n \"family\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/ipam/prefixes/:id/available-ips/")
.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/ipam/prefixes/:id/available-ips/',
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({address: '', family: 0}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/ipam/prefixes/:id/available-ips/',
headers: {'content-type': 'application/json'},
body: {address: '', family: 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}}/ipam/prefixes/:id/available-ips/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
address: '',
family: 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}}/ipam/prefixes/:id/available-ips/',
headers: {'content-type': 'application/json'},
data: {address: '', family: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/prefixes/:id/available-ips/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"address":"","family":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 = @{ @"address": @"",
@"family": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/prefixes/:id/available-ips/"]
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}}/ipam/prefixes/:id/available-ips/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"address\": \"\",\n \"family\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/prefixes/:id/available-ips/",
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([
'address' => '',
'family' => 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}}/ipam/prefixes/:id/available-ips/', [
'body' => '{
"address": "",
"family": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/prefixes/:id/available-ips/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'address' => '',
'family' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'address' => '',
'family' => 0
]));
$request->setRequestUrl('{{baseUrl}}/ipam/prefixes/:id/available-ips/');
$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}}/ipam/prefixes/:id/available-ips/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"address": "",
"family": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/prefixes/:id/available-ips/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"address": "",
"family": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"address\": \"\",\n \"family\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/ipam/prefixes/:id/available-ips/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/prefixes/:id/available-ips/"
payload = {
"address": "",
"family": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/prefixes/:id/available-ips/"
payload <- "{\n \"address\": \"\",\n \"family\": 0\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/ipam/prefixes/:id/available-ips/")
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 \"address\": \"\",\n \"family\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/ipam/prefixes/:id/available-ips/') do |req|
req.body = "{\n \"address\": \"\",\n \"family\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/prefixes/:id/available-ips/";
let payload = json!({
"address": "",
"family": 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}}/ipam/prefixes/:id/available-ips/ \
--header 'content-type: application/json' \
--data '{
"address": "",
"family": 0
}'
echo '{
"address": "",
"family": 0
}' | \
http POST {{baseUrl}}/ipam/prefixes/:id/available-ips/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "address": "",\n "family": 0\n}' \
--output-document \
- {{baseUrl}}/ipam/prefixes/:id/available-ips/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"address": "",
"family": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/prefixes/:id/available-ips/")! 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
ipam_prefixes_available-ips_read
{{baseUrl}}/ipam/prefixes/:id/available-ips/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/prefixes/:id/available-ips/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/ipam/prefixes/:id/available-ips/")
require "http/client"
url = "{{baseUrl}}/ipam/prefixes/:id/available-ips/"
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}}/ipam/prefixes/:id/available-ips/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/prefixes/:id/available-ips/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/prefixes/:id/available-ips/"
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/ipam/prefixes/:id/available-ips/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/ipam/prefixes/:id/available-ips/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/prefixes/:id/available-ips/"))
.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}}/ipam/prefixes/:id/available-ips/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/ipam/prefixes/:id/available-ips/")
.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}}/ipam/prefixes/:id/available-ips/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/ipam/prefixes/:id/available-ips/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/prefixes/:id/available-ips/';
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}}/ipam/prefixes/:id/available-ips/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/ipam/prefixes/:id/available-ips/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/ipam/prefixes/:id/available-ips/',
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}}/ipam/prefixes/:id/available-ips/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/ipam/prefixes/:id/available-ips/');
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}}/ipam/prefixes/:id/available-ips/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/prefixes/:id/available-ips/';
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}}/ipam/prefixes/:id/available-ips/"]
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}}/ipam/prefixes/:id/available-ips/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/prefixes/:id/available-ips/",
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}}/ipam/prefixes/:id/available-ips/');
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/prefixes/:id/available-ips/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/ipam/prefixes/:id/available-ips/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/ipam/prefixes/:id/available-ips/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/prefixes/:id/available-ips/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/ipam/prefixes/:id/available-ips/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/prefixes/:id/available-ips/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/prefixes/:id/available-ips/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/ipam/prefixes/:id/available-ips/")
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/ipam/prefixes/:id/available-ips/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/prefixes/:id/available-ips/";
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}}/ipam/prefixes/:id/available-ips/
http GET {{baseUrl}}/ipam/prefixes/:id/available-ips/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/ipam/prefixes/:id/available-ips/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/prefixes/:id/available-ips/")! 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
ipam_prefixes_create
{{baseUrl}}/ipam/prefixes/
BODY json
{
"created": "",
"custom_fields": {},
"description": "",
"family": "",
"id": 0,
"is_pool": false,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vlan": 0,
"vrf": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/prefixes/");
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 \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/ipam/prefixes/" {:content-type :json
:form-params {:created ""
:custom_fields {}
:description ""
:family ""
:id 0
:is_pool false
:last_updated ""
:prefix ""
:role 0
:site 0
:status ""
:tags []
:tenant 0
:vlan 0
:vrf 0}})
require "http/client"
url = "{{baseUrl}}/ipam/prefixes/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/ipam/prefixes/"),
Content = new StringContent("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/prefixes/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/prefixes/"
payload := strings.NewReader("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ipam/prefixes/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 244
{
"created": "",
"custom_fields": {},
"description": "",
"family": "",
"id": 0,
"is_pool": false,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vlan": 0,
"vrf": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/ipam/prefixes/")
.setHeader("content-type", "application/json")
.setBody("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/prefixes/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/prefixes/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/ipam/prefixes/")
.header("content-type", "application/json")
.body("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}")
.asString();
const data = JSON.stringify({
created: '',
custom_fields: {},
description: '',
family: '',
id: 0,
is_pool: false,
last_updated: '',
prefix: '',
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vlan: 0,
vrf: 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}}/ipam/prefixes/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/ipam/prefixes/',
headers: {'content-type': 'application/json'},
data: {
created: '',
custom_fields: {},
description: '',
family: '',
id: 0,
is_pool: false,
last_updated: '',
prefix: '',
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vlan: 0,
vrf: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/prefixes/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"created":"","custom_fields":{},"description":"","family":"","id":0,"is_pool":false,"last_updated":"","prefix":"","role":0,"site":0,"status":"","tags":[],"tenant":0,"vlan":0,"vrf":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}}/ipam/prefixes/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "created": "",\n "custom_fields": {},\n "description": "",\n "family": "",\n "id": 0,\n "is_pool": false,\n "last_updated": "",\n "prefix": "",\n "role": 0,\n "site": 0,\n "status": "",\n "tags": [],\n "tenant": 0,\n "vlan": 0,\n "vrf": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/ipam/prefixes/")
.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/ipam/prefixes/',
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({
created: '',
custom_fields: {},
description: '',
family: '',
id: 0,
is_pool: false,
last_updated: '',
prefix: '',
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vlan: 0,
vrf: 0
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/ipam/prefixes/',
headers: {'content-type': 'application/json'},
body: {
created: '',
custom_fields: {},
description: '',
family: '',
id: 0,
is_pool: false,
last_updated: '',
prefix: '',
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vlan: 0,
vrf: 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}}/ipam/prefixes/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
created: '',
custom_fields: {},
description: '',
family: '',
id: 0,
is_pool: false,
last_updated: '',
prefix: '',
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vlan: 0,
vrf: 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}}/ipam/prefixes/',
headers: {'content-type': 'application/json'},
data: {
created: '',
custom_fields: {},
description: '',
family: '',
id: 0,
is_pool: false,
last_updated: '',
prefix: '',
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vlan: 0,
vrf: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/prefixes/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"created":"","custom_fields":{},"description":"","family":"","id":0,"is_pool":false,"last_updated":"","prefix":"","role":0,"site":0,"status":"","tags":[],"tenant":0,"vlan":0,"vrf":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 = @{ @"created": @"",
@"custom_fields": @{ },
@"description": @"",
@"family": @"",
@"id": @0,
@"is_pool": @NO,
@"last_updated": @"",
@"prefix": @"",
@"role": @0,
@"site": @0,
@"status": @"",
@"tags": @[ ],
@"tenant": @0,
@"vlan": @0,
@"vrf": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/prefixes/"]
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}}/ipam/prefixes/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/prefixes/",
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([
'created' => '',
'custom_fields' => [
],
'description' => '',
'family' => '',
'id' => 0,
'is_pool' => null,
'last_updated' => '',
'prefix' => '',
'role' => 0,
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'vlan' => 0,
'vrf' => 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}}/ipam/prefixes/', [
'body' => '{
"created": "",
"custom_fields": {},
"description": "",
"family": "",
"id": 0,
"is_pool": false,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vlan": 0,
"vrf": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/prefixes/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'created' => '',
'custom_fields' => [
],
'description' => '',
'family' => '',
'id' => 0,
'is_pool' => null,
'last_updated' => '',
'prefix' => '',
'role' => 0,
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'vlan' => 0,
'vrf' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'created' => '',
'custom_fields' => [
],
'description' => '',
'family' => '',
'id' => 0,
'is_pool' => null,
'last_updated' => '',
'prefix' => '',
'role' => 0,
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'vlan' => 0,
'vrf' => 0
]));
$request->setRequestUrl('{{baseUrl}}/ipam/prefixes/');
$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}}/ipam/prefixes/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"custom_fields": {},
"description": "",
"family": "",
"id": 0,
"is_pool": false,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vlan": 0,
"vrf": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/prefixes/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"custom_fields": {},
"description": "",
"family": "",
"id": 0,
"is_pool": false,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vlan": 0,
"vrf": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/ipam/prefixes/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/prefixes/"
payload = {
"created": "",
"custom_fields": {},
"description": "",
"family": "",
"id": 0,
"is_pool": False,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vlan": 0,
"vrf": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/prefixes/"
payload <- "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/ipam/prefixes/")
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 \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/ipam/prefixes/') do |req|
req.body = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/prefixes/";
let payload = json!({
"created": "",
"custom_fields": json!({}),
"description": "",
"family": "",
"id": 0,
"is_pool": false,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": (),
"tenant": 0,
"vlan": 0,
"vrf": 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}}/ipam/prefixes/ \
--header 'content-type: application/json' \
--data '{
"created": "",
"custom_fields": {},
"description": "",
"family": "",
"id": 0,
"is_pool": false,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vlan": 0,
"vrf": 0
}'
echo '{
"created": "",
"custom_fields": {},
"description": "",
"family": "",
"id": 0,
"is_pool": false,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vlan": 0,
"vrf": 0
}' | \
http POST {{baseUrl}}/ipam/prefixes/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "created": "",\n "custom_fields": {},\n "description": "",\n "family": "",\n "id": 0,\n "is_pool": false,\n "last_updated": "",\n "prefix": "",\n "role": 0,\n "site": 0,\n "status": "",\n "tags": [],\n "tenant": 0,\n "vlan": 0,\n "vrf": 0\n}' \
--output-document \
- {{baseUrl}}/ipam/prefixes/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"created": "",
"custom_fields": [],
"description": "",
"family": "",
"id": 0,
"is_pool": false,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vlan": 0,
"vrf": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/prefixes/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
ipam_prefixes_delete
{{baseUrl}}/ipam/prefixes/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/prefixes/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/ipam/prefixes/:id/")
require "http/client"
url = "{{baseUrl}}/ipam/prefixes/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/ipam/prefixes/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/prefixes/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/prefixes/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/ipam/prefixes/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/ipam/prefixes/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/prefixes/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/prefixes/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/ipam/prefixes/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/ipam/prefixes/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/ipam/prefixes/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/prefixes/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/ipam/prefixes/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/ipam/prefixes/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/ipam/prefixes/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/ipam/prefixes/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/ipam/prefixes/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/ipam/prefixes/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/prefixes/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/prefixes/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/ipam/prefixes/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/prefixes/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/ipam/prefixes/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/prefixes/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/ipam/prefixes/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/ipam/prefixes/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/prefixes/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/ipam/prefixes/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/prefixes/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/prefixes/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/ipam/prefixes/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/ipam/prefixes/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/prefixes/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/ipam/prefixes/:id/
http DELETE {{baseUrl}}/ipam/prefixes/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/ipam/prefixes/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/prefixes/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
ipam_prefixes_list
{{baseUrl}}/ipam/prefixes/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/prefixes/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/ipam/prefixes/")
require "http/client"
url = "{{baseUrl}}/ipam/prefixes/"
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}}/ipam/prefixes/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/prefixes/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/prefixes/"
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/ipam/prefixes/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/ipam/prefixes/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/prefixes/"))
.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}}/ipam/prefixes/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/ipam/prefixes/")
.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}}/ipam/prefixes/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/ipam/prefixes/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/prefixes/';
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}}/ipam/prefixes/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/ipam/prefixes/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/ipam/prefixes/',
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}}/ipam/prefixes/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/ipam/prefixes/');
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}}/ipam/prefixes/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/prefixes/';
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}}/ipam/prefixes/"]
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}}/ipam/prefixes/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/prefixes/",
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}}/ipam/prefixes/');
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/prefixes/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/ipam/prefixes/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/ipam/prefixes/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/prefixes/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/ipam/prefixes/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/prefixes/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/prefixes/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/ipam/prefixes/")
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/ipam/prefixes/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/prefixes/";
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}}/ipam/prefixes/
http GET {{baseUrl}}/ipam/prefixes/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/ipam/prefixes/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/prefixes/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
ipam_prefixes_partial_update
{{baseUrl}}/ipam/prefixes/:id/
BODY json
{
"created": "",
"custom_fields": {},
"description": "",
"family": "",
"id": 0,
"is_pool": false,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vlan": 0,
"vrf": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/prefixes/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/ipam/prefixes/:id/" {:content-type :json
:form-params {:created ""
:custom_fields {}
:description ""
:family ""
:id 0
:is_pool false
:last_updated ""
:prefix ""
:role 0
:site 0
:status ""
:tags []
:tenant 0
:vlan 0
:vrf 0}})
require "http/client"
url = "{{baseUrl}}/ipam/prefixes/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\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}}/ipam/prefixes/:id/"),
Content = new StringContent("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/prefixes/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/prefixes/:id/"
payload := strings.NewReader("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\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/ipam/prefixes/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 244
{
"created": "",
"custom_fields": {},
"description": "",
"family": "",
"id": 0,
"is_pool": false,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vlan": 0,
"vrf": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/ipam/prefixes/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/prefixes/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/prefixes/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/ipam/prefixes/:id/")
.header("content-type", "application/json")
.body("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}")
.asString();
const data = JSON.stringify({
created: '',
custom_fields: {},
description: '',
family: '',
id: 0,
is_pool: false,
last_updated: '',
prefix: '',
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vlan: 0,
vrf: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/ipam/prefixes/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/ipam/prefixes/:id/',
headers: {'content-type': 'application/json'},
data: {
created: '',
custom_fields: {},
description: '',
family: '',
id: 0,
is_pool: false,
last_updated: '',
prefix: '',
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vlan: 0,
vrf: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/prefixes/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"created":"","custom_fields":{},"description":"","family":"","id":0,"is_pool":false,"last_updated":"","prefix":"","role":0,"site":0,"status":"","tags":[],"tenant":0,"vlan":0,"vrf":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}}/ipam/prefixes/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "created": "",\n "custom_fields": {},\n "description": "",\n "family": "",\n "id": 0,\n "is_pool": false,\n "last_updated": "",\n "prefix": "",\n "role": 0,\n "site": 0,\n "status": "",\n "tags": [],\n "tenant": 0,\n "vlan": 0,\n "vrf": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/ipam/prefixes/:id/")
.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/ipam/prefixes/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
created: '',
custom_fields: {},
description: '',
family: '',
id: 0,
is_pool: false,
last_updated: '',
prefix: '',
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vlan: 0,
vrf: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/ipam/prefixes/:id/',
headers: {'content-type': 'application/json'},
body: {
created: '',
custom_fields: {},
description: '',
family: '',
id: 0,
is_pool: false,
last_updated: '',
prefix: '',
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vlan: 0,
vrf: 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('PATCH', '{{baseUrl}}/ipam/prefixes/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
created: '',
custom_fields: {},
description: '',
family: '',
id: 0,
is_pool: false,
last_updated: '',
prefix: '',
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vlan: 0,
vrf: 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: 'PATCH',
url: '{{baseUrl}}/ipam/prefixes/:id/',
headers: {'content-type': 'application/json'},
data: {
created: '',
custom_fields: {},
description: '',
family: '',
id: 0,
is_pool: false,
last_updated: '',
prefix: '',
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vlan: 0,
vrf: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/prefixes/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"created":"","custom_fields":{},"description":"","family":"","id":0,"is_pool":false,"last_updated":"","prefix":"","role":0,"site":0,"status":"","tags":[],"tenant":0,"vlan":0,"vrf":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 = @{ @"created": @"",
@"custom_fields": @{ },
@"description": @"",
@"family": @"",
@"id": @0,
@"is_pool": @NO,
@"last_updated": @"",
@"prefix": @"",
@"role": @0,
@"site": @0,
@"status": @"",
@"tags": @[ ],
@"tenant": @0,
@"vlan": @0,
@"vrf": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/prefixes/:id/"]
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}}/ipam/prefixes/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/prefixes/:id/",
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([
'created' => '',
'custom_fields' => [
],
'description' => '',
'family' => '',
'id' => 0,
'is_pool' => null,
'last_updated' => '',
'prefix' => '',
'role' => 0,
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'vlan' => 0,
'vrf' => 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('PATCH', '{{baseUrl}}/ipam/prefixes/:id/', [
'body' => '{
"created": "",
"custom_fields": {},
"description": "",
"family": "",
"id": 0,
"is_pool": false,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vlan": 0,
"vrf": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/prefixes/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'created' => '',
'custom_fields' => [
],
'description' => '',
'family' => '',
'id' => 0,
'is_pool' => null,
'last_updated' => '',
'prefix' => '',
'role' => 0,
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'vlan' => 0,
'vrf' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'created' => '',
'custom_fields' => [
],
'description' => '',
'family' => '',
'id' => 0,
'is_pool' => null,
'last_updated' => '',
'prefix' => '',
'role' => 0,
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'vlan' => 0,
'vrf' => 0
]));
$request->setRequestUrl('{{baseUrl}}/ipam/prefixes/:id/');
$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}}/ipam/prefixes/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"custom_fields": {},
"description": "",
"family": "",
"id": 0,
"is_pool": false,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vlan": 0,
"vrf": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/prefixes/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"custom_fields": {},
"description": "",
"family": "",
"id": 0,
"is_pool": false,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vlan": 0,
"vrf": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/ipam/prefixes/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/prefixes/:id/"
payload = {
"created": "",
"custom_fields": {},
"description": "",
"family": "",
"id": 0,
"is_pool": False,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vlan": 0,
"vrf": 0
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/prefixes/:id/"
payload <- "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\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}}/ipam/prefixes/:id/")
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 \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/ipam/prefixes/:id/') do |req|
req.body = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\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}}/ipam/prefixes/:id/";
let payload = json!({
"created": "",
"custom_fields": json!({}),
"description": "",
"family": "",
"id": 0,
"is_pool": false,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": (),
"tenant": 0,
"vlan": 0,
"vrf": 0
});
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}}/ipam/prefixes/:id/ \
--header 'content-type: application/json' \
--data '{
"created": "",
"custom_fields": {},
"description": "",
"family": "",
"id": 0,
"is_pool": false,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vlan": 0,
"vrf": 0
}'
echo '{
"created": "",
"custom_fields": {},
"description": "",
"family": "",
"id": 0,
"is_pool": false,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vlan": 0,
"vrf": 0
}' | \
http PATCH {{baseUrl}}/ipam/prefixes/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "created": "",\n "custom_fields": {},\n "description": "",\n "family": "",\n "id": 0,\n "is_pool": false,\n "last_updated": "",\n "prefix": "",\n "role": 0,\n "site": 0,\n "status": "",\n "tags": [],\n "tenant": 0,\n "vlan": 0,\n "vrf": 0\n}' \
--output-document \
- {{baseUrl}}/ipam/prefixes/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"created": "",
"custom_fields": [],
"description": "",
"family": "",
"id": 0,
"is_pool": false,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vlan": 0,
"vrf": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/prefixes/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
ipam_prefixes_read
{{baseUrl}}/ipam/prefixes/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/prefixes/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/ipam/prefixes/:id/")
require "http/client"
url = "{{baseUrl}}/ipam/prefixes/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/ipam/prefixes/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/prefixes/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/prefixes/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/ipam/prefixes/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/ipam/prefixes/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/prefixes/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/prefixes/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/ipam/prefixes/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/ipam/prefixes/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/ipam/prefixes/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/prefixes/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/ipam/prefixes/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/ipam/prefixes/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/ipam/prefixes/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/ipam/prefixes/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/ipam/prefixes/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/ipam/prefixes/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/prefixes/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/prefixes/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/ipam/prefixes/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/prefixes/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/ipam/prefixes/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/prefixes/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/ipam/prefixes/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/ipam/prefixes/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/prefixes/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/ipam/prefixes/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/prefixes/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/prefixes/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/ipam/prefixes/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/ipam/prefixes/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/prefixes/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/ipam/prefixes/:id/
http GET {{baseUrl}}/ipam/prefixes/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/ipam/prefixes/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/prefixes/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
ipam_prefixes_update
{{baseUrl}}/ipam/prefixes/:id/
BODY json
{
"created": "",
"custom_fields": {},
"description": "",
"family": "",
"id": 0,
"is_pool": false,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vlan": 0,
"vrf": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/prefixes/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/ipam/prefixes/:id/" {:content-type :json
:form-params {:created ""
:custom_fields {}
:description ""
:family ""
:id 0
:is_pool false
:last_updated ""
:prefix ""
:role 0
:site 0
:status ""
:tags []
:tenant 0
:vlan 0
:vrf 0}})
require "http/client"
url = "{{baseUrl}}/ipam/prefixes/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\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}}/ipam/prefixes/:id/"),
Content = new StringContent("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/prefixes/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/prefixes/:id/"
payload := strings.NewReader("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\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/ipam/prefixes/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 244
{
"created": "",
"custom_fields": {},
"description": "",
"family": "",
"id": 0,
"is_pool": false,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vlan": 0,
"vrf": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/ipam/prefixes/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/prefixes/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/prefixes/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/ipam/prefixes/:id/")
.header("content-type", "application/json")
.body("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}")
.asString();
const data = JSON.stringify({
created: '',
custom_fields: {},
description: '',
family: '',
id: 0,
is_pool: false,
last_updated: '',
prefix: '',
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vlan: 0,
vrf: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/ipam/prefixes/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/ipam/prefixes/:id/',
headers: {'content-type': 'application/json'},
data: {
created: '',
custom_fields: {},
description: '',
family: '',
id: 0,
is_pool: false,
last_updated: '',
prefix: '',
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vlan: 0,
vrf: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/prefixes/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"created":"","custom_fields":{},"description":"","family":"","id":0,"is_pool":false,"last_updated":"","prefix":"","role":0,"site":0,"status":"","tags":[],"tenant":0,"vlan":0,"vrf":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}}/ipam/prefixes/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "created": "",\n "custom_fields": {},\n "description": "",\n "family": "",\n "id": 0,\n "is_pool": false,\n "last_updated": "",\n "prefix": "",\n "role": 0,\n "site": 0,\n "status": "",\n "tags": [],\n "tenant": 0,\n "vlan": 0,\n "vrf": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/ipam/prefixes/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/ipam/prefixes/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
created: '',
custom_fields: {},
description: '',
family: '',
id: 0,
is_pool: false,
last_updated: '',
prefix: '',
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vlan: 0,
vrf: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/ipam/prefixes/:id/',
headers: {'content-type': 'application/json'},
body: {
created: '',
custom_fields: {},
description: '',
family: '',
id: 0,
is_pool: false,
last_updated: '',
prefix: '',
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vlan: 0,
vrf: 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('PUT', '{{baseUrl}}/ipam/prefixes/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
created: '',
custom_fields: {},
description: '',
family: '',
id: 0,
is_pool: false,
last_updated: '',
prefix: '',
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vlan: 0,
vrf: 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: 'PUT',
url: '{{baseUrl}}/ipam/prefixes/:id/',
headers: {'content-type': 'application/json'},
data: {
created: '',
custom_fields: {},
description: '',
family: '',
id: 0,
is_pool: false,
last_updated: '',
prefix: '',
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vlan: 0,
vrf: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/prefixes/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"created":"","custom_fields":{},"description":"","family":"","id":0,"is_pool":false,"last_updated":"","prefix":"","role":0,"site":0,"status":"","tags":[],"tenant":0,"vlan":0,"vrf":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 = @{ @"created": @"",
@"custom_fields": @{ },
@"description": @"",
@"family": @"",
@"id": @0,
@"is_pool": @NO,
@"last_updated": @"",
@"prefix": @"",
@"role": @0,
@"site": @0,
@"status": @"",
@"tags": @[ ],
@"tenant": @0,
@"vlan": @0,
@"vrf": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/prefixes/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/ipam/prefixes/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/prefixes/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'created' => '',
'custom_fields' => [
],
'description' => '',
'family' => '',
'id' => 0,
'is_pool' => null,
'last_updated' => '',
'prefix' => '',
'role' => 0,
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'vlan' => 0,
'vrf' => 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('PUT', '{{baseUrl}}/ipam/prefixes/:id/', [
'body' => '{
"created": "",
"custom_fields": {},
"description": "",
"family": "",
"id": 0,
"is_pool": false,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vlan": 0,
"vrf": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/prefixes/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'created' => '',
'custom_fields' => [
],
'description' => '',
'family' => '',
'id' => 0,
'is_pool' => null,
'last_updated' => '',
'prefix' => '',
'role' => 0,
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'vlan' => 0,
'vrf' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'created' => '',
'custom_fields' => [
],
'description' => '',
'family' => '',
'id' => 0,
'is_pool' => null,
'last_updated' => '',
'prefix' => '',
'role' => 0,
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'vlan' => 0,
'vrf' => 0
]));
$request->setRequestUrl('{{baseUrl}}/ipam/prefixes/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/ipam/prefixes/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"custom_fields": {},
"description": "",
"family": "",
"id": 0,
"is_pool": false,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vlan": 0,
"vrf": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/prefixes/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"custom_fields": {},
"description": "",
"family": "",
"id": 0,
"is_pool": false,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vlan": 0,
"vrf": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/ipam/prefixes/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/prefixes/:id/"
payload = {
"created": "",
"custom_fields": {},
"description": "",
"family": "",
"id": 0,
"is_pool": False,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vlan": 0,
"vrf": 0
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/prefixes/:id/"
payload <- "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\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}}/ipam/prefixes/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/ipam/prefixes/:id/') do |req|
req.body = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"family\": \"\",\n \"id\": 0,\n \"is_pool\": false,\n \"last_updated\": \"\",\n \"prefix\": \"\",\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vlan\": 0,\n \"vrf\": 0\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}}/ipam/prefixes/:id/";
let payload = json!({
"created": "",
"custom_fields": json!({}),
"description": "",
"family": "",
"id": 0,
"is_pool": false,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": (),
"tenant": 0,
"vlan": 0,
"vrf": 0
});
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}}/ipam/prefixes/:id/ \
--header 'content-type: application/json' \
--data '{
"created": "",
"custom_fields": {},
"description": "",
"family": "",
"id": 0,
"is_pool": false,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vlan": 0,
"vrf": 0
}'
echo '{
"created": "",
"custom_fields": {},
"description": "",
"family": "",
"id": 0,
"is_pool": false,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vlan": 0,
"vrf": 0
}' | \
http PUT {{baseUrl}}/ipam/prefixes/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "created": "",\n "custom_fields": {},\n "description": "",\n "family": "",\n "id": 0,\n "is_pool": false,\n "last_updated": "",\n "prefix": "",\n "role": 0,\n "site": 0,\n "status": "",\n "tags": [],\n "tenant": 0,\n "vlan": 0,\n "vrf": 0\n}' \
--output-document \
- {{baseUrl}}/ipam/prefixes/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"created": "",
"custom_fields": [],
"description": "",
"family": "",
"id": 0,
"is_pool": false,
"last_updated": "",
"prefix": "",
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vlan": 0,
"vrf": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/prefixes/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
ipam_rirs_create
{{baseUrl}}/ipam/rirs/
BODY json
{
"aggregate_count": 0,
"description": "",
"id": 0,
"is_private": false,
"name": "",
"slug": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/rirs/");
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 \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/ipam/rirs/" {:content-type :json
:form-params {:aggregate_count 0
:description ""
:id 0
:is_private false
:name ""
:slug ""}})
require "http/client"
url = "{{baseUrl}}/ipam/rirs/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\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}}/ipam/rirs/"),
Content = new StringContent("{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\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}}/ipam/rirs/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/rirs/"
payload := strings.NewReader("{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\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/ipam/rirs/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 109
{
"aggregate_count": 0,
"description": "",
"id": 0,
"is_private": false,
"name": "",
"slug": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/ipam/rirs/")
.setHeader("content-type", "application/json")
.setBody("{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/rirs/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\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 \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/rirs/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/ipam/rirs/")
.header("content-type", "application/json")
.body("{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\n}")
.asString();
const data = JSON.stringify({
aggregate_count: 0,
description: '',
id: 0,
is_private: false,
name: '',
slug: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/ipam/rirs/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/ipam/rirs/',
headers: {'content-type': 'application/json'},
data: {
aggregate_count: 0,
description: '',
id: 0,
is_private: false,
name: '',
slug: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/rirs/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"aggregate_count":0,"description":"","id":0,"is_private":false,"name":"","slug":""}'
};
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}}/ipam/rirs/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "aggregate_count": 0,\n "description": "",\n "id": 0,\n "is_private": false,\n "name": "",\n "slug": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/ipam/rirs/")
.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/ipam/rirs/',
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({
aggregate_count: 0,
description: '',
id: 0,
is_private: false,
name: '',
slug: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/ipam/rirs/',
headers: {'content-type': 'application/json'},
body: {
aggregate_count: 0,
description: '',
id: 0,
is_private: false,
name: '',
slug: ''
},
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}}/ipam/rirs/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
aggregate_count: 0,
description: '',
id: 0,
is_private: false,
name: '',
slug: ''
});
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}}/ipam/rirs/',
headers: {'content-type': 'application/json'},
data: {
aggregate_count: 0,
description: '',
id: 0,
is_private: false,
name: '',
slug: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/rirs/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"aggregate_count":0,"description":"","id":0,"is_private":false,"name":"","slug":""}'
};
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 = @{ @"aggregate_count": @0,
@"description": @"",
@"id": @0,
@"is_private": @NO,
@"name": @"",
@"slug": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/rirs/"]
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}}/ipam/rirs/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/rirs/",
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([
'aggregate_count' => 0,
'description' => '',
'id' => 0,
'is_private' => null,
'name' => '',
'slug' => ''
]),
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}}/ipam/rirs/', [
'body' => '{
"aggregate_count": 0,
"description": "",
"id": 0,
"is_private": false,
"name": "",
"slug": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/rirs/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'aggregate_count' => 0,
'description' => '',
'id' => 0,
'is_private' => null,
'name' => '',
'slug' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'aggregate_count' => 0,
'description' => '',
'id' => 0,
'is_private' => null,
'name' => '',
'slug' => ''
]));
$request->setRequestUrl('{{baseUrl}}/ipam/rirs/');
$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}}/ipam/rirs/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"aggregate_count": 0,
"description": "",
"id": 0,
"is_private": false,
"name": "",
"slug": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/rirs/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"aggregate_count": 0,
"description": "",
"id": 0,
"is_private": false,
"name": "",
"slug": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/ipam/rirs/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/rirs/"
payload = {
"aggregate_count": 0,
"description": "",
"id": 0,
"is_private": False,
"name": "",
"slug": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/rirs/"
payload <- "{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\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}}/ipam/rirs/")
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 \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\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/ipam/rirs/') do |req|
req.body = "{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/rirs/";
let payload = json!({
"aggregate_count": 0,
"description": "",
"id": 0,
"is_private": false,
"name": "",
"slug": ""
});
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}}/ipam/rirs/ \
--header 'content-type: application/json' \
--data '{
"aggregate_count": 0,
"description": "",
"id": 0,
"is_private": false,
"name": "",
"slug": ""
}'
echo '{
"aggregate_count": 0,
"description": "",
"id": 0,
"is_private": false,
"name": "",
"slug": ""
}' | \
http POST {{baseUrl}}/ipam/rirs/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "aggregate_count": 0,\n "description": "",\n "id": 0,\n "is_private": false,\n "name": "",\n "slug": ""\n}' \
--output-document \
- {{baseUrl}}/ipam/rirs/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"aggregate_count": 0,
"description": "",
"id": 0,
"is_private": false,
"name": "",
"slug": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/rirs/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
ipam_rirs_delete
{{baseUrl}}/ipam/rirs/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/rirs/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/ipam/rirs/:id/")
require "http/client"
url = "{{baseUrl}}/ipam/rirs/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/ipam/rirs/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/rirs/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/rirs/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/ipam/rirs/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/ipam/rirs/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/rirs/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/rirs/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/ipam/rirs/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/ipam/rirs/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/ipam/rirs/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/rirs/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/ipam/rirs/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/ipam/rirs/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/ipam/rirs/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/ipam/rirs/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/ipam/rirs/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/ipam/rirs/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/rirs/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/rirs/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/ipam/rirs/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/rirs/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/ipam/rirs/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/rirs/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/ipam/rirs/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/ipam/rirs/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/rirs/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/ipam/rirs/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/rirs/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/rirs/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/ipam/rirs/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/ipam/rirs/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/rirs/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/ipam/rirs/:id/
http DELETE {{baseUrl}}/ipam/rirs/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/ipam/rirs/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/rirs/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
ipam_rirs_list
{{baseUrl}}/ipam/rirs/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/rirs/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/ipam/rirs/")
require "http/client"
url = "{{baseUrl}}/ipam/rirs/"
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}}/ipam/rirs/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/rirs/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/rirs/"
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/ipam/rirs/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/ipam/rirs/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/rirs/"))
.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}}/ipam/rirs/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/ipam/rirs/")
.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}}/ipam/rirs/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/ipam/rirs/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/rirs/';
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}}/ipam/rirs/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/ipam/rirs/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/ipam/rirs/',
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}}/ipam/rirs/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/ipam/rirs/');
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}}/ipam/rirs/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/rirs/';
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}}/ipam/rirs/"]
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}}/ipam/rirs/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/rirs/",
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}}/ipam/rirs/');
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/rirs/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/ipam/rirs/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/ipam/rirs/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/rirs/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/ipam/rirs/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/rirs/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/rirs/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/ipam/rirs/")
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/ipam/rirs/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/rirs/";
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}}/ipam/rirs/
http GET {{baseUrl}}/ipam/rirs/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/ipam/rirs/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/rirs/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
ipam_rirs_partial_update
{{baseUrl}}/ipam/rirs/:id/
BODY json
{
"aggregate_count": 0,
"description": "",
"id": 0,
"is_private": false,
"name": "",
"slug": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/rirs/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/ipam/rirs/:id/" {:content-type :json
:form-params {:aggregate_count 0
:description ""
:id 0
:is_private false
:name ""
:slug ""}})
require "http/client"
url = "{{baseUrl}}/ipam/rirs/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\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}}/ipam/rirs/:id/"),
Content = new StringContent("{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\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}}/ipam/rirs/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/rirs/:id/"
payload := strings.NewReader("{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\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/ipam/rirs/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 109
{
"aggregate_count": 0,
"description": "",
"id": 0,
"is_private": false,
"name": "",
"slug": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/ipam/rirs/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/rirs/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\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 \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/rirs/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/ipam/rirs/:id/")
.header("content-type", "application/json")
.body("{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\n}")
.asString();
const data = JSON.stringify({
aggregate_count: 0,
description: '',
id: 0,
is_private: false,
name: '',
slug: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/ipam/rirs/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/ipam/rirs/:id/',
headers: {'content-type': 'application/json'},
data: {
aggregate_count: 0,
description: '',
id: 0,
is_private: false,
name: '',
slug: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/rirs/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"aggregate_count":0,"description":"","id":0,"is_private":false,"name":"","slug":""}'
};
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}}/ipam/rirs/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "aggregate_count": 0,\n "description": "",\n "id": 0,\n "is_private": false,\n "name": "",\n "slug": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/ipam/rirs/:id/")
.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/ipam/rirs/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
aggregate_count: 0,
description: '',
id: 0,
is_private: false,
name: '',
slug: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/ipam/rirs/:id/',
headers: {'content-type': 'application/json'},
body: {
aggregate_count: 0,
description: '',
id: 0,
is_private: false,
name: '',
slug: ''
},
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}}/ipam/rirs/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
aggregate_count: 0,
description: '',
id: 0,
is_private: false,
name: '',
slug: ''
});
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}}/ipam/rirs/:id/',
headers: {'content-type': 'application/json'},
data: {
aggregate_count: 0,
description: '',
id: 0,
is_private: false,
name: '',
slug: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/rirs/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"aggregate_count":0,"description":"","id":0,"is_private":false,"name":"","slug":""}'
};
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 = @{ @"aggregate_count": @0,
@"description": @"",
@"id": @0,
@"is_private": @NO,
@"name": @"",
@"slug": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/rirs/:id/"]
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}}/ipam/rirs/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/rirs/:id/",
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([
'aggregate_count' => 0,
'description' => '',
'id' => 0,
'is_private' => null,
'name' => '',
'slug' => ''
]),
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}}/ipam/rirs/:id/', [
'body' => '{
"aggregate_count": 0,
"description": "",
"id": 0,
"is_private": false,
"name": "",
"slug": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/rirs/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'aggregate_count' => 0,
'description' => '',
'id' => 0,
'is_private' => null,
'name' => '',
'slug' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'aggregate_count' => 0,
'description' => '',
'id' => 0,
'is_private' => null,
'name' => '',
'slug' => ''
]));
$request->setRequestUrl('{{baseUrl}}/ipam/rirs/:id/');
$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}}/ipam/rirs/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"aggregate_count": 0,
"description": "",
"id": 0,
"is_private": false,
"name": "",
"slug": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/rirs/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"aggregate_count": 0,
"description": "",
"id": 0,
"is_private": false,
"name": "",
"slug": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/ipam/rirs/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/rirs/:id/"
payload = {
"aggregate_count": 0,
"description": "",
"id": 0,
"is_private": False,
"name": "",
"slug": ""
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/rirs/:id/"
payload <- "{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\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}}/ipam/rirs/:id/")
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 \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\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/ipam/rirs/:id/') do |req|
req.body = "{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\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}}/ipam/rirs/:id/";
let payload = json!({
"aggregate_count": 0,
"description": "",
"id": 0,
"is_private": false,
"name": "",
"slug": ""
});
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}}/ipam/rirs/:id/ \
--header 'content-type: application/json' \
--data '{
"aggregate_count": 0,
"description": "",
"id": 0,
"is_private": false,
"name": "",
"slug": ""
}'
echo '{
"aggregate_count": 0,
"description": "",
"id": 0,
"is_private": false,
"name": "",
"slug": ""
}' | \
http PATCH {{baseUrl}}/ipam/rirs/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "aggregate_count": 0,\n "description": "",\n "id": 0,\n "is_private": false,\n "name": "",\n "slug": ""\n}' \
--output-document \
- {{baseUrl}}/ipam/rirs/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"aggregate_count": 0,
"description": "",
"id": 0,
"is_private": false,
"name": "",
"slug": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/rirs/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
ipam_rirs_read
{{baseUrl}}/ipam/rirs/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/rirs/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/ipam/rirs/:id/")
require "http/client"
url = "{{baseUrl}}/ipam/rirs/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/ipam/rirs/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/rirs/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/rirs/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/ipam/rirs/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/ipam/rirs/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/rirs/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/rirs/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/ipam/rirs/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/ipam/rirs/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/ipam/rirs/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/rirs/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/ipam/rirs/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/ipam/rirs/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/ipam/rirs/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/ipam/rirs/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/ipam/rirs/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/ipam/rirs/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/rirs/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/rirs/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/ipam/rirs/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/rirs/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/ipam/rirs/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/rirs/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/ipam/rirs/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/ipam/rirs/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/rirs/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/ipam/rirs/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/rirs/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/rirs/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/ipam/rirs/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/ipam/rirs/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/rirs/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/ipam/rirs/:id/
http GET {{baseUrl}}/ipam/rirs/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/ipam/rirs/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/rirs/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
ipam_rirs_update
{{baseUrl}}/ipam/rirs/:id/
BODY json
{
"aggregate_count": 0,
"description": "",
"id": 0,
"is_private": false,
"name": "",
"slug": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/rirs/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/ipam/rirs/:id/" {:content-type :json
:form-params {:aggregate_count 0
:description ""
:id 0
:is_private false
:name ""
:slug ""}})
require "http/client"
url = "{{baseUrl}}/ipam/rirs/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\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}}/ipam/rirs/:id/"),
Content = new StringContent("{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\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}}/ipam/rirs/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/rirs/:id/"
payload := strings.NewReader("{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\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/ipam/rirs/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 109
{
"aggregate_count": 0,
"description": "",
"id": 0,
"is_private": false,
"name": "",
"slug": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/ipam/rirs/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/rirs/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\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 \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/rirs/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/ipam/rirs/:id/")
.header("content-type", "application/json")
.body("{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\n}")
.asString();
const data = JSON.stringify({
aggregate_count: 0,
description: '',
id: 0,
is_private: false,
name: '',
slug: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/ipam/rirs/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/ipam/rirs/:id/',
headers: {'content-type': 'application/json'},
data: {
aggregate_count: 0,
description: '',
id: 0,
is_private: false,
name: '',
slug: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/rirs/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"aggregate_count":0,"description":"","id":0,"is_private":false,"name":"","slug":""}'
};
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}}/ipam/rirs/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "aggregate_count": 0,\n "description": "",\n "id": 0,\n "is_private": false,\n "name": "",\n "slug": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/ipam/rirs/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/ipam/rirs/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
aggregate_count: 0,
description: '',
id: 0,
is_private: false,
name: '',
slug: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/ipam/rirs/:id/',
headers: {'content-type': 'application/json'},
body: {
aggregate_count: 0,
description: '',
id: 0,
is_private: false,
name: '',
slug: ''
},
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}}/ipam/rirs/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
aggregate_count: 0,
description: '',
id: 0,
is_private: false,
name: '',
slug: ''
});
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}}/ipam/rirs/:id/',
headers: {'content-type': 'application/json'},
data: {
aggregate_count: 0,
description: '',
id: 0,
is_private: false,
name: '',
slug: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/rirs/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"aggregate_count":0,"description":"","id":0,"is_private":false,"name":"","slug":""}'
};
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 = @{ @"aggregate_count": @0,
@"description": @"",
@"id": @0,
@"is_private": @NO,
@"name": @"",
@"slug": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/rirs/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/ipam/rirs/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/rirs/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'aggregate_count' => 0,
'description' => '',
'id' => 0,
'is_private' => null,
'name' => '',
'slug' => ''
]),
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}}/ipam/rirs/:id/', [
'body' => '{
"aggregate_count": 0,
"description": "",
"id": 0,
"is_private": false,
"name": "",
"slug": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/rirs/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'aggregate_count' => 0,
'description' => '',
'id' => 0,
'is_private' => null,
'name' => '',
'slug' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'aggregate_count' => 0,
'description' => '',
'id' => 0,
'is_private' => null,
'name' => '',
'slug' => ''
]));
$request->setRequestUrl('{{baseUrl}}/ipam/rirs/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/ipam/rirs/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"aggregate_count": 0,
"description": "",
"id": 0,
"is_private": false,
"name": "",
"slug": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/rirs/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"aggregate_count": 0,
"description": "",
"id": 0,
"is_private": false,
"name": "",
"slug": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/ipam/rirs/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/rirs/:id/"
payload = {
"aggregate_count": 0,
"description": "",
"id": 0,
"is_private": False,
"name": "",
"slug": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/rirs/:id/"
payload <- "{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\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}}/ipam/rirs/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\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/ipam/rirs/:id/') do |req|
req.body = "{\n \"aggregate_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"is_private\": false,\n \"name\": \"\",\n \"slug\": \"\"\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}}/ipam/rirs/:id/";
let payload = json!({
"aggregate_count": 0,
"description": "",
"id": 0,
"is_private": false,
"name": "",
"slug": ""
});
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}}/ipam/rirs/:id/ \
--header 'content-type: application/json' \
--data '{
"aggregate_count": 0,
"description": "",
"id": 0,
"is_private": false,
"name": "",
"slug": ""
}'
echo '{
"aggregate_count": 0,
"description": "",
"id": 0,
"is_private": false,
"name": "",
"slug": ""
}' | \
http PUT {{baseUrl}}/ipam/rirs/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "aggregate_count": 0,\n "description": "",\n "id": 0,\n "is_private": false,\n "name": "",\n "slug": ""\n}' \
--output-document \
- {{baseUrl}}/ipam/rirs/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"aggregate_count": 0,
"description": "",
"id": 0,
"is_private": false,
"name": "",
"slug": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/rirs/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
ipam_roles_create
{{baseUrl}}/ipam/roles/
BODY json
{
"description": "",
"id": 0,
"name": "",
"prefix_count": 0,
"slug": "",
"vlan_count": 0,
"weight": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/roles/");
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 \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/ipam/roles/" {:content-type :json
:form-params {:description ""
:id 0
:name ""
:prefix_count 0
:slug ""
:vlan_count 0
:weight 0}})
require "http/client"
url = "{{baseUrl}}/ipam/roles/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/ipam/roles/"),
Content = new StringContent("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/roles/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/roles/"
payload := strings.NewReader("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ipam/roles/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 117
{
"description": "",
"id": 0,
"name": "",
"prefix_count": 0,
"slug": "",
"vlan_count": 0,
"weight": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/ipam/roles/")
.setHeader("content-type", "application/json")
.setBody("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/roles/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/roles/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/ipam/roles/")
.header("content-type", "application/json")
.body("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\n}")
.asString();
const data = JSON.stringify({
description: '',
id: 0,
name: '',
prefix_count: 0,
slug: '',
vlan_count: 0,
weight: 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}}/ipam/roles/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/ipam/roles/',
headers: {'content-type': 'application/json'},
data: {
description: '',
id: 0,
name: '',
prefix_count: 0,
slug: '',
vlan_count: 0,
weight: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/roles/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"description":"","id":0,"name":"","prefix_count":0,"slug":"","vlan_count":0,"weight":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}}/ipam/roles/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "description": "",\n "id": 0,\n "name": "",\n "prefix_count": 0,\n "slug": "",\n "vlan_count": 0,\n "weight": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/ipam/roles/")
.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/ipam/roles/',
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({
description: '',
id: 0,
name: '',
prefix_count: 0,
slug: '',
vlan_count: 0,
weight: 0
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/ipam/roles/',
headers: {'content-type': 'application/json'},
body: {
description: '',
id: 0,
name: '',
prefix_count: 0,
slug: '',
vlan_count: 0,
weight: 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}}/ipam/roles/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
description: '',
id: 0,
name: '',
prefix_count: 0,
slug: '',
vlan_count: 0,
weight: 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}}/ipam/roles/',
headers: {'content-type': 'application/json'},
data: {
description: '',
id: 0,
name: '',
prefix_count: 0,
slug: '',
vlan_count: 0,
weight: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/roles/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"description":"","id":0,"name":"","prefix_count":0,"slug":"","vlan_count":0,"weight":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 = @{ @"description": @"",
@"id": @0,
@"name": @"",
@"prefix_count": @0,
@"slug": @"",
@"vlan_count": @0,
@"weight": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/roles/"]
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}}/ipam/roles/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/roles/",
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([
'description' => '',
'id' => 0,
'name' => '',
'prefix_count' => 0,
'slug' => '',
'vlan_count' => 0,
'weight' => 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}}/ipam/roles/', [
'body' => '{
"description": "",
"id": 0,
"name": "",
"prefix_count": 0,
"slug": "",
"vlan_count": 0,
"weight": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/roles/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'description' => '',
'id' => 0,
'name' => '',
'prefix_count' => 0,
'slug' => '',
'vlan_count' => 0,
'weight' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'description' => '',
'id' => 0,
'name' => '',
'prefix_count' => 0,
'slug' => '',
'vlan_count' => 0,
'weight' => 0
]));
$request->setRequestUrl('{{baseUrl}}/ipam/roles/');
$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}}/ipam/roles/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"id": 0,
"name": "",
"prefix_count": 0,
"slug": "",
"vlan_count": 0,
"weight": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/roles/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"id": 0,
"name": "",
"prefix_count": 0,
"slug": "",
"vlan_count": 0,
"weight": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/ipam/roles/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/roles/"
payload = {
"description": "",
"id": 0,
"name": "",
"prefix_count": 0,
"slug": "",
"vlan_count": 0,
"weight": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/roles/"
payload <- "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/ipam/roles/")
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 \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/ipam/roles/') do |req|
req.body = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/roles/";
let payload = json!({
"description": "",
"id": 0,
"name": "",
"prefix_count": 0,
"slug": "",
"vlan_count": 0,
"weight": 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}}/ipam/roles/ \
--header 'content-type: application/json' \
--data '{
"description": "",
"id": 0,
"name": "",
"prefix_count": 0,
"slug": "",
"vlan_count": 0,
"weight": 0
}'
echo '{
"description": "",
"id": 0,
"name": "",
"prefix_count": 0,
"slug": "",
"vlan_count": 0,
"weight": 0
}' | \
http POST {{baseUrl}}/ipam/roles/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "description": "",\n "id": 0,\n "name": "",\n "prefix_count": 0,\n "slug": "",\n "vlan_count": 0,\n "weight": 0\n}' \
--output-document \
- {{baseUrl}}/ipam/roles/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"description": "",
"id": 0,
"name": "",
"prefix_count": 0,
"slug": "",
"vlan_count": 0,
"weight": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/roles/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
ipam_roles_delete
{{baseUrl}}/ipam/roles/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/roles/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/ipam/roles/:id/")
require "http/client"
url = "{{baseUrl}}/ipam/roles/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/ipam/roles/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/roles/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/roles/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/ipam/roles/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/ipam/roles/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/roles/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/roles/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/ipam/roles/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/ipam/roles/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/ipam/roles/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/roles/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/ipam/roles/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/ipam/roles/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/ipam/roles/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/ipam/roles/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/ipam/roles/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/ipam/roles/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/roles/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/roles/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/ipam/roles/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/roles/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/ipam/roles/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/roles/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/ipam/roles/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/ipam/roles/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/roles/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/ipam/roles/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/roles/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/roles/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/ipam/roles/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/ipam/roles/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/roles/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/ipam/roles/:id/
http DELETE {{baseUrl}}/ipam/roles/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/ipam/roles/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/roles/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
ipam_roles_list
{{baseUrl}}/ipam/roles/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/roles/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/ipam/roles/")
require "http/client"
url = "{{baseUrl}}/ipam/roles/"
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}}/ipam/roles/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/roles/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/roles/"
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/ipam/roles/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/ipam/roles/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/roles/"))
.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}}/ipam/roles/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/ipam/roles/")
.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}}/ipam/roles/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/ipam/roles/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/roles/';
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}}/ipam/roles/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/ipam/roles/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/ipam/roles/',
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}}/ipam/roles/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/ipam/roles/');
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}}/ipam/roles/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/roles/';
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}}/ipam/roles/"]
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}}/ipam/roles/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/roles/",
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}}/ipam/roles/');
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/roles/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/ipam/roles/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/ipam/roles/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/roles/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/ipam/roles/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/roles/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/roles/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/ipam/roles/")
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/ipam/roles/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/roles/";
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}}/ipam/roles/
http GET {{baseUrl}}/ipam/roles/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/ipam/roles/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/roles/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
ipam_roles_partial_update
{{baseUrl}}/ipam/roles/:id/
BODY json
{
"description": "",
"id": 0,
"name": "",
"prefix_count": 0,
"slug": "",
"vlan_count": 0,
"weight": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/roles/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/ipam/roles/:id/" {:content-type :json
:form-params {:description ""
:id 0
:name ""
:prefix_count 0
:slug ""
:vlan_count 0
:weight 0}})
require "http/client"
url = "{{baseUrl}}/ipam/roles/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\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}}/ipam/roles/:id/"),
Content = new StringContent("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/roles/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/roles/:id/"
payload := strings.NewReader("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\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/ipam/roles/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 117
{
"description": "",
"id": 0,
"name": "",
"prefix_count": 0,
"slug": "",
"vlan_count": 0,
"weight": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/ipam/roles/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/roles/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/roles/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/ipam/roles/:id/")
.header("content-type", "application/json")
.body("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\n}")
.asString();
const data = JSON.stringify({
description: '',
id: 0,
name: '',
prefix_count: 0,
slug: '',
vlan_count: 0,
weight: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/ipam/roles/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/ipam/roles/:id/',
headers: {'content-type': 'application/json'},
data: {
description: '',
id: 0,
name: '',
prefix_count: 0,
slug: '',
vlan_count: 0,
weight: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/roles/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"description":"","id":0,"name":"","prefix_count":0,"slug":"","vlan_count":0,"weight":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}}/ipam/roles/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "description": "",\n "id": 0,\n "name": "",\n "prefix_count": 0,\n "slug": "",\n "vlan_count": 0,\n "weight": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/ipam/roles/:id/")
.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/ipam/roles/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
description: '',
id: 0,
name: '',
prefix_count: 0,
slug: '',
vlan_count: 0,
weight: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/ipam/roles/:id/',
headers: {'content-type': 'application/json'},
body: {
description: '',
id: 0,
name: '',
prefix_count: 0,
slug: '',
vlan_count: 0,
weight: 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('PATCH', '{{baseUrl}}/ipam/roles/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
description: '',
id: 0,
name: '',
prefix_count: 0,
slug: '',
vlan_count: 0,
weight: 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: 'PATCH',
url: '{{baseUrl}}/ipam/roles/:id/',
headers: {'content-type': 'application/json'},
data: {
description: '',
id: 0,
name: '',
prefix_count: 0,
slug: '',
vlan_count: 0,
weight: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/roles/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"description":"","id":0,"name":"","prefix_count":0,"slug":"","vlan_count":0,"weight":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 = @{ @"description": @"",
@"id": @0,
@"name": @"",
@"prefix_count": @0,
@"slug": @"",
@"vlan_count": @0,
@"weight": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/roles/:id/"]
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}}/ipam/roles/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/roles/:id/",
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([
'description' => '',
'id' => 0,
'name' => '',
'prefix_count' => 0,
'slug' => '',
'vlan_count' => 0,
'weight' => 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('PATCH', '{{baseUrl}}/ipam/roles/:id/', [
'body' => '{
"description": "",
"id": 0,
"name": "",
"prefix_count": 0,
"slug": "",
"vlan_count": 0,
"weight": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/roles/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'description' => '',
'id' => 0,
'name' => '',
'prefix_count' => 0,
'slug' => '',
'vlan_count' => 0,
'weight' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'description' => '',
'id' => 0,
'name' => '',
'prefix_count' => 0,
'slug' => '',
'vlan_count' => 0,
'weight' => 0
]));
$request->setRequestUrl('{{baseUrl}}/ipam/roles/:id/');
$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}}/ipam/roles/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"id": 0,
"name": "",
"prefix_count": 0,
"slug": "",
"vlan_count": 0,
"weight": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/roles/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"id": 0,
"name": "",
"prefix_count": 0,
"slug": "",
"vlan_count": 0,
"weight": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/ipam/roles/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/roles/:id/"
payload = {
"description": "",
"id": 0,
"name": "",
"prefix_count": 0,
"slug": "",
"vlan_count": 0,
"weight": 0
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/roles/:id/"
payload <- "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\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}}/ipam/roles/:id/")
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 \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/ipam/roles/:id/') do |req|
req.body = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\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}}/ipam/roles/:id/";
let payload = json!({
"description": "",
"id": 0,
"name": "",
"prefix_count": 0,
"slug": "",
"vlan_count": 0,
"weight": 0
});
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}}/ipam/roles/:id/ \
--header 'content-type: application/json' \
--data '{
"description": "",
"id": 0,
"name": "",
"prefix_count": 0,
"slug": "",
"vlan_count": 0,
"weight": 0
}'
echo '{
"description": "",
"id": 0,
"name": "",
"prefix_count": 0,
"slug": "",
"vlan_count": 0,
"weight": 0
}' | \
http PATCH {{baseUrl}}/ipam/roles/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "description": "",\n "id": 0,\n "name": "",\n "prefix_count": 0,\n "slug": "",\n "vlan_count": 0,\n "weight": 0\n}' \
--output-document \
- {{baseUrl}}/ipam/roles/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"description": "",
"id": 0,
"name": "",
"prefix_count": 0,
"slug": "",
"vlan_count": 0,
"weight": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/roles/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
ipam_roles_read
{{baseUrl}}/ipam/roles/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/roles/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/ipam/roles/:id/")
require "http/client"
url = "{{baseUrl}}/ipam/roles/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/ipam/roles/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/roles/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/roles/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/ipam/roles/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/ipam/roles/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/roles/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/roles/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/ipam/roles/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/ipam/roles/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/ipam/roles/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/roles/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/ipam/roles/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/ipam/roles/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/ipam/roles/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/ipam/roles/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/ipam/roles/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/ipam/roles/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/roles/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/roles/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/ipam/roles/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/roles/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/ipam/roles/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/roles/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/ipam/roles/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/ipam/roles/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/roles/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/ipam/roles/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/roles/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/roles/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/ipam/roles/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/ipam/roles/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/roles/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/ipam/roles/:id/
http GET {{baseUrl}}/ipam/roles/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/ipam/roles/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/roles/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
ipam_roles_update
{{baseUrl}}/ipam/roles/:id/
BODY json
{
"description": "",
"id": 0,
"name": "",
"prefix_count": 0,
"slug": "",
"vlan_count": 0,
"weight": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/roles/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/ipam/roles/:id/" {:content-type :json
:form-params {:description ""
:id 0
:name ""
:prefix_count 0
:slug ""
:vlan_count 0
:weight 0}})
require "http/client"
url = "{{baseUrl}}/ipam/roles/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\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}}/ipam/roles/:id/"),
Content = new StringContent("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/roles/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/roles/:id/"
payload := strings.NewReader("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\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/ipam/roles/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 117
{
"description": "",
"id": 0,
"name": "",
"prefix_count": 0,
"slug": "",
"vlan_count": 0,
"weight": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/ipam/roles/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/roles/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/roles/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/ipam/roles/:id/")
.header("content-type", "application/json")
.body("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\n}")
.asString();
const data = JSON.stringify({
description: '',
id: 0,
name: '',
prefix_count: 0,
slug: '',
vlan_count: 0,
weight: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/ipam/roles/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/ipam/roles/:id/',
headers: {'content-type': 'application/json'},
data: {
description: '',
id: 0,
name: '',
prefix_count: 0,
slug: '',
vlan_count: 0,
weight: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/roles/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"description":"","id":0,"name":"","prefix_count":0,"slug":"","vlan_count":0,"weight":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}}/ipam/roles/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "description": "",\n "id": 0,\n "name": "",\n "prefix_count": 0,\n "slug": "",\n "vlan_count": 0,\n "weight": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/ipam/roles/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/ipam/roles/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
description: '',
id: 0,
name: '',
prefix_count: 0,
slug: '',
vlan_count: 0,
weight: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/ipam/roles/:id/',
headers: {'content-type': 'application/json'},
body: {
description: '',
id: 0,
name: '',
prefix_count: 0,
slug: '',
vlan_count: 0,
weight: 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('PUT', '{{baseUrl}}/ipam/roles/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
description: '',
id: 0,
name: '',
prefix_count: 0,
slug: '',
vlan_count: 0,
weight: 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: 'PUT',
url: '{{baseUrl}}/ipam/roles/:id/',
headers: {'content-type': 'application/json'},
data: {
description: '',
id: 0,
name: '',
prefix_count: 0,
slug: '',
vlan_count: 0,
weight: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/roles/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"description":"","id":0,"name":"","prefix_count":0,"slug":"","vlan_count":0,"weight":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 = @{ @"description": @"",
@"id": @0,
@"name": @"",
@"prefix_count": @0,
@"slug": @"",
@"vlan_count": @0,
@"weight": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/roles/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/ipam/roles/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/roles/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'description' => '',
'id' => 0,
'name' => '',
'prefix_count' => 0,
'slug' => '',
'vlan_count' => 0,
'weight' => 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('PUT', '{{baseUrl}}/ipam/roles/:id/', [
'body' => '{
"description": "",
"id": 0,
"name": "",
"prefix_count": 0,
"slug": "",
"vlan_count": 0,
"weight": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/roles/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'description' => '',
'id' => 0,
'name' => '',
'prefix_count' => 0,
'slug' => '',
'vlan_count' => 0,
'weight' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'description' => '',
'id' => 0,
'name' => '',
'prefix_count' => 0,
'slug' => '',
'vlan_count' => 0,
'weight' => 0
]));
$request->setRequestUrl('{{baseUrl}}/ipam/roles/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/ipam/roles/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"id": 0,
"name": "",
"prefix_count": 0,
"slug": "",
"vlan_count": 0,
"weight": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/roles/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"id": 0,
"name": "",
"prefix_count": 0,
"slug": "",
"vlan_count": 0,
"weight": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/ipam/roles/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/roles/:id/"
payload = {
"description": "",
"id": 0,
"name": "",
"prefix_count": 0,
"slug": "",
"vlan_count": 0,
"weight": 0
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/roles/:id/"
payload <- "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\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}}/ipam/roles/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/ipam/roles/:id/') do |req|
req.body = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"prefix_count\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0,\n \"weight\": 0\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}}/ipam/roles/:id/";
let payload = json!({
"description": "",
"id": 0,
"name": "",
"prefix_count": 0,
"slug": "",
"vlan_count": 0,
"weight": 0
});
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}}/ipam/roles/:id/ \
--header 'content-type: application/json' \
--data '{
"description": "",
"id": 0,
"name": "",
"prefix_count": 0,
"slug": "",
"vlan_count": 0,
"weight": 0
}'
echo '{
"description": "",
"id": 0,
"name": "",
"prefix_count": 0,
"slug": "",
"vlan_count": 0,
"weight": 0
}' | \
http PUT {{baseUrl}}/ipam/roles/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "description": "",\n "id": 0,\n "name": "",\n "prefix_count": 0,\n "slug": "",\n "vlan_count": 0,\n "weight": 0\n}' \
--output-document \
- {{baseUrl}}/ipam/roles/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"description": "",
"id": 0,
"name": "",
"prefix_count": 0,
"slug": "",
"vlan_count": 0,
"weight": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/roles/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
ipam_services_create
{{baseUrl}}/ipam/services/
BODY json
{
"created": "",
"custom_fields": {},
"description": "",
"device": 0,
"id": 0,
"ipaddresses": [],
"last_updated": "",
"name": "",
"port": 0,
"protocol": "",
"tags": [],
"virtual_machine": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/services/");
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 \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/ipam/services/" {:content-type :json
:form-params {:created ""
:custom_fields {}
:description ""
:device 0
:id 0
:ipaddresses []
:last_updated ""
:name ""
:port 0
:protocol ""
:tags []
:virtual_machine 0}})
require "http/client"
url = "{{baseUrl}}/ipam/services/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/ipam/services/"),
Content = new StringContent("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/services/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/services/"
payload := strings.NewReader("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ipam/services/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 215
{
"created": "",
"custom_fields": {},
"description": "",
"device": 0,
"id": 0,
"ipaddresses": [],
"last_updated": "",
"name": "",
"port": 0,
"protocol": "",
"tags": [],
"virtual_machine": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/ipam/services/")
.setHeader("content-type", "application/json")
.setBody("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/services/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/services/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/ipam/services/")
.header("content-type", "application/json")
.body("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\n}")
.asString();
const data = JSON.stringify({
created: '',
custom_fields: {},
description: '',
device: 0,
id: 0,
ipaddresses: [],
last_updated: '',
name: '',
port: 0,
protocol: '',
tags: [],
virtual_machine: 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}}/ipam/services/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/ipam/services/',
headers: {'content-type': 'application/json'},
data: {
created: '',
custom_fields: {},
description: '',
device: 0,
id: 0,
ipaddresses: [],
last_updated: '',
name: '',
port: 0,
protocol: '',
tags: [],
virtual_machine: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/services/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"created":"","custom_fields":{},"description":"","device":0,"id":0,"ipaddresses":[],"last_updated":"","name":"","port":0,"protocol":"","tags":[],"virtual_machine":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}}/ipam/services/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "created": "",\n "custom_fields": {},\n "description": "",\n "device": 0,\n "id": 0,\n "ipaddresses": [],\n "last_updated": "",\n "name": "",\n "port": 0,\n "protocol": "",\n "tags": [],\n "virtual_machine": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/ipam/services/")
.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/ipam/services/',
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({
created: '',
custom_fields: {},
description: '',
device: 0,
id: 0,
ipaddresses: [],
last_updated: '',
name: '',
port: 0,
protocol: '',
tags: [],
virtual_machine: 0
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/ipam/services/',
headers: {'content-type': 'application/json'},
body: {
created: '',
custom_fields: {},
description: '',
device: 0,
id: 0,
ipaddresses: [],
last_updated: '',
name: '',
port: 0,
protocol: '',
tags: [],
virtual_machine: 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}}/ipam/services/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
created: '',
custom_fields: {},
description: '',
device: 0,
id: 0,
ipaddresses: [],
last_updated: '',
name: '',
port: 0,
protocol: '',
tags: [],
virtual_machine: 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}}/ipam/services/',
headers: {'content-type': 'application/json'},
data: {
created: '',
custom_fields: {},
description: '',
device: 0,
id: 0,
ipaddresses: [],
last_updated: '',
name: '',
port: 0,
protocol: '',
tags: [],
virtual_machine: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/services/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"created":"","custom_fields":{},"description":"","device":0,"id":0,"ipaddresses":[],"last_updated":"","name":"","port":0,"protocol":"","tags":[],"virtual_machine":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 = @{ @"created": @"",
@"custom_fields": @{ },
@"description": @"",
@"device": @0,
@"id": @0,
@"ipaddresses": @[ ],
@"last_updated": @"",
@"name": @"",
@"port": @0,
@"protocol": @"",
@"tags": @[ ],
@"virtual_machine": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/services/"]
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}}/ipam/services/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/services/",
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([
'created' => '',
'custom_fields' => [
],
'description' => '',
'device' => 0,
'id' => 0,
'ipaddresses' => [
],
'last_updated' => '',
'name' => '',
'port' => 0,
'protocol' => '',
'tags' => [
],
'virtual_machine' => 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}}/ipam/services/', [
'body' => '{
"created": "",
"custom_fields": {},
"description": "",
"device": 0,
"id": 0,
"ipaddresses": [],
"last_updated": "",
"name": "",
"port": 0,
"protocol": "",
"tags": [],
"virtual_machine": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/services/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'created' => '',
'custom_fields' => [
],
'description' => '',
'device' => 0,
'id' => 0,
'ipaddresses' => [
],
'last_updated' => '',
'name' => '',
'port' => 0,
'protocol' => '',
'tags' => [
],
'virtual_machine' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'created' => '',
'custom_fields' => [
],
'description' => '',
'device' => 0,
'id' => 0,
'ipaddresses' => [
],
'last_updated' => '',
'name' => '',
'port' => 0,
'protocol' => '',
'tags' => [
],
'virtual_machine' => 0
]));
$request->setRequestUrl('{{baseUrl}}/ipam/services/');
$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}}/ipam/services/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"custom_fields": {},
"description": "",
"device": 0,
"id": 0,
"ipaddresses": [],
"last_updated": "",
"name": "",
"port": 0,
"protocol": "",
"tags": [],
"virtual_machine": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/services/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"custom_fields": {},
"description": "",
"device": 0,
"id": 0,
"ipaddresses": [],
"last_updated": "",
"name": "",
"port": 0,
"protocol": "",
"tags": [],
"virtual_machine": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/ipam/services/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/services/"
payload = {
"created": "",
"custom_fields": {},
"description": "",
"device": 0,
"id": 0,
"ipaddresses": [],
"last_updated": "",
"name": "",
"port": 0,
"protocol": "",
"tags": [],
"virtual_machine": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/services/"
payload <- "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/ipam/services/")
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 \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/ipam/services/') do |req|
req.body = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/services/";
let payload = json!({
"created": "",
"custom_fields": json!({}),
"description": "",
"device": 0,
"id": 0,
"ipaddresses": (),
"last_updated": "",
"name": "",
"port": 0,
"protocol": "",
"tags": (),
"virtual_machine": 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}}/ipam/services/ \
--header 'content-type: application/json' \
--data '{
"created": "",
"custom_fields": {},
"description": "",
"device": 0,
"id": 0,
"ipaddresses": [],
"last_updated": "",
"name": "",
"port": 0,
"protocol": "",
"tags": [],
"virtual_machine": 0
}'
echo '{
"created": "",
"custom_fields": {},
"description": "",
"device": 0,
"id": 0,
"ipaddresses": [],
"last_updated": "",
"name": "",
"port": 0,
"protocol": "",
"tags": [],
"virtual_machine": 0
}' | \
http POST {{baseUrl}}/ipam/services/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "created": "",\n "custom_fields": {},\n "description": "",\n "device": 0,\n "id": 0,\n "ipaddresses": [],\n "last_updated": "",\n "name": "",\n "port": 0,\n "protocol": "",\n "tags": [],\n "virtual_machine": 0\n}' \
--output-document \
- {{baseUrl}}/ipam/services/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"created": "",
"custom_fields": [],
"description": "",
"device": 0,
"id": 0,
"ipaddresses": [],
"last_updated": "",
"name": "",
"port": 0,
"protocol": "",
"tags": [],
"virtual_machine": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/services/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
ipam_services_delete
{{baseUrl}}/ipam/services/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/services/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/ipam/services/:id/")
require "http/client"
url = "{{baseUrl}}/ipam/services/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/ipam/services/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/services/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/services/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/ipam/services/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/ipam/services/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/services/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/services/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/ipam/services/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/ipam/services/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/ipam/services/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/services/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/ipam/services/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/ipam/services/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/ipam/services/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/ipam/services/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/ipam/services/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/ipam/services/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/services/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/services/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/ipam/services/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/services/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/ipam/services/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/services/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/ipam/services/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/ipam/services/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/services/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/ipam/services/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/services/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/services/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/ipam/services/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/ipam/services/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/services/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/ipam/services/:id/
http DELETE {{baseUrl}}/ipam/services/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/ipam/services/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/services/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
ipam_services_list
{{baseUrl}}/ipam/services/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/services/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/ipam/services/")
require "http/client"
url = "{{baseUrl}}/ipam/services/"
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}}/ipam/services/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/services/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/services/"
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/ipam/services/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/ipam/services/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/services/"))
.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}}/ipam/services/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/ipam/services/")
.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}}/ipam/services/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/ipam/services/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/services/';
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}}/ipam/services/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/ipam/services/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/ipam/services/',
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}}/ipam/services/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/ipam/services/');
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}}/ipam/services/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/services/';
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}}/ipam/services/"]
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}}/ipam/services/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/services/",
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}}/ipam/services/');
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/services/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/ipam/services/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/ipam/services/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/services/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/ipam/services/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/services/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/services/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/ipam/services/")
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/ipam/services/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/services/";
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}}/ipam/services/
http GET {{baseUrl}}/ipam/services/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/ipam/services/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/services/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
ipam_services_partial_update
{{baseUrl}}/ipam/services/:id/
BODY json
{
"created": "",
"custom_fields": {},
"description": "",
"device": 0,
"id": 0,
"ipaddresses": [],
"last_updated": "",
"name": "",
"port": 0,
"protocol": "",
"tags": [],
"virtual_machine": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/services/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/ipam/services/:id/" {:content-type :json
:form-params {:created ""
:custom_fields {}
:description ""
:device 0
:id 0
:ipaddresses []
:last_updated ""
:name ""
:port 0
:protocol ""
:tags []
:virtual_machine 0}})
require "http/client"
url = "{{baseUrl}}/ipam/services/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\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}}/ipam/services/:id/"),
Content = new StringContent("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/services/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/services/:id/"
payload := strings.NewReader("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\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/ipam/services/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 215
{
"created": "",
"custom_fields": {},
"description": "",
"device": 0,
"id": 0,
"ipaddresses": [],
"last_updated": "",
"name": "",
"port": 0,
"protocol": "",
"tags": [],
"virtual_machine": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/ipam/services/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/services/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/services/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/ipam/services/:id/")
.header("content-type", "application/json")
.body("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\n}")
.asString();
const data = JSON.stringify({
created: '',
custom_fields: {},
description: '',
device: 0,
id: 0,
ipaddresses: [],
last_updated: '',
name: '',
port: 0,
protocol: '',
tags: [],
virtual_machine: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/ipam/services/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/ipam/services/:id/',
headers: {'content-type': 'application/json'},
data: {
created: '',
custom_fields: {},
description: '',
device: 0,
id: 0,
ipaddresses: [],
last_updated: '',
name: '',
port: 0,
protocol: '',
tags: [],
virtual_machine: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/services/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"created":"","custom_fields":{},"description":"","device":0,"id":0,"ipaddresses":[],"last_updated":"","name":"","port":0,"protocol":"","tags":[],"virtual_machine":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}}/ipam/services/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "created": "",\n "custom_fields": {},\n "description": "",\n "device": 0,\n "id": 0,\n "ipaddresses": [],\n "last_updated": "",\n "name": "",\n "port": 0,\n "protocol": "",\n "tags": [],\n "virtual_machine": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/ipam/services/:id/")
.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/ipam/services/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
created: '',
custom_fields: {},
description: '',
device: 0,
id: 0,
ipaddresses: [],
last_updated: '',
name: '',
port: 0,
protocol: '',
tags: [],
virtual_machine: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/ipam/services/:id/',
headers: {'content-type': 'application/json'},
body: {
created: '',
custom_fields: {},
description: '',
device: 0,
id: 0,
ipaddresses: [],
last_updated: '',
name: '',
port: 0,
protocol: '',
tags: [],
virtual_machine: 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('PATCH', '{{baseUrl}}/ipam/services/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
created: '',
custom_fields: {},
description: '',
device: 0,
id: 0,
ipaddresses: [],
last_updated: '',
name: '',
port: 0,
protocol: '',
tags: [],
virtual_machine: 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: 'PATCH',
url: '{{baseUrl}}/ipam/services/:id/',
headers: {'content-type': 'application/json'},
data: {
created: '',
custom_fields: {},
description: '',
device: 0,
id: 0,
ipaddresses: [],
last_updated: '',
name: '',
port: 0,
protocol: '',
tags: [],
virtual_machine: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/services/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"created":"","custom_fields":{},"description":"","device":0,"id":0,"ipaddresses":[],"last_updated":"","name":"","port":0,"protocol":"","tags":[],"virtual_machine":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 = @{ @"created": @"",
@"custom_fields": @{ },
@"description": @"",
@"device": @0,
@"id": @0,
@"ipaddresses": @[ ],
@"last_updated": @"",
@"name": @"",
@"port": @0,
@"protocol": @"",
@"tags": @[ ],
@"virtual_machine": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/services/:id/"]
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}}/ipam/services/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/services/:id/",
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([
'created' => '',
'custom_fields' => [
],
'description' => '',
'device' => 0,
'id' => 0,
'ipaddresses' => [
],
'last_updated' => '',
'name' => '',
'port' => 0,
'protocol' => '',
'tags' => [
],
'virtual_machine' => 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('PATCH', '{{baseUrl}}/ipam/services/:id/', [
'body' => '{
"created": "",
"custom_fields": {},
"description": "",
"device": 0,
"id": 0,
"ipaddresses": [],
"last_updated": "",
"name": "",
"port": 0,
"protocol": "",
"tags": [],
"virtual_machine": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/services/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'created' => '',
'custom_fields' => [
],
'description' => '',
'device' => 0,
'id' => 0,
'ipaddresses' => [
],
'last_updated' => '',
'name' => '',
'port' => 0,
'protocol' => '',
'tags' => [
],
'virtual_machine' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'created' => '',
'custom_fields' => [
],
'description' => '',
'device' => 0,
'id' => 0,
'ipaddresses' => [
],
'last_updated' => '',
'name' => '',
'port' => 0,
'protocol' => '',
'tags' => [
],
'virtual_machine' => 0
]));
$request->setRequestUrl('{{baseUrl}}/ipam/services/:id/');
$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}}/ipam/services/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"custom_fields": {},
"description": "",
"device": 0,
"id": 0,
"ipaddresses": [],
"last_updated": "",
"name": "",
"port": 0,
"protocol": "",
"tags": [],
"virtual_machine": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/services/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"custom_fields": {},
"description": "",
"device": 0,
"id": 0,
"ipaddresses": [],
"last_updated": "",
"name": "",
"port": 0,
"protocol": "",
"tags": [],
"virtual_machine": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/ipam/services/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/services/:id/"
payload = {
"created": "",
"custom_fields": {},
"description": "",
"device": 0,
"id": 0,
"ipaddresses": [],
"last_updated": "",
"name": "",
"port": 0,
"protocol": "",
"tags": [],
"virtual_machine": 0
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/services/:id/"
payload <- "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\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}}/ipam/services/:id/")
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 \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/ipam/services/:id/') do |req|
req.body = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\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}}/ipam/services/:id/";
let payload = json!({
"created": "",
"custom_fields": json!({}),
"description": "",
"device": 0,
"id": 0,
"ipaddresses": (),
"last_updated": "",
"name": "",
"port": 0,
"protocol": "",
"tags": (),
"virtual_machine": 0
});
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}}/ipam/services/:id/ \
--header 'content-type: application/json' \
--data '{
"created": "",
"custom_fields": {},
"description": "",
"device": 0,
"id": 0,
"ipaddresses": [],
"last_updated": "",
"name": "",
"port": 0,
"protocol": "",
"tags": [],
"virtual_machine": 0
}'
echo '{
"created": "",
"custom_fields": {},
"description": "",
"device": 0,
"id": 0,
"ipaddresses": [],
"last_updated": "",
"name": "",
"port": 0,
"protocol": "",
"tags": [],
"virtual_machine": 0
}' | \
http PATCH {{baseUrl}}/ipam/services/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "created": "",\n "custom_fields": {},\n "description": "",\n "device": 0,\n "id": 0,\n "ipaddresses": [],\n "last_updated": "",\n "name": "",\n "port": 0,\n "protocol": "",\n "tags": [],\n "virtual_machine": 0\n}' \
--output-document \
- {{baseUrl}}/ipam/services/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"created": "",
"custom_fields": [],
"description": "",
"device": 0,
"id": 0,
"ipaddresses": [],
"last_updated": "",
"name": "",
"port": 0,
"protocol": "",
"tags": [],
"virtual_machine": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/services/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
ipam_services_read
{{baseUrl}}/ipam/services/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/services/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/ipam/services/:id/")
require "http/client"
url = "{{baseUrl}}/ipam/services/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/ipam/services/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/services/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/services/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/ipam/services/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/ipam/services/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/services/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/services/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/ipam/services/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/ipam/services/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/ipam/services/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/services/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/ipam/services/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/ipam/services/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/ipam/services/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/ipam/services/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/ipam/services/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/ipam/services/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/services/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/services/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/ipam/services/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/services/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/ipam/services/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/services/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/ipam/services/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/ipam/services/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/services/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/ipam/services/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/services/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/services/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/ipam/services/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/ipam/services/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/services/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/ipam/services/:id/
http GET {{baseUrl}}/ipam/services/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/ipam/services/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/services/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
ipam_services_update
{{baseUrl}}/ipam/services/:id/
BODY json
{
"created": "",
"custom_fields": {},
"description": "",
"device": 0,
"id": 0,
"ipaddresses": [],
"last_updated": "",
"name": "",
"port": 0,
"protocol": "",
"tags": [],
"virtual_machine": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/services/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/ipam/services/:id/" {:content-type :json
:form-params {:created ""
:custom_fields {}
:description ""
:device 0
:id 0
:ipaddresses []
:last_updated ""
:name ""
:port 0
:protocol ""
:tags []
:virtual_machine 0}})
require "http/client"
url = "{{baseUrl}}/ipam/services/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\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}}/ipam/services/:id/"),
Content = new StringContent("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/services/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/services/:id/"
payload := strings.NewReader("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\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/ipam/services/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 215
{
"created": "",
"custom_fields": {},
"description": "",
"device": 0,
"id": 0,
"ipaddresses": [],
"last_updated": "",
"name": "",
"port": 0,
"protocol": "",
"tags": [],
"virtual_machine": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/ipam/services/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/services/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/services/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/ipam/services/:id/")
.header("content-type", "application/json")
.body("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\n}")
.asString();
const data = JSON.stringify({
created: '',
custom_fields: {},
description: '',
device: 0,
id: 0,
ipaddresses: [],
last_updated: '',
name: '',
port: 0,
protocol: '',
tags: [],
virtual_machine: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/ipam/services/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/ipam/services/:id/',
headers: {'content-type': 'application/json'},
data: {
created: '',
custom_fields: {},
description: '',
device: 0,
id: 0,
ipaddresses: [],
last_updated: '',
name: '',
port: 0,
protocol: '',
tags: [],
virtual_machine: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/services/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"created":"","custom_fields":{},"description":"","device":0,"id":0,"ipaddresses":[],"last_updated":"","name":"","port":0,"protocol":"","tags":[],"virtual_machine":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}}/ipam/services/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "created": "",\n "custom_fields": {},\n "description": "",\n "device": 0,\n "id": 0,\n "ipaddresses": [],\n "last_updated": "",\n "name": "",\n "port": 0,\n "protocol": "",\n "tags": [],\n "virtual_machine": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/ipam/services/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/ipam/services/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
created: '',
custom_fields: {},
description: '',
device: 0,
id: 0,
ipaddresses: [],
last_updated: '',
name: '',
port: 0,
protocol: '',
tags: [],
virtual_machine: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/ipam/services/:id/',
headers: {'content-type': 'application/json'},
body: {
created: '',
custom_fields: {},
description: '',
device: 0,
id: 0,
ipaddresses: [],
last_updated: '',
name: '',
port: 0,
protocol: '',
tags: [],
virtual_machine: 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('PUT', '{{baseUrl}}/ipam/services/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
created: '',
custom_fields: {},
description: '',
device: 0,
id: 0,
ipaddresses: [],
last_updated: '',
name: '',
port: 0,
protocol: '',
tags: [],
virtual_machine: 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: 'PUT',
url: '{{baseUrl}}/ipam/services/:id/',
headers: {'content-type': 'application/json'},
data: {
created: '',
custom_fields: {},
description: '',
device: 0,
id: 0,
ipaddresses: [],
last_updated: '',
name: '',
port: 0,
protocol: '',
tags: [],
virtual_machine: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/services/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"created":"","custom_fields":{},"description":"","device":0,"id":0,"ipaddresses":[],"last_updated":"","name":"","port":0,"protocol":"","tags":[],"virtual_machine":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 = @{ @"created": @"",
@"custom_fields": @{ },
@"description": @"",
@"device": @0,
@"id": @0,
@"ipaddresses": @[ ],
@"last_updated": @"",
@"name": @"",
@"port": @0,
@"protocol": @"",
@"tags": @[ ],
@"virtual_machine": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/services/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/ipam/services/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/services/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'created' => '',
'custom_fields' => [
],
'description' => '',
'device' => 0,
'id' => 0,
'ipaddresses' => [
],
'last_updated' => '',
'name' => '',
'port' => 0,
'protocol' => '',
'tags' => [
],
'virtual_machine' => 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('PUT', '{{baseUrl}}/ipam/services/:id/', [
'body' => '{
"created": "",
"custom_fields": {},
"description": "",
"device": 0,
"id": 0,
"ipaddresses": [],
"last_updated": "",
"name": "",
"port": 0,
"protocol": "",
"tags": [],
"virtual_machine": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/services/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'created' => '',
'custom_fields' => [
],
'description' => '',
'device' => 0,
'id' => 0,
'ipaddresses' => [
],
'last_updated' => '',
'name' => '',
'port' => 0,
'protocol' => '',
'tags' => [
],
'virtual_machine' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'created' => '',
'custom_fields' => [
],
'description' => '',
'device' => 0,
'id' => 0,
'ipaddresses' => [
],
'last_updated' => '',
'name' => '',
'port' => 0,
'protocol' => '',
'tags' => [
],
'virtual_machine' => 0
]));
$request->setRequestUrl('{{baseUrl}}/ipam/services/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/ipam/services/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"custom_fields": {},
"description": "",
"device": 0,
"id": 0,
"ipaddresses": [],
"last_updated": "",
"name": "",
"port": 0,
"protocol": "",
"tags": [],
"virtual_machine": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/services/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"custom_fields": {},
"description": "",
"device": 0,
"id": 0,
"ipaddresses": [],
"last_updated": "",
"name": "",
"port": 0,
"protocol": "",
"tags": [],
"virtual_machine": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/ipam/services/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/services/:id/"
payload = {
"created": "",
"custom_fields": {},
"description": "",
"device": 0,
"id": 0,
"ipaddresses": [],
"last_updated": "",
"name": "",
"port": 0,
"protocol": "",
"tags": [],
"virtual_machine": 0
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/services/:id/"
payload <- "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\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}}/ipam/services/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/ipam/services/:id/') do |req|
req.body = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device\": 0,\n \"id\": 0,\n \"ipaddresses\": [],\n \"last_updated\": \"\",\n \"name\": \"\",\n \"port\": 0,\n \"protocol\": \"\",\n \"tags\": [],\n \"virtual_machine\": 0\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}}/ipam/services/:id/";
let payload = json!({
"created": "",
"custom_fields": json!({}),
"description": "",
"device": 0,
"id": 0,
"ipaddresses": (),
"last_updated": "",
"name": "",
"port": 0,
"protocol": "",
"tags": (),
"virtual_machine": 0
});
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}}/ipam/services/:id/ \
--header 'content-type: application/json' \
--data '{
"created": "",
"custom_fields": {},
"description": "",
"device": 0,
"id": 0,
"ipaddresses": [],
"last_updated": "",
"name": "",
"port": 0,
"protocol": "",
"tags": [],
"virtual_machine": 0
}'
echo '{
"created": "",
"custom_fields": {},
"description": "",
"device": 0,
"id": 0,
"ipaddresses": [],
"last_updated": "",
"name": "",
"port": 0,
"protocol": "",
"tags": [],
"virtual_machine": 0
}' | \
http PUT {{baseUrl}}/ipam/services/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "created": "",\n "custom_fields": {},\n "description": "",\n "device": 0,\n "id": 0,\n "ipaddresses": [],\n "last_updated": "",\n "name": "",\n "port": 0,\n "protocol": "",\n "tags": [],\n "virtual_machine": 0\n}' \
--output-document \
- {{baseUrl}}/ipam/services/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"created": "",
"custom_fields": [],
"description": "",
"device": 0,
"id": 0,
"ipaddresses": [],
"last_updated": "",
"name": "",
"port": 0,
"protocol": "",
"tags": [],
"virtual_machine": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/services/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
ipam_vlan-groups_create
{{baseUrl}}/ipam/vlan-groups/
BODY json
{
"description": "",
"id": 0,
"name": "",
"site": 0,
"slug": "",
"vlan_count": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/vlan-groups/");
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 \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/ipam/vlan-groups/" {:content-type :json
:form-params {:description ""
:id 0
:name ""
:site 0
:slug ""
:vlan_count 0}})
require "http/client"
url = "{{baseUrl}}/ipam/vlan-groups/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/ipam/vlan-groups/"),
Content = new StringContent("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/vlan-groups/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/vlan-groups/"
payload := strings.NewReader("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ipam/vlan-groups/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 94
{
"description": "",
"id": 0,
"name": "",
"site": 0,
"slug": "",
"vlan_count": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/ipam/vlan-groups/")
.setHeader("content-type", "application/json")
.setBody("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/vlan-groups/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/vlan-groups/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/ipam/vlan-groups/")
.header("content-type", "application/json")
.body("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\n}")
.asString();
const data = JSON.stringify({
description: '',
id: 0,
name: '',
site: 0,
slug: '',
vlan_count: 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}}/ipam/vlan-groups/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/ipam/vlan-groups/',
headers: {'content-type': 'application/json'},
data: {description: '', id: 0, name: '', site: 0, slug: '', vlan_count: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/vlan-groups/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"description":"","id":0,"name":"","site":0,"slug":"","vlan_count":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}}/ipam/vlan-groups/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "description": "",\n "id": 0,\n "name": "",\n "site": 0,\n "slug": "",\n "vlan_count": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/ipam/vlan-groups/")
.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/ipam/vlan-groups/',
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({description: '', id: 0, name: '', site: 0, slug: '', vlan_count: 0}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/ipam/vlan-groups/',
headers: {'content-type': 'application/json'},
body: {description: '', id: 0, name: '', site: 0, slug: '', vlan_count: 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}}/ipam/vlan-groups/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
description: '',
id: 0,
name: '',
site: 0,
slug: '',
vlan_count: 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}}/ipam/vlan-groups/',
headers: {'content-type': 'application/json'},
data: {description: '', id: 0, name: '', site: 0, slug: '', vlan_count: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/vlan-groups/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"description":"","id":0,"name":"","site":0,"slug":"","vlan_count":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 = @{ @"description": @"",
@"id": @0,
@"name": @"",
@"site": @0,
@"slug": @"",
@"vlan_count": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/vlan-groups/"]
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}}/ipam/vlan-groups/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/vlan-groups/",
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([
'description' => '',
'id' => 0,
'name' => '',
'site' => 0,
'slug' => '',
'vlan_count' => 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}}/ipam/vlan-groups/', [
'body' => '{
"description": "",
"id": 0,
"name": "",
"site": 0,
"slug": "",
"vlan_count": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/vlan-groups/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'description' => '',
'id' => 0,
'name' => '',
'site' => 0,
'slug' => '',
'vlan_count' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'description' => '',
'id' => 0,
'name' => '',
'site' => 0,
'slug' => '',
'vlan_count' => 0
]));
$request->setRequestUrl('{{baseUrl}}/ipam/vlan-groups/');
$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}}/ipam/vlan-groups/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"id": 0,
"name": "",
"site": 0,
"slug": "",
"vlan_count": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/vlan-groups/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"id": 0,
"name": "",
"site": 0,
"slug": "",
"vlan_count": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/ipam/vlan-groups/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/vlan-groups/"
payload = {
"description": "",
"id": 0,
"name": "",
"site": 0,
"slug": "",
"vlan_count": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/vlan-groups/"
payload <- "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/ipam/vlan-groups/")
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 \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/ipam/vlan-groups/') do |req|
req.body = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/vlan-groups/";
let payload = json!({
"description": "",
"id": 0,
"name": "",
"site": 0,
"slug": "",
"vlan_count": 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}}/ipam/vlan-groups/ \
--header 'content-type: application/json' \
--data '{
"description": "",
"id": 0,
"name": "",
"site": 0,
"slug": "",
"vlan_count": 0
}'
echo '{
"description": "",
"id": 0,
"name": "",
"site": 0,
"slug": "",
"vlan_count": 0
}' | \
http POST {{baseUrl}}/ipam/vlan-groups/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "description": "",\n "id": 0,\n "name": "",\n "site": 0,\n "slug": "",\n "vlan_count": 0\n}' \
--output-document \
- {{baseUrl}}/ipam/vlan-groups/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"description": "",
"id": 0,
"name": "",
"site": 0,
"slug": "",
"vlan_count": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/vlan-groups/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
ipam_vlan-groups_delete
{{baseUrl}}/ipam/vlan-groups/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/vlan-groups/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/ipam/vlan-groups/:id/")
require "http/client"
url = "{{baseUrl}}/ipam/vlan-groups/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/ipam/vlan-groups/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/vlan-groups/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/vlan-groups/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/ipam/vlan-groups/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/ipam/vlan-groups/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/vlan-groups/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/vlan-groups/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/ipam/vlan-groups/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/ipam/vlan-groups/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/ipam/vlan-groups/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/vlan-groups/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/ipam/vlan-groups/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/ipam/vlan-groups/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/ipam/vlan-groups/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/ipam/vlan-groups/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/ipam/vlan-groups/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/ipam/vlan-groups/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/vlan-groups/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/vlan-groups/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/ipam/vlan-groups/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/vlan-groups/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/ipam/vlan-groups/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/vlan-groups/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/ipam/vlan-groups/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/ipam/vlan-groups/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/vlan-groups/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/ipam/vlan-groups/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/vlan-groups/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/vlan-groups/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/ipam/vlan-groups/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/ipam/vlan-groups/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/vlan-groups/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/ipam/vlan-groups/:id/
http DELETE {{baseUrl}}/ipam/vlan-groups/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/ipam/vlan-groups/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/vlan-groups/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
ipam_vlan-groups_list
{{baseUrl}}/ipam/vlan-groups/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/vlan-groups/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/ipam/vlan-groups/")
require "http/client"
url = "{{baseUrl}}/ipam/vlan-groups/"
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}}/ipam/vlan-groups/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/vlan-groups/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/vlan-groups/"
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/ipam/vlan-groups/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/ipam/vlan-groups/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/vlan-groups/"))
.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}}/ipam/vlan-groups/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/ipam/vlan-groups/")
.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}}/ipam/vlan-groups/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/ipam/vlan-groups/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/vlan-groups/';
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}}/ipam/vlan-groups/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/ipam/vlan-groups/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/ipam/vlan-groups/',
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}}/ipam/vlan-groups/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/ipam/vlan-groups/');
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}}/ipam/vlan-groups/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/vlan-groups/';
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}}/ipam/vlan-groups/"]
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}}/ipam/vlan-groups/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/vlan-groups/",
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}}/ipam/vlan-groups/');
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/vlan-groups/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/ipam/vlan-groups/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/ipam/vlan-groups/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/vlan-groups/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/ipam/vlan-groups/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/vlan-groups/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/vlan-groups/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/ipam/vlan-groups/")
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/ipam/vlan-groups/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/vlan-groups/";
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}}/ipam/vlan-groups/
http GET {{baseUrl}}/ipam/vlan-groups/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/ipam/vlan-groups/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/vlan-groups/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
ipam_vlan-groups_partial_update
{{baseUrl}}/ipam/vlan-groups/:id/
BODY json
{
"description": "",
"id": 0,
"name": "",
"site": 0,
"slug": "",
"vlan_count": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/vlan-groups/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/ipam/vlan-groups/:id/" {:content-type :json
:form-params {:description ""
:id 0
:name ""
:site 0
:slug ""
:vlan_count 0}})
require "http/client"
url = "{{baseUrl}}/ipam/vlan-groups/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\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}}/ipam/vlan-groups/:id/"),
Content = new StringContent("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/vlan-groups/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/vlan-groups/:id/"
payload := strings.NewReader("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\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/ipam/vlan-groups/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 94
{
"description": "",
"id": 0,
"name": "",
"site": 0,
"slug": "",
"vlan_count": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/ipam/vlan-groups/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/vlan-groups/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/vlan-groups/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/ipam/vlan-groups/:id/")
.header("content-type", "application/json")
.body("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\n}")
.asString();
const data = JSON.stringify({
description: '',
id: 0,
name: '',
site: 0,
slug: '',
vlan_count: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/ipam/vlan-groups/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/ipam/vlan-groups/:id/',
headers: {'content-type': 'application/json'},
data: {description: '', id: 0, name: '', site: 0, slug: '', vlan_count: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/vlan-groups/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"description":"","id":0,"name":"","site":0,"slug":"","vlan_count":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}}/ipam/vlan-groups/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "description": "",\n "id": 0,\n "name": "",\n "site": 0,\n "slug": "",\n "vlan_count": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/ipam/vlan-groups/:id/")
.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/ipam/vlan-groups/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({description: '', id: 0, name: '', site: 0, slug: '', vlan_count: 0}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/ipam/vlan-groups/:id/',
headers: {'content-type': 'application/json'},
body: {description: '', id: 0, name: '', site: 0, slug: '', vlan_count: 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('PATCH', '{{baseUrl}}/ipam/vlan-groups/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
description: '',
id: 0,
name: '',
site: 0,
slug: '',
vlan_count: 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: 'PATCH',
url: '{{baseUrl}}/ipam/vlan-groups/:id/',
headers: {'content-type': 'application/json'},
data: {description: '', id: 0, name: '', site: 0, slug: '', vlan_count: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/vlan-groups/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"description":"","id":0,"name":"","site":0,"slug":"","vlan_count":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 = @{ @"description": @"",
@"id": @0,
@"name": @"",
@"site": @0,
@"slug": @"",
@"vlan_count": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/vlan-groups/:id/"]
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}}/ipam/vlan-groups/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/vlan-groups/:id/",
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([
'description' => '',
'id' => 0,
'name' => '',
'site' => 0,
'slug' => '',
'vlan_count' => 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('PATCH', '{{baseUrl}}/ipam/vlan-groups/:id/', [
'body' => '{
"description": "",
"id": 0,
"name": "",
"site": 0,
"slug": "",
"vlan_count": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/vlan-groups/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'description' => '',
'id' => 0,
'name' => '',
'site' => 0,
'slug' => '',
'vlan_count' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'description' => '',
'id' => 0,
'name' => '',
'site' => 0,
'slug' => '',
'vlan_count' => 0
]));
$request->setRequestUrl('{{baseUrl}}/ipam/vlan-groups/:id/');
$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}}/ipam/vlan-groups/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"id": 0,
"name": "",
"site": 0,
"slug": "",
"vlan_count": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/vlan-groups/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"id": 0,
"name": "",
"site": 0,
"slug": "",
"vlan_count": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/ipam/vlan-groups/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/vlan-groups/:id/"
payload = {
"description": "",
"id": 0,
"name": "",
"site": 0,
"slug": "",
"vlan_count": 0
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/vlan-groups/:id/"
payload <- "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\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}}/ipam/vlan-groups/:id/")
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 \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/ipam/vlan-groups/:id/') do |req|
req.body = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\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}}/ipam/vlan-groups/:id/";
let payload = json!({
"description": "",
"id": 0,
"name": "",
"site": 0,
"slug": "",
"vlan_count": 0
});
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}}/ipam/vlan-groups/:id/ \
--header 'content-type: application/json' \
--data '{
"description": "",
"id": 0,
"name": "",
"site": 0,
"slug": "",
"vlan_count": 0
}'
echo '{
"description": "",
"id": 0,
"name": "",
"site": 0,
"slug": "",
"vlan_count": 0
}' | \
http PATCH {{baseUrl}}/ipam/vlan-groups/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "description": "",\n "id": 0,\n "name": "",\n "site": 0,\n "slug": "",\n "vlan_count": 0\n}' \
--output-document \
- {{baseUrl}}/ipam/vlan-groups/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"description": "",
"id": 0,
"name": "",
"site": 0,
"slug": "",
"vlan_count": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/vlan-groups/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
ipam_vlan-groups_read
{{baseUrl}}/ipam/vlan-groups/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/vlan-groups/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/ipam/vlan-groups/:id/")
require "http/client"
url = "{{baseUrl}}/ipam/vlan-groups/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/ipam/vlan-groups/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/vlan-groups/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/vlan-groups/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/ipam/vlan-groups/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/ipam/vlan-groups/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/vlan-groups/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/vlan-groups/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/ipam/vlan-groups/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/ipam/vlan-groups/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/ipam/vlan-groups/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/vlan-groups/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/ipam/vlan-groups/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/ipam/vlan-groups/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/ipam/vlan-groups/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/ipam/vlan-groups/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/ipam/vlan-groups/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/ipam/vlan-groups/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/vlan-groups/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/vlan-groups/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/ipam/vlan-groups/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/vlan-groups/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/ipam/vlan-groups/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/vlan-groups/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/ipam/vlan-groups/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/ipam/vlan-groups/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/vlan-groups/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/ipam/vlan-groups/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/vlan-groups/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/vlan-groups/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/ipam/vlan-groups/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/ipam/vlan-groups/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/vlan-groups/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/ipam/vlan-groups/:id/
http GET {{baseUrl}}/ipam/vlan-groups/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/ipam/vlan-groups/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/vlan-groups/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
ipam_vlan-groups_update
{{baseUrl}}/ipam/vlan-groups/:id/
BODY json
{
"description": "",
"id": 0,
"name": "",
"site": 0,
"slug": "",
"vlan_count": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/vlan-groups/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/ipam/vlan-groups/:id/" {:content-type :json
:form-params {:description ""
:id 0
:name ""
:site 0
:slug ""
:vlan_count 0}})
require "http/client"
url = "{{baseUrl}}/ipam/vlan-groups/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\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}}/ipam/vlan-groups/:id/"),
Content = new StringContent("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/vlan-groups/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/vlan-groups/:id/"
payload := strings.NewReader("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\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/ipam/vlan-groups/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 94
{
"description": "",
"id": 0,
"name": "",
"site": 0,
"slug": "",
"vlan_count": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/ipam/vlan-groups/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/vlan-groups/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/vlan-groups/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/ipam/vlan-groups/:id/")
.header("content-type", "application/json")
.body("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\n}")
.asString();
const data = JSON.stringify({
description: '',
id: 0,
name: '',
site: 0,
slug: '',
vlan_count: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/ipam/vlan-groups/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/ipam/vlan-groups/:id/',
headers: {'content-type': 'application/json'},
data: {description: '', id: 0, name: '', site: 0, slug: '', vlan_count: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/vlan-groups/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"description":"","id":0,"name":"","site":0,"slug":"","vlan_count":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}}/ipam/vlan-groups/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "description": "",\n "id": 0,\n "name": "",\n "site": 0,\n "slug": "",\n "vlan_count": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/ipam/vlan-groups/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/ipam/vlan-groups/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({description: '', id: 0, name: '', site: 0, slug: '', vlan_count: 0}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/ipam/vlan-groups/:id/',
headers: {'content-type': 'application/json'},
body: {description: '', id: 0, name: '', site: 0, slug: '', vlan_count: 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('PUT', '{{baseUrl}}/ipam/vlan-groups/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
description: '',
id: 0,
name: '',
site: 0,
slug: '',
vlan_count: 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: 'PUT',
url: '{{baseUrl}}/ipam/vlan-groups/:id/',
headers: {'content-type': 'application/json'},
data: {description: '', id: 0, name: '', site: 0, slug: '', vlan_count: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/vlan-groups/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"description":"","id":0,"name":"","site":0,"slug":"","vlan_count":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 = @{ @"description": @"",
@"id": @0,
@"name": @"",
@"site": @0,
@"slug": @"",
@"vlan_count": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/vlan-groups/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/ipam/vlan-groups/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/vlan-groups/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'description' => '',
'id' => 0,
'name' => '',
'site' => 0,
'slug' => '',
'vlan_count' => 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('PUT', '{{baseUrl}}/ipam/vlan-groups/:id/', [
'body' => '{
"description": "",
"id": 0,
"name": "",
"site": 0,
"slug": "",
"vlan_count": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/vlan-groups/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'description' => '',
'id' => 0,
'name' => '',
'site' => 0,
'slug' => '',
'vlan_count' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'description' => '',
'id' => 0,
'name' => '',
'site' => 0,
'slug' => '',
'vlan_count' => 0
]));
$request->setRequestUrl('{{baseUrl}}/ipam/vlan-groups/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/ipam/vlan-groups/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"id": 0,
"name": "",
"site": 0,
"slug": "",
"vlan_count": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/vlan-groups/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"id": 0,
"name": "",
"site": 0,
"slug": "",
"vlan_count": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/ipam/vlan-groups/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/vlan-groups/:id/"
payload = {
"description": "",
"id": 0,
"name": "",
"site": 0,
"slug": "",
"vlan_count": 0
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/vlan-groups/:id/"
payload <- "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\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}}/ipam/vlan-groups/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/ipam/vlan-groups/:id/') do |req|
req.body = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"site\": 0,\n \"slug\": \"\",\n \"vlan_count\": 0\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}}/ipam/vlan-groups/:id/";
let payload = json!({
"description": "",
"id": 0,
"name": "",
"site": 0,
"slug": "",
"vlan_count": 0
});
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}}/ipam/vlan-groups/:id/ \
--header 'content-type: application/json' \
--data '{
"description": "",
"id": 0,
"name": "",
"site": 0,
"slug": "",
"vlan_count": 0
}'
echo '{
"description": "",
"id": 0,
"name": "",
"site": 0,
"slug": "",
"vlan_count": 0
}' | \
http PUT {{baseUrl}}/ipam/vlan-groups/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "description": "",\n "id": 0,\n "name": "",\n "site": 0,\n "slug": "",\n "vlan_count": 0\n}' \
--output-document \
- {{baseUrl}}/ipam/vlan-groups/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"description": "",
"id": 0,
"name": "",
"site": 0,
"slug": "",
"vlan_count": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/vlan-groups/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
ipam_vlans_create
{{baseUrl}}/ipam/vlans/
BODY json
{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vid": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/vlans/");
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 \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/ipam/vlans/" {:content-type :json
:form-params {:created ""
:custom_fields {}
:description ""
:display_name ""
:group 0
:id 0
:last_updated ""
:name ""
:prefix_count 0
:role 0
:site 0
:status ""
:tags []
:tenant 0
:vid 0}})
require "http/client"
url = "{{baseUrl}}/ipam/vlans/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/ipam/vlans/"),
Content = new StringContent("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/vlans/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/vlans/"
payload := strings.NewReader("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ipam/vlans/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 250
{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vid": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/ipam/vlans/")
.setHeader("content-type", "application/json")
.setBody("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/vlans/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/vlans/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/ipam/vlans/")
.header("content-type", "application/json")
.body("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\n}")
.asString();
const data = JSON.stringify({
created: '',
custom_fields: {},
description: '',
display_name: '',
group: 0,
id: 0,
last_updated: '',
name: '',
prefix_count: 0,
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vid: 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}}/ipam/vlans/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/ipam/vlans/',
headers: {'content-type': 'application/json'},
data: {
created: '',
custom_fields: {},
description: '',
display_name: '',
group: 0,
id: 0,
last_updated: '',
name: '',
prefix_count: 0,
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vid: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/vlans/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"created":"","custom_fields":{},"description":"","display_name":"","group":0,"id":0,"last_updated":"","name":"","prefix_count":0,"role":0,"site":0,"status":"","tags":[],"tenant":0,"vid":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}}/ipam/vlans/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "created": "",\n "custom_fields": {},\n "description": "",\n "display_name": "",\n "group": 0,\n "id": 0,\n "last_updated": "",\n "name": "",\n "prefix_count": 0,\n "role": 0,\n "site": 0,\n "status": "",\n "tags": [],\n "tenant": 0,\n "vid": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/ipam/vlans/")
.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/ipam/vlans/',
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({
created: '',
custom_fields: {},
description: '',
display_name: '',
group: 0,
id: 0,
last_updated: '',
name: '',
prefix_count: 0,
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vid: 0
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/ipam/vlans/',
headers: {'content-type': 'application/json'},
body: {
created: '',
custom_fields: {},
description: '',
display_name: '',
group: 0,
id: 0,
last_updated: '',
name: '',
prefix_count: 0,
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vid: 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}}/ipam/vlans/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
created: '',
custom_fields: {},
description: '',
display_name: '',
group: 0,
id: 0,
last_updated: '',
name: '',
prefix_count: 0,
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vid: 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}}/ipam/vlans/',
headers: {'content-type': 'application/json'},
data: {
created: '',
custom_fields: {},
description: '',
display_name: '',
group: 0,
id: 0,
last_updated: '',
name: '',
prefix_count: 0,
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vid: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/vlans/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"created":"","custom_fields":{},"description":"","display_name":"","group":0,"id":0,"last_updated":"","name":"","prefix_count":0,"role":0,"site":0,"status":"","tags":[],"tenant":0,"vid":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 = @{ @"created": @"",
@"custom_fields": @{ },
@"description": @"",
@"display_name": @"",
@"group": @0,
@"id": @0,
@"last_updated": @"",
@"name": @"",
@"prefix_count": @0,
@"role": @0,
@"site": @0,
@"status": @"",
@"tags": @[ ],
@"tenant": @0,
@"vid": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/vlans/"]
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}}/ipam/vlans/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/vlans/",
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([
'created' => '',
'custom_fields' => [
],
'description' => '',
'display_name' => '',
'group' => 0,
'id' => 0,
'last_updated' => '',
'name' => '',
'prefix_count' => 0,
'role' => 0,
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'vid' => 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}}/ipam/vlans/', [
'body' => '{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vid": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/vlans/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'created' => '',
'custom_fields' => [
],
'description' => '',
'display_name' => '',
'group' => 0,
'id' => 0,
'last_updated' => '',
'name' => '',
'prefix_count' => 0,
'role' => 0,
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'vid' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'created' => '',
'custom_fields' => [
],
'description' => '',
'display_name' => '',
'group' => 0,
'id' => 0,
'last_updated' => '',
'name' => '',
'prefix_count' => 0,
'role' => 0,
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'vid' => 0
]));
$request->setRequestUrl('{{baseUrl}}/ipam/vlans/');
$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}}/ipam/vlans/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vid": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/vlans/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vid": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/ipam/vlans/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/vlans/"
payload = {
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vid": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/vlans/"
payload <- "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/ipam/vlans/")
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 \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/ipam/vlans/') do |req|
req.body = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/vlans/";
let payload = json!({
"created": "",
"custom_fields": json!({}),
"description": "",
"display_name": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"role": 0,
"site": 0,
"status": "",
"tags": (),
"tenant": 0,
"vid": 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}}/ipam/vlans/ \
--header 'content-type: application/json' \
--data '{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vid": 0
}'
echo '{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vid": 0
}' | \
http POST {{baseUrl}}/ipam/vlans/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "created": "",\n "custom_fields": {},\n "description": "",\n "display_name": "",\n "group": 0,\n "id": 0,\n "last_updated": "",\n "name": "",\n "prefix_count": 0,\n "role": 0,\n "site": 0,\n "status": "",\n "tags": [],\n "tenant": 0,\n "vid": 0\n}' \
--output-document \
- {{baseUrl}}/ipam/vlans/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"created": "",
"custom_fields": [],
"description": "",
"display_name": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vid": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/vlans/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
ipam_vlans_delete
{{baseUrl}}/ipam/vlans/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/vlans/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/ipam/vlans/:id/")
require "http/client"
url = "{{baseUrl}}/ipam/vlans/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/ipam/vlans/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/vlans/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/vlans/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/ipam/vlans/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/ipam/vlans/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/vlans/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/vlans/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/ipam/vlans/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/ipam/vlans/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/ipam/vlans/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/vlans/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/ipam/vlans/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/ipam/vlans/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/ipam/vlans/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/ipam/vlans/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/ipam/vlans/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/ipam/vlans/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/vlans/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/vlans/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/ipam/vlans/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/vlans/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/ipam/vlans/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/vlans/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/ipam/vlans/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/ipam/vlans/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/vlans/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/ipam/vlans/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/vlans/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/vlans/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/ipam/vlans/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/ipam/vlans/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/vlans/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/ipam/vlans/:id/
http DELETE {{baseUrl}}/ipam/vlans/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/ipam/vlans/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/vlans/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
ipam_vlans_list
{{baseUrl}}/ipam/vlans/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/vlans/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/ipam/vlans/")
require "http/client"
url = "{{baseUrl}}/ipam/vlans/"
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}}/ipam/vlans/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/vlans/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/vlans/"
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/ipam/vlans/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/ipam/vlans/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/vlans/"))
.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}}/ipam/vlans/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/ipam/vlans/")
.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}}/ipam/vlans/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/ipam/vlans/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/vlans/';
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}}/ipam/vlans/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/ipam/vlans/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/ipam/vlans/',
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}}/ipam/vlans/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/ipam/vlans/');
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}}/ipam/vlans/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/vlans/';
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}}/ipam/vlans/"]
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}}/ipam/vlans/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/vlans/",
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}}/ipam/vlans/');
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/vlans/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/ipam/vlans/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/ipam/vlans/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/vlans/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/ipam/vlans/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/vlans/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/vlans/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/ipam/vlans/")
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/ipam/vlans/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/vlans/";
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}}/ipam/vlans/
http GET {{baseUrl}}/ipam/vlans/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/ipam/vlans/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/vlans/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
ipam_vlans_partial_update
{{baseUrl}}/ipam/vlans/:id/
BODY json
{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vid": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/vlans/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/ipam/vlans/:id/" {:content-type :json
:form-params {:created ""
:custom_fields {}
:description ""
:display_name ""
:group 0
:id 0
:last_updated ""
:name ""
:prefix_count 0
:role 0
:site 0
:status ""
:tags []
:tenant 0
:vid 0}})
require "http/client"
url = "{{baseUrl}}/ipam/vlans/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\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}}/ipam/vlans/:id/"),
Content = new StringContent("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/vlans/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/vlans/:id/"
payload := strings.NewReader("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\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/ipam/vlans/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 250
{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vid": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/ipam/vlans/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/vlans/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/vlans/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/ipam/vlans/:id/")
.header("content-type", "application/json")
.body("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\n}")
.asString();
const data = JSON.stringify({
created: '',
custom_fields: {},
description: '',
display_name: '',
group: 0,
id: 0,
last_updated: '',
name: '',
prefix_count: 0,
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vid: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/ipam/vlans/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/ipam/vlans/:id/',
headers: {'content-type': 'application/json'},
data: {
created: '',
custom_fields: {},
description: '',
display_name: '',
group: 0,
id: 0,
last_updated: '',
name: '',
prefix_count: 0,
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vid: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/vlans/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"created":"","custom_fields":{},"description":"","display_name":"","group":0,"id":0,"last_updated":"","name":"","prefix_count":0,"role":0,"site":0,"status":"","tags":[],"tenant":0,"vid":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}}/ipam/vlans/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "created": "",\n "custom_fields": {},\n "description": "",\n "display_name": "",\n "group": 0,\n "id": 0,\n "last_updated": "",\n "name": "",\n "prefix_count": 0,\n "role": 0,\n "site": 0,\n "status": "",\n "tags": [],\n "tenant": 0,\n "vid": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/ipam/vlans/:id/")
.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/ipam/vlans/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
created: '',
custom_fields: {},
description: '',
display_name: '',
group: 0,
id: 0,
last_updated: '',
name: '',
prefix_count: 0,
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vid: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/ipam/vlans/:id/',
headers: {'content-type': 'application/json'},
body: {
created: '',
custom_fields: {},
description: '',
display_name: '',
group: 0,
id: 0,
last_updated: '',
name: '',
prefix_count: 0,
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vid: 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('PATCH', '{{baseUrl}}/ipam/vlans/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
created: '',
custom_fields: {},
description: '',
display_name: '',
group: 0,
id: 0,
last_updated: '',
name: '',
prefix_count: 0,
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vid: 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: 'PATCH',
url: '{{baseUrl}}/ipam/vlans/:id/',
headers: {'content-type': 'application/json'},
data: {
created: '',
custom_fields: {},
description: '',
display_name: '',
group: 0,
id: 0,
last_updated: '',
name: '',
prefix_count: 0,
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vid: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/vlans/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"created":"","custom_fields":{},"description":"","display_name":"","group":0,"id":0,"last_updated":"","name":"","prefix_count":0,"role":0,"site":0,"status":"","tags":[],"tenant":0,"vid":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 = @{ @"created": @"",
@"custom_fields": @{ },
@"description": @"",
@"display_name": @"",
@"group": @0,
@"id": @0,
@"last_updated": @"",
@"name": @"",
@"prefix_count": @0,
@"role": @0,
@"site": @0,
@"status": @"",
@"tags": @[ ],
@"tenant": @0,
@"vid": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/vlans/:id/"]
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}}/ipam/vlans/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/vlans/:id/",
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([
'created' => '',
'custom_fields' => [
],
'description' => '',
'display_name' => '',
'group' => 0,
'id' => 0,
'last_updated' => '',
'name' => '',
'prefix_count' => 0,
'role' => 0,
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'vid' => 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('PATCH', '{{baseUrl}}/ipam/vlans/:id/', [
'body' => '{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vid": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/vlans/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'created' => '',
'custom_fields' => [
],
'description' => '',
'display_name' => '',
'group' => 0,
'id' => 0,
'last_updated' => '',
'name' => '',
'prefix_count' => 0,
'role' => 0,
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'vid' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'created' => '',
'custom_fields' => [
],
'description' => '',
'display_name' => '',
'group' => 0,
'id' => 0,
'last_updated' => '',
'name' => '',
'prefix_count' => 0,
'role' => 0,
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'vid' => 0
]));
$request->setRequestUrl('{{baseUrl}}/ipam/vlans/:id/');
$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}}/ipam/vlans/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vid": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/vlans/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vid": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/ipam/vlans/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/vlans/:id/"
payload = {
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vid": 0
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/vlans/:id/"
payload <- "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\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}}/ipam/vlans/:id/")
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 \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/ipam/vlans/:id/') do |req|
req.body = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\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}}/ipam/vlans/:id/";
let payload = json!({
"created": "",
"custom_fields": json!({}),
"description": "",
"display_name": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"role": 0,
"site": 0,
"status": "",
"tags": (),
"tenant": 0,
"vid": 0
});
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}}/ipam/vlans/:id/ \
--header 'content-type: application/json' \
--data '{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vid": 0
}'
echo '{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vid": 0
}' | \
http PATCH {{baseUrl}}/ipam/vlans/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "created": "",\n "custom_fields": {},\n "description": "",\n "display_name": "",\n "group": 0,\n "id": 0,\n "last_updated": "",\n "name": "",\n "prefix_count": 0,\n "role": 0,\n "site": 0,\n "status": "",\n "tags": [],\n "tenant": 0,\n "vid": 0\n}' \
--output-document \
- {{baseUrl}}/ipam/vlans/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"created": "",
"custom_fields": [],
"description": "",
"display_name": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vid": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/vlans/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
ipam_vlans_read
{{baseUrl}}/ipam/vlans/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/vlans/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/ipam/vlans/:id/")
require "http/client"
url = "{{baseUrl}}/ipam/vlans/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/ipam/vlans/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/vlans/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/vlans/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/ipam/vlans/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/ipam/vlans/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/vlans/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/vlans/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/ipam/vlans/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/ipam/vlans/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/ipam/vlans/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/vlans/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/ipam/vlans/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/ipam/vlans/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/ipam/vlans/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/ipam/vlans/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/ipam/vlans/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/ipam/vlans/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/vlans/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/vlans/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/ipam/vlans/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/vlans/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/ipam/vlans/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/vlans/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/ipam/vlans/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/ipam/vlans/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/vlans/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/ipam/vlans/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/vlans/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/vlans/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/ipam/vlans/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/ipam/vlans/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/vlans/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/ipam/vlans/:id/
http GET {{baseUrl}}/ipam/vlans/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/ipam/vlans/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/vlans/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
ipam_vlans_update
{{baseUrl}}/ipam/vlans/:id/
BODY json
{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vid": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/vlans/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/ipam/vlans/:id/" {:content-type :json
:form-params {:created ""
:custom_fields {}
:description ""
:display_name ""
:group 0
:id 0
:last_updated ""
:name ""
:prefix_count 0
:role 0
:site 0
:status ""
:tags []
:tenant 0
:vid 0}})
require "http/client"
url = "{{baseUrl}}/ipam/vlans/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\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}}/ipam/vlans/:id/"),
Content = new StringContent("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/vlans/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/vlans/:id/"
payload := strings.NewReader("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\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/ipam/vlans/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 250
{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vid": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/ipam/vlans/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/vlans/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/vlans/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/ipam/vlans/:id/")
.header("content-type", "application/json")
.body("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\n}")
.asString();
const data = JSON.stringify({
created: '',
custom_fields: {},
description: '',
display_name: '',
group: 0,
id: 0,
last_updated: '',
name: '',
prefix_count: 0,
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vid: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/ipam/vlans/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/ipam/vlans/:id/',
headers: {'content-type': 'application/json'},
data: {
created: '',
custom_fields: {},
description: '',
display_name: '',
group: 0,
id: 0,
last_updated: '',
name: '',
prefix_count: 0,
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vid: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/vlans/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"created":"","custom_fields":{},"description":"","display_name":"","group":0,"id":0,"last_updated":"","name":"","prefix_count":0,"role":0,"site":0,"status":"","tags":[],"tenant":0,"vid":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}}/ipam/vlans/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "created": "",\n "custom_fields": {},\n "description": "",\n "display_name": "",\n "group": 0,\n "id": 0,\n "last_updated": "",\n "name": "",\n "prefix_count": 0,\n "role": 0,\n "site": 0,\n "status": "",\n "tags": [],\n "tenant": 0,\n "vid": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/ipam/vlans/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/ipam/vlans/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
created: '',
custom_fields: {},
description: '',
display_name: '',
group: 0,
id: 0,
last_updated: '',
name: '',
prefix_count: 0,
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vid: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/ipam/vlans/:id/',
headers: {'content-type': 'application/json'},
body: {
created: '',
custom_fields: {},
description: '',
display_name: '',
group: 0,
id: 0,
last_updated: '',
name: '',
prefix_count: 0,
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vid: 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('PUT', '{{baseUrl}}/ipam/vlans/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
created: '',
custom_fields: {},
description: '',
display_name: '',
group: 0,
id: 0,
last_updated: '',
name: '',
prefix_count: 0,
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vid: 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: 'PUT',
url: '{{baseUrl}}/ipam/vlans/:id/',
headers: {'content-type': 'application/json'},
data: {
created: '',
custom_fields: {},
description: '',
display_name: '',
group: 0,
id: 0,
last_updated: '',
name: '',
prefix_count: 0,
role: 0,
site: 0,
status: '',
tags: [],
tenant: 0,
vid: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/vlans/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"created":"","custom_fields":{},"description":"","display_name":"","group":0,"id":0,"last_updated":"","name":"","prefix_count":0,"role":0,"site":0,"status":"","tags":[],"tenant":0,"vid":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 = @{ @"created": @"",
@"custom_fields": @{ },
@"description": @"",
@"display_name": @"",
@"group": @0,
@"id": @0,
@"last_updated": @"",
@"name": @"",
@"prefix_count": @0,
@"role": @0,
@"site": @0,
@"status": @"",
@"tags": @[ ],
@"tenant": @0,
@"vid": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/vlans/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/ipam/vlans/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/vlans/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'created' => '',
'custom_fields' => [
],
'description' => '',
'display_name' => '',
'group' => 0,
'id' => 0,
'last_updated' => '',
'name' => '',
'prefix_count' => 0,
'role' => 0,
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'vid' => 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('PUT', '{{baseUrl}}/ipam/vlans/:id/', [
'body' => '{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vid": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/vlans/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'created' => '',
'custom_fields' => [
],
'description' => '',
'display_name' => '',
'group' => 0,
'id' => 0,
'last_updated' => '',
'name' => '',
'prefix_count' => 0,
'role' => 0,
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'vid' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'created' => '',
'custom_fields' => [
],
'description' => '',
'display_name' => '',
'group' => 0,
'id' => 0,
'last_updated' => '',
'name' => '',
'prefix_count' => 0,
'role' => 0,
'site' => 0,
'status' => '',
'tags' => [
],
'tenant' => 0,
'vid' => 0
]));
$request->setRequestUrl('{{baseUrl}}/ipam/vlans/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/ipam/vlans/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vid": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/vlans/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vid": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/ipam/vlans/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/vlans/:id/"
payload = {
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vid": 0
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/vlans/:id/"
payload <- "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\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}}/ipam/vlans/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/ipam/vlans/:id/') do |req|
req.body = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"role\": 0,\n \"site\": 0,\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vid\": 0\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}}/ipam/vlans/:id/";
let payload = json!({
"created": "",
"custom_fields": json!({}),
"description": "",
"display_name": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"role": 0,
"site": 0,
"status": "",
"tags": (),
"tenant": 0,
"vid": 0
});
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}}/ipam/vlans/:id/ \
--header 'content-type: application/json' \
--data '{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vid": 0
}'
echo '{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vid": 0
}' | \
http PUT {{baseUrl}}/ipam/vlans/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "created": "",\n "custom_fields": {},\n "description": "",\n "display_name": "",\n "group": 0,\n "id": 0,\n "last_updated": "",\n "name": "",\n "prefix_count": 0,\n "role": 0,\n "site": 0,\n "status": "",\n "tags": [],\n "tenant": 0,\n "vid": 0\n}' \
--output-document \
- {{baseUrl}}/ipam/vlans/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"created": "",
"custom_fields": [],
"description": "",
"display_name": "",
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"role": 0,
"site": 0,
"status": "",
"tags": [],
"tenant": 0,
"vid": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/vlans/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
ipam_vrfs_create
{{baseUrl}}/ipam/vrfs/
BODY json
{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"enforce_unique": false,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rd": "",
"tags": [],
"tenant": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/vrfs/");
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 \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/ipam/vrfs/" {:content-type :json
:form-params {:created ""
:custom_fields {}
:description ""
:display_name ""
:enforce_unique false
:id 0
:ipaddress_count 0
:last_updated ""
:name ""
:prefix_count 0
:rd ""
:tags []
:tenant 0}})
require "http/client"
url = "{{baseUrl}}/ipam/vrfs/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/ipam/vrfs/"),
Content = new StringContent("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/vrfs/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/vrfs/"
payload := strings.NewReader("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/ipam/vrfs/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 245
{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"enforce_unique": false,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rd": "",
"tags": [],
"tenant": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/ipam/vrfs/")
.setHeader("content-type", "application/json")
.setBody("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/vrfs/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/vrfs/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/ipam/vrfs/")
.header("content-type", "application/json")
.body("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\n}")
.asString();
const data = JSON.stringify({
created: '',
custom_fields: {},
description: '',
display_name: '',
enforce_unique: false,
id: 0,
ipaddress_count: 0,
last_updated: '',
name: '',
prefix_count: 0,
rd: '',
tags: [],
tenant: 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}}/ipam/vrfs/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/ipam/vrfs/',
headers: {'content-type': 'application/json'},
data: {
created: '',
custom_fields: {},
description: '',
display_name: '',
enforce_unique: false,
id: 0,
ipaddress_count: 0,
last_updated: '',
name: '',
prefix_count: 0,
rd: '',
tags: [],
tenant: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/vrfs/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"created":"","custom_fields":{},"description":"","display_name":"","enforce_unique":false,"id":0,"ipaddress_count":0,"last_updated":"","name":"","prefix_count":0,"rd":"","tags":[],"tenant":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}}/ipam/vrfs/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "created": "",\n "custom_fields": {},\n "description": "",\n "display_name": "",\n "enforce_unique": false,\n "id": 0,\n "ipaddress_count": 0,\n "last_updated": "",\n "name": "",\n "prefix_count": 0,\n "rd": "",\n "tags": [],\n "tenant": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/ipam/vrfs/")
.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/ipam/vrfs/',
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({
created: '',
custom_fields: {},
description: '',
display_name: '',
enforce_unique: false,
id: 0,
ipaddress_count: 0,
last_updated: '',
name: '',
prefix_count: 0,
rd: '',
tags: [],
tenant: 0
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/ipam/vrfs/',
headers: {'content-type': 'application/json'},
body: {
created: '',
custom_fields: {},
description: '',
display_name: '',
enforce_unique: false,
id: 0,
ipaddress_count: 0,
last_updated: '',
name: '',
prefix_count: 0,
rd: '',
tags: [],
tenant: 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}}/ipam/vrfs/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
created: '',
custom_fields: {},
description: '',
display_name: '',
enforce_unique: false,
id: 0,
ipaddress_count: 0,
last_updated: '',
name: '',
prefix_count: 0,
rd: '',
tags: [],
tenant: 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}}/ipam/vrfs/',
headers: {'content-type': 'application/json'},
data: {
created: '',
custom_fields: {},
description: '',
display_name: '',
enforce_unique: false,
id: 0,
ipaddress_count: 0,
last_updated: '',
name: '',
prefix_count: 0,
rd: '',
tags: [],
tenant: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/vrfs/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"created":"","custom_fields":{},"description":"","display_name":"","enforce_unique":false,"id":0,"ipaddress_count":0,"last_updated":"","name":"","prefix_count":0,"rd":"","tags":[],"tenant":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 = @{ @"created": @"",
@"custom_fields": @{ },
@"description": @"",
@"display_name": @"",
@"enforce_unique": @NO,
@"id": @0,
@"ipaddress_count": @0,
@"last_updated": @"",
@"name": @"",
@"prefix_count": @0,
@"rd": @"",
@"tags": @[ ],
@"tenant": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/vrfs/"]
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}}/ipam/vrfs/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/vrfs/",
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([
'created' => '',
'custom_fields' => [
],
'description' => '',
'display_name' => '',
'enforce_unique' => null,
'id' => 0,
'ipaddress_count' => 0,
'last_updated' => '',
'name' => '',
'prefix_count' => 0,
'rd' => '',
'tags' => [
],
'tenant' => 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}}/ipam/vrfs/', [
'body' => '{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"enforce_unique": false,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rd": "",
"tags": [],
"tenant": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/vrfs/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'created' => '',
'custom_fields' => [
],
'description' => '',
'display_name' => '',
'enforce_unique' => null,
'id' => 0,
'ipaddress_count' => 0,
'last_updated' => '',
'name' => '',
'prefix_count' => 0,
'rd' => '',
'tags' => [
],
'tenant' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'created' => '',
'custom_fields' => [
],
'description' => '',
'display_name' => '',
'enforce_unique' => null,
'id' => 0,
'ipaddress_count' => 0,
'last_updated' => '',
'name' => '',
'prefix_count' => 0,
'rd' => '',
'tags' => [
],
'tenant' => 0
]));
$request->setRequestUrl('{{baseUrl}}/ipam/vrfs/');
$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}}/ipam/vrfs/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"enforce_unique": false,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rd": "",
"tags": [],
"tenant": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/vrfs/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"enforce_unique": false,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rd": "",
"tags": [],
"tenant": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/ipam/vrfs/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/vrfs/"
payload = {
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"enforce_unique": False,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rd": "",
"tags": [],
"tenant": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/vrfs/"
payload <- "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/ipam/vrfs/")
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 \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/ipam/vrfs/') do |req|
req.body = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/vrfs/";
let payload = json!({
"created": "",
"custom_fields": json!({}),
"description": "",
"display_name": "",
"enforce_unique": false,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rd": "",
"tags": (),
"tenant": 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}}/ipam/vrfs/ \
--header 'content-type: application/json' \
--data '{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"enforce_unique": false,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rd": "",
"tags": [],
"tenant": 0
}'
echo '{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"enforce_unique": false,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rd": "",
"tags": [],
"tenant": 0
}' | \
http POST {{baseUrl}}/ipam/vrfs/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "created": "",\n "custom_fields": {},\n "description": "",\n "display_name": "",\n "enforce_unique": false,\n "id": 0,\n "ipaddress_count": 0,\n "last_updated": "",\n "name": "",\n "prefix_count": 0,\n "rd": "",\n "tags": [],\n "tenant": 0\n}' \
--output-document \
- {{baseUrl}}/ipam/vrfs/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"created": "",
"custom_fields": [],
"description": "",
"display_name": "",
"enforce_unique": false,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rd": "",
"tags": [],
"tenant": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/vrfs/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
ipam_vrfs_delete
{{baseUrl}}/ipam/vrfs/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/vrfs/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/ipam/vrfs/:id/")
require "http/client"
url = "{{baseUrl}}/ipam/vrfs/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/ipam/vrfs/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/vrfs/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/vrfs/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/ipam/vrfs/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/ipam/vrfs/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/vrfs/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/vrfs/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/ipam/vrfs/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/ipam/vrfs/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/ipam/vrfs/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/vrfs/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/ipam/vrfs/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/ipam/vrfs/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/ipam/vrfs/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/ipam/vrfs/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/ipam/vrfs/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/ipam/vrfs/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/vrfs/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/vrfs/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/ipam/vrfs/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/vrfs/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/ipam/vrfs/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/vrfs/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/ipam/vrfs/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/ipam/vrfs/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/vrfs/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/ipam/vrfs/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/vrfs/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/vrfs/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/ipam/vrfs/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/ipam/vrfs/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/vrfs/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/ipam/vrfs/:id/
http DELETE {{baseUrl}}/ipam/vrfs/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/ipam/vrfs/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/vrfs/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
ipam_vrfs_list
{{baseUrl}}/ipam/vrfs/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/vrfs/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/ipam/vrfs/")
require "http/client"
url = "{{baseUrl}}/ipam/vrfs/"
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}}/ipam/vrfs/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/vrfs/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/vrfs/"
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/ipam/vrfs/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/ipam/vrfs/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/vrfs/"))
.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}}/ipam/vrfs/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/ipam/vrfs/")
.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}}/ipam/vrfs/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/ipam/vrfs/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/vrfs/';
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}}/ipam/vrfs/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/ipam/vrfs/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/ipam/vrfs/',
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}}/ipam/vrfs/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/ipam/vrfs/');
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}}/ipam/vrfs/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/vrfs/';
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}}/ipam/vrfs/"]
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}}/ipam/vrfs/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/vrfs/",
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}}/ipam/vrfs/');
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/vrfs/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/ipam/vrfs/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/ipam/vrfs/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/vrfs/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/ipam/vrfs/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/vrfs/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/vrfs/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/ipam/vrfs/")
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/ipam/vrfs/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/vrfs/";
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}}/ipam/vrfs/
http GET {{baseUrl}}/ipam/vrfs/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/ipam/vrfs/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/vrfs/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
ipam_vrfs_partial_update
{{baseUrl}}/ipam/vrfs/:id/
BODY json
{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"enforce_unique": false,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rd": "",
"tags": [],
"tenant": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/vrfs/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/ipam/vrfs/:id/" {:content-type :json
:form-params {:created ""
:custom_fields {}
:description ""
:display_name ""
:enforce_unique false
:id 0
:ipaddress_count 0
:last_updated ""
:name ""
:prefix_count 0
:rd ""
:tags []
:tenant 0}})
require "http/client"
url = "{{baseUrl}}/ipam/vrfs/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\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}}/ipam/vrfs/:id/"),
Content = new StringContent("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/vrfs/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/vrfs/:id/"
payload := strings.NewReader("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\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/ipam/vrfs/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 245
{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"enforce_unique": false,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rd": "",
"tags": [],
"tenant": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/ipam/vrfs/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/vrfs/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/vrfs/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/ipam/vrfs/:id/")
.header("content-type", "application/json")
.body("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\n}")
.asString();
const data = JSON.stringify({
created: '',
custom_fields: {},
description: '',
display_name: '',
enforce_unique: false,
id: 0,
ipaddress_count: 0,
last_updated: '',
name: '',
prefix_count: 0,
rd: '',
tags: [],
tenant: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/ipam/vrfs/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/ipam/vrfs/:id/',
headers: {'content-type': 'application/json'},
data: {
created: '',
custom_fields: {},
description: '',
display_name: '',
enforce_unique: false,
id: 0,
ipaddress_count: 0,
last_updated: '',
name: '',
prefix_count: 0,
rd: '',
tags: [],
tenant: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/vrfs/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"created":"","custom_fields":{},"description":"","display_name":"","enforce_unique":false,"id":0,"ipaddress_count":0,"last_updated":"","name":"","prefix_count":0,"rd":"","tags":[],"tenant":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}}/ipam/vrfs/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "created": "",\n "custom_fields": {},\n "description": "",\n "display_name": "",\n "enforce_unique": false,\n "id": 0,\n "ipaddress_count": 0,\n "last_updated": "",\n "name": "",\n "prefix_count": 0,\n "rd": "",\n "tags": [],\n "tenant": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/ipam/vrfs/:id/")
.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/ipam/vrfs/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
created: '',
custom_fields: {},
description: '',
display_name: '',
enforce_unique: false,
id: 0,
ipaddress_count: 0,
last_updated: '',
name: '',
prefix_count: 0,
rd: '',
tags: [],
tenant: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/ipam/vrfs/:id/',
headers: {'content-type': 'application/json'},
body: {
created: '',
custom_fields: {},
description: '',
display_name: '',
enforce_unique: false,
id: 0,
ipaddress_count: 0,
last_updated: '',
name: '',
prefix_count: 0,
rd: '',
tags: [],
tenant: 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('PATCH', '{{baseUrl}}/ipam/vrfs/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
created: '',
custom_fields: {},
description: '',
display_name: '',
enforce_unique: false,
id: 0,
ipaddress_count: 0,
last_updated: '',
name: '',
prefix_count: 0,
rd: '',
tags: [],
tenant: 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: 'PATCH',
url: '{{baseUrl}}/ipam/vrfs/:id/',
headers: {'content-type': 'application/json'},
data: {
created: '',
custom_fields: {},
description: '',
display_name: '',
enforce_unique: false,
id: 0,
ipaddress_count: 0,
last_updated: '',
name: '',
prefix_count: 0,
rd: '',
tags: [],
tenant: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/vrfs/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"created":"","custom_fields":{},"description":"","display_name":"","enforce_unique":false,"id":0,"ipaddress_count":0,"last_updated":"","name":"","prefix_count":0,"rd":"","tags":[],"tenant":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 = @{ @"created": @"",
@"custom_fields": @{ },
@"description": @"",
@"display_name": @"",
@"enforce_unique": @NO,
@"id": @0,
@"ipaddress_count": @0,
@"last_updated": @"",
@"name": @"",
@"prefix_count": @0,
@"rd": @"",
@"tags": @[ ],
@"tenant": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/vrfs/:id/"]
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}}/ipam/vrfs/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/vrfs/:id/",
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([
'created' => '',
'custom_fields' => [
],
'description' => '',
'display_name' => '',
'enforce_unique' => null,
'id' => 0,
'ipaddress_count' => 0,
'last_updated' => '',
'name' => '',
'prefix_count' => 0,
'rd' => '',
'tags' => [
],
'tenant' => 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('PATCH', '{{baseUrl}}/ipam/vrfs/:id/', [
'body' => '{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"enforce_unique": false,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rd": "",
"tags": [],
"tenant": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/vrfs/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'created' => '',
'custom_fields' => [
],
'description' => '',
'display_name' => '',
'enforce_unique' => null,
'id' => 0,
'ipaddress_count' => 0,
'last_updated' => '',
'name' => '',
'prefix_count' => 0,
'rd' => '',
'tags' => [
],
'tenant' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'created' => '',
'custom_fields' => [
],
'description' => '',
'display_name' => '',
'enforce_unique' => null,
'id' => 0,
'ipaddress_count' => 0,
'last_updated' => '',
'name' => '',
'prefix_count' => 0,
'rd' => '',
'tags' => [
],
'tenant' => 0
]));
$request->setRequestUrl('{{baseUrl}}/ipam/vrfs/:id/');
$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}}/ipam/vrfs/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"enforce_unique": false,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rd": "",
"tags": [],
"tenant": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/vrfs/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"enforce_unique": false,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rd": "",
"tags": [],
"tenant": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/ipam/vrfs/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/vrfs/:id/"
payload = {
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"enforce_unique": False,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rd": "",
"tags": [],
"tenant": 0
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/vrfs/:id/"
payload <- "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\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}}/ipam/vrfs/:id/")
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 \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/ipam/vrfs/:id/') do |req|
req.body = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\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}}/ipam/vrfs/:id/";
let payload = json!({
"created": "",
"custom_fields": json!({}),
"description": "",
"display_name": "",
"enforce_unique": false,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rd": "",
"tags": (),
"tenant": 0
});
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}}/ipam/vrfs/:id/ \
--header 'content-type: application/json' \
--data '{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"enforce_unique": false,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rd": "",
"tags": [],
"tenant": 0
}'
echo '{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"enforce_unique": false,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rd": "",
"tags": [],
"tenant": 0
}' | \
http PATCH {{baseUrl}}/ipam/vrfs/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "created": "",\n "custom_fields": {},\n "description": "",\n "display_name": "",\n "enforce_unique": false,\n "id": 0,\n "ipaddress_count": 0,\n "last_updated": "",\n "name": "",\n "prefix_count": 0,\n "rd": "",\n "tags": [],\n "tenant": 0\n}' \
--output-document \
- {{baseUrl}}/ipam/vrfs/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"created": "",
"custom_fields": [],
"description": "",
"display_name": "",
"enforce_unique": false,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rd": "",
"tags": [],
"tenant": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/vrfs/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
ipam_vrfs_read
{{baseUrl}}/ipam/vrfs/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/vrfs/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/ipam/vrfs/:id/")
require "http/client"
url = "{{baseUrl}}/ipam/vrfs/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/ipam/vrfs/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/vrfs/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/vrfs/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/ipam/vrfs/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/ipam/vrfs/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/vrfs/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/vrfs/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/ipam/vrfs/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/ipam/vrfs/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/ipam/vrfs/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/vrfs/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/ipam/vrfs/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/ipam/vrfs/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/ipam/vrfs/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/ipam/vrfs/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/ipam/vrfs/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/ipam/vrfs/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/vrfs/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/vrfs/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/ipam/vrfs/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/vrfs/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/ipam/vrfs/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/vrfs/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/ipam/vrfs/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/ipam/vrfs/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/vrfs/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/ipam/vrfs/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/vrfs/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/vrfs/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/ipam/vrfs/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/ipam/vrfs/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/ipam/vrfs/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/ipam/vrfs/:id/
http GET {{baseUrl}}/ipam/vrfs/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/ipam/vrfs/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/vrfs/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
ipam_vrfs_update
{{baseUrl}}/ipam/vrfs/:id/
BODY json
{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"enforce_unique": false,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rd": "",
"tags": [],
"tenant": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/ipam/vrfs/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/ipam/vrfs/:id/" {:content-type :json
:form-params {:created ""
:custom_fields {}
:description ""
:display_name ""
:enforce_unique false
:id 0
:ipaddress_count 0
:last_updated ""
:name ""
:prefix_count 0
:rd ""
:tags []
:tenant 0}})
require "http/client"
url = "{{baseUrl}}/ipam/vrfs/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\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}}/ipam/vrfs/:id/"),
Content = new StringContent("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/ipam/vrfs/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/ipam/vrfs/:id/"
payload := strings.NewReader("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\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/ipam/vrfs/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 245
{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"enforce_unique": false,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rd": "",
"tags": [],
"tenant": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/ipam/vrfs/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/ipam/vrfs/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/ipam/vrfs/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/ipam/vrfs/:id/")
.header("content-type", "application/json")
.body("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\n}")
.asString();
const data = JSON.stringify({
created: '',
custom_fields: {},
description: '',
display_name: '',
enforce_unique: false,
id: 0,
ipaddress_count: 0,
last_updated: '',
name: '',
prefix_count: 0,
rd: '',
tags: [],
tenant: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/ipam/vrfs/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/ipam/vrfs/:id/',
headers: {'content-type': 'application/json'},
data: {
created: '',
custom_fields: {},
description: '',
display_name: '',
enforce_unique: false,
id: 0,
ipaddress_count: 0,
last_updated: '',
name: '',
prefix_count: 0,
rd: '',
tags: [],
tenant: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/ipam/vrfs/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"created":"","custom_fields":{},"description":"","display_name":"","enforce_unique":false,"id":0,"ipaddress_count":0,"last_updated":"","name":"","prefix_count":0,"rd":"","tags":[],"tenant":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}}/ipam/vrfs/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "created": "",\n "custom_fields": {},\n "description": "",\n "display_name": "",\n "enforce_unique": false,\n "id": 0,\n "ipaddress_count": 0,\n "last_updated": "",\n "name": "",\n "prefix_count": 0,\n "rd": "",\n "tags": [],\n "tenant": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/ipam/vrfs/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/ipam/vrfs/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
created: '',
custom_fields: {},
description: '',
display_name: '',
enforce_unique: false,
id: 0,
ipaddress_count: 0,
last_updated: '',
name: '',
prefix_count: 0,
rd: '',
tags: [],
tenant: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/ipam/vrfs/:id/',
headers: {'content-type': 'application/json'},
body: {
created: '',
custom_fields: {},
description: '',
display_name: '',
enforce_unique: false,
id: 0,
ipaddress_count: 0,
last_updated: '',
name: '',
prefix_count: 0,
rd: '',
tags: [],
tenant: 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('PUT', '{{baseUrl}}/ipam/vrfs/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
created: '',
custom_fields: {},
description: '',
display_name: '',
enforce_unique: false,
id: 0,
ipaddress_count: 0,
last_updated: '',
name: '',
prefix_count: 0,
rd: '',
tags: [],
tenant: 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: 'PUT',
url: '{{baseUrl}}/ipam/vrfs/:id/',
headers: {'content-type': 'application/json'},
data: {
created: '',
custom_fields: {},
description: '',
display_name: '',
enforce_unique: false,
id: 0,
ipaddress_count: 0,
last_updated: '',
name: '',
prefix_count: 0,
rd: '',
tags: [],
tenant: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/ipam/vrfs/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"created":"","custom_fields":{},"description":"","display_name":"","enforce_unique":false,"id":0,"ipaddress_count":0,"last_updated":"","name":"","prefix_count":0,"rd":"","tags":[],"tenant":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 = @{ @"created": @"",
@"custom_fields": @{ },
@"description": @"",
@"display_name": @"",
@"enforce_unique": @NO,
@"id": @0,
@"ipaddress_count": @0,
@"last_updated": @"",
@"name": @"",
@"prefix_count": @0,
@"rd": @"",
@"tags": @[ ],
@"tenant": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/ipam/vrfs/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/ipam/vrfs/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/ipam/vrfs/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'created' => '',
'custom_fields' => [
],
'description' => '',
'display_name' => '',
'enforce_unique' => null,
'id' => 0,
'ipaddress_count' => 0,
'last_updated' => '',
'name' => '',
'prefix_count' => 0,
'rd' => '',
'tags' => [
],
'tenant' => 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('PUT', '{{baseUrl}}/ipam/vrfs/:id/', [
'body' => '{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"enforce_unique": false,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rd": "",
"tags": [],
"tenant": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/ipam/vrfs/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'created' => '',
'custom_fields' => [
],
'description' => '',
'display_name' => '',
'enforce_unique' => null,
'id' => 0,
'ipaddress_count' => 0,
'last_updated' => '',
'name' => '',
'prefix_count' => 0,
'rd' => '',
'tags' => [
],
'tenant' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'created' => '',
'custom_fields' => [
],
'description' => '',
'display_name' => '',
'enforce_unique' => null,
'id' => 0,
'ipaddress_count' => 0,
'last_updated' => '',
'name' => '',
'prefix_count' => 0,
'rd' => '',
'tags' => [
],
'tenant' => 0
]));
$request->setRequestUrl('{{baseUrl}}/ipam/vrfs/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/ipam/vrfs/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"enforce_unique": false,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rd": "",
"tags": [],
"tenant": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/ipam/vrfs/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"enforce_unique": false,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rd": "",
"tags": [],
"tenant": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/ipam/vrfs/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/ipam/vrfs/:id/"
payload = {
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"enforce_unique": False,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rd": "",
"tags": [],
"tenant": 0
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/ipam/vrfs/:id/"
payload <- "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\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}}/ipam/vrfs/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/ipam/vrfs/:id/') do |req|
req.body = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"display_name\": \"\",\n \"enforce_unique\": false,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rd\": \"\",\n \"tags\": [],\n \"tenant\": 0\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}}/ipam/vrfs/:id/";
let payload = json!({
"created": "",
"custom_fields": json!({}),
"description": "",
"display_name": "",
"enforce_unique": false,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rd": "",
"tags": (),
"tenant": 0
});
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}}/ipam/vrfs/:id/ \
--header 'content-type: application/json' \
--data '{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"enforce_unique": false,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rd": "",
"tags": [],
"tenant": 0
}'
echo '{
"created": "",
"custom_fields": {},
"description": "",
"display_name": "",
"enforce_unique": false,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rd": "",
"tags": [],
"tenant": 0
}' | \
http PUT {{baseUrl}}/ipam/vrfs/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "created": "",\n "custom_fields": {},\n "description": "",\n "display_name": "",\n "enforce_unique": false,\n "id": 0,\n "ipaddress_count": 0,\n "last_updated": "",\n "name": "",\n "prefix_count": 0,\n "rd": "",\n "tags": [],\n "tenant": 0\n}' \
--output-document \
- {{baseUrl}}/ipam/vrfs/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"created": "",
"custom_fields": [],
"description": "",
"display_name": "",
"enforce_unique": false,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rd": "",
"tags": [],
"tenant": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/ipam/vrfs/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
This endpoint can be used to generate a new RSA key pair. The keys are returned in PEM format.
{{baseUrl}}/secrets/generate-rsa-key-pair/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/secrets/generate-rsa-key-pair/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/secrets/generate-rsa-key-pair/")
require "http/client"
url = "{{baseUrl}}/secrets/generate-rsa-key-pair/"
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}}/secrets/generate-rsa-key-pair/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/secrets/generate-rsa-key-pair/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/secrets/generate-rsa-key-pair/"
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/secrets/generate-rsa-key-pair/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/secrets/generate-rsa-key-pair/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/secrets/generate-rsa-key-pair/"))
.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}}/secrets/generate-rsa-key-pair/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/secrets/generate-rsa-key-pair/")
.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}}/secrets/generate-rsa-key-pair/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/secrets/generate-rsa-key-pair/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/secrets/generate-rsa-key-pair/';
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}}/secrets/generate-rsa-key-pair/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/secrets/generate-rsa-key-pair/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/secrets/generate-rsa-key-pair/',
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}}/secrets/generate-rsa-key-pair/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/secrets/generate-rsa-key-pair/');
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}}/secrets/generate-rsa-key-pair/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/secrets/generate-rsa-key-pair/';
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}}/secrets/generate-rsa-key-pair/"]
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}}/secrets/generate-rsa-key-pair/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/secrets/generate-rsa-key-pair/",
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}}/secrets/generate-rsa-key-pair/');
echo $response->getBody();
setUrl('{{baseUrl}}/secrets/generate-rsa-key-pair/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/secrets/generate-rsa-key-pair/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/secrets/generate-rsa-key-pair/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/secrets/generate-rsa-key-pair/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/secrets/generate-rsa-key-pair/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/secrets/generate-rsa-key-pair/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/secrets/generate-rsa-key-pair/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/secrets/generate-rsa-key-pair/")
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/secrets/generate-rsa-key-pair/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/secrets/generate-rsa-key-pair/";
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}}/secrets/generate-rsa-key-pair/
http GET {{baseUrl}}/secrets/generate-rsa-key-pair/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/secrets/generate-rsa-key-pair/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/secrets/generate-rsa-key-pair/")! 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
secrets_get-session-key_create
{{baseUrl}}/secrets/get-session-key/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/secrets/get-session-key/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/secrets/get-session-key/")
require "http/client"
url = "{{baseUrl}}/secrets/get-session-key/"
response = HTTP::Client.post url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/secrets/get-session-key/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/secrets/get-session-key/");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/secrets/get-session-key/"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/secrets/get-session-key/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/secrets/get-session-key/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/secrets/get-session-key/"))
.method("POST", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/secrets/get-session-key/")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/secrets/get-session-key/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/secrets/get-session-key/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'POST', url: '{{baseUrl}}/secrets/get-session-key/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/secrets/get-session-key/';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/secrets/get-session-key/',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/secrets/get-session-key/")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/secrets/get-session-key/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'POST', url: '{{baseUrl}}/secrets/get-session-key/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/secrets/get-session-key/');
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}}/secrets/get-session-key/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/secrets/get-session-key/';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/secrets/get-session-key/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/secrets/get-session-key/" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/secrets/get-session-key/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/secrets/get-session-key/');
echo $response->getBody();
setUrl('{{baseUrl}}/secrets/get-session-key/');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/secrets/get-session-key/');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/secrets/get-session-key/' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/secrets/get-session-key/' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/secrets/get-session-key/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/secrets/get-session-key/"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/secrets/get-session-key/"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/secrets/get-session-key/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.post('/baseUrl/secrets/get-session-key/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/secrets/get-session-key/";
let client = reqwest::Client::new();
let response = client.post(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/secrets/get-session-key/
http POST {{baseUrl}}/secrets/get-session-key/
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/secrets/get-session-key/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/secrets/get-session-key/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
secrets_secret-roles_create
{{baseUrl}}/secrets/secret-roles/
BODY json
{
"description": "",
"id": 0,
"name": "",
"secret_count": 0,
"slug": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/secrets/secret-roles/");
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 \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/secrets/secret-roles/" {:content-type :json
:form-params {:description ""
:id 0
:name ""
:secret_count 0
:slug ""}})
require "http/client"
url = "{{baseUrl}}/secrets/secret-roles/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\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}}/secrets/secret-roles/"),
Content = new StringContent("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\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}}/secrets/secret-roles/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/secrets/secret-roles/"
payload := strings.NewReader("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\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/secrets/secret-roles/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 83
{
"description": "",
"id": 0,
"name": "",
"secret_count": 0,
"slug": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/secrets/secret-roles/")
.setHeader("content-type", "application/json")
.setBody("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/secrets/secret-roles/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\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 \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/secrets/secret-roles/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/secrets/secret-roles/")
.header("content-type", "application/json")
.body("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\n}")
.asString();
const data = JSON.stringify({
description: '',
id: 0,
name: '',
secret_count: 0,
slug: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/secrets/secret-roles/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/secrets/secret-roles/',
headers: {'content-type': 'application/json'},
data: {description: '', id: 0, name: '', secret_count: 0, slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/secrets/secret-roles/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"description":"","id":0,"name":"","secret_count":0,"slug":""}'
};
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}}/secrets/secret-roles/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "description": "",\n "id": 0,\n "name": "",\n "secret_count": 0,\n "slug": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/secrets/secret-roles/")
.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/secrets/secret-roles/',
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({description: '', id: 0, name: '', secret_count: 0, slug: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/secrets/secret-roles/',
headers: {'content-type': 'application/json'},
body: {description: '', id: 0, name: '', secret_count: 0, slug: ''},
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}}/secrets/secret-roles/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
description: '',
id: 0,
name: '',
secret_count: 0,
slug: ''
});
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}}/secrets/secret-roles/',
headers: {'content-type': 'application/json'},
data: {description: '', id: 0, name: '', secret_count: 0, slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/secrets/secret-roles/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"description":"","id":0,"name":"","secret_count":0,"slug":""}'
};
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 = @{ @"description": @"",
@"id": @0,
@"name": @"",
@"secret_count": @0,
@"slug": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/secrets/secret-roles/"]
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}}/secrets/secret-roles/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/secrets/secret-roles/",
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([
'description' => '',
'id' => 0,
'name' => '',
'secret_count' => 0,
'slug' => ''
]),
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}}/secrets/secret-roles/', [
'body' => '{
"description": "",
"id": 0,
"name": "",
"secret_count": 0,
"slug": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/secrets/secret-roles/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'description' => '',
'id' => 0,
'name' => '',
'secret_count' => 0,
'slug' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'description' => '',
'id' => 0,
'name' => '',
'secret_count' => 0,
'slug' => ''
]));
$request->setRequestUrl('{{baseUrl}}/secrets/secret-roles/');
$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}}/secrets/secret-roles/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"id": 0,
"name": "",
"secret_count": 0,
"slug": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/secrets/secret-roles/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"id": 0,
"name": "",
"secret_count": 0,
"slug": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/secrets/secret-roles/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/secrets/secret-roles/"
payload = {
"description": "",
"id": 0,
"name": "",
"secret_count": 0,
"slug": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/secrets/secret-roles/"
payload <- "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\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}}/secrets/secret-roles/")
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 \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\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/secrets/secret-roles/') do |req|
req.body = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/secrets/secret-roles/";
let payload = json!({
"description": "",
"id": 0,
"name": "",
"secret_count": 0,
"slug": ""
});
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}}/secrets/secret-roles/ \
--header 'content-type: application/json' \
--data '{
"description": "",
"id": 0,
"name": "",
"secret_count": 0,
"slug": ""
}'
echo '{
"description": "",
"id": 0,
"name": "",
"secret_count": 0,
"slug": ""
}' | \
http POST {{baseUrl}}/secrets/secret-roles/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "description": "",\n "id": 0,\n "name": "",\n "secret_count": 0,\n "slug": ""\n}' \
--output-document \
- {{baseUrl}}/secrets/secret-roles/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"description": "",
"id": 0,
"name": "",
"secret_count": 0,
"slug": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/secrets/secret-roles/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
secrets_secret-roles_delete
{{baseUrl}}/secrets/secret-roles/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/secrets/secret-roles/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/secrets/secret-roles/:id/")
require "http/client"
url = "{{baseUrl}}/secrets/secret-roles/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/secrets/secret-roles/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/secrets/secret-roles/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/secrets/secret-roles/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/secrets/secret-roles/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/secrets/secret-roles/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/secrets/secret-roles/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/secrets/secret-roles/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/secrets/secret-roles/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/secrets/secret-roles/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/secrets/secret-roles/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/secrets/secret-roles/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/secrets/secret-roles/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/secrets/secret-roles/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/secrets/secret-roles/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/secrets/secret-roles/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/secrets/secret-roles/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/secrets/secret-roles/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/secrets/secret-roles/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/secrets/secret-roles/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/secrets/secret-roles/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/secrets/secret-roles/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/secrets/secret-roles/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/secrets/secret-roles/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/secrets/secret-roles/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/secrets/secret-roles/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/secrets/secret-roles/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/secrets/secret-roles/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/secrets/secret-roles/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/secrets/secret-roles/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/secrets/secret-roles/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/secrets/secret-roles/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/secrets/secret-roles/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/secrets/secret-roles/:id/
http DELETE {{baseUrl}}/secrets/secret-roles/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/secrets/secret-roles/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/secrets/secret-roles/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
secrets_secret-roles_list
{{baseUrl}}/secrets/secret-roles/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/secrets/secret-roles/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/secrets/secret-roles/")
require "http/client"
url = "{{baseUrl}}/secrets/secret-roles/"
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}}/secrets/secret-roles/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/secrets/secret-roles/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/secrets/secret-roles/"
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/secrets/secret-roles/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/secrets/secret-roles/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/secrets/secret-roles/"))
.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}}/secrets/secret-roles/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/secrets/secret-roles/")
.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}}/secrets/secret-roles/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/secrets/secret-roles/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/secrets/secret-roles/';
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}}/secrets/secret-roles/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/secrets/secret-roles/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/secrets/secret-roles/',
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}}/secrets/secret-roles/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/secrets/secret-roles/');
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}}/secrets/secret-roles/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/secrets/secret-roles/';
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}}/secrets/secret-roles/"]
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}}/secrets/secret-roles/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/secrets/secret-roles/",
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}}/secrets/secret-roles/');
echo $response->getBody();
setUrl('{{baseUrl}}/secrets/secret-roles/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/secrets/secret-roles/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/secrets/secret-roles/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/secrets/secret-roles/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/secrets/secret-roles/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/secrets/secret-roles/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/secrets/secret-roles/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/secrets/secret-roles/")
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/secrets/secret-roles/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/secrets/secret-roles/";
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}}/secrets/secret-roles/
http GET {{baseUrl}}/secrets/secret-roles/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/secrets/secret-roles/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/secrets/secret-roles/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
secrets_secret-roles_partial_update
{{baseUrl}}/secrets/secret-roles/:id/
BODY json
{
"description": "",
"id": 0,
"name": "",
"secret_count": 0,
"slug": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/secrets/secret-roles/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/secrets/secret-roles/:id/" {:content-type :json
:form-params {:description ""
:id 0
:name ""
:secret_count 0
:slug ""}})
require "http/client"
url = "{{baseUrl}}/secrets/secret-roles/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\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}}/secrets/secret-roles/:id/"),
Content = new StringContent("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\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}}/secrets/secret-roles/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/secrets/secret-roles/:id/"
payload := strings.NewReader("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\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/secrets/secret-roles/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 83
{
"description": "",
"id": 0,
"name": "",
"secret_count": 0,
"slug": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/secrets/secret-roles/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/secrets/secret-roles/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\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 \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/secrets/secret-roles/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/secrets/secret-roles/:id/")
.header("content-type", "application/json")
.body("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\n}")
.asString();
const data = JSON.stringify({
description: '',
id: 0,
name: '',
secret_count: 0,
slug: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/secrets/secret-roles/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/secrets/secret-roles/:id/',
headers: {'content-type': 'application/json'},
data: {description: '', id: 0, name: '', secret_count: 0, slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/secrets/secret-roles/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"description":"","id":0,"name":"","secret_count":0,"slug":""}'
};
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}}/secrets/secret-roles/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "description": "",\n "id": 0,\n "name": "",\n "secret_count": 0,\n "slug": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/secrets/secret-roles/:id/")
.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/secrets/secret-roles/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({description: '', id: 0, name: '', secret_count: 0, slug: ''}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/secrets/secret-roles/:id/',
headers: {'content-type': 'application/json'},
body: {description: '', id: 0, name: '', secret_count: 0, slug: ''},
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}}/secrets/secret-roles/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
description: '',
id: 0,
name: '',
secret_count: 0,
slug: ''
});
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}}/secrets/secret-roles/:id/',
headers: {'content-type': 'application/json'},
data: {description: '', id: 0, name: '', secret_count: 0, slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/secrets/secret-roles/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"description":"","id":0,"name":"","secret_count":0,"slug":""}'
};
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 = @{ @"description": @"",
@"id": @0,
@"name": @"",
@"secret_count": @0,
@"slug": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/secrets/secret-roles/:id/"]
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}}/secrets/secret-roles/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/secrets/secret-roles/:id/",
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([
'description' => '',
'id' => 0,
'name' => '',
'secret_count' => 0,
'slug' => ''
]),
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}}/secrets/secret-roles/:id/', [
'body' => '{
"description": "",
"id": 0,
"name": "",
"secret_count": 0,
"slug": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/secrets/secret-roles/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'description' => '',
'id' => 0,
'name' => '',
'secret_count' => 0,
'slug' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'description' => '',
'id' => 0,
'name' => '',
'secret_count' => 0,
'slug' => ''
]));
$request->setRequestUrl('{{baseUrl}}/secrets/secret-roles/:id/');
$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}}/secrets/secret-roles/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"id": 0,
"name": "",
"secret_count": 0,
"slug": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/secrets/secret-roles/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"id": 0,
"name": "",
"secret_count": 0,
"slug": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/secrets/secret-roles/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/secrets/secret-roles/:id/"
payload = {
"description": "",
"id": 0,
"name": "",
"secret_count": 0,
"slug": ""
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/secrets/secret-roles/:id/"
payload <- "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\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}}/secrets/secret-roles/:id/")
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 \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\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/secrets/secret-roles/:id/') do |req|
req.body = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\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}}/secrets/secret-roles/:id/";
let payload = json!({
"description": "",
"id": 0,
"name": "",
"secret_count": 0,
"slug": ""
});
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}}/secrets/secret-roles/:id/ \
--header 'content-type: application/json' \
--data '{
"description": "",
"id": 0,
"name": "",
"secret_count": 0,
"slug": ""
}'
echo '{
"description": "",
"id": 0,
"name": "",
"secret_count": 0,
"slug": ""
}' | \
http PATCH {{baseUrl}}/secrets/secret-roles/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "description": "",\n "id": 0,\n "name": "",\n "secret_count": 0,\n "slug": ""\n}' \
--output-document \
- {{baseUrl}}/secrets/secret-roles/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"description": "",
"id": 0,
"name": "",
"secret_count": 0,
"slug": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/secrets/secret-roles/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
secrets_secret-roles_read
{{baseUrl}}/secrets/secret-roles/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/secrets/secret-roles/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/secrets/secret-roles/:id/")
require "http/client"
url = "{{baseUrl}}/secrets/secret-roles/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/secrets/secret-roles/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/secrets/secret-roles/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/secrets/secret-roles/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/secrets/secret-roles/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/secrets/secret-roles/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/secrets/secret-roles/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/secrets/secret-roles/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/secrets/secret-roles/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/secrets/secret-roles/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/secrets/secret-roles/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/secrets/secret-roles/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/secrets/secret-roles/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/secrets/secret-roles/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/secrets/secret-roles/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/secrets/secret-roles/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/secrets/secret-roles/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/secrets/secret-roles/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/secrets/secret-roles/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/secrets/secret-roles/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/secrets/secret-roles/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/secrets/secret-roles/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/secrets/secret-roles/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/secrets/secret-roles/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/secrets/secret-roles/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/secrets/secret-roles/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/secrets/secret-roles/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/secrets/secret-roles/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/secrets/secret-roles/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/secrets/secret-roles/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/secrets/secret-roles/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/secrets/secret-roles/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/secrets/secret-roles/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/secrets/secret-roles/:id/
http GET {{baseUrl}}/secrets/secret-roles/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/secrets/secret-roles/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/secrets/secret-roles/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
secrets_secret-roles_update
{{baseUrl}}/secrets/secret-roles/:id/
BODY json
{
"description": "",
"id": 0,
"name": "",
"secret_count": 0,
"slug": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/secrets/secret-roles/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/secrets/secret-roles/:id/" {:content-type :json
:form-params {:description ""
:id 0
:name ""
:secret_count 0
:slug ""}})
require "http/client"
url = "{{baseUrl}}/secrets/secret-roles/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\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}}/secrets/secret-roles/:id/"),
Content = new StringContent("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\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}}/secrets/secret-roles/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/secrets/secret-roles/:id/"
payload := strings.NewReader("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\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/secrets/secret-roles/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 83
{
"description": "",
"id": 0,
"name": "",
"secret_count": 0,
"slug": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/secrets/secret-roles/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/secrets/secret-roles/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\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 \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/secrets/secret-roles/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/secrets/secret-roles/:id/")
.header("content-type", "application/json")
.body("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\n}")
.asString();
const data = JSON.stringify({
description: '',
id: 0,
name: '',
secret_count: 0,
slug: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/secrets/secret-roles/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/secrets/secret-roles/:id/',
headers: {'content-type': 'application/json'},
data: {description: '', id: 0, name: '', secret_count: 0, slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/secrets/secret-roles/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"description":"","id":0,"name":"","secret_count":0,"slug":""}'
};
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}}/secrets/secret-roles/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "description": "",\n "id": 0,\n "name": "",\n "secret_count": 0,\n "slug": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/secrets/secret-roles/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/secrets/secret-roles/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({description: '', id: 0, name: '', secret_count: 0, slug: ''}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/secrets/secret-roles/:id/',
headers: {'content-type': 'application/json'},
body: {description: '', id: 0, name: '', secret_count: 0, slug: ''},
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}}/secrets/secret-roles/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
description: '',
id: 0,
name: '',
secret_count: 0,
slug: ''
});
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}}/secrets/secret-roles/:id/',
headers: {'content-type': 'application/json'},
data: {description: '', id: 0, name: '', secret_count: 0, slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/secrets/secret-roles/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"description":"","id":0,"name":"","secret_count":0,"slug":""}'
};
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 = @{ @"description": @"",
@"id": @0,
@"name": @"",
@"secret_count": @0,
@"slug": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/secrets/secret-roles/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/secrets/secret-roles/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/secrets/secret-roles/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'description' => '',
'id' => 0,
'name' => '',
'secret_count' => 0,
'slug' => ''
]),
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}}/secrets/secret-roles/:id/', [
'body' => '{
"description": "",
"id": 0,
"name": "",
"secret_count": 0,
"slug": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/secrets/secret-roles/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'description' => '',
'id' => 0,
'name' => '',
'secret_count' => 0,
'slug' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'description' => '',
'id' => 0,
'name' => '',
'secret_count' => 0,
'slug' => ''
]));
$request->setRequestUrl('{{baseUrl}}/secrets/secret-roles/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/secrets/secret-roles/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"id": 0,
"name": "",
"secret_count": 0,
"slug": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/secrets/secret-roles/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"id": 0,
"name": "",
"secret_count": 0,
"slug": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/secrets/secret-roles/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/secrets/secret-roles/:id/"
payload = {
"description": "",
"id": 0,
"name": "",
"secret_count": 0,
"slug": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/secrets/secret-roles/:id/"
payload <- "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\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}}/secrets/secret-roles/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\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/secrets/secret-roles/:id/') do |req|
req.body = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"secret_count\": 0,\n \"slug\": \"\"\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}}/secrets/secret-roles/:id/";
let payload = json!({
"description": "",
"id": 0,
"name": "",
"secret_count": 0,
"slug": ""
});
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}}/secrets/secret-roles/:id/ \
--header 'content-type: application/json' \
--data '{
"description": "",
"id": 0,
"name": "",
"secret_count": 0,
"slug": ""
}'
echo '{
"description": "",
"id": 0,
"name": "",
"secret_count": 0,
"slug": ""
}' | \
http PUT {{baseUrl}}/secrets/secret-roles/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "description": "",\n "id": 0,\n "name": "",\n "secret_count": 0,\n "slug": ""\n}' \
--output-document \
- {{baseUrl}}/secrets/secret-roles/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"description": "",
"id": 0,
"name": "",
"secret_count": 0,
"slug": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/secrets/secret-roles/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
secrets_secrets_create
{{baseUrl}}/secrets/secrets/
BODY json
{
"created": "",
"custom_fields": {},
"device": 0,
"hash": "",
"id": 0,
"last_updated": "",
"name": "",
"plaintext": "",
"role": 0,
"tags": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/secrets/secrets/");
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 \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/secrets/secrets/" {:content-type :json
:form-params {:created ""
:custom_fields {}
:device 0
:hash ""
:id 0
:last_updated ""
:name ""
:plaintext ""
:role 0
:tags []}})
require "http/client"
url = "{{baseUrl}}/secrets/secrets/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\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}}/secrets/secrets/"),
Content = new StringContent("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\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}}/secrets/secrets/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/secrets/secrets/"
payload := strings.NewReader("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\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/secrets/secrets/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 164
{
"created": "",
"custom_fields": {},
"device": 0,
"hash": "",
"id": 0,
"last_updated": "",
"name": "",
"plaintext": "",
"role": 0,
"tags": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/secrets/secrets/")
.setHeader("content-type", "application/json")
.setBody("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/secrets/secrets/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\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 \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/secrets/secrets/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/secrets/secrets/")
.header("content-type", "application/json")
.body("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\n}")
.asString();
const data = JSON.stringify({
created: '',
custom_fields: {},
device: 0,
hash: '',
id: 0,
last_updated: '',
name: '',
plaintext: '',
role: 0,
tags: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/secrets/secrets/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/secrets/secrets/',
headers: {'content-type': 'application/json'},
data: {
created: '',
custom_fields: {},
device: 0,
hash: '',
id: 0,
last_updated: '',
name: '',
plaintext: '',
role: 0,
tags: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/secrets/secrets/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"created":"","custom_fields":{},"device":0,"hash":"","id":0,"last_updated":"","name":"","plaintext":"","role":0,"tags":[]}'
};
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}}/secrets/secrets/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "created": "",\n "custom_fields": {},\n "device": 0,\n "hash": "",\n "id": 0,\n "last_updated": "",\n "name": "",\n "plaintext": "",\n "role": 0,\n "tags": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/secrets/secrets/")
.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/secrets/secrets/',
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({
created: '',
custom_fields: {},
device: 0,
hash: '',
id: 0,
last_updated: '',
name: '',
plaintext: '',
role: 0,
tags: []
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/secrets/secrets/',
headers: {'content-type': 'application/json'},
body: {
created: '',
custom_fields: {},
device: 0,
hash: '',
id: 0,
last_updated: '',
name: '',
plaintext: '',
role: 0,
tags: []
},
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}}/secrets/secrets/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
created: '',
custom_fields: {},
device: 0,
hash: '',
id: 0,
last_updated: '',
name: '',
plaintext: '',
role: 0,
tags: []
});
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}}/secrets/secrets/',
headers: {'content-type': 'application/json'},
data: {
created: '',
custom_fields: {},
device: 0,
hash: '',
id: 0,
last_updated: '',
name: '',
plaintext: '',
role: 0,
tags: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/secrets/secrets/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"created":"","custom_fields":{},"device":0,"hash":"","id":0,"last_updated":"","name":"","plaintext":"","role":0,"tags":[]}'
};
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 = @{ @"created": @"",
@"custom_fields": @{ },
@"device": @0,
@"hash": @"",
@"id": @0,
@"last_updated": @"",
@"name": @"",
@"plaintext": @"",
@"role": @0,
@"tags": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/secrets/secrets/"]
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}}/secrets/secrets/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/secrets/secrets/",
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([
'created' => '',
'custom_fields' => [
],
'device' => 0,
'hash' => '',
'id' => 0,
'last_updated' => '',
'name' => '',
'plaintext' => '',
'role' => 0,
'tags' => [
]
]),
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}}/secrets/secrets/', [
'body' => '{
"created": "",
"custom_fields": {},
"device": 0,
"hash": "",
"id": 0,
"last_updated": "",
"name": "",
"plaintext": "",
"role": 0,
"tags": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/secrets/secrets/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'created' => '',
'custom_fields' => [
],
'device' => 0,
'hash' => '',
'id' => 0,
'last_updated' => '',
'name' => '',
'plaintext' => '',
'role' => 0,
'tags' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'created' => '',
'custom_fields' => [
],
'device' => 0,
'hash' => '',
'id' => 0,
'last_updated' => '',
'name' => '',
'plaintext' => '',
'role' => 0,
'tags' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/secrets/secrets/');
$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}}/secrets/secrets/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"custom_fields": {},
"device": 0,
"hash": "",
"id": 0,
"last_updated": "",
"name": "",
"plaintext": "",
"role": 0,
"tags": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/secrets/secrets/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"custom_fields": {},
"device": 0,
"hash": "",
"id": 0,
"last_updated": "",
"name": "",
"plaintext": "",
"role": 0,
"tags": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/secrets/secrets/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/secrets/secrets/"
payload = {
"created": "",
"custom_fields": {},
"device": 0,
"hash": "",
"id": 0,
"last_updated": "",
"name": "",
"plaintext": "",
"role": 0,
"tags": []
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/secrets/secrets/"
payload <- "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\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}}/secrets/secrets/")
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 \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\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/secrets/secrets/') do |req|
req.body = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/secrets/secrets/";
let payload = json!({
"created": "",
"custom_fields": json!({}),
"device": 0,
"hash": "",
"id": 0,
"last_updated": "",
"name": "",
"plaintext": "",
"role": 0,
"tags": ()
});
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}}/secrets/secrets/ \
--header 'content-type: application/json' \
--data '{
"created": "",
"custom_fields": {},
"device": 0,
"hash": "",
"id": 0,
"last_updated": "",
"name": "",
"plaintext": "",
"role": 0,
"tags": []
}'
echo '{
"created": "",
"custom_fields": {},
"device": 0,
"hash": "",
"id": 0,
"last_updated": "",
"name": "",
"plaintext": "",
"role": 0,
"tags": []
}' | \
http POST {{baseUrl}}/secrets/secrets/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "created": "",\n "custom_fields": {},\n "device": 0,\n "hash": "",\n "id": 0,\n "last_updated": "",\n "name": "",\n "plaintext": "",\n "role": 0,\n "tags": []\n}' \
--output-document \
- {{baseUrl}}/secrets/secrets/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"created": "",
"custom_fields": [],
"device": 0,
"hash": "",
"id": 0,
"last_updated": "",
"name": "",
"plaintext": "",
"role": 0,
"tags": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/secrets/secrets/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
secrets_secrets_delete
{{baseUrl}}/secrets/secrets/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/secrets/secrets/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/secrets/secrets/:id/")
require "http/client"
url = "{{baseUrl}}/secrets/secrets/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/secrets/secrets/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/secrets/secrets/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/secrets/secrets/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/secrets/secrets/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/secrets/secrets/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/secrets/secrets/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/secrets/secrets/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/secrets/secrets/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/secrets/secrets/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/secrets/secrets/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/secrets/secrets/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/secrets/secrets/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/secrets/secrets/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/secrets/secrets/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/secrets/secrets/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/secrets/secrets/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/secrets/secrets/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/secrets/secrets/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/secrets/secrets/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/secrets/secrets/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/secrets/secrets/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/secrets/secrets/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/secrets/secrets/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/secrets/secrets/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/secrets/secrets/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/secrets/secrets/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/secrets/secrets/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/secrets/secrets/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/secrets/secrets/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/secrets/secrets/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/secrets/secrets/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/secrets/secrets/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/secrets/secrets/:id/
http DELETE {{baseUrl}}/secrets/secrets/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/secrets/secrets/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/secrets/secrets/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
secrets_secrets_list
{{baseUrl}}/secrets/secrets/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/secrets/secrets/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/secrets/secrets/")
require "http/client"
url = "{{baseUrl}}/secrets/secrets/"
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}}/secrets/secrets/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/secrets/secrets/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/secrets/secrets/"
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/secrets/secrets/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/secrets/secrets/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/secrets/secrets/"))
.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}}/secrets/secrets/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/secrets/secrets/")
.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}}/secrets/secrets/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/secrets/secrets/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/secrets/secrets/';
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}}/secrets/secrets/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/secrets/secrets/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/secrets/secrets/',
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}}/secrets/secrets/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/secrets/secrets/');
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}}/secrets/secrets/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/secrets/secrets/';
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}}/secrets/secrets/"]
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}}/secrets/secrets/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/secrets/secrets/",
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}}/secrets/secrets/');
echo $response->getBody();
setUrl('{{baseUrl}}/secrets/secrets/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/secrets/secrets/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/secrets/secrets/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/secrets/secrets/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/secrets/secrets/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/secrets/secrets/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/secrets/secrets/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/secrets/secrets/")
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/secrets/secrets/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/secrets/secrets/";
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}}/secrets/secrets/
http GET {{baseUrl}}/secrets/secrets/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/secrets/secrets/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/secrets/secrets/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
secrets_secrets_partial_update
{{baseUrl}}/secrets/secrets/:id/
BODY json
{
"created": "",
"custom_fields": {},
"device": 0,
"hash": "",
"id": 0,
"last_updated": "",
"name": "",
"plaintext": "",
"role": 0,
"tags": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/secrets/secrets/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/secrets/secrets/:id/" {:content-type :json
:form-params {:created ""
:custom_fields {}
:device 0
:hash ""
:id 0
:last_updated ""
:name ""
:plaintext ""
:role 0
:tags []}})
require "http/client"
url = "{{baseUrl}}/secrets/secrets/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\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}}/secrets/secrets/:id/"),
Content = new StringContent("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\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}}/secrets/secrets/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/secrets/secrets/:id/"
payload := strings.NewReader("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\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/secrets/secrets/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 164
{
"created": "",
"custom_fields": {},
"device": 0,
"hash": "",
"id": 0,
"last_updated": "",
"name": "",
"plaintext": "",
"role": 0,
"tags": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/secrets/secrets/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/secrets/secrets/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\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 \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/secrets/secrets/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/secrets/secrets/:id/")
.header("content-type", "application/json")
.body("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\n}")
.asString();
const data = JSON.stringify({
created: '',
custom_fields: {},
device: 0,
hash: '',
id: 0,
last_updated: '',
name: '',
plaintext: '',
role: 0,
tags: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/secrets/secrets/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/secrets/secrets/:id/',
headers: {'content-type': 'application/json'},
data: {
created: '',
custom_fields: {},
device: 0,
hash: '',
id: 0,
last_updated: '',
name: '',
plaintext: '',
role: 0,
tags: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/secrets/secrets/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"created":"","custom_fields":{},"device":0,"hash":"","id":0,"last_updated":"","name":"","plaintext":"","role":0,"tags":[]}'
};
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}}/secrets/secrets/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "created": "",\n "custom_fields": {},\n "device": 0,\n "hash": "",\n "id": 0,\n "last_updated": "",\n "name": "",\n "plaintext": "",\n "role": 0,\n "tags": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/secrets/secrets/:id/")
.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/secrets/secrets/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
created: '',
custom_fields: {},
device: 0,
hash: '',
id: 0,
last_updated: '',
name: '',
plaintext: '',
role: 0,
tags: []
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/secrets/secrets/:id/',
headers: {'content-type': 'application/json'},
body: {
created: '',
custom_fields: {},
device: 0,
hash: '',
id: 0,
last_updated: '',
name: '',
plaintext: '',
role: 0,
tags: []
},
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}}/secrets/secrets/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
created: '',
custom_fields: {},
device: 0,
hash: '',
id: 0,
last_updated: '',
name: '',
plaintext: '',
role: 0,
tags: []
});
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}}/secrets/secrets/:id/',
headers: {'content-type': 'application/json'},
data: {
created: '',
custom_fields: {},
device: 0,
hash: '',
id: 0,
last_updated: '',
name: '',
plaintext: '',
role: 0,
tags: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/secrets/secrets/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"created":"","custom_fields":{},"device":0,"hash":"","id":0,"last_updated":"","name":"","plaintext":"","role":0,"tags":[]}'
};
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 = @{ @"created": @"",
@"custom_fields": @{ },
@"device": @0,
@"hash": @"",
@"id": @0,
@"last_updated": @"",
@"name": @"",
@"plaintext": @"",
@"role": @0,
@"tags": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/secrets/secrets/:id/"]
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}}/secrets/secrets/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/secrets/secrets/:id/",
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([
'created' => '',
'custom_fields' => [
],
'device' => 0,
'hash' => '',
'id' => 0,
'last_updated' => '',
'name' => '',
'plaintext' => '',
'role' => 0,
'tags' => [
]
]),
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}}/secrets/secrets/:id/', [
'body' => '{
"created": "",
"custom_fields": {},
"device": 0,
"hash": "",
"id": 0,
"last_updated": "",
"name": "",
"plaintext": "",
"role": 0,
"tags": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/secrets/secrets/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'created' => '',
'custom_fields' => [
],
'device' => 0,
'hash' => '',
'id' => 0,
'last_updated' => '',
'name' => '',
'plaintext' => '',
'role' => 0,
'tags' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'created' => '',
'custom_fields' => [
],
'device' => 0,
'hash' => '',
'id' => 0,
'last_updated' => '',
'name' => '',
'plaintext' => '',
'role' => 0,
'tags' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/secrets/secrets/:id/');
$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}}/secrets/secrets/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"custom_fields": {},
"device": 0,
"hash": "",
"id": 0,
"last_updated": "",
"name": "",
"plaintext": "",
"role": 0,
"tags": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/secrets/secrets/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"custom_fields": {},
"device": 0,
"hash": "",
"id": 0,
"last_updated": "",
"name": "",
"plaintext": "",
"role": 0,
"tags": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/secrets/secrets/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/secrets/secrets/:id/"
payload = {
"created": "",
"custom_fields": {},
"device": 0,
"hash": "",
"id": 0,
"last_updated": "",
"name": "",
"plaintext": "",
"role": 0,
"tags": []
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/secrets/secrets/:id/"
payload <- "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\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}}/secrets/secrets/:id/")
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 \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\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/secrets/secrets/:id/') do |req|
req.body = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\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}}/secrets/secrets/:id/";
let payload = json!({
"created": "",
"custom_fields": json!({}),
"device": 0,
"hash": "",
"id": 0,
"last_updated": "",
"name": "",
"plaintext": "",
"role": 0,
"tags": ()
});
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}}/secrets/secrets/:id/ \
--header 'content-type: application/json' \
--data '{
"created": "",
"custom_fields": {},
"device": 0,
"hash": "",
"id": 0,
"last_updated": "",
"name": "",
"plaintext": "",
"role": 0,
"tags": []
}'
echo '{
"created": "",
"custom_fields": {},
"device": 0,
"hash": "",
"id": 0,
"last_updated": "",
"name": "",
"plaintext": "",
"role": 0,
"tags": []
}' | \
http PATCH {{baseUrl}}/secrets/secrets/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "created": "",\n "custom_fields": {},\n "device": 0,\n "hash": "",\n "id": 0,\n "last_updated": "",\n "name": "",\n "plaintext": "",\n "role": 0,\n "tags": []\n}' \
--output-document \
- {{baseUrl}}/secrets/secrets/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"created": "",
"custom_fields": [],
"device": 0,
"hash": "",
"id": 0,
"last_updated": "",
"name": "",
"plaintext": "",
"role": 0,
"tags": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/secrets/secrets/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
secrets_secrets_read
{{baseUrl}}/secrets/secrets/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/secrets/secrets/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/secrets/secrets/:id/")
require "http/client"
url = "{{baseUrl}}/secrets/secrets/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/secrets/secrets/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/secrets/secrets/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/secrets/secrets/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/secrets/secrets/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/secrets/secrets/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/secrets/secrets/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/secrets/secrets/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/secrets/secrets/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/secrets/secrets/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/secrets/secrets/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/secrets/secrets/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/secrets/secrets/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/secrets/secrets/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/secrets/secrets/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/secrets/secrets/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/secrets/secrets/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/secrets/secrets/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/secrets/secrets/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/secrets/secrets/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/secrets/secrets/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/secrets/secrets/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/secrets/secrets/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/secrets/secrets/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/secrets/secrets/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/secrets/secrets/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/secrets/secrets/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/secrets/secrets/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/secrets/secrets/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/secrets/secrets/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/secrets/secrets/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/secrets/secrets/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/secrets/secrets/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/secrets/secrets/:id/
http GET {{baseUrl}}/secrets/secrets/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/secrets/secrets/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/secrets/secrets/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
secrets_secrets_update
{{baseUrl}}/secrets/secrets/:id/
BODY json
{
"created": "",
"custom_fields": {},
"device": 0,
"hash": "",
"id": 0,
"last_updated": "",
"name": "",
"plaintext": "",
"role": 0,
"tags": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/secrets/secrets/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/secrets/secrets/:id/" {:content-type :json
:form-params {:created ""
:custom_fields {}
:device 0
:hash ""
:id 0
:last_updated ""
:name ""
:plaintext ""
:role 0
:tags []}})
require "http/client"
url = "{{baseUrl}}/secrets/secrets/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\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}}/secrets/secrets/:id/"),
Content = new StringContent("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\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}}/secrets/secrets/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/secrets/secrets/:id/"
payload := strings.NewReader("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\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/secrets/secrets/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 164
{
"created": "",
"custom_fields": {},
"device": 0,
"hash": "",
"id": 0,
"last_updated": "",
"name": "",
"plaintext": "",
"role": 0,
"tags": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/secrets/secrets/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/secrets/secrets/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\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 \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/secrets/secrets/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/secrets/secrets/:id/")
.header("content-type", "application/json")
.body("{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\n}")
.asString();
const data = JSON.stringify({
created: '',
custom_fields: {},
device: 0,
hash: '',
id: 0,
last_updated: '',
name: '',
plaintext: '',
role: 0,
tags: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/secrets/secrets/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/secrets/secrets/:id/',
headers: {'content-type': 'application/json'},
data: {
created: '',
custom_fields: {},
device: 0,
hash: '',
id: 0,
last_updated: '',
name: '',
plaintext: '',
role: 0,
tags: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/secrets/secrets/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"created":"","custom_fields":{},"device":0,"hash":"","id":0,"last_updated":"","name":"","plaintext":"","role":0,"tags":[]}'
};
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}}/secrets/secrets/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "created": "",\n "custom_fields": {},\n "device": 0,\n "hash": "",\n "id": 0,\n "last_updated": "",\n "name": "",\n "plaintext": "",\n "role": 0,\n "tags": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/secrets/secrets/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/secrets/secrets/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
created: '',
custom_fields: {},
device: 0,
hash: '',
id: 0,
last_updated: '',
name: '',
plaintext: '',
role: 0,
tags: []
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/secrets/secrets/:id/',
headers: {'content-type': 'application/json'},
body: {
created: '',
custom_fields: {},
device: 0,
hash: '',
id: 0,
last_updated: '',
name: '',
plaintext: '',
role: 0,
tags: []
},
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}}/secrets/secrets/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
created: '',
custom_fields: {},
device: 0,
hash: '',
id: 0,
last_updated: '',
name: '',
plaintext: '',
role: 0,
tags: []
});
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}}/secrets/secrets/:id/',
headers: {'content-type': 'application/json'},
data: {
created: '',
custom_fields: {},
device: 0,
hash: '',
id: 0,
last_updated: '',
name: '',
plaintext: '',
role: 0,
tags: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/secrets/secrets/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"created":"","custom_fields":{},"device":0,"hash":"","id":0,"last_updated":"","name":"","plaintext":"","role":0,"tags":[]}'
};
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 = @{ @"created": @"",
@"custom_fields": @{ },
@"device": @0,
@"hash": @"",
@"id": @0,
@"last_updated": @"",
@"name": @"",
@"plaintext": @"",
@"role": @0,
@"tags": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/secrets/secrets/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/secrets/secrets/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/secrets/secrets/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'created' => '',
'custom_fields' => [
],
'device' => 0,
'hash' => '',
'id' => 0,
'last_updated' => '',
'name' => '',
'plaintext' => '',
'role' => 0,
'tags' => [
]
]),
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}}/secrets/secrets/:id/', [
'body' => '{
"created": "",
"custom_fields": {},
"device": 0,
"hash": "",
"id": 0,
"last_updated": "",
"name": "",
"plaintext": "",
"role": 0,
"tags": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/secrets/secrets/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'created' => '',
'custom_fields' => [
],
'device' => 0,
'hash' => '',
'id' => 0,
'last_updated' => '',
'name' => '',
'plaintext' => '',
'role' => 0,
'tags' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'created' => '',
'custom_fields' => [
],
'device' => 0,
'hash' => '',
'id' => 0,
'last_updated' => '',
'name' => '',
'plaintext' => '',
'role' => 0,
'tags' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/secrets/secrets/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/secrets/secrets/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"custom_fields": {},
"device": 0,
"hash": "",
"id": 0,
"last_updated": "",
"name": "",
"plaintext": "",
"role": 0,
"tags": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/secrets/secrets/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"created": "",
"custom_fields": {},
"device": 0,
"hash": "",
"id": 0,
"last_updated": "",
"name": "",
"plaintext": "",
"role": 0,
"tags": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/secrets/secrets/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/secrets/secrets/:id/"
payload = {
"created": "",
"custom_fields": {},
"device": 0,
"hash": "",
"id": 0,
"last_updated": "",
"name": "",
"plaintext": "",
"role": 0,
"tags": []
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/secrets/secrets/:id/"
payload <- "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\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}}/secrets/secrets/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\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/secrets/secrets/:id/') do |req|
req.body = "{\n \"created\": \"\",\n \"custom_fields\": {},\n \"device\": 0,\n \"hash\": \"\",\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"plaintext\": \"\",\n \"role\": 0,\n \"tags\": []\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}}/secrets/secrets/:id/";
let payload = json!({
"created": "",
"custom_fields": json!({}),
"device": 0,
"hash": "",
"id": 0,
"last_updated": "",
"name": "",
"plaintext": "",
"role": 0,
"tags": ()
});
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}}/secrets/secrets/:id/ \
--header 'content-type: application/json' \
--data '{
"created": "",
"custom_fields": {},
"device": 0,
"hash": "",
"id": 0,
"last_updated": "",
"name": "",
"plaintext": "",
"role": 0,
"tags": []
}'
echo '{
"created": "",
"custom_fields": {},
"device": 0,
"hash": "",
"id": 0,
"last_updated": "",
"name": "",
"plaintext": "",
"role": 0,
"tags": []
}' | \
http PUT {{baseUrl}}/secrets/secrets/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "created": "",\n "custom_fields": {},\n "device": 0,\n "hash": "",\n "id": 0,\n "last_updated": "",\n "name": "",\n "plaintext": "",\n "role": 0,\n "tags": []\n}' \
--output-document \
- {{baseUrl}}/secrets/secrets/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"created": "",
"custom_fields": [],
"device": 0,
"hash": "",
"id": 0,
"last_updated": "",
"name": "",
"plaintext": "",
"role": 0,
"tags": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/secrets/secrets/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
tenancy_tenant-groups_create
{{baseUrl}}/tenancy/tenant-groups/
BODY json
{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"slug": "",
"tenant_count": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/tenancy/tenant-groups/");
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 \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/tenancy/tenant-groups/" {:content-type :json
:form-params {:description ""
:id 0
:name ""
:parent 0
:slug ""
:tenant_count 0}})
require "http/client"
url = "{{baseUrl}}/tenancy/tenant-groups/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/tenancy/tenant-groups/"),
Content = new StringContent("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/tenancy/tenant-groups/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/tenancy/tenant-groups/"
payload := strings.NewReader("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/tenancy/tenant-groups/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 98
{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"slug": "",
"tenant_count": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/tenancy/tenant-groups/")
.setHeader("content-type", "application/json")
.setBody("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/tenancy/tenant-groups/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/tenancy/tenant-groups/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/tenancy/tenant-groups/")
.header("content-type", "application/json")
.body("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\n}")
.asString();
const data = JSON.stringify({
description: '',
id: 0,
name: '',
parent: 0,
slug: '',
tenant_count: 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}}/tenancy/tenant-groups/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/tenancy/tenant-groups/',
headers: {'content-type': 'application/json'},
data: {description: '', id: 0, name: '', parent: 0, slug: '', tenant_count: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/tenancy/tenant-groups/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"description":"","id":0,"name":"","parent":0,"slug":"","tenant_count":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}}/tenancy/tenant-groups/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "description": "",\n "id": 0,\n "name": "",\n "parent": 0,\n "slug": "",\n "tenant_count": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/tenancy/tenant-groups/")
.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/tenancy/tenant-groups/',
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({description: '', id: 0, name: '', parent: 0, slug: '', tenant_count: 0}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/tenancy/tenant-groups/',
headers: {'content-type': 'application/json'},
body: {description: '', id: 0, name: '', parent: 0, slug: '', tenant_count: 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}}/tenancy/tenant-groups/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
description: '',
id: 0,
name: '',
parent: 0,
slug: '',
tenant_count: 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}}/tenancy/tenant-groups/',
headers: {'content-type': 'application/json'},
data: {description: '', id: 0, name: '', parent: 0, slug: '', tenant_count: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/tenancy/tenant-groups/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"description":"","id":0,"name":"","parent":0,"slug":"","tenant_count":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 = @{ @"description": @"",
@"id": @0,
@"name": @"",
@"parent": @0,
@"slug": @"",
@"tenant_count": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/tenancy/tenant-groups/"]
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}}/tenancy/tenant-groups/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/tenancy/tenant-groups/",
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([
'description' => '',
'id' => 0,
'name' => '',
'parent' => 0,
'slug' => '',
'tenant_count' => 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}}/tenancy/tenant-groups/', [
'body' => '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"slug": "",
"tenant_count": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/tenancy/tenant-groups/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'description' => '',
'id' => 0,
'name' => '',
'parent' => 0,
'slug' => '',
'tenant_count' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'description' => '',
'id' => 0,
'name' => '',
'parent' => 0,
'slug' => '',
'tenant_count' => 0
]));
$request->setRequestUrl('{{baseUrl}}/tenancy/tenant-groups/');
$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}}/tenancy/tenant-groups/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"slug": "",
"tenant_count": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/tenancy/tenant-groups/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"slug": "",
"tenant_count": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/tenancy/tenant-groups/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/tenancy/tenant-groups/"
payload = {
"description": "",
"id": 0,
"name": "",
"parent": 0,
"slug": "",
"tenant_count": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/tenancy/tenant-groups/"
payload <- "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/tenancy/tenant-groups/")
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 \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/tenancy/tenant-groups/') do |req|
req.body = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/tenancy/tenant-groups/";
let payload = json!({
"description": "",
"id": 0,
"name": "",
"parent": 0,
"slug": "",
"tenant_count": 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}}/tenancy/tenant-groups/ \
--header 'content-type: application/json' \
--data '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"slug": "",
"tenant_count": 0
}'
echo '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"slug": "",
"tenant_count": 0
}' | \
http POST {{baseUrl}}/tenancy/tenant-groups/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "description": "",\n "id": 0,\n "name": "",\n "parent": 0,\n "slug": "",\n "tenant_count": 0\n}' \
--output-document \
- {{baseUrl}}/tenancy/tenant-groups/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"description": "",
"id": 0,
"name": "",
"parent": 0,
"slug": "",
"tenant_count": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/tenancy/tenant-groups/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
tenancy_tenant-groups_delete
{{baseUrl}}/tenancy/tenant-groups/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/tenancy/tenant-groups/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/tenancy/tenant-groups/:id/")
require "http/client"
url = "{{baseUrl}}/tenancy/tenant-groups/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/tenancy/tenant-groups/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/tenancy/tenant-groups/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/tenancy/tenant-groups/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/tenancy/tenant-groups/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/tenancy/tenant-groups/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/tenancy/tenant-groups/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/tenancy/tenant-groups/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/tenancy/tenant-groups/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/tenancy/tenant-groups/:id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/tenancy/tenant-groups/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/tenancy/tenant-groups/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/tenancy/tenant-groups/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/tenancy/tenant-groups/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/tenancy/tenant-groups/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/tenancy/tenant-groups/:id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/tenancy/tenant-groups/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/tenancy/tenant-groups/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/tenancy/tenant-groups/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/tenancy/tenant-groups/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/tenancy/tenant-groups/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/tenancy/tenant-groups/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/tenancy/tenant-groups/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/tenancy/tenant-groups/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/tenancy/tenant-groups/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/tenancy/tenant-groups/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/tenancy/tenant-groups/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/tenancy/tenant-groups/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/tenancy/tenant-groups/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/tenancy/tenant-groups/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/tenancy/tenant-groups/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/tenancy/tenant-groups/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/tenancy/tenant-groups/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/tenancy/tenant-groups/:id/
http DELETE {{baseUrl}}/tenancy/tenant-groups/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/tenancy/tenant-groups/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/tenancy/tenant-groups/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
tenancy_tenant-groups_list
{{baseUrl}}/tenancy/tenant-groups/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/tenancy/tenant-groups/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/tenancy/tenant-groups/")
require "http/client"
url = "{{baseUrl}}/tenancy/tenant-groups/"
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}}/tenancy/tenant-groups/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/tenancy/tenant-groups/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/tenancy/tenant-groups/"
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/tenancy/tenant-groups/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/tenancy/tenant-groups/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/tenancy/tenant-groups/"))
.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}}/tenancy/tenant-groups/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/tenancy/tenant-groups/")
.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}}/tenancy/tenant-groups/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/tenancy/tenant-groups/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/tenancy/tenant-groups/';
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}}/tenancy/tenant-groups/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/tenancy/tenant-groups/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/tenancy/tenant-groups/',
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}}/tenancy/tenant-groups/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/tenancy/tenant-groups/');
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}}/tenancy/tenant-groups/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/tenancy/tenant-groups/';
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}}/tenancy/tenant-groups/"]
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}}/tenancy/tenant-groups/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/tenancy/tenant-groups/",
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}}/tenancy/tenant-groups/');
echo $response->getBody();
setUrl('{{baseUrl}}/tenancy/tenant-groups/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/tenancy/tenant-groups/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/tenancy/tenant-groups/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/tenancy/tenant-groups/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/tenancy/tenant-groups/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/tenancy/tenant-groups/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/tenancy/tenant-groups/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/tenancy/tenant-groups/")
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/tenancy/tenant-groups/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/tenancy/tenant-groups/";
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}}/tenancy/tenant-groups/
http GET {{baseUrl}}/tenancy/tenant-groups/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/tenancy/tenant-groups/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/tenancy/tenant-groups/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
tenancy_tenant-groups_partial_update
{{baseUrl}}/tenancy/tenant-groups/:id/
BODY json
{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"slug": "",
"tenant_count": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/tenancy/tenant-groups/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/tenancy/tenant-groups/:id/" {:content-type :json
:form-params {:description ""
:id 0
:name ""
:parent 0
:slug ""
:tenant_count 0}})
require "http/client"
url = "{{baseUrl}}/tenancy/tenant-groups/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\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}}/tenancy/tenant-groups/:id/"),
Content = new StringContent("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/tenancy/tenant-groups/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/tenancy/tenant-groups/:id/"
payload := strings.NewReader("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\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/tenancy/tenant-groups/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 98
{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"slug": "",
"tenant_count": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/tenancy/tenant-groups/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/tenancy/tenant-groups/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/tenancy/tenant-groups/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/tenancy/tenant-groups/:id/")
.header("content-type", "application/json")
.body("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\n}")
.asString();
const data = JSON.stringify({
description: '',
id: 0,
name: '',
parent: 0,
slug: '',
tenant_count: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/tenancy/tenant-groups/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/tenancy/tenant-groups/:id/',
headers: {'content-type': 'application/json'},
data: {description: '', id: 0, name: '', parent: 0, slug: '', tenant_count: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/tenancy/tenant-groups/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"description":"","id":0,"name":"","parent":0,"slug":"","tenant_count":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}}/tenancy/tenant-groups/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "description": "",\n "id": 0,\n "name": "",\n "parent": 0,\n "slug": "",\n "tenant_count": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/tenancy/tenant-groups/:id/")
.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/tenancy/tenant-groups/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({description: '', id: 0, name: '', parent: 0, slug: '', tenant_count: 0}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/tenancy/tenant-groups/:id/',
headers: {'content-type': 'application/json'},
body: {description: '', id: 0, name: '', parent: 0, slug: '', tenant_count: 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('PATCH', '{{baseUrl}}/tenancy/tenant-groups/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
description: '',
id: 0,
name: '',
parent: 0,
slug: '',
tenant_count: 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: 'PATCH',
url: '{{baseUrl}}/tenancy/tenant-groups/:id/',
headers: {'content-type': 'application/json'},
data: {description: '', id: 0, name: '', parent: 0, slug: '', tenant_count: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/tenancy/tenant-groups/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"description":"","id":0,"name":"","parent":0,"slug":"","tenant_count":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 = @{ @"description": @"",
@"id": @0,
@"name": @"",
@"parent": @0,
@"slug": @"",
@"tenant_count": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/tenancy/tenant-groups/:id/"]
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}}/tenancy/tenant-groups/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/tenancy/tenant-groups/:id/",
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([
'description' => '',
'id' => 0,
'name' => '',
'parent' => 0,
'slug' => '',
'tenant_count' => 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('PATCH', '{{baseUrl}}/tenancy/tenant-groups/:id/', [
'body' => '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"slug": "",
"tenant_count": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/tenancy/tenant-groups/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'description' => '',
'id' => 0,
'name' => '',
'parent' => 0,
'slug' => '',
'tenant_count' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'description' => '',
'id' => 0,
'name' => '',
'parent' => 0,
'slug' => '',
'tenant_count' => 0
]));
$request->setRequestUrl('{{baseUrl}}/tenancy/tenant-groups/:id/');
$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}}/tenancy/tenant-groups/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"slug": "",
"tenant_count": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/tenancy/tenant-groups/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"slug": "",
"tenant_count": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/tenancy/tenant-groups/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/tenancy/tenant-groups/:id/"
payload = {
"description": "",
"id": 0,
"name": "",
"parent": 0,
"slug": "",
"tenant_count": 0
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/tenancy/tenant-groups/:id/"
payload <- "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\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}}/tenancy/tenant-groups/:id/")
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 \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/tenancy/tenant-groups/:id/') do |req|
req.body = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\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}}/tenancy/tenant-groups/:id/";
let payload = json!({
"description": "",
"id": 0,
"name": "",
"parent": 0,
"slug": "",
"tenant_count": 0
});
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}}/tenancy/tenant-groups/:id/ \
--header 'content-type: application/json' \
--data '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"slug": "",
"tenant_count": 0
}'
echo '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"slug": "",
"tenant_count": 0
}' | \
http PATCH {{baseUrl}}/tenancy/tenant-groups/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "description": "",\n "id": 0,\n "name": "",\n "parent": 0,\n "slug": "",\n "tenant_count": 0\n}' \
--output-document \
- {{baseUrl}}/tenancy/tenant-groups/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"description": "",
"id": 0,
"name": "",
"parent": 0,
"slug": "",
"tenant_count": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/tenancy/tenant-groups/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
tenancy_tenant-groups_read
{{baseUrl}}/tenancy/tenant-groups/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/tenancy/tenant-groups/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/tenancy/tenant-groups/:id/")
require "http/client"
url = "{{baseUrl}}/tenancy/tenant-groups/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/tenancy/tenant-groups/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/tenancy/tenant-groups/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/tenancy/tenant-groups/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/tenancy/tenant-groups/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/tenancy/tenant-groups/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/tenancy/tenant-groups/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/tenancy/tenant-groups/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/tenancy/tenant-groups/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/tenancy/tenant-groups/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/tenancy/tenant-groups/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/tenancy/tenant-groups/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/tenancy/tenant-groups/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/tenancy/tenant-groups/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/tenancy/tenant-groups/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/tenancy/tenant-groups/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/tenancy/tenant-groups/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/tenancy/tenant-groups/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/tenancy/tenant-groups/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/tenancy/tenant-groups/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/tenancy/tenant-groups/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/tenancy/tenant-groups/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/tenancy/tenant-groups/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/tenancy/tenant-groups/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/tenancy/tenant-groups/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/tenancy/tenant-groups/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/tenancy/tenant-groups/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/tenancy/tenant-groups/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/tenancy/tenant-groups/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/tenancy/tenant-groups/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/tenancy/tenant-groups/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/tenancy/tenant-groups/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/tenancy/tenant-groups/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/tenancy/tenant-groups/:id/
http GET {{baseUrl}}/tenancy/tenant-groups/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/tenancy/tenant-groups/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/tenancy/tenant-groups/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
tenancy_tenant-groups_update
{{baseUrl}}/tenancy/tenant-groups/:id/
BODY json
{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"slug": "",
"tenant_count": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/tenancy/tenant-groups/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/tenancy/tenant-groups/:id/" {:content-type :json
:form-params {:description ""
:id 0
:name ""
:parent 0
:slug ""
:tenant_count 0}})
require "http/client"
url = "{{baseUrl}}/tenancy/tenant-groups/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\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}}/tenancy/tenant-groups/:id/"),
Content = new StringContent("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/tenancy/tenant-groups/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/tenancy/tenant-groups/:id/"
payload := strings.NewReader("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\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/tenancy/tenant-groups/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 98
{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"slug": "",
"tenant_count": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/tenancy/tenant-groups/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/tenancy/tenant-groups/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/tenancy/tenant-groups/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/tenancy/tenant-groups/:id/")
.header("content-type", "application/json")
.body("{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\n}")
.asString();
const data = JSON.stringify({
description: '',
id: 0,
name: '',
parent: 0,
slug: '',
tenant_count: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/tenancy/tenant-groups/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/tenancy/tenant-groups/:id/',
headers: {'content-type': 'application/json'},
data: {description: '', id: 0, name: '', parent: 0, slug: '', tenant_count: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/tenancy/tenant-groups/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"description":"","id":0,"name":"","parent":0,"slug":"","tenant_count":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}}/tenancy/tenant-groups/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "description": "",\n "id": 0,\n "name": "",\n "parent": 0,\n "slug": "",\n "tenant_count": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/tenancy/tenant-groups/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/tenancy/tenant-groups/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({description: '', id: 0, name: '', parent: 0, slug: '', tenant_count: 0}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/tenancy/tenant-groups/:id/',
headers: {'content-type': 'application/json'},
body: {description: '', id: 0, name: '', parent: 0, slug: '', tenant_count: 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('PUT', '{{baseUrl}}/tenancy/tenant-groups/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
description: '',
id: 0,
name: '',
parent: 0,
slug: '',
tenant_count: 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: 'PUT',
url: '{{baseUrl}}/tenancy/tenant-groups/:id/',
headers: {'content-type': 'application/json'},
data: {description: '', id: 0, name: '', parent: 0, slug: '', tenant_count: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/tenancy/tenant-groups/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"description":"","id":0,"name":"","parent":0,"slug":"","tenant_count":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 = @{ @"description": @"",
@"id": @0,
@"name": @"",
@"parent": @0,
@"slug": @"",
@"tenant_count": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/tenancy/tenant-groups/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/tenancy/tenant-groups/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/tenancy/tenant-groups/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'description' => '',
'id' => 0,
'name' => '',
'parent' => 0,
'slug' => '',
'tenant_count' => 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('PUT', '{{baseUrl}}/tenancy/tenant-groups/:id/', [
'body' => '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"slug": "",
"tenant_count": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/tenancy/tenant-groups/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'description' => '',
'id' => 0,
'name' => '',
'parent' => 0,
'slug' => '',
'tenant_count' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'description' => '',
'id' => 0,
'name' => '',
'parent' => 0,
'slug' => '',
'tenant_count' => 0
]));
$request->setRequestUrl('{{baseUrl}}/tenancy/tenant-groups/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/tenancy/tenant-groups/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"slug": "",
"tenant_count": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/tenancy/tenant-groups/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"slug": "",
"tenant_count": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/tenancy/tenant-groups/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/tenancy/tenant-groups/:id/"
payload = {
"description": "",
"id": 0,
"name": "",
"parent": 0,
"slug": "",
"tenant_count": 0
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/tenancy/tenant-groups/:id/"
payload <- "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\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}}/tenancy/tenant-groups/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/tenancy/tenant-groups/:id/') do |req|
req.body = "{\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"parent\": 0,\n \"slug\": \"\",\n \"tenant_count\": 0\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}}/tenancy/tenant-groups/:id/";
let payload = json!({
"description": "",
"id": 0,
"name": "",
"parent": 0,
"slug": "",
"tenant_count": 0
});
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}}/tenancy/tenant-groups/:id/ \
--header 'content-type: application/json' \
--data '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"slug": "",
"tenant_count": 0
}'
echo '{
"description": "",
"id": 0,
"name": "",
"parent": 0,
"slug": "",
"tenant_count": 0
}' | \
http PUT {{baseUrl}}/tenancy/tenant-groups/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "description": "",\n "id": 0,\n "name": "",\n "parent": 0,\n "slug": "",\n "tenant_count": 0\n}' \
--output-document \
- {{baseUrl}}/tenancy/tenant-groups/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"description": "",
"id": 0,
"name": "",
"parent": 0,
"slug": "",
"tenant_count": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/tenancy/tenant-groups/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
tenancy_tenants_create
{{baseUrl}}/tenancy/tenants/
BODY json
{
"circuit_count": 0,
"cluster_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"group": 0,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rack_count": 0,
"site_count": 0,
"slug": "",
"tags": [],
"virtualmachine_count": 0,
"vlan_count": 0,
"vrf_count": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/tenancy/tenants/");
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 \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/tenancy/tenants/" {:content-type :json
:form-params {:circuit_count 0
:cluster_count 0
:comments ""
:created ""
:custom_fields {}
:description ""
:device_count 0
:group 0
:id 0
:ipaddress_count 0
:last_updated ""
:name ""
:prefix_count 0
:rack_count 0
:site_count 0
:slug ""
:tags []
:virtualmachine_count 0
:vlan_count 0
:vrf_count 0}})
require "http/client"
url = "{{baseUrl}}/tenancy/tenants/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/tenancy/tenants/"),
Content = new StringContent("{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/tenancy/tenants/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/tenancy/tenants/"
payload := strings.NewReader("{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/tenancy/tenants/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 384
{
"circuit_count": 0,
"cluster_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"group": 0,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rack_count": 0,
"site_count": 0,
"slug": "",
"tags": [],
"virtualmachine_count": 0,
"vlan_count": 0,
"vrf_count": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/tenancy/tenants/")
.setHeader("content-type", "application/json")
.setBody("{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/tenancy/tenants/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/tenancy/tenants/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/tenancy/tenants/")
.header("content-type", "application/json")
.body("{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\n}")
.asString();
const data = JSON.stringify({
circuit_count: 0,
cluster_count: 0,
comments: '',
created: '',
custom_fields: {},
description: '',
device_count: 0,
group: 0,
id: 0,
ipaddress_count: 0,
last_updated: '',
name: '',
prefix_count: 0,
rack_count: 0,
site_count: 0,
slug: '',
tags: [],
virtualmachine_count: 0,
vlan_count: 0,
vrf_count: 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}}/tenancy/tenants/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/tenancy/tenants/',
headers: {'content-type': 'application/json'},
data: {
circuit_count: 0,
cluster_count: 0,
comments: '',
created: '',
custom_fields: {},
description: '',
device_count: 0,
group: 0,
id: 0,
ipaddress_count: 0,
last_updated: '',
name: '',
prefix_count: 0,
rack_count: 0,
site_count: 0,
slug: '',
tags: [],
virtualmachine_count: 0,
vlan_count: 0,
vrf_count: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/tenancy/tenants/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"circuit_count":0,"cluster_count":0,"comments":"","created":"","custom_fields":{},"description":"","device_count":0,"group":0,"id":0,"ipaddress_count":0,"last_updated":"","name":"","prefix_count":0,"rack_count":0,"site_count":0,"slug":"","tags":[],"virtualmachine_count":0,"vlan_count":0,"vrf_count":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}}/tenancy/tenants/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "circuit_count": 0,\n "cluster_count": 0,\n "comments": "",\n "created": "",\n "custom_fields": {},\n "description": "",\n "device_count": 0,\n "group": 0,\n "id": 0,\n "ipaddress_count": 0,\n "last_updated": "",\n "name": "",\n "prefix_count": 0,\n "rack_count": 0,\n "site_count": 0,\n "slug": "",\n "tags": [],\n "virtualmachine_count": 0,\n "vlan_count": 0,\n "vrf_count": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/tenancy/tenants/")
.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/tenancy/tenants/',
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({
circuit_count: 0,
cluster_count: 0,
comments: '',
created: '',
custom_fields: {},
description: '',
device_count: 0,
group: 0,
id: 0,
ipaddress_count: 0,
last_updated: '',
name: '',
prefix_count: 0,
rack_count: 0,
site_count: 0,
slug: '',
tags: [],
virtualmachine_count: 0,
vlan_count: 0,
vrf_count: 0
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/tenancy/tenants/',
headers: {'content-type': 'application/json'},
body: {
circuit_count: 0,
cluster_count: 0,
comments: '',
created: '',
custom_fields: {},
description: '',
device_count: 0,
group: 0,
id: 0,
ipaddress_count: 0,
last_updated: '',
name: '',
prefix_count: 0,
rack_count: 0,
site_count: 0,
slug: '',
tags: [],
virtualmachine_count: 0,
vlan_count: 0,
vrf_count: 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}}/tenancy/tenants/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
circuit_count: 0,
cluster_count: 0,
comments: '',
created: '',
custom_fields: {},
description: '',
device_count: 0,
group: 0,
id: 0,
ipaddress_count: 0,
last_updated: '',
name: '',
prefix_count: 0,
rack_count: 0,
site_count: 0,
slug: '',
tags: [],
virtualmachine_count: 0,
vlan_count: 0,
vrf_count: 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}}/tenancy/tenants/',
headers: {'content-type': 'application/json'},
data: {
circuit_count: 0,
cluster_count: 0,
comments: '',
created: '',
custom_fields: {},
description: '',
device_count: 0,
group: 0,
id: 0,
ipaddress_count: 0,
last_updated: '',
name: '',
prefix_count: 0,
rack_count: 0,
site_count: 0,
slug: '',
tags: [],
virtualmachine_count: 0,
vlan_count: 0,
vrf_count: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/tenancy/tenants/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"circuit_count":0,"cluster_count":0,"comments":"","created":"","custom_fields":{},"description":"","device_count":0,"group":0,"id":0,"ipaddress_count":0,"last_updated":"","name":"","prefix_count":0,"rack_count":0,"site_count":0,"slug":"","tags":[],"virtualmachine_count":0,"vlan_count":0,"vrf_count":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 = @{ @"circuit_count": @0,
@"cluster_count": @0,
@"comments": @"",
@"created": @"",
@"custom_fields": @{ },
@"description": @"",
@"device_count": @0,
@"group": @0,
@"id": @0,
@"ipaddress_count": @0,
@"last_updated": @"",
@"name": @"",
@"prefix_count": @0,
@"rack_count": @0,
@"site_count": @0,
@"slug": @"",
@"tags": @[ ],
@"virtualmachine_count": @0,
@"vlan_count": @0,
@"vrf_count": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/tenancy/tenants/"]
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}}/tenancy/tenants/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/tenancy/tenants/",
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([
'circuit_count' => 0,
'cluster_count' => 0,
'comments' => '',
'created' => '',
'custom_fields' => [
],
'description' => '',
'device_count' => 0,
'group' => 0,
'id' => 0,
'ipaddress_count' => 0,
'last_updated' => '',
'name' => '',
'prefix_count' => 0,
'rack_count' => 0,
'site_count' => 0,
'slug' => '',
'tags' => [
],
'virtualmachine_count' => 0,
'vlan_count' => 0,
'vrf_count' => 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}}/tenancy/tenants/', [
'body' => '{
"circuit_count": 0,
"cluster_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"group": 0,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rack_count": 0,
"site_count": 0,
"slug": "",
"tags": [],
"virtualmachine_count": 0,
"vlan_count": 0,
"vrf_count": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/tenancy/tenants/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'circuit_count' => 0,
'cluster_count' => 0,
'comments' => '',
'created' => '',
'custom_fields' => [
],
'description' => '',
'device_count' => 0,
'group' => 0,
'id' => 0,
'ipaddress_count' => 0,
'last_updated' => '',
'name' => '',
'prefix_count' => 0,
'rack_count' => 0,
'site_count' => 0,
'slug' => '',
'tags' => [
],
'virtualmachine_count' => 0,
'vlan_count' => 0,
'vrf_count' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'circuit_count' => 0,
'cluster_count' => 0,
'comments' => '',
'created' => '',
'custom_fields' => [
],
'description' => '',
'device_count' => 0,
'group' => 0,
'id' => 0,
'ipaddress_count' => 0,
'last_updated' => '',
'name' => '',
'prefix_count' => 0,
'rack_count' => 0,
'site_count' => 0,
'slug' => '',
'tags' => [
],
'virtualmachine_count' => 0,
'vlan_count' => 0,
'vrf_count' => 0
]));
$request->setRequestUrl('{{baseUrl}}/tenancy/tenants/');
$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}}/tenancy/tenants/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"circuit_count": 0,
"cluster_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"group": 0,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rack_count": 0,
"site_count": 0,
"slug": "",
"tags": [],
"virtualmachine_count": 0,
"vlan_count": 0,
"vrf_count": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/tenancy/tenants/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"circuit_count": 0,
"cluster_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"group": 0,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rack_count": 0,
"site_count": 0,
"slug": "",
"tags": [],
"virtualmachine_count": 0,
"vlan_count": 0,
"vrf_count": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/tenancy/tenants/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/tenancy/tenants/"
payload = {
"circuit_count": 0,
"cluster_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"group": 0,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rack_count": 0,
"site_count": 0,
"slug": "",
"tags": [],
"virtualmachine_count": 0,
"vlan_count": 0,
"vrf_count": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/tenancy/tenants/"
payload <- "{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/tenancy/tenants/")
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 \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/tenancy/tenants/') do |req|
req.body = "{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/tenancy/tenants/";
let payload = json!({
"circuit_count": 0,
"cluster_count": 0,
"comments": "",
"created": "",
"custom_fields": json!({}),
"description": "",
"device_count": 0,
"group": 0,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rack_count": 0,
"site_count": 0,
"slug": "",
"tags": (),
"virtualmachine_count": 0,
"vlan_count": 0,
"vrf_count": 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}}/tenancy/tenants/ \
--header 'content-type: application/json' \
--data '{
"circuit_count": 0,
"cluster_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"group": 0,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rack_count": 0,
"site_count": 0,
"slug": "",
"tags": [],
"virtualmachine_count": 0,
"vlan_count": 0,
"vrf_count": 0
}'
echo '{
"circuit_count": 0,
"cluster_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"group": 0,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rack_count": 0,
"site_count": 0,
"slug": "",
"tags": [],
"virtualmachine_count": 0,
"vlan_count": 0,
"vrf_count": 0
}' | \
http POST {{baseUrl}}/tenancy/tenants/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "circuit_count": 0,\n "cluster_count": 0,\n "comments": "",\n "created": "",\n "custom_fields": {},\n "description": "",\n "device_count": 0,\n "group": 0,\n "id": 0,\n "ipaddress_count": 0,\n "last_updated": "",\n "name": "",\n "prefix_count": 0,\n "rack_count": 0,\n "site_count": 0,\n "slug": "",\n "tags": [],\n "virtualmachine_count": 0,\n "vlan_count": 0,\n "vrf_count": 0\n}' \
--output-document \
- {{baseUrl}}/tenancy/tenants/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"circuit_count": 0,
"cluster_count": 0,
"comments": "",
"created": "",
"custom_fields": [],
"description": "",
"device_count": 0,
"group": 0,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rack_count": 0,
"site_count": 0,
"slug": "",
"tags": [],
"virtualmachine_count": 0,
"vlan_count": 0,
"vrf_count": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/tenancy/tenants/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
tenancy_tenants_delete
{{baseUrl}}/tenancy/tenants/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/tenancy/tenants/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/tenancy/tenants/:id/")
require "http/client"
url = "{{baseUrl}}/tenancy/tenants/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/tenancy/tenants/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/tenancy/tenants/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/tenancy/tenants/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/tenancy/tenants/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/tenancy/tenants/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/tenancy/tenants/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/tenancy/tenants/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/tenancy/tenants/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/tenancy/tenants/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/tenancy/tenants/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/tenancy/tenants/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/tenancy/tenants/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/tenancy/tenants/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/tenancy/tenants/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/tenancy/tenants/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/tenancy/tenants/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/tenancy/tenants/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/tenancy/tenants/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/tenancy/tenants/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/tenancy/tenants/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/tenancy/tenants/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/tenancy/tenants/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/tenancy/tenants/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/tenancy/tenants/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/tenancy/tenants/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/tenancy/tenants/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/tenancy/tenants/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/tenancy/tenants/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/tenancy/tenants/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/tenancy/tenants/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/tenancy/tenants/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/tenancy/tenants/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/tenancy/tenants/:id/
http DELETE {{baseUrl}}/tenancy/tenants/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/tenancy/tenants/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/tenancy/tenants/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
tenancy_tenants_list
{{baseUrl}}/tenancy/tenants/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/tenancy/tenants/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/tenancy/tenants/")
require "http/client"
url = "{{baseUrl}}/tenancy/tenants/"
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}}/tenancy/tenants/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/tenancy/tenants/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/tenancy/tenants/"
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/tenancy/tenants/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/tenancy/tenants/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/tenancy/tenants/"))
.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}}/tenancy/tenants/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/tenancy/tenants/")
.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}}/tenancy/tenants/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/tenancy/tenants/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/tenancy/tenants/';
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}}/tenancy/tenants/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/tenancy/tenants/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/tenancy/tenants/',
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}}/tenancy/tenants/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/tenancy/tenants/');
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}}/tenancy/tenants/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/tenancy/tenants/';
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}}/tenancy/tenants/"]
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}}/tenancy/tenants/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/tenancy/tenants/",
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}}/tenancy/tenants/');
echo $response->getBody();
setUrl('{{baseUrl}}/tenancy/tenants/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/tenancy/tenants/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/tenancy/tenants/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/tenancy/tenants/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/tenancy/tenants/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/tenancy/tenants/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/tenancy/tenants/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/tenancy/tenants/")
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/tenancy/tenants/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/tenancy/tenants/";
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}}/tenancy/tenants/
http GET {{baseUrl}}/tenancy/tenants/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/tenancy/tenants/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/tenancy/tenants/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
tenancy_tenants_partial_update
{{baseUrl}}/tenancy/tenants/:id/
BODY json
{
"circuit_count": 0,
"cluster_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"group": 0,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rack_count": 0,
"site_count": 0,
"slug": "",
"tags": [],
"virtualmachine_count": 0,
"vlan_count": 0,
"vrf_count": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/tenancy/tenants/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/tenancy/tenants/:id/" {:content-type :json
:form-params {:circuit_count 0
:cluster_count 0
:comments ""
:created ""
:custom_fields {}
:description ""
:device_count 0
:group 0
:id 0
:ipaddress_count 0
:last_updated ""
:name ""
:prefix_count 0
:rack_count 0
:site_count 0
:slug ""
:tags []
:virtualmachine_count 0
:vlan_count 0
:vrf_count 0}})
require "http/client"
url = "{{baseUrl}}/tenancy/tenants/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\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}}/tenancy/tenants/:id/"),
Content = new StringContent("{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/tenancy/tenants/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/tenancy/tenants/:id/"
payload := strings.NewReader("{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\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/tenancy/tenants/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 384
{
"circuit_count": 0,
"cluster_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"group": 0,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rack_count": 0,
"site_count": 0,
"slug": "",
"tags": [],
"virtualmachine_count": 0,
"vlan_count": 0,
"vrf_count": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/tenancy/tenants/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/tenancy/tenants/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/tenancy/tenants/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/tenancy/tenants/:id/")
.header("content-type", "application/json")
.body("{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\n}")
.asString();
const data = JSON.stringify({
circuit_count: 0,
cluster_count: 0,
comments: '',
created: '',
custom_fields: {},
description: '',
device_count: 0,
group: 0,
id: 0,
ipaddress_count: 0,
last_updated: '',
name: '',
prefix_count: 0,
rack_count: 0,
site_count: 0,
slug: '',
tags: [],
virtualmachine_count: 0,
vlan_count: 0,
vrf_count: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/tenancy/tenants/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/tenancy/tenants/:id/',
headers: {'content-type': 'application/json'},
data: {
circuit_count: 0,
cluster_count: 0,
comments: '',
created: '',
custom_fields: {},
description: '',
device_count: 0,
group: 0,
id: 0,
ipaddress_count: 0,
last_updated: '',
name: '',
prefix_count: 0,
rack_count: 0,
site_count: 0,
slug: '',
tags: [],
virtualmachine_count: 0,
vlan_count: 0,
vrf_count: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/tenancy/tenants/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"circuit_count":0,"cluster_count":0,"comments":"","created":"","custom_fields":{},"description":"","device_count":0,"group":0,"id":0,"ipaddress_count":0,"last_updated":"","name":"","prefix_count":0,"rack_count":0,"site_count":0,"slug":"","tags":[],"virtualmachine_count":0,"vlan_count":0,"vrf_count":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}}/tenancy/tenants/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "circuit_count": 0,\n "cluster_count": 0,\n "comments": "",\n "created": "",\n "custom_fields": {},\n "description": "",\n "device_count": 0,\n "group": 0,\n "id": 0,\n "ipaddress_count": 0,\n "last_updated": "",\n "name": "",\n "prefix_count": 0,\n "rack_count": 0,\n "site_count": 0,\n "slug": "",\n "tags": [],\n "virtualmachine_count": 0,\n "vlan_count": 0,\n "vrf_count": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/tenancy/tenants/:id/")
.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/tenancy/tenants/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
circuit_count: 0,
cluster_count: 0,
comments: '',
created: '',
custom_fields: {},
description: '',
device_count: 0,
group: 0,
id: 0,
ipaddress_count: 0,
last_updated: '',
name: '',
prefix_count: 0,
rack_count: 0,
site_count: 0,
slug: '',
tags: [],
virtualmachine_count: 0,
vlan_count: 0,
vrf_count: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/tenancy/tenants/:id/',
headers: {'content-type': 'application/json'},
body: {
circuit_count: 0,
cluster_count: 0,
comments: '',
created: '',
custom_fields: {},
description: '',
device_count: 0,
group: 0,
id: 0,
ipaddress_count: 0,
last_updated: '',
name: '',
prefix_count: 0,
rack_count: 0,
site_count: 0,
slug: '',
tags: [],
virtualmachine_count: 0,
vlan_count: 0,
vrf_count: 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('PATCH', '{{baseUrl}}/tenancy/tenants/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
circuit_count: 0,
cluster_count: 0,
comments: '',
created: '',
custom_fields: {},
description: '',
device_count: 0,
group: 0,
id: 0,
ipaddress_count: 0,
last_updated: '',
name: '',
prefix_count: 0,
rack_count: 0,
site_count: 0,
slug: '',
tags: [],
virtualmachine_count: 0,
vlan_count: 0,
vrf_count: 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: 'PATCH',
url: '{{baseUrl}}/tenancy/tenants/:id/',
headers: {'content-type': 'application/json'},
data: {
circuit_count: 0,
cluster_count: 0,
comments: '',
created: '',
custom_fields: {},
description: '',
device_count: 0,
group: 0,
id: 0,
ipaddress_count: 0,
last_updated: '',
name: '',
prefix_count: 0,
rack_count: 0,
site_count: 0,
slug: '',
tags: [],
virtualmachine_count: 0,
vlan_count: 0,
vrf_count: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/tenancy/tenants/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"circuit_count":0,"cluster_count":0,"comments":"","created":"","custom_fields":{},"description":"","device_count":0,"group":0,"id":0,"ipaddress_count":0,"last_updated":"","name":"","prefix_count":0,"rack_count":0,"site_count":0,"slug":"","tags":[],"virtualmachine_count":0,"vlan_count":0,"vrf_count":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 = @{ @"circuit_count": @0,
@"cluster_count": @0,
@"comments": @"",
@"created": @"",
@"custom_fields": @{ },
@"description": @"",
@"device_count": @0,
@"group": @0,
@"id": @0,
@"ipaddress_count": @0,
@"last_updated": @"",
@"name": @"",
@"prefix_count": @0,
@"rack_count": @0,
@"site_count": @0,
@"slug": @"",
@"tags": @[ ],
@"virtualmachine_count": @0,
@"vlan_count": @0,
@"vrf_count": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/tenancy/tenants/:id/"]
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}}/tenancy/tenants/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/tenancy/tenants/:id/",
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([
'circuit_count' => 0,
'cluster_count' => 0,
'comments' => '',
'created' => '',
'custom_fields' => [
],
'description' => '',
'device_count' => 0,
'group' => 0,
'id' => 0,
'ipaddress_count' => 0,
'last_updated' => '',
'name' => '',
'prefix_count' => 0,
'rack_count' => 0,
'site_count' => 0,
'slug' => '',
'tags' => [
],
'virtualmachine_count' => 0,
'vlan_count' => 0,
'vrf_count' => 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('PATCH', '{{baseUrl}}/tenancy/tenants/:id/', [
'body' => '{
"circuit_count": 0,
"cluster_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"group": 0,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rack_count": 0,
"site_count": 0,
"slug": "",
"tags": [],
"virtualmachine_count": 0,
"vlan_count": 0,
"vrf_count": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/tenancy/tenants/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'circuit_count' => 0,
'cluster_count' => 0,
'comments' => '',
'created' => '',
'custom_fields' => [
],
'description' => '',
'device_count' => 0,
'group' => 0,
'id' => 0,
'ipaddress_count' => 0,
'last_updated' => '',
'name' => '',
'prefix_count' => 0,
'rack_count' => 0,
'site_count' => 0,
'slug' => '',
'tags' => [
],
'virtualmachine_count' => 0,
'vlan_count' => 0,
'vrf_count' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'circuit_count' => 0,
'cluster_count' => 0,
'comments' => '',
'created' => '',
'custom_fields' => [
],
'description' => '',
'device_count' => 0,
'group' => 0,
'id' => 0,
'ipaddress_count' => 0,
'last_updated' => '',
'name' => '',
'prefix_count' => 0,
'rack_count' => 0,
'site_count' => 0,
'slug' => '',
'tags' => [
],
'virtualmachine_count' => 0,
'vlan_count' => 0,
'vrf_count' => 0
]));
$request->setRequestUrl('{{baseUrl}}/tenancy/tenants/:id/');
$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}}/tenancy/tenants/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"circuit_count": 0,
"cluster_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"group": 0,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rack_count": 0,
"site_count": 0,
"slug": "",
"tags": [],
"virtualmachine_count": 0,
"vlan_count": 0,
"vrf_count": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/tenancy/tenants/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"circuit_count": 0,
"cluster_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"group": 0,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rack_count": 0,
"site_count": 0,
"slug": "",
"tags": [],
"virtualmachine_count": 0,
"vlan_count": 0,
"vrf_count": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/tenancy/tenants/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/tenancy/tenants/:id/"
payload = {
"circuit_count": 0,
"cluster_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"group": 0,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rack_count": 0,
"site_count": 0,
"slug": "",
"tags": [],
"virtualmachine_count": 0,
"vlan_count": 0,
"vrf_count": 0
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/tenancy/tenants/:id/"
payload <- "{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\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}}/tenancy/tenants/:id/")
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 \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/tenancy/tenants/:id/') do |req|
req.body = "{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\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}}/tenancy/tenants/:id/";
let payload = json!({
"circuit_count": 0,
"cluster_count": 0,
"comments": "",
"created": "",
"custom_fields": json!({}),
"description": "",
"device_count": 0,
"group": 0,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rack_count": 0,
"site_count": 0,
"slug": "",
"tags": (),
"virtualmachine_count": 0,
"vlan_count": 0,
"vrf_count": 0
});
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}}/tenancy/tenants/:id/ \
--header 'content-type: application/json' \
--data '{
"circuit_count": 0,
"cluster_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"group": 0,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rack_count": 0,
"site_count": 0,
"slug": "",
"tags": [],
"virtualmachine_count": 0,
"vlan_count": 0,
"vrf_count": 0
}'
echo '{
"circuit_count": 0,
"cluster_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"group": 0,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rack_count": 0,
"site_count": 0,
"slug": "",
"tags": [],
"virtualmachine_count": 0,
"vlan_count": 0,
"vrf_count": 0
}' | \
http PATCH {{baseUrl}}/tenancy/tenants/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "circuit_count": 0,\n "cluster_count": 0,\n "comments": "",\n "created": "",\n "custom_fields": {},\n "description": "",\n "device_count": 0,\n "group": 0,\n "id": 0,\n "ipaddress_count": 0,\n "last_updated": "",\n "name": "",\n "prefix_count": 0,\n "rack_count": 0,\n "site_count": 0,\n "slug": "",\n "tags": [],\n "virtualmachine_count": 0,\n "vlan_count": 0,\n "vrf_count": 0\n}' \
--output-document \
- {{baseUrl}}/tenancy/tenants/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"circuit_count": 0,
"cluster_count": 0,
"comments": "",
"created": "",
"custom_fields": [],
"description": "",
"device_count": 0,
"group": 0,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rack_count": 0,
"site_count": 0,
"slug": "",
"tags": [],
"virtualmachine_count": 0,
"vlan_count": 0,
"vrf_count": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/tenancy/tenants/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
tenancy_tenants_read
{{baseUrl}}/tenancy/tenants/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/tenancy/tenants/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/tenancy/tenants/:id/")
require "http/client"
url = "{{baseUrl}}/tenancy/tenants/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/tenancy/tenants/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/tenancy/tenants/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/tenancy/tenants/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/tenancy/tenants/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/tenancy/tenants/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/tenancy/tenants/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/tenancy/tenants/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/tenancy/tenants/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/tenancy/tenants/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/tenancy/tenants/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/tenancy/tenants/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/tenancy/tenants/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/tenancy/tenants/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/tenancy/tenants/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/tenancy/tenants/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/tenancy/tenants/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/tenancy/tenants/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/tenancy/tenants/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/tenancy/tenants/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/tenancy/tenants/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/tenancy/tenants/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/tenancy/tenants/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/tenancy/tenants/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/tenancy/tenants/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/tenancy/tenants/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/tenancy/tenants/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/tenancy/tenants/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/tenancy/tenants/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/tenancy/tenants/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/tenancy/tenants/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/tenancy/tenants/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/tenancy/tenants/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/tenancy/tenants/:id/
http GET {{baseUrl}}/tenancy/tenants/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/tenancy/tenants/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/tenancy/tenants/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
tenancy_tenants_update
{{baseUrl}}/tenancy/tenants/:id/
BODY json
{
"circuit_count": 0,
"cluster_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"group": 0,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rack_count": 0,
"site_count": 0,
"slug": "",
"tags": [],
"virtualmachine_count": 0,
"vlan_count": 0,
"vrf_count": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/tenancy/tenants/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/tenancy/tenants/:id/" {:content-type :json
:form-params {:circuit_count 0
:cluster_count 0
:comments ""
:created ""
:custom_fields {}
:description ""
:device_count 0
:group 0
:id 0
:ipaddress_count 0
:last_updated ""
:name ""
:prefix_count 0
:rack_count 0
:site_count 0
:slug ""
:tags []
:virtualmachine_count 0
:vlan_count 0
:vrf_count 0}})
require "http/client"
url = "{{baseUrl}}/tenancy/tenants/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\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}}/tenancy/tenants/:id/"),
Content = new StringContent("{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/tenancy/tenants/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/tenancy/tenants/:id/"
payload := strings.NewReader("{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\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/tenancy/tenants/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 384
{
"circuit_count": 0,
"cluster_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"group": 0,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rack_count": 0,
"site_count": 0,
"slug": "",
"tags": [],
"virtualmachine_count": 0,
"vlan_count": 0,
"vrf_count": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/tenancy/tenants/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/tenancy/tenants/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/tenancy/tenants/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/tenancy/tenants/:id/")
.header("content-type", "application/json")
.body("{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\n}")
.asString();
const data = JSON.stringify({
circuit_count: 0,
cluster_count: 0,
comments: '',
created: '',
custom_fields: {},
description: '',
device_count: 0,
group: 0,
id: 0,
ipaddress_count: 0,
last_updated: '',
name: '',
prefix_count: 0,
rack_count: 0,
site_count: 0,
slug: '',
tags: [],
virtualmachine_count: 0,
vlan_count: 0,
vrf_count: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/tenancy/tenants/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/tenancy/tenants/:id/',
headers: {'content-type': 'application/json'},
data: {
circuit_count: 0,
cluster_count: 0,
comments: '',
created: '',
custom_fields: {},
description: '',
device_count: 0,
group: 0,
id: 0,
ipaddress_count: 0,
last_updated: '',
name: '',
prefix_count: 0,
rack_count: 0,
site_count: 0,
slug: '',
tags: [],
virtualmachine_count: 0,
vlan_count: 0,
vrf_count: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/tenancy/tenants/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"circuit_count":0,"cluster_count":0,"comments":"","created":"","custom_fields":{},"description":"","device_count":0,"group":0,"id":0,"ipaddress_count":0,"last_updated":"","name":"","prefix_count":0,"rack_count":0,"site_count":0,"slug":"","tags":[],"virtualmachine_count":0,"vlan_count":0,"vrf_count":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}}/tenancy/tenants/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "circuit_count": 0,\n "cluster_count": 0,\n "comments": "",\n "created": "",\n "custom_fields": {},\n "description": "",\n "device_count": 0,\n "group": 0,\n "id": 0,\n "ipaddress_count": 0,\n "last_updated": "",\n "name": "",\n "prefix_count": 0,\n "rack_count": 0,\n "site_count": 0,\n "slug": "",\n "tags": [],\n "virtualmachine_count": 0,\n "vlan_count": 0,\n "vrf_count": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/tenancy/tenants/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/tenancy/tenants/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
circuit_count: 0,
cluster_count: 0,
comments: '',
created: '',
custom_fields: {},
description: '',
device_count: 0,
group: 0,
id: 0,
ipaddress_count: 0,
last_updated: '',
name: '',
prefix_count: 0,
rack_count: 0,
site_count: 0,
slug: '',
tags: [],
virtualmachine_count: 0,
vlan_count: 0,
vrf_count: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/tenancy/tenants/:id/',
headers: {'content-type': 'application/json'},
body: {
circuit_count: 0,
cluster_count: 0,
comments: '',
created: '',
custom_fields: {},
description: '',
device_count: 0,
group: 0,
id: 0,
ipaddress_count: 0,
last_updated: '',
name: '',
prefix_count: 0,
rack_count: 0,
site_count: 0,
slug: '',
tags: [],
virtualmachine_count: 0,
vlan_count: 0,
vrf_count: 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('PUT', '{{baseUrl}}/tenancy/tenants/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
circuit_count: 0,
cluster_count: 0,
comments: '',
created: '',
custom_fields: {},
description: '',
device_count: 0,
group: 0,
id: 0,
ipaddress_count: 0,
last_updated: '',
name: '',
prefix_count: 0,
rack_count: 0,
site_count: 0,
slug: '',
tags: [],
virtualmachine_count: 0,
vlan_count: 0,
vrf_count: 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: 'PUT',
url: '{{baseUrl}}/tenancy/tenants/:id/',
headers: {'content-type': 'application/json'},
data: {
circuit_count: 0,
cluster_count: 0,
comments: '',
created: '',
custom_fields: {},
description: '',
device_count: 0,
group: 0,
id: 0,
ipaddress_count: 0,
last_updated: '',
name: '',
prefix_count: 0,
rack_count: 0,
site_count: 0,
slug: '',
tags: [],
virtualmachine_count: 0,
vlan_count: 0,
vrf_count: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/tenancy/tenants/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"circuit_count":0,"cluster_count":0,"comments":"","created":"","custom_fields":{},"description":"","device_count":0,"group":0,"id":0,"ipaddress_count":0,"last_updated":"","name":"","prefix_count":0,"rack_count":0,"site_count":0,"slug":"","tags":[],"virtualmachine_count":0,"vlan_count":0,"vrf_count":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 = @{ @"circuit_count": @0,
@"cluster_count": @0,
@"comments": @"",
@"created": @"",
@"custom_fields": @{ },
@"description": @"",
@"device_count": @0,
@"group": @0,
@"id": @0,
@"ipaddress_count": @0,
@"last_updated": @"",
@"name": @"",
@"prefix_count": @0,
@"rack_count": @0,
@"site_count": @0,
@"slug": @"",
@"tags": @[ ],
@"virtualmachine_count": @0,
@"vlan_count": @0,
@"vrf_count": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/tenancy/tenants/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/tenancy/tenants/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/tenancy/tenants/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'circuit_count' => 0,
'cluster_count' => 0,
'comments' => '',
'created' => '',
'custom_fields' => [
],
'description' => '',
'device_count' => 0,
'group' => 0,
'id' => 0,
'ipaddress_count' => 0,
'last_updated' => '',
'name' => '',
'prefix_count' => 0,
'rack_count' => 0,
'site_count' => 0,
'slug' => '',
'tags' => [
],
'virtualmachine_count' => 0,
'vlan_count' => 0,
'vrf_count' => 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('PUT', '{{baseUrl}}/tenancy/tenants/:id/', [
'body' => '{
"circuit_count": 0,
"cluster_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"group": 0,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rack_count": 0,
"site_count": 0,
"slug": "",
"tags": [],
"virtualmachine_count": 0,
"vlan_count": 0,
"vrf_count": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/tenancy/tenants/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'circuit_count' => 0,
'cluster_count' => 0,
'comments' => '',
'created' => '',
'custom_fields' => [
],
'description' => '',
'device_count' => 0,
'group' => 0,
'id' => 0,
'ipaddress_count' => 0,
'last_updated' => '',
'name' => '',
'prefix_count' => 0,
'rack_count' => 0,
'site_count' => 0,
'slug' => '',
'tags' => [
],
'virtualmachine_count' => 0,
'vlan_count' => 0,
'vrf_count' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'circuit_count' => 0,
'cluster_count' => 0,
'comments' => '',
'created' => '',
'custom_fields' => [
],
'description' => '',
'device_count' => 0,
'group' => 0,
'id' => 0,
'ipaddress_count' => 0,
'last_updated' => '',
'name' => '',
'prefix_count' => 0,
'rack_count' => 0,
'site_count' => 0,
'slug' => '',
'tags' => [
],
'virtualmachine_count' => 0,
'vlan_count' => 0,
'vrf_count' => 0
]));
$request->setRequestUrl('{{baseUrl}}/tenancy/tenants/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/tenancy/tenants/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"circuit_count": 0,
"cluster_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"group": 0,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rack_count": 0,
"site_count": 0,
"slug": "",
"tags": [],
"virtualmachine_count": 0,
"vlan_count": 0,
"vrf_count": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/tenancy/tenants/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"circuit_count": 0,
"cluster_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"group": 0,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rack_count": 0,
"site_count": 0,
"slug": "",
"tags": [],
"virtualmachine_count": 0,
"vlan_count": 0,
"vrf_count": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/tenancy/tenants/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/tenancy/tenants/:id/"
payload = {
"circuit_count": 0,
"cluster_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"group": 0,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rack_count": 0,
"site_count": 0,
"slug": "",
"tags": [],
"virtualmachine_count": 0,
"vlan_count": 0,
"vrf_count": 0
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/tenancy/tenants/:id/"
payload <- "{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\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}}/tenancy/tenants/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/tenancy/tenants/:id/') do |req|
req.body = "{\n \"circuit_count\": 0,\n \"cluster_count\": 0,\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"description\": \"\",\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"ipaddress_count\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"prefix_count\": 0,\n \"rack_count\": 0,\n \"site_count\": 0,\n \"slug\": \"\",\n \"tags\": [],\n \"virtualmachine_count\": 0,\n \"vlan_count\": 0,\n \"vrf_count\": 0\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}}/tenancy/tenants/:id/";
let payload = json!({
"circuit_count": 0,
"cluster_count": 0,
"comments": "",
"created": "",
"custom_fields": json!({}),
"description": "",
"device_count": 0,
"group": 0,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rack_count": 0,
"site_count": 0,
"slug": "",
"tags": (),
"virtualmachine_count": 0,
"vlan_count": 0,
"vrf_count": 0
});
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}}/tenancy/tenants/:id/ \
--header 'content-type: application/json' \
--data '{
"circuit_count": 0,
"cluster_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"group": 0,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rack_count": 0,
"site_count": 0,
"slug": "",
"tags": [],
"virtualmachine_count": 0,
"vlan_count": 0,
"vrf_count": 0
}'
echo '{
"circuit_count": 0,
"cluster_count": 0,
"comments": "",
"created": "",
"custom_fields": {},
"description": "",
"device_count": 0,
"group": 0,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rack_count": 0,
"site_count": 0,
"slug": "",
"tags": [],
"virtualmachine_count": 0,
"vlan_count": 0,
"vrf_count": 0
}' | \
http PUT {{baseUrl}}/tenancy/tenants/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "circuit_count": 0,\n "cluster_count": 0,\n "comments": "",\n "created": "",\n "custom_fields": {},\n "description": "",\n "device_count": 0,\n "group": 0,\n "id": 0,\n "ipaddress_count": 0,\n "last_updated": "",\n "name": "",\n "prefix_count": 0,\n "rack_count": 0,\n "site_count": 0,\n "slug": "",\n "tags": [],\n "virtualmachine_count": 0,\n "vlan_count": 0,\n "vrf_count": 0\n}' \
--output-document \
- {{baseUrl}}/tenancy/tenants/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"circuit_count": 0,
"cluster_count": 0,
"comments": "",
"created": "",
"custom_fields": [],
"description": "",
"device_count": 0,
"group": 0,
"id": 0,
"ipaddress_count": 0,
"last_updated": "",
"name": "",
"prefix_count": 0,
"rack_count": 0,
"site_count": 0,
"slug": "",
"tags": [],
"virtualmachine_count": 0,
"vlan_count": 0,
"vrf_count": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/tenancy/tenants/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
virtualization_cluster-groups_create
{{baseUrl}}/virtualization/cluster-groups/
BODY json
{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/virtualization/cluster-groups/");
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 \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/virtualization/cluster-groups/" {:content-type :json
:form-params {:cluster_count 0
:description ""
:id 0
:name ""
:slug ""}})
require "http/client"
url = "{{baseUrl}}/virtualization/cluster-groups/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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}}/virtualization/cluster-groups/"),
Content = new StringContent("{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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}}/virtualization/cluster-groups/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/virtualization/cluster-groups/"
payload := strings.NewReader("{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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/virtualization/cluster-groups/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 84
{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/virtualization/cluster-groups/")
.setHeader("content-type", "application/json")
.setBody("{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/virtualization/cluster-groups/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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 \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/virtualization/cluster-groups/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/virtualization/cluster-groups/")
.header("content-type", "application/json")
.body("{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}")
.asString();
const data = JSON.stringify({
cluster_count: 0,
description: '',
id: 0,
name: '',
slug: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/virtualization/cluster-groups/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/virtualization/cluster-groups/',
headers: {'content-type': 'application/json'},
data: {cluster_count: 0, description: '', id: 0, name: '', slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/virtualization/cluster-groups/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cluster_count":0,"description":"","id":0,"name":"","slug":""}'
};
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}}/virtualization/cluster-groups/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cluster_count": 0,\n "description": "",\n "id": 0,\n "name": "",\n "slug": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/virtualization/cluster-groups/")
.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/virtualization/cluster-groups/',
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({cluster_count: 0, description: '', id: 0, name: '', slug: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/virtualization/cluster-groups/',
headers: {'content-type': 'application/json'},
body: {cluster_count: 0, description: '', id: 0, name: '', slug: ''},
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}}/virtualization/cluster-groups/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cluster_count: 0,
description: '',
id: 0,
name: '',
slug: ''
});
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}}/virtualization/cluster-groups/',
headers: {'content-type': 'application/json'},
data: {cluster_count: 0, description: '', id: 0, name: '', slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/virtualization/cluster-groups/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cluster_count":0,"description":"","id":0,"name":"","slug":""}'
};
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 = @{ @"cluster_count": @0,
@"description": @"",
@"id": @0,
@"name": @"",
@"slug": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/virtualization/cluster-groups/"]
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}}/virtualization/cluster-groups/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/virtualization/cluster-groups/",
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([
'cluster_count' => 0,
'description' => '',
'id' => 0,
'name' => '',
'slug' => ''
]),
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}}/virtualization/cluster-groups/', [
'body' => '{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/virtualization/cluster-groups/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cluster_count' => 0,
'description' => '',
'id' => 0,
'name' => '',
'slug' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cluster_count' => 0,
'description' => '',
'id' => 0,
'name' => '',
'slug' => ''
]));
$request->setRequestUrl('{{baseUrl}}/virtualization/cluster-groups/');
$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}}/virtualization/cluster-groups/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/virtualization/cluster-groups/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/virtualization/cluster-groups/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/virtualization/cluster-groups/"
payload = {
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/virtualization/cluster-groups/"
payload <- "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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}}/virtualization/cluster-groups/")
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 \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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/virtualization/cluster-groups/') do |req|
req.body = "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/virtualization/cluster-groups/";
let payload = json!({
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
});
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}}/virtualization/cluster-groups/ \
--header 'content-type: application/json' \
--data '{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}'
echo '{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}' | \
http POST {{baseUrl}}/virtualization/cluster-groups/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "cluster_count": 0,\n "description": "",\n "id": 0,\n "name": "",\n "slug": ""\n}' \
--output-document \
- {{baseUrl}}/virtualization/cluster-groups/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/virtualization/cluster-groups/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
virtualization_cluster-groups_delete
{{baseUrl}}/virtualization/cluster-groups/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/virtualization/cluster-groups/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/virtualization/cluster-groups/:id/")
require "http/client"
url = "{{baseUrl}}/virtualization/cluster-groups/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/virtualization/cluster-groups/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/virtualization/cluster-groups/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/virtualization/cluster-groups/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/virtualization/cluster-groups/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/virtualization/cluster-groups/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/virtualization/cluster-groups/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/virtualization/cluster-groups/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/virtualization/cluster-groups/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/virtualization/cluster-groups/:id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/virtualization/cluster-groups/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/virtualization/cluster-groups/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/virtualization/cluster-groups/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/virtualization/cluster-groups/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/virtualization/cluster-groups/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/virtualization/cluster-groups/:id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/virtualization/cluster-groups/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/virtualization/cluster-groups/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/virtualization/cluster-groups/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/virtualization/cluster-groups/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/virtualization/cluster-groups/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/virtualization/cluster-groups/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/virtualization/cluster-groups/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/virtualization/cluster-groups/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/virtualization/cluster-groups/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/virtualization/cluster-groups/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/virtualization/cluster-groups/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/virtualization/cluster-groups/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/virtualization/cluster-groups/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/virtualization/cluster-groups/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/virtualization/cluster-groups/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/virtualization/cluster-groups/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/virtualization/cluster-groups/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/virtualization/cluster-groups/:id/
http DELETE {{baseUrl}}/virtualization/cluster-groups/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/virtualization/cluster-groups/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/virtualization/cluster-groups/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
virtualization_cluster-groups_list
{{baseUrl}}/virtualization/cluster-groups/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/virtualization/cluster-groups/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/virtualization/cluster-groups/")
require "http/client"
url = "{{baseUrl}}/virtualization/cluster-groups/"
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}}/virtualization/cluster-groups/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/virtualization/cluster-groups/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/virtualization/cluster-groups/"
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/virtualization/cluster-groups/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/virtualization/cluster-groups/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/virtualization/cluster-groups/"))
.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}}/virtualization/cluster-groups/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/virtualization/cluster-groups/")
.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}}/virtualization/cluster-groups/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/virtualization/cluster-groups/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/virtualization/cluster-groups/';
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}}/virtualization/cluster-groups/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/virtualization/cluster-groups/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/virtualization/cluster-groups/',
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}}/virtualization/cluster-groups/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/virtualization/cluster-groups/');
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}}/virtualization/cluster-groups/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/virtualization/cluster-groups/';
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}}/virtualization/cluster-groups/"]
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}}/virtualization/cluster-groups/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/virtualization/cluster-groups/",
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}}/virtualization/cluster-groups/');
echo $response->getBody();
setUrl('{{baseUrl}}/virtualization/cluster-groups/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/virtualization/cluster-groups/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/virtualization/cluster-groups/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/virtualization/cluster-groups/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/virtualization/cluster-groups/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/virtualization/cluster-groups/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/virtualization/cluster-groups/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/virtualization/cluster-groups/")
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/virtualization/cluster-groups/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/virtualization/cluster-groups/";
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}}/virtualization/cluster-groups/
http GET {{baseUrl}}/virtualization/cluster-groups/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/virtualization/cluster-groups/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/virtualization/cluster-groups/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
virtualization_cluster-groups_partial_update
{{baseUrl}}/virtualization/cluster-groups/:id/
BODY json
{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/virtualization/cluster-groups/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/virtualization/cluster-groups/:id/" {:content-type :json
:form-params {:cluster_count 0
:description ""
:id 0
:name ""
:slug ""}})
require "http/client"
url = "{{baseUrl}}/virtualization/cluster-groups/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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}}/virtualization/cluster-groups/:id/"),
Content = new StringContent("{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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}}/virtualization/cluster-groups/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/virtualization/cluster-groups/:id/"
payload := strings.NewReader("{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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/virtualization/cluster-groups/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 84
{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/virtualization/cluster-groups/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/virtualization/cluster-groups/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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 \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/virtualization/cluster-groups/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/virtualization/cluster-groups/:id/")
.header("content-type", "application/json")
.body("{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}")
.asString();
const data = JSON.stringify({
cluster_count: 0,
description: '',
id: 0,
name: '',
slug: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/virtualization/cluster-groups/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/virtualization/cluster-groups/:id/',
headers: {'content-type': 'application/json'},
data: {cluster_count: 0, description: '', id: 0, name: '', slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/virtualization/cluster-groups/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"cluster_count":0,"description":"","id":0,"name":"","slug":""}'
};
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}}/virtualization/cluster-groups/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cluster_count": 0,\n "description": "",\n "id": 0,\n "name": "",\n "slug": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/virtualization/cluster-groups/:id/")
.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/virtualization/cluster-groups/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({cluster_count: 0, description: '', id: 0, name: '', slug: ''}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/virtualization/cluster-groups/:id/',
headers: {'content-type': 'application/json'},
body: {cluster_count: 0, description: '', id: 0, name: '', slug: ''},
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}}/virtualization/cluster-groups/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cluster_count: 0,
description: '',
id: 0,
name: '',
slug: ''
});
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}}/virtualization/cluster-groups/:id/',
headers: {'content-type': 'application/json'},
data: {cluster_count: 0, description: '', id: 0, name: '', slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/virtualization/cluster-groups/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"cluster_count":0,"description":"","id":0,"name":"","slug":""}'
};
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 = @{ @"cluster_count": @0,
@"description": @"",
@"id": @0,
@"name": @"",
@"slug": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/virtualization/cluster-groups/:id/"]
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}}/virtualization/cluster-groups/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/virtualization/cluster-groups/:id/",
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([
'cluster_count' => 0,
'description' => '',
'id' => 0,
'name' => '',
'slug' => ''
]),
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}}/virtualization/cluster-groups/:id/', [
'body' => '{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/virtualization/cluster-groups/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cluster_count' => 0,
'description' => '',
'id' => 0,
'name' => '',
'slug' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cluster_count' => 0,
'description' => '',
'id' => 0,
'name' => '',
'slug' => ''
]));
$request->setRequestUrl('{{baseUrl}}/virtualization/cluster-groups/:id/');
$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}}/virtualization/cluster-groups/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/virtualization/cluster-groups/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/virtualization/cluster-groups/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/virtualization/cluster-groups/:id/"
payload = {
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/virtualization/cluster-groups/:id/"
payload <- "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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}}/virtualization/cluster-groups/:id/")
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 \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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/virtualization/cluster-groups/:id/') do |req|
req.body = "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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}}/virtualization/cluster-groups/:id/";
let payload = json!({
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
});
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}}/virtualization/cluster-groups/:id/ \
--header 'content-type: application/json' \
--data '{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}'
echo '{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}' | \
http PATCH {{baseUrl}}/virtualization/cluster-groups/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "cluster_count": 0,\n "description": "",\n "id": 0,\n "name": "",\n "slug": ""\n}' \
--output-document \
- {{baseUrl}}/virtualization/cluster-groups/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/virtualization/cluster-groups/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
virtualization_cluster-groups_read
{{baseUrl}}/virtualization/cluster-groups/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/virtualization/cluster-groups/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/virtualization/cluster-groups/:id/")
require "http/client"
url = "{{baseUrl}}/virtualization/cluster-groups/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/virtualization/cluster-groups/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/virtualization/cluster-groups/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/virtualization/cluster-groups/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/virtualization/cluster-groups/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/virtualization/cluster-groups/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/virtualization/cluster-groups/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/virtualization/cluster-groups/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/virtualization/cluster-groups/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/virtualization/cluster-groups/:id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/virtualization/cluster-groups/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/virtualization/cluster-groups/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/virtualization/cluster-groups/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/virtualization/cluster-groups/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/virtualization/cluster-groups/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/virtualization/cluster-groups/:id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/virtualization/cluster-groups/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/virtualization/cluster-groups/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/virtualization/cluster-groups/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/virtualization/cluster-groups/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/virtualization/cluster-groups/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/virtualization/cluster-groups/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/virtualization/cluster-groups/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/virtualization/cluster-groups/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/virtualization/cluster-groups/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/virtualization/cluster-groups/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/virtualization/cluster-groups/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/virtualization/cluster-groups/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/virtualization/cluster-groups/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/virtualization/cluster-groups/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/virtualization/cluster-groups/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/virtualization/cluster-groups/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/virtualization/cluster-groups/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/virtualization/cluster-groups/:id/
http GET {{baseUrl}}/virtualization/cluster-groups/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/virtualization/cluster-groups/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/virtualization/cluster-groups/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
virtualization_cluster-groups_update
{{baseUrl}}/virtualization/cluster-groups/:id/
BODY json
{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/virtualization/cluster-groups/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/virtualization/cluster-groups/:id/" {:content-type :json
:form-params {:cluster_count 0
:description ""
:id 0
:name ""
:slug ""}})
require "http/client"
url = "{{baseUrl}}/virtualization/cluster-groups/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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}}/virtualization/cluster-groups/:id/"),
Content = new StringContent("{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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}}/virtualization/cluster-groups/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/virtualization/cluster-groups/:id/"
payload := strings.NewReader("{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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/virtualization/cluster-groups/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 84
{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/virtualization/cluster-groups/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/virtualization/cluster-groups/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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 \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/virtualization/cluster-groups/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/virtualization/cluster-groups/:id/")
.header("content-type", "application/json")
.body("{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}")
.asString();
const data = JSON.stringify({
cluster_count: 0,
description: '',
id: 0,
name: '',
slug: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/virtualization/cluster-groups/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/virtualization/cluster-groups/:id/',
headers: {'content-type': 'application/json'},
data: {cluster_count: 0, description: '', id: 0, name: '', slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/virtualization/cluster-groups/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"cluster_count":0,"description":"","id":0,"name":"","slug":""}'
};
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}}/virtualization/cluster-groups/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cluster_count": 0,\n "description": "",\n "id": 0,\n "name": "",\n "slug": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/virtualization/cluster-groups/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/virtualization/cluster-groups/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({cluster_count: 0, description: '', id: 0, name: '', slug: ''}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/virtualization/cluster-groups/:id/',
headers: {'content-type': 'application/json'},
body: {cluster_count: 0, description: '', id: 0, name: '', slug: ''},
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}}/virtualization/cluster-groups/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cluster_count: 0,
description: '',
id: 0,
name: '',
slug: ''
});
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}}/virtualization/cluster-groups/:id/',
headers: {'content-type': 'application/json'},
data: {cluster_count: 0, description: '', id: 0, name: '', slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/virtualization/cluster-groups/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"cluster_count":0,"description":"","id":0,"name":"","slug":""}'
};
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 = @{ @"cluster_count": @0,
@"description": @"",
@"id": @0,
@"name": @"",
@"slug": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/virtualization/cluster-groups/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/virtualization/cluster-groups/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/virtualization/cluster-groups/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'cluster_count' => 0,
'description' => '',
'id' => 0,
'name' => '',
'slug' => ''
]),
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}}/virtualization/cluster-groups/:id/', [
'body' => '{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/virtualization/cluster-groups/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cluster_count' => 0,
'description' => '',
'id' => 0,
'name' => '',
'slug' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cluster_count' => 0,
'description' => '',
'id' => 0,
'name' => '',
'slug' => ''
]));
$request->setRequestUrl('{{baseUrl}}/virtualization/cluster-groups/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/virtualization/cluster-groups/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/virtualization/cluster-groups/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/virtualization/cluster-groups/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/virtualization/cluster-groups/:id/"
payload = {
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/virtualization/cluster-groups/:id/"
payload <- "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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}}/virtualization/cluster-groups/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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/virtualization/cluster-groups/:id/') do |req|
req.body = "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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}}/virtualization/cluster-groups/:id/";
let payload = json!({
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
});
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}}/virtualization/cluster-groups/:id/ \
--header 'content-type: application/json' \
--data '{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}'
echo '{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}' | \
http PUT {{baseUrl}}/virtualization/cluster-groups/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "cluster_count": 0,\n "description": "",\n "id": 0,\n "name": "",\n "slug": ""\n}' \
--output-document \
- {{baseUrl}}/virtualization/cluster-groups/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/virtualization/cluster-groups/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
virtualization_cluster-types_create
{{baseUrl}}/virtualization/cluster-types/
BODY json
{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/virtualization/cluster-types/");
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 \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/virtualization/cluster-types/" {:content-type :json
:form-params {:cluster_count 0
:description ""
:id 0
:name ""
:slug ""}})
require "http/client"
url = "{{baseUrl}}/virtualization/cluster-types/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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}}/virtualization/cluster-types/"),
Content = new StringContent("{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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}}/virtualization/cluster-types/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/virtualization/cluster-types/"
payload := strings.NewReader("{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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/virtualization/cluster-types/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 84
{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/virtualization/cluster-types/")
.setHeader("content-type", "application/json")
.setBody("{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/virtualization/cluster-types/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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 \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/virtualization/cluster-types/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/virtualization/cluster-types/")
.header("content-type", "application/json")
.body("{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}")
.asString();
const data = JSON.stringify({
cluster_count: 0,
description: '',
id: 0,
name: '',
slug: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/virtualization/cluster-types/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/virtualization/cluster-types/',
headers: {'content-type': 'application/json'},
data: {cluster_count: 0, description: '', id: 0, name: '', slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/virtualization/cluster-types/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cluster_count":0,"description":"","id":0,"name":"","slug":""}'
};
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}}/virtualization/cluster-types/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cluster_count": 0,\n "description": "",\n "id": 0,\n "name": "",\n "slug": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/virtualization/cluster-types/")
.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/virtualization/cluster-types/',
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({cluster_count: 0, description: '', id: 0, name: '', slug: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/virtualization/cluster-types/',
headers: {'content-type': 'application/json'},
body: {cluster_count: 0, description: '', id: 0, name: '', slug: ''},
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}}/virtualization/cluster-types/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cluster_count: 0,
description: '',
id: 0,
name: '',
slug: ''
});
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}}/virtualization/cluster-types/',
headers: {'content-type': 'application/json'},
data: {cluster_count: 0, description: '', id: 0, name: '', slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/virtualization/cluster-types/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cluster_count":0,"description":"","id":0,"name":"","slug":""}'
};
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 = @{ @"cluster_count": @0,
@"description": @"",
@"id": @0,
@"name": @"",
@"slug": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/virtualization/cluster-types/"]
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}}/virtualization/cluster-types/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/virtualization/cluster-types/",
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([
'cluster_count' => 0,
'description' => '',
'id' => 0,
'name' => '',
'slug' => ''
]),
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}}/virtualization/cluster-types/', [
'body' => '{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/virtualization/cluster-types/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cluster_count' => 0,
'description' => '',
'id' => 0,
'name' => '',
'slug' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cluster_count' => 0,
'description' => '',
'id' => 0,
'name' => '',
'slug' => ''
]));
$request->setRequestUrl('{{baseUrl}}/virtualization/cluster-types/');
$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}}/virtualization/cluster-types/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/virtualization/cluster-types/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/virtualization/cluster-types/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/virtualization/cluster-types/"
payload = {
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/virtualization/cluster-types/"
payload <- "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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}}/virtualization/cluster-types/")
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 \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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/virtualization/cluster-types/') do |req|
req.body = "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/virtualization/cluster-types/";
let payload = json!({
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
});
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}}/virtualization/cluster-types/ \
--header 'content-type: application/json' \
--data '{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}'
echo '{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}' | \
http POST {{baseUrl}}/virtualization/cluster-types/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "cluster_count": 0,\n "description": "",\n "id": 0,\n "name": "",\n "slug": ""\n}' \
--output-document \
- {{baseUrl}}/virtualization/cluster-types/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/virtualization/cluster-types/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
virtualization_cluster-types_delete
{{baseUrl}}/virtualization/cluster-types/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/virtualization/cluster-types/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/virtualization/cluster-types/:id/")
require "http/client"
url = "{{baseUrl}}/virtualization/cluster-types/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/virtualization/cluster-types/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/virtualization/cluster-types/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/virtualization/cluster-types/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/virtualization/cluster-types/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/virtualization/cluster-types/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/virtualization/cluster-types/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/virtualization/cluster-types/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/virtualization/cluster-types/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/virtualization/cluster-types/:id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/virtualization/cluster-types/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/virtualization/cluster-types/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/virtualization/cluster-types/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/virtualization/cluster-types/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/virtualization/cluster-types/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/virtualization/cluster-types/:id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/virtualization/cluster-types/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/virtualization/cluster-types/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/virtualization/cluster-types/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/virtualization/cluster-types/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/virtualization/cluster-types/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/virtualization/cluster-types/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/virtualization/cluster-types/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/virtualization/cluster-types/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/virtualization/cluster-types/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/virtualization/cluster-types/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/virtualization/cluster-types/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/virtualization/cluster-types/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/virtualization/cluster-types/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/virtualization/cluster-types/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/virtualization/cluster-types/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/virtualization/cluster-types/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/virtualization/cluster-types/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/virtualization/cluster-types/:id/
http DELETE {{baseUrl}}/virtualization/cluster-types/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/virtualization/cluster-types/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/virtualization/cluster-types/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
virtualization_cluster-types_list
{{baseUrl}}/virtualization/cluster-types/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/virtualization/cluster-types/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/virtualization/cluster-types/")
require "http/client"
url = "{{baseUrl}}/virtualization/cluster-types/"
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}}/virtualization/cluster-types/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/virtualization/cluster-types/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/virtualization/cluster-types/"
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/virtualization/cluster-types/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/virtualization/cluster-types/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/virtualization/cluster-types/"))
.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}}/virtualization/cluster-types/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/virtualization/cluster-types/")
.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}}/virtualization/cluster-types/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/virtualization/cluster-types/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/virtualization/cluster-types/';
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}}/virtualization/cluster-types/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/virtualization/cluster-types/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/virtualization/cluster-types/',
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}}/virtualization/cluster-types/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/virtualization/cluster-types/');
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}}/virtualization/cluster-types/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/virtualization/cluster-types/';
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}}/virtualization/cluster-types/"]
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}}/virtualization/cluster-types/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/virtualization/cluster-types/",
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}}/virtualization/cluster-types/');
echo $response->getBody();
setUrl('{{baseUrl}}/virtualization/cluster-types/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/virtualization/cluster-types/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/virtualization/cluster-types/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/virtualization/cluster-types/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/virtualization/cluster-types/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/virtualization/cluster-types/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/virtualization/cluster-types/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/virtualization/cluster-types/")
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/virtualization/cluster-types/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/virtualization/cluster-types/";
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}}/virtualization/cluster-types/
http GET {{baseUrl}}/virtualization/cluster-types/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/virtualization/cluster-types/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/virtualization/cluster-types/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
virtualization_cluster-types_partial_update
{{baseUrl}}/virtualization/cluster-types/:id/
BODY json
{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/virtualization/cluster-types/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/virtualization/cluster-types/:id/" {:content-type :json
:form-params {:cluster_count 0
:description ""
:id 0
:name ""
:slug ""}})
require "http/client"
url = "{{baseUrl}}/virtualization/cluster-types/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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}}/virtualization/cluster-types/:id/"),
Content = new StringContent("{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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}}/virtualization/cluster-types/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/virtualization/cluster-types/:id/"
payload := strings.NewReader("{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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/virtualization/cluster-types/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 84
{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/virtualization/cluster-types/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/virtualization/cluster-types/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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 \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/virtualization/cluster-types/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/virtualization/cluster-types/:id/")
.header("content-type", "application/json")
.body("{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}")
.asString();
const data = JSON.stringify({
cluster_count: 0,
description: '',
id: 0,
name: '',
slug: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/virtualization/cluster-types/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/virtualization/cluster-types/:id/',
headers: {'content-type': 'application/json'},
data: {cluster_count: 0, description: '', id: 0, name: '', slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/virtualization/cluster-types/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"cluster_count":0,"description":"","id":0,"name":"","slug":""}'
};
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}}/virtualization/cluster-types/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cluster_count": 0,\n "description": "",\n "id": 0,\n "name": "",\n "slug": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/virtualization/cluster-types/:id/")
.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/virtualization/cluster-types/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({cluster_count: 0, description: '', id: 0, name: '', slug: ''}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/virtualization/cluster-types/:id/',
headers: {'content-type': 'application/json'},
body: {cluster_count: 0, description: '', id: 0, name: '', slug: ''},
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}}/virtualization/cluster-types/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cluster_count: 0,
description: '',
id: 0,
name: '',
slug: ''
});
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}}/virtualization/cluster-types/:id/',
headers: {'content-type': 'application/json'},
data: {cluster_count: 0, description: '', id: 0, name: '', slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/virtualization/cluster-types/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"cluster_count":0,"description":"","id":0,"name":"","slug":""}'
};
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 = @{ @"cluster_count": @0,
@"description": @"",
@"id": @0,
@"name": @"",
@"slug": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/virtualization/cluster-types/:id/"]
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}}/virtualization/cluster-types/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/virtualization/cluster-types/:id/",
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([
'cluster_count' => 0,
'description' => '',
'id' => 0,
'name' => '',
'slug' => ''
]),
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}}/virtualization/cluster-types/:id/', [
'body' => '{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/virtualization/cluster-types/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cluster_count' => 0,
'description' => '',
'id' => 0,
'name' => '',
'slug' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cluster_count' => 0,
'description' => '',
'id' => 0,
'name' => '',
'slug' => ''
]));
$request->setRequestUrl('{{baseUrl}}/virtualization/cluster-types/:id/');
$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}}/virtualization/cluster-types/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/virtualization/cluster-types/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/virtualization/cluster-types/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/virtualization/cluster-types/:id/"
payload = {
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/virtualization/cluster-types/:id/"
payload <- "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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}}/virtualization/cluster-types/:id/")
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 \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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/virtualization/cluster-types/:id/') do |req|
req.body = "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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}}/virtualization/cluster-types/:id/";
let payload = json!({
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
});
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}}/virtualization/cluster-types/:id/ \
--header 'content-type: application/json' \
--data '{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}'
echo '{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}' | \
http PATCH {{baseUrl}}/virtualization/cluster-types/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "cluster_count": 0,\n "description": "",\n "id": 0,\n "name": "",\n "slug": ""\n}' \
--output-document \
- {{baseUrl}}/virtualization/cluster-types/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/virtualization/cluster-types/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
virtualization_cluster-types_read
{{baseUrl}}/virtualization/cluster-types/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/virtualization/cluster-types/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/virtualization/cluster-types/:id/")
require "http/client"
url = "{{baseUrl}}/virtualization/cluster-types/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/virtualization/cluster-types/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/virtualization/cluster-types/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/virtualization/cluster-types/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/virtualization/cluster-types/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/virtualization/cluster-types/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/virtualization/cluster-types/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/virtualization/cluster-types/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/virtualization/cluster-types/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/virtualization/cluster-types/:id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/virtualization/cluster-types/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/virtualization/cluster-types/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/virtualization/cluster-types/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/virtualization/cluster-types/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/virtualization/cluster-types/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/virtualization/cluster-types/:id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/virtualization/cluster-types/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/virtualization/cluster-types/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/virtualization/cluster-types/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/virtualization/cluster-types/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/virtualization/cluster-types/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/virtualization/cluster-types/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/virtualization/cluster-types/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/virtualization/cluster-types/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/virtualization/cluster-types/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/virtualization/cluster-types/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/virtualization/cluster-types/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/virtualization/cluster-types/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/virtualization/cluster-types/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/virtualization/cluster-types/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/virtualization/cluster-types/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/virtualization/cluster-types/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/virtualization/cluster-types/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/virtualization/cluster-types/:id/
http GET {{baseUrl}}/virtualization/cluster-types/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/virtualization/cluster-types/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/virtualization/cluster-types/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
virtualization_cluster-types_update
{{baseUrl}}/virtualization/cluster-types/:id/
BODY json
{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/virtualization/cluster-types/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/virtualization/cluster-types/:id/" {:content-type :json
:form-params {:cluster_count 0
:description ""
:id 0
:name ""
:slug ""}})
require "http/client"
url = "{{baseUrl}}/virtualization/cluster-types/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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}}/virtualization/cluster-types/:id/"),
Content = new StringContent("{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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}}/virtualization/cluster-types/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/virtualization/cluster-types/:id/"
payload := strings.NewReader("{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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/virtualization/cluster-types/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 84
{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/virtualization/cluster-types/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/virtualization/cluster-types/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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 \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/virtualization/cluster-types/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/virtualization/cluster-types/:id/")
.header("content-type", "application/json")
.body("{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}")
.asString();
const data = JSON.stringify({
cluster_count: 0,
description: '',
id: 0,
name: '',
slug: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/virtualization/cluster-types/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/virtualization/cluster-types/:id/',
headers: {'content-type': 'application/json'},
data: {cluster_count: 0, description: '', id: 0, name: '', slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/virtualization/cluster-types/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"cluster_count":0,"description":"","id":0,"name":"","slug":""}'
};
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}}/virtualization/cluster-types/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cluster_count": 0,\n "description": "",\n "id": 0,\n "name": "",\n "slug": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/virtualization/cluster-types/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/virtualization/cluster-types/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({cluster_count: 0, description: '', id: 0, name: '', slug: ''}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/virtualization/cluster-types/:id/',
headers: {'content-type': 'application/json'},
body: {cluster_count: 0, description: '', id: 0, name: '', slug: ''},
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}}/virtualization/cluster-types/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cluster_count: 0,
description: '',
id: 0,
name: '',
slug: ''
});
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}}/virtualization/cluster-types/:id/',
headers: {'content-type': 'application/json'},
data: {cluster_count: 0, description: '', id: 0, name: '', slug: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/virtualization/cluster-types/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"cluster_count":0,"description":"","id":0,"name":"","slug":""}'
};
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 = @{ @"cluster_count": @0,
@"description": @"",
@"id": @0,
@"name": @"",
@"slug": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/virtualization/cluster-types/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/virtualization/cluster-types/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/virtualization/cluster-types/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'cluster_count' => 0,
'description' => '',
'id' => 0,
'name' => '',
'slug' => ''
]),
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}}/virtualization/cluster-types/:id/', [
'body' => '{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/virtualization/cluster-types/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cluster_count' => 0,
'description' => '',
'id' => 0,
'name' => '',
'slug' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cluster_count' => 0,
'description' => '',
'id' => 0,
'name' => '',
'slug' => ''
]));
$request->setRequestUrl('{{baseUrl}}/virtualization/cluster-types/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/virtualization/cluster-types/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/virtualization/cluster-types/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/virtualization/cluster-types/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/virtualization/cluster-types/:id/"
payload = {
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/virtualization/cluster-types/:id/"
payload <- "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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}}/virtualization/cluster-types/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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/virtualization/cluster-types/:id/') do |req|
req.body = "{\n \"cluster_count\": 0,\n \"description\": \"\",\n \"id\": 0,\n \"name\": \"\",\n \"slug\": \"\"\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}}/virtualization/cluster-types/:id/";
let payload = json!({
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
});
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}}/virtualization/cluster-types/:id/ \
--header 'content-type: application/json' \
--data '{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}'
echo '{
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
}' | \
http PUT {{baseUrl}}/virtualization/cluster-types/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "cluster_count": 0,\n "description": "",\n "id": 0,\n "name": "",\n "slug": ""\n}' \
--output-document \
- {{baseUrl}}/virtualization/cluster-types/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cluster_count": 0,
"description": "",
"id": 0,
"name": "",
"slug": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/virtualization/cluster-types/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
virtualization_clusters_create
{{baseUrl}}/virtualization/clusters/
BODY json
{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"site": 0,
"tags": [],
"tenant": 0,
"type": 0,
"virtualmachine_count": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/virtualization/clusters/");
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 \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/virtualization/clusters/" {:content-type :json
:form-params {:comments ""
:created ""
:custom_fields {}
:device_count 0
:group 0
:id 0
:last_updated ""
:name ""
:site 0
:tags []
:tenant 0
:type 0
:virtualmachine_count 0}})
require "http/client"
url = "{{baseUrl}}/virtualization/clusters/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/virtualization/clusters/"),
Content = new StringContent("{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/virtualization/clusters/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/virtualization/clusters/"
payload := strings.NewReader("{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/virtualization/clusters/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 226
{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"site": 0,
"tags": [],
"tenant": 0,
"type": 0,
"virtualmachine_count": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/virtualization/clusters/")
.setHeader("content-type", "application/json")
.setBody("{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/virtualization/clusters/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/virtualization/clusters/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/virtualization/clusters/")
.header("content-type", "application/json")
.body("{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\n}")
.asString();
const data = JSON.stringify({
comments: '',
created: '',
custom_fields: {},
device_count: 0,
group: 0,
id: 0,
last_updated: '',
name: '',
site: 0,
tags: [],
tenant: 0,
type: 0,
virtualmachine_count: 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}}/virtualization/clusters/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/virtualization/clusters/',
headers: {'content-type': 'application/json'},
data: {
comments: '',
created: '',
custom_fields: {},
device_count: 0,
group: 0,
id: 0,
last_updated: '',
name: '',
site: 0,
tags: [],
tenant: 0,
type: 0,
virtualmachine_count: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/virtualization/clusters/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"comments":"","created":"","custom_fields":{},"device_count":0,"group":0,"id":0,"last_updated":"","name":"","site":0,"tags":[],"tenant":0,"type":0,"virtualmachine_count":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}}/virtualization/clusters/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "comments": "",\n "created": "",\n "custom_fields": {},\n "device_count": 0,\n "group": 0,\n "id": 0,\n "last_updated": "",\n "name": "",\n "site": 0,\n "tags": [],\n "tenant": 0,\n "type": 0,\n "virtualmachine_count": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/virtualization/clusters/")
.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/virtualization/clusters/',
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({
comments: '',
created: '',
custom_fields: {},
device_count: 0,
group: 0,
id: 0,
last_updated: '',
name: '',
site: 0,
tags: [],
tenant: 0,
type: 0,
virtualmachine_count: 0
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/virtualization/clusters/',
headers: {'content-type': 'application/json'},
body: {
comments: '',
created: '',
custom_fields: {},
device_count: 0,
group: 0,
id: 0,
last_updated: '',
name: '',
site: 0,
tags: [],
tenant: 0,
type: 0,
virtualmachine_count: 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}}/virtualization/clusters/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
comments: '',
created: '',
custom_fields: {},
device_count: 0,
group: 0,
id: 0,
last_updated: '',
name: '',
site: 0,
tags: [],
tenant: 0,
type: 0,
virtualmachine_count: 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}}/virtualization/clusters/',
headers: {'content-type': 'application/json'},
data: {
comments: '',
created: '',
custom_fields: {},
device_count: 0,
group: 0,
id: 0,
last_updated: '',
name: '',
site: 0,
tags: [],
tenant: 0,
type: 0,
virtualmachine_count: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/virtualization/clusters/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"comments":"","created":"","custom_fields":{},"device_count":0,"group":0,"id":0,"last_updated":"","name":"","site":0,"tags":[],"tenant":0,"type":0,"virtualmachine_count":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 = @{ @"comments": @"",
@"created": @"",
@"custom_fields": @{ },
@"device_count": @0,
@"group": @0,
@"id": @0,
@"last_updated": @"",
@"name": @"",
@"site": @0,
@"tags": @[ ],
@"tenant": @0,
@"type": @0,
@"virtualmachine_count": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/virtualization/clusters/"]
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}}/virtualization/clusters/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/virtualization/clusters/",
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([
'comments' => '',
'created' => '',
'custom_fields' => [
],
'device_count' => 0,
'group' => 0,
'id' => 0,
'last_updated' => '',
'name' => '',
'site' => 0,
'tags' => [
],
'tenant' => 0,
'type' => 0,
'virtualmachine_count' => 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}}/virtualization/clusters/', [
'body' => '{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"site": 0,
"tags": [],
"tenant": 0,
"type": 0,
"virtualmachine_count": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/virtualization/clusters/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'comments' => '',
'created' => '',
'custom_fields' => [
],
'device_count' => 0,
'group' => 0,
'id' => 0,
'last_updated' => '',
'name' => '',
'site' => 0,
'tags' => [
],
'tenant' => 0,
'type' => 0,
'virtualmachine_count' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'comments' => '',
'created' => '',
'custom_fields' => [
],
'device_count' => 0,
'group' => 0,
'id' => 0,
'last_updated' => '',
'name' => '',
'site' => 0,
'tags' => [
],
'tenant' => 0,
'type' => 0,
'virtualmachine_count' => 0
]));
$request->setRequestUrl('{{baseUrl}}/virtualization/clusters/');
$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}}/virtualization/clusters/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"site": 0,
"tags": [],
"tenant": 0,
"type": 0,
"virtualmachine_count": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/virtualization/clusters/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"site": 0,
"tags": [],
"tenant": 0,
"type": 0,
"virtualmachine_count": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/virtualization/clusters/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/virtualization/clusters/"
payload = {
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"site": 0,
"tags": [],
"tenant": 0,
"type": 0,
"virtualmachine_count": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/virtualization/clusters/"
payload <- "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/virtualization/clusters/")
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 \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/virtualization/clusters/') do |req|
req.body = "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/virtualization/clusters/";
let payload = json!({
"comments": "",
"created": "",
"custom_fields": json!({}),
"device_count": 0,
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"site": 0,
"tags": (),
"tenant": 0,
"type": 0,
"virtualmachine_count": 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}}/virtualization/clusters/ \
--header 'content-type: application/json' \
--data '{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"site": 0,
"tags": [],
"tenant": 0,
"type": 0,
"virtualmachine_count": 0
}'
echo '{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"site": 0,
"tags": [],
"tenant": 0,
"type": 0,
"virtualmachine_count": 0
}' | \
http POST {{baseUrl}}/virtualization/clusters/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "comments": "",\n "created": "",\n "custom_fields": {},\n "device_count": 0,\n "group": 0,\n "id": 0,\n "last_updated": "",\n "name": "",\n "site": 0,\n "tags": [],\n "tenant": 0,\n "type": 0,\n "virtualmachine_count": 0\n}' \
--output-document \
- {{baseUrl}}/virtualization/clusters/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"comments": "",
"created": "",
"custom_fields": [],
"device_count": 0,
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"site": 0,
"tags": [],
"tenant": 0,
"type": 0,
"virtualmachine_count": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/virtualization/clusters/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
virtualization_clusters_delete
{{baseUrl}}/virtualization/clusters/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/virtualization/clusters/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/virtualization/clusters/:id/")
require "http/client"
url = "{{baseUrl}}/virtualization/clusters/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/virtualization/clusters/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/virtualization/clusters/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/virtualization/clusters/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/virtualization/clusters/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/virtualization/clusters/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/virtualization/clusters/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/virtualization/clusters/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/virtualization/clusters/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/virtualization/clusters/:id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/virtualization/clusters/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/virtualization/clusters/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/virtualization/clusters/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/virtualization/clusters/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/virtualization/clusters/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/virtualization/clusters/:id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/virtualization/clusters/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/virtualization/clusters/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/virtualization/clusters/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/virtualization/clusters/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/virtualization/clusters/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/virtualization/clusters/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/virtualization/clusters/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/virtualization/clusters/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/virtualization/clusters/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/virtualization/clusters/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/virtualization/clusters/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/virtualization/clusters/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/virtualization/clusters/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/virtualization/clusters/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/virtualization/clusters/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/virtualization/clusters/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/virtualization/clusters/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/virtualization/clusters/:id/
http DELETE {{baseUrl}}/virtualization/clusters/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/virtualization/clusters/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/virtualization/clusters/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
virtualization_clusters_list
{{baseUrl}}/virtualization/clusters/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/virtualization/clusters/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/virtualization/clusters/")
require "http/client"
url = "{{baseUrl}}/virtualization/clusters/"
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}}/virtualization/clusters/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/virtualization/clusters/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/virtualization/clusters/"
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/virtualization/clusters/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/virtualization/clusters/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/virtualization/clusters/"))
.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}}/virtualization/clusters/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/virtualization/clusters/")
.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}}/virtualization/clusters/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/virtualization/clusters/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/virtualization/clusters/';
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}}/virtualization/clusters/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/virtualization/clusters/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/virtualization/clusters/',
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}}/virtualization/clusters/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/virtualization/clusters/');
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}}/virtualization/clusters/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/virtualization/clusters/';
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}}/virtualization/clusters/"]
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}}/virtualization/clusters/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/virtualization/clusters/",
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}}/virtualization/clusters/');
echo $response->getBody();
setUrl('{{baseUrl}}/virtualization/clusters/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/virtualization/clusters/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/virtualization/clusters/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/virtualization/clusters/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/virtualization/clusters/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/virtualization/clusters/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/virtualization/clusters/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/virtualization/clusters/")
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/virtualization/clusters/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/virtualization/clusters/";
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}}/virtualization/clusters/
http GET {{baseUrl}}/virtualization/clusters/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/virtualization/clusters/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/virtualization/clusters/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
virtualization_clusters_partial_update
{{baseUrl}}/virtualization/clusters/:id/
BODY json
{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"site": 0,
"tags": [],
"tenant": 0,
"type": 0,
"virtualmachine_count": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/virtualization/clusters/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/virtualization/clusters/:id/" {:content-type :json
:form-params {:comments ""
:created ""
:custom_fields {}
:device_count 0
:group 0
:id 0
:last_updated ""
:name ""
:site 0
:tags []
:tenant 0
:type 0
:virtualmachine_count 0}})
require "http/client"
url = "{{baseUrl}}/virtualization/clusters/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\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}}/virtualization/clusters/:id/"),
Content = new StringContent("{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/virtualization/clusters/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/virtualization/clusters/:id/"
payload := strings.NewReader("{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\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/virtualization/clusters/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 226
{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"site": 0,
"tags": [],
"tenant": 0,
"type": 0,
"virtualmachine_count": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/virtualization/clusters/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/virtualization/clusters/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/virtualization/clusters/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/virtualization/clusters/:id/")
.header("content-type", "application/json")
.body("{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\n}")
.asString();
const data = JSON.stringify({
comments: '',
created: '',
custom_fields: {},
device_count: 0,
group: 0,
id: 0,
last_updated: '',
name: '',
site: 0,
tags: [],
tenant: 0,
type: 0,
virtualmachine_count: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/virtualization/clusters/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/virtualization/clusters/:id/',
headers: {'content-type': 'application/json'},
data: {
comments: '',
created: '',
custom_fields: {},
device_count: 0,
group: 0,
id: 0,
last_updated: '',
name: '',
site: 0,
tags: [],
tenant: 0,
type: 0,
virtualmachine_count: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/virtualization/clusters/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"comments":"","created":"","custom_fields":{},"device_count":0,"group":0,"id":0,"last_updated":"","name":"","site":0,"tags":[],"tenant":0,"type":0,"virtualmachine_count":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}}/virtualization/clusters/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "comments": "",\n "created": "",\n "custom_fields": {},\n "device_count": 0,\n "group": 0,\n "id": 0,\n "last_updated": "",\n "name": "",\n "site": 0,\n "tags": [],\n "tenant": 0,\n "type": 0,\n "virtualmachine_count": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/virtualization/clusters/:id/")
.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/virtualization/clusters/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
comments: '',
created: '',
custom_fields: {},
device_count: 0,
group: 0,
id: 0,
last_updated: '',
name: '',
site: 0,
tags: [],
tenant: 0,
type: 0,
virtualmachine_count: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/virtualization/clusters/:id/',
headers: {'content-type': 'application/json'},
body: {
comments: '',
created: '',
custom_fields: {},
device_count: 0,
group: 0,
id: 0,
last_updated: '',
name: '',
site: 0,
tags: [],
tenant: 0,
type: 0,
virtualmachine_count: 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('PATCH', '{{baseUrl}}/virtualization/clusters/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
comments: '',
created: '',
custom_fields: {},
device_count: 0,
group: 0,
id: 0,
last_updated: '',
name: '',
site: 0,
tags: [],
tenant: 0,
type: 0,
virtualmachine_count: 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: 'PATCH',
url: '{{baseUrl}}/virtualization/clusters/:id/',
headers: {'content-type': 'application/json'},
data: {
comments: '',
created: '',
custom_fields: {},
device_count: 0,
group: 0,
id: 0,
last_updated: '',
name: '',
site: 0,
tags: [],
tenant: 0,
type: 0,
virtualmachine_count: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/virtualization/clusters/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"comments":"","created":"","custom_fields":{},"device_count":0,"group":0,"id":0,"last_updated":"","name":"","site":0,"tags":[],"tenant":0,"type":0,"virtualmachine_count":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 = @{ @"comments": @"",
@"created": @"",
@"custom_fields": @{ },
@"device_count": @0,
@"group": @0,
@"id": @0,
@"last_updated": @"",
@"name": @"",
@"site": @0,
@"tags": @[ ],
@"tenant": @0,
@"type": @0,
@"virtualmachine_count": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/virtualization/clusters/:id/"]
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}}/virtualization/clusters/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/virtualization/clusters/:id/",
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([
'comments' => '',
'created' => '',
'custom_fields' => [
],
'device_count' => 0,
'group' => 0,
'id' => 0,
'last_updated' => '',
'name' => '',
'site' => 0,
'tags' => [
],
'tenant' => 0,
'type' => 0,
'virtualmachine_count' => 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('PATCH', '{{baseUrl}}/virtualization/clusters/:id/', [
'body' => '{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"site": 0,
"tags": [],
"tenant": 0,
"type": 0,
"virtualmachine_count": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/virtualization/clusters/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'comments' => '',
'created' => '',
'custom_fields' => [
],
'device_count' => 0,
'group' => 0,
'id' => 0,
'last_updated' => '',
'name' => '',
'site' => 0,
'tags' => [
],
'tenant' => 0,
'type' => 0,
'virtualmachine_count' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'comments' => '',
'created' => '',
'custom_fields' => [
],
'device_count' => 0,
'group' => 0,
'id' => 0,
'last_updated' => '',
'name' => '',
'site' => 0,
'tags' => [
],
'tenant' => 0,
'type' => 0,
'virtualmachine_count' => 0
]));
$request->setRequestUrl('{{baseUrl}}/virtualization/clusters/:id/');
$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}}/virtualization/clusters/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"site": 0,
"tags": [],
"tenant": 0,
"type": 0,
"virtualmachine_count": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/virtualization/clusters/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"site": 0,
"tags": [],
"tenant": 0,
"type": 0,
"virtualmachine_count": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/virtualization/clusters/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/virtualization/clusters/:id/"
payload = {
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"site": 0,
"tags": [],
"tenant": 0,
"type": 0,
"virtualmachine_count": 0
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/virtualization/clusters/:id/"
payload <- "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\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}}/virtualization/clusters/:id/")
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 \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/virtualization/clusters/:id/') do |req|
req.body = "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\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}}/virtualization/clusters/:id/";
let payload = json!({
"comments": "",
"created": "",
"custom_fields": json!({}),
"device_count": 0,
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"site": 0,
"tags": (),
"tenant": 0,
"type": 0,
"virtualmachine_count": 0
});
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}}/virtualization/clusters/:id/ \
--header 'content-type: application/json' \
--data '{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"site": 0,
"tags": [],
"tenant": 0,
"type": 0,
"virtualmachine_count": 0
}'
echo '{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"site": 0,
"tags": [],
"tenant": 0,
"type": 0,
"virtualmachine_count": 0
}' | \
http PATCH {{baseUrl}}/virtualization/clusters/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "comments": "",\n "created": "",\n "custom_fields": {},\n "device_count": 0,\n "group": 0,\n "id": 0,\n "last_updated": "",\n "name": "",\n "site": 0,\n "tags": [],\n "tenant": 0,\n "type": 0,\n "virtualmachine_count": 0\n}' \
--output-document \
- {{baseUrl}}/virtualization/clusters/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"comments": "",
"created": "",
"custom_fields": [],
"device_count": 0,
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"site": 0,
"tags": [],
"tenant": 0,
"type": 0,
"virtualmachine_count": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/virtualization/clusters/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
virtualization_clusters_read
{{baseUrl}}/virtualization/clusters/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/virtualization/clusters/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/virtualization/clusters/:id/")
require "http/client"
url = "{{baseUrl}}/virtualization/clusters/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/virtualization/clusters/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/virtualization/clusters/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/virtualization/clusters/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/virtualization/clusters/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/virtualization/clusters/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/virtualization/clusters/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/virtualization/clusters/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/virtualization/clusters/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/virtualization/clusters/:id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/virtualization/clusters/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/virtualization/clusters/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/virtualization/clusters/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/virtualization/clusters/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/virtualization/clusters/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/virtualization/clusters/:id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/virtualization/clusters/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/virtualization/clusters/:id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/virtualization/clusters/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/virtualization/clusters/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/virtualization/clusters/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/virtualization/clusters/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/virtualization/clusters/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/virtualization/clusters/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/virtualization/clusters/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/virtualization/clusters/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/virtualization/clusters/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/virtualization/clusters/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/virtualization/clusters/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/virtualization/clusters/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/virtualization/clusters/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/virtualization/clusters/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/virtualization/clusters/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/virtualization/clusters/:id/
http GET {{baseUrl}}/virtualization/clusters/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/virtualization/clusters/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/virtualization/clusters/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
virtualization_clusters_update
{{baseUrl}}/virtualization/clusters/:id/
BODY json
{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"site": 0,
"tags": [],
"tenant": 0,
"type": 0,
"virtualmachine_count": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/virtualization/clusters/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/virtualization/clusters/:id/" {:content-type :json
:form-params {:comments ""
:created ""
:custom_fields {}
:device_count 0
:group 0
:id 0
:last_updated ""
:name ""
:site 0
:tags []
:tenant 0
:type 0
:virtualmachine_count 0}})
require "http/client"
url = "{{baseUrl}}/virtualization/clusters/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\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}}/virtualization/clusters/:id/"),
Content = new StringContent("{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/virtualization/clusters/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/virtualization/clusters/:id/"
payload := strings.NewReader("{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\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/virtualization/clusters/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 226
{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"site": 0,
"tags": [],
"tenant": 0,
"type": 0,
"virtualmachine_count": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/virtualization/clusters/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/virtualization/clusters/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/virtualization/clusters/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/virtualization/clusters/:id/")
.header("content-type", "application/json")
.body("{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\n}")
.asString();
const data = JSON.stringify({
comments: '',
created: '',
custom_fields: {},
device_count: 0,
group: 0,
id: 0,
last_updated: '',
name: '',
site: 0,
tags: [],
tenant: 0,
type: 0,
virtualmachine_count: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/virtualization/clusters/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/virtualization/clusters/:id/',
headers: {'content-type': 'application/json'},
data: {
comments: '',
created: '',
custom_fields: {},
device_count: 0,
group: 0,
id: 0,
last_updated: '',
name: '',
site: 0,
tags: [],
tenant: 0,
type: 0,
virtualmachine_count: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/virtualization/clusters/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"comments":"","created":"","custom_fields":{},"device_count":0,"group":0,"id":0,"last_updated":"","name":"","site":0,"tags":[],"tenant":0,"type":0,"virtualmachine_count":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}}/virtualization/clusters/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "comments": "",\n "created": "",\n "custom_fields": {},\n "device_count": 0,\n "group": 0,\n "id": 0,\n "last_updated": "",\n "name": "",\n "site": 0,\n "tags": [],\n "tenant": 0,\n "type": 0,\n "virtualmachine_count": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/virtualization/clusters/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/virtualization/clusters/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
comments: '',
created: '',
custom_fields: {},
device_count: 0,
group: 0,
id: 0,
last_updated: '',
name: '',
site: 0,
tags: [],
tenant: 0,
type: 0,
virtualmachine_count: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/virtualization/clusters/:id/',
headers: {'content-type': 'application/json'},
body: {
comments: '',
created: '',
custom_fields: {},
device_count: 0,
group: 0,
id: 0,
last_updated: '',
name: '',
site: 0,
tags: [],
tenant: 0,
type: 0,
virtualmachine_count: 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('PUT', '{{baseUrl}}/virtualization/clusters/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
comments: '',
created: '',
custom_fields: {},
device_count: 0,
group: 0,
id: 0,
last_updated: '',
name: '',
site: 0,
tags: [],
tenant: 0,
type: 0,
virtualmachine_count: 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: 'PUT',
url: '{{baseUrl}}/virtualization/clusters/:id/',
headers: {'content-type': 'application/json'},
data: {
comments: '',
created: '',
custom_fields: {},
device_count: 0,
group: 0,
id: 0,
last_updated: '',
name: '',
site: 0,
tags: [],
tenant: 0,
type: 0,
virtualmachine_count: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/virtualization/clusters/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"comments":"","created":"","custom_fields":{},"device_count":0,"group":0,"id":0,"last_updated":"","name":"","site":0,"tags":[],"tenant":0,"type":0,"virtualmachine_count":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 = @{ @"comments": @"",
@"created": @"",
@"custom_fields": @{ },
@"device_count": @0,
@"group": @0,
@"id": @0,
@"last_updated": @"",
@"name": @"",
@"site": @0,
@"tags": @[ ],
@"tenant": @0,
@"type": @0,
@"virtualmachine_count": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/virtualization/clusters/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/virtualization/clusters/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/virtualization/clusters/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'comments' => '',
'created' => '',
'custom_fields' => [
],
'device_count' => 0,
'group' => 0,
'id' => 0,
'last_updated' => '',
'name' => '',
'site' => 0,
'tags' => [
],
'tenant' => 0,
'type' => 0,
'virtualmachine_count' => 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('PUT', '{{baseUrl}}/virtualization/clusters/:id/', [
'body' => '{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"site": 0,
"tags": [],
"tenant": 0,
"type": 0,
"virtualmachine_count": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/virtualization/clusters/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'comments' => '',
'created' => '',
'custom_fields' => [
],
'device_count' => 0,
'group' => 0,
'id' => 0,
'last_updated' => '',
'name' => '',
'site' => 0,
'tags' => [
],
'tenant' => 0,
'type' => 0,
'virtualmachine_count' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'comments' => '',
'created' => '',
'custom_fields' => [
],
'device_count' => 0,
'group' => 0,
'id' => 0,
'last_updated' => '',
'name' => '',
'site' => 0,
'tags' => [
],
'tenant' => 0,
'type' => 0,
'virtualmachine_count' => 0
]));
$request->setRequestUrl('{{baseUrl}}/virtualization/clusters/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/virtualization/clusters/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"site": 0,
"tags": [],
"tenant": 0,
"type": 0,
"virtualmachine_count": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/virtualization/clusters/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"site": 0,
"tags": [],
"tenant": 0,
"type": 0,
"virtualmachine_count": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/virtualization/clusters/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/virtualization/clusters/:id/"
payload = {
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"site": 0,
"tags": [],
"tenant": 0,
"type": 0,
"virtualmachine_count": 0
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/virtualization/clusters/:id/"
payload <- "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\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}}/virtualization/clusters/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/virtualization/clusters/:id/') do |req|
req.body = "{\n \"comments\": \"\",\n \"created\": \"\",\n \"custom_fields\": {},\n \"device_count\": 0,\n \"group\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"name\": \"\",\n \"site\": 0,\n \"tags\": [],\n \"tenant\": 0,\n \"type\": 0,\n \"virtualmachine_count\": 0\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}}/virtualization/clusters/:id/";
let payload = json!({
"comments": "",
"created": "",
"custom_fields": json!({}),
"device_count": 0,
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"site": 0,
"tags": (),
"tenant": 0,
"type": 0,
"virtualmachine_count": 0
});
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}}/virtualization/clusters/:id/ \
--header 'content-type: application/json' \
--data '{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"site": 0,
"tags": [],
"tenant": 0,
"type": 0,
"virtualmachine_count": 0
}'
echo '{
"comments": "",
"created": "",
"custom_fields": {},
"device_count": 0,
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"site": 0,
"tags": [],
"tenant": 0,
"type": 0,
"virtualmachine_count": 0
}' | \
http PUT {{baseUrl}}/virtualization/clusters/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "comments": "",\n "created": "",\n "custom_fields": {},\n "device_count": 0,\n "group": 0,\n "id": 0,\n "last_updated": "",\n "name": "",\n "site": 0,\n "tags": [],\n "tenant": 0,\n "type": 0,\n "virtualmachine_count": 0\n}' \
--output-document \
- {{baseUrl}}/virtualization/clusters/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"comments": "",
"created": "",
"custom_fields": [],
"device_count": 0,
"group": 0,
"id": 0,
"last_updated": "",
"name": "",
"site": 0,
"tags": [],
"tenant": 0,
"type": 0,
"virtualmachine_count": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/virtualization/clusters/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
virtualization_interfaces_create
{{baseUrl}}/virtualization/interfaces/
BODY json
{
"description": "",
"enabled": false,
"id": 0,
"mac_address": "",
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0,
"virtual_machine": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/virtualization/interfaces/");
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 \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/virtualization/interfaces/" {:content-type :json
:form-params {:description ""
:enabled false
:id 0
:mac_address ""
:mode ""
:mtu 0
:name ""
:tagged_vlans []
:tags []
:type ""
:untagged_vlan 0
:virtual_machine 0}})
require "http/client"
url = "{{baseUrl}}/virtualization/interfaces/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/virtualization/interfaces/"),
Content = new StringContent("{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/virtualization/interfaces/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/virtualization/interfaces/"
payload := strings.NewReader("{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/virtualization/interfaces/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 211
{
"description": "",
"enabled": false,
"id": 0,
"mac_address": "",
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0,
"virtual_machine": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/virtualization/interfaces/")
.setHeader("content-type", "application/json")
.setBody("{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/virtualization/interfaces/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/virtualization/interfaces/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/virtualization/interfaces/")
.header("content-type", "application/json")
.body("{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\n}")
.asString();
const data = JSON.stringify({
description: '',
enabled: false,
id: 0,
mac_address: '',
mode: '',
mtu: 0,
name: '',
tagged_vlans: [],
tags: [],
type: '',
untagged_vlan: 0,
virtual_machine: 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}}/virtualization/interfaces/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/virtualization/interfaces/',
headers: {'content-type': 'application/json'},
data: {
description: '',
enabled: false,
id: 0,
mac_address: '',
mode: '',
mtu: 0,
name: '',
tagged_vlans: [],
tags: [],
type: '',
untagged_vlan: 0,
virtual_machine: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/virtualization/interfaces/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"description":"","enabled":false,"id":0,"mac_address":"","mode":"","mtu":0,"name":"","tagged_vlans":[],"tags":[],"type":"","untagged_vlan":0,"virtual_machine":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}}/virtualization/interfaces/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "description": "",\n "enabled": false,\n "id": 0,\n "mac_address": "",\n "mode": "",\n "mtu": 0,\n "name": "",\n "tagged_vlans": [],\n "tags": [],\n "type": "",\n "untagged_vlan": 0,\n "virtual_machine": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/virtualization/interfaces/")
.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/virtualization/interfaces/',
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({
description: '',
enabled: false,
id: 0,
mac_address: '',
mode: '',
mtu: 0,
name: '',
tagged_vlans: [],
tags: [],
type: '',
untagged_vlan: 0,
virtual_machine: 0
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/virtualization/interfaces/',
headers: {'content-type': 'application/json'},
body: {
description: '',
enabled: false,
id: 0,
mac_address: '',
mode: '',
mtu: 0,
name: '',
tagged_vlans: [],
tags: [],
type: '',
untagged_vlan: 0,
virtual_machine: 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}}/virtualization/interfaces/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
description: '',
enabled: false,
id: 0,
mac_address: '',
mode: '',
mtu: 0,
name: '',
tagged_vlans: [],
tags: [],
type: '',
untagged_vlan: 0,
virtual_machine: 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}}/virtualization/interfaces/',
headers: {'content-type': 'application/json'},
data: {
description: '',
enabled: false,
id: 0,
mac_address: '',
mode: '',
mtu: 0,
name: '',
tagged_vlans: [],
tags: [],
type: '',
untagged_vlan: 0,
virtual_machine: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/virtualization/interfaces/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"description":"","enabled":false,"id":0,"mac_address":"","mode":"","mtu":0,"name":"","tagged_vlans":[],"tags":[],"type":"","untagged_vlan":0,"virtual_machine":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 = @{ @"description": @"",
@"enabled": @NO,
@"id": @0,
@"mac_address": @"",
@"mode": @"",
@"mtu": @0,
@"name": @"",
@"tagged_vlans": @[ ],
@"tags": @[ ],
@"type": @"",
@"untagged_vlan": @0,
@"virtual_machine": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/virtualization/interfaces/"]
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}}/virtualization/interfaces/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/virtualization/interfaces/",
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([
'description' => '',
'enabled' => null,
'id' => 0,
'mac_address' => '',
'mode' => '',
'mtu' => 0,
'name' => '',
'tagged_vlans' => [
],
'tags' => [
],
'type' => '',
'untagged_vlan' => 0,
'virtual_machine' => 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}}/virtualization/interfaces/', [
'body' => '{
"description": "",
"enabled": false,
"id": 0,
"mac_address": "",
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0,
"virtual_machine": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/virtualization/interfaces/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'description' => '',
'enabled' => null,
'id' => 0,
'mac_address' => '',
'mode' => '',
'mtu' => 0,
'name' => '',
'tagged_vlans' => [
],
'tags' => [
],
'type' => '',
'untagged_vlan' => 0,
'virtual_machine' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'description' => '',
'enabled' => null,
'id' => 0,
'mac_address' => '',
'mode' => '',
'mtu' => 0,
'name' => '',
'tagged_vlans' => [
],
'tags' => [
],
'type' => '',
'untagged_vlan' => 0,
'virtual_machine' => 0
]));
$request->setRequestUrl('{{baseUrl}}/virtualization/interfaces/');
$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}}/virtualization/interfaces/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"enabled": false,
"id": 0,
"mac_address": "",
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0,
"virtual_machine": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/virtualization/interfaces/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"enabled": false,
"id": 0,
"mac_address": "",
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0,
"virtual_machine": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/virtualization/interfaces/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/virtualization/interfaces/"
payload = {
"description": "",
"enabled": False,
"id": 0,
"mac_address": "",
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0,
"virtual_machine": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/virtualization/interfaces/"
payload <- "{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/virtualization/interfaces/")
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 \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/virtualization/interfaces/') do |req|
req.body = "{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/virtualization/interfaces/";
let payload = json!({
"description": "",
"enabled": false,
"id": 0,
"mac_address": "",
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": (),
"tags": (),
"type": "",
"untagged_vlan": 0,
"virtual_machine": 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}}/virtualization/interfaces/ \
--header 'content-type: application/json' \
--data '{
"description": "",
"enabled": false,
"id": 0,
"mac_address": "",
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0,
"virtual_machine": 0
}'
echo '{
"description": "",
"enabled": false,
"id": 0,
"mac_address": "",
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0,
"virtual_machine": 0
}' | \
http POST {{baseUrl}}/virtualization/interfaces/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "description": "",\n "enabled": false,\n "id": 0,\n "mac_address": "",\n "mode": "",\n "mtu": 0,\n "name": "",\n "tagged_vlans": [],\n "tags": [],\n "type": "",\n "untagged_vlan": 0,\n "virtual_machine": 0\n}' \
--output-document \
- {{baseUrl}}/virtualization/interfaces/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"description": "",
"enabled": false,
"id": 0,
"mac_address": "",
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0,
"virtual_machine": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/virtualization/interfaces/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
virtualization_interfaces_delete
{{baseUrl}}/virtualization/interfaces/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/virtualization/interfaces/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/virtualization/interfaces/:id/")
require "http/client"
url = "{{baseUrl}}/virtualization/interfaces/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/virtualization/interfaces/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/virtualization/interfaces/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/virtualization/interfaces/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/virtualization/interfaces/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/virtualization/interfaces/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/virtualization/interfaces/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/virtualization/interfaces/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/virtualization/interfaces/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/virtualization/interfaces/:id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/virtualization/interfaces/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/virtualization/interfaces/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/virtualization/interfaces/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/virtualization/interfaces/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/virtualization/interfaces/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/virtualization/interfaces/:id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/virtualization/interfaces/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/virtualization/interfaces/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/virtualization/interfaces/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/virtualization/interfaces/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/virtualization/interfaces/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/virtualization/interfaces/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/virtualization/interfaces/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/virtualization/interfaces/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/virtualization/interfaces/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/virtualization/interfaces/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/virtualization/interfaces/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/virtualization/interfaces/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/virtualization/interfaces/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/virtualization/interfaces/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/virtualization/interfaces/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/virtualization/interfaces/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/virtualization/interfaces/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/virtualization/interfaces/:id/
http DELETE {{baseUrl}}/virtualization/interfaces/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/virtualization/interfaces/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/virtualization/interfaces/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
virtualization_interfaces_list
{{baseUrl}}/virtualization/interfaces/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/virtualization/interfaces/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/virtualization/interfaces/")
require "http/client"
url = "{{baseUrl}}/virtualization/interfaces/"
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}}/virtualization/interfaces/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/virtualization/interfaces/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/virtualization/interfaces/"
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/virtualization/interfaces/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/virtualization/interfaces/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/virtualization/interfaces/"))
.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}}/virtualization/interfaces/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/virtualization/interfaces/")
.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}}/virtualization/interfaces/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/virtualization/interfaces/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/virtualization/interfaces/';
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}}/virtualization/interfaces/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/virtualization/interfaces/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/virtualization/interfaces/',
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}}/virtualization/interfaces/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/virtualization/interfaces/');
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}}/virtualization/interfaces/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/virtualization/interfaces/';
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}}/virtualization/interfaces/"]
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}}/virtualization/interfaces/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/virtualization/interfaces/",
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}}/virtualization/interfaces/');
echo $response->getBody();
setUrl('{{baseUrl}}/virtualization/interfaces/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/virtualization/interfaces/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/virtualization/interfaces/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/virtualization/interfaces/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/virtualization/interfaces/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/virtualization/interfaces/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/virtualization/interfaces/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/virtualization/interfaces/")
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/virtualization/interfaces/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/virtualization/interfaces/";
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}}/virtualization/interfaces/
http GET {{baseUrl}}/virtualization/interfaces/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/virtualization/interfaces/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/virtualization/interfaces/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
virtualization_interfaces_partial_update
{{baseUrl}}/virtualization/interfaces/:id/
BODY json
{
"description": "",
"enabled": false,
"id": 0,
"mac_address": "",
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0,
"virtual_machine": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/virtualization/interfaces/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/virtualization/interfaces/:id/" {:content-type :json
:form-params {:description ""
:enabled false
:id 0
:mac_address ""
:mode ""
:mtu 0
:name ""
:tagged_vlans []
:tags []
:type ""
:untagged_vlan 0
:virtual_machine 0}})
require "http/client"
url = "{{baseUrl}}/virtualization/interfaces/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\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}}/virtualization/interfaces/:id/"),
Content = new StringContent("{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/virtualization/interfaces/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/virtualization/interfaces/:id/"
payload := strings.NewReader("{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\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/virtualization/interfaces/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 211
{
"description": "",
"enabled": false,
"id": 0,
"mac_address": "",
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0,
"virtual_machine": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/virtualization/interfaces/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/virtualization/interfaces/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/virtualization/interfaces/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/virtualization/interfaces/:id/")
.header("content-type", "application/json")
.body("{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\n}")
.asString();
const data = JSON.stringify({
description: '',
enabled: false,
id: 0,
mac_address: '',
mode: '',
mtu: 0,
name: '',
tagged_vlans: [],
tags: [],
type: '',
untagged_vlan: 0,
virtual_machine: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/virtualization/interfaces/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/virtualization/interfaces/:id/',
headers: {'content-type': 'application/json'},
data: {
description: '',
enabled: false,
id: 0,
mac_address: '',
mode: '',
mtu: 0,
name: '',
tagged_vlans: [],
tags: [],
type: '',
untagged_vlan: 0,
virtual_machine: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/virtualization/interfaces/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"description":"","enabled":false,"id":0,"mac_address":"","mode":"","mtu":0,"name":"","tagged_vlans":[],"tags":[],"type":"","untagged_vlan":0,"virtual_machine":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}}/virtualization/interfaces/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "description": "",\n "enabled": false,\n "id": 0,\n "mac_address": "",\n "mode": "",\n "mtu": 0,\n "name": "",\n "tagged_vlans": [],\n "tags": [],\n "type": "",\n "untagged_vlan": 0,\n "virtual_machine": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/virtualization/interfaces/:id/")
.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/virtualization/interfaces/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
description: '',
enabled: false,
id: 0,
mac_address: '',
mode: '',
mtu: 0,
name: '',
tagged_vlans: [],
tags: [],
type: '',
untagged_vlan: 0,
virtual_machine: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/virtualization/interfaces/:id/',
headers: {'content-type': 'application/json'},
body: {
description: '',
enabled: false,
id: 0,
mac_address: '',
mode: '',
mtu: 0,
name: '',
tagged_vlans: [],
tags: [],
type: '',
untagged_vlan: 0,
virtual_machine: 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('PATCH', '{{baseUrl}}/virtualization/interfaces/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
description: '',
enabled: false,
id: 0,
mac_address: '',
mode: '',
mtu: 0,
name: '',
tagged_vlans: [],
tags: [],
type: '',
untagged_vlan: 0,
virtual_machine: 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: 'PATCH',
url: '{{baseUrl}}/virtualization/interfaces/:id/',
headers: {'content-type': 'application/json'},
data: {
description: '',
enabled: false,
id: 0,
mac_address: '',
mode: '',
mtu: 0,
name: '',
tagged_vlans: [],
tags: [],
type: '',
untagged_vlan: 0,
virtual_machine: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/virtualization/interfaces/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"description":"","enabled":false,"id":0,"mac_address":"","mode":"","mtu":0,"name":"","tagged_vlans":[],"tags":[],"type":"","untagged_vlan":0,"virtual_machine":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 = @{ @"description": @"",
@"enabled": @NO,
@"id": @0,
@"mac_address": @"",
@"mode": @"",
@"mtu": @0,
@"name": @"",
@"tagged_vlans": @[ ],
@"tags": @[ ],
@"type": @"",
@"untagged_vlan": @0,
@"virtual_machine": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/virtualization/interfaces/:id/"]
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}}/virtualization/interfaces/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/virtualization/interfaces/:id/",
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([
'description' => '',
'enabled' => null,
'id' => 0,
'mac_address' => '',
'mode' => '',
'mtu' => 0,
'name' => '',
'tagged_vlans' => [
],
'tags' => [
],
'type' => '',
'untagged_vlan' => 0,
'virtual_machine' => 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('PATCH', '{{baseUrl}}/virtualization/interfaces/:id/', [
'body' => '{
"description": "",
"enabled": false,
"id": 0,
"mac_address": "",
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0,
"virtual_machine": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/virtualization/interfaces/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'description' => '',
'enabled' => null,
'id' => 0,
'mac_address' => '',
'mode' => '',
'mtu' => 0,
'name' => '',
'tagged_vlans' => [
],
'tags' => [
],
'type' => '',
'untagged_vlan' => 0,
'virtual_machine' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'description' => '',
'enabled' => null,
'id' => 0,
'mac_address' => '',
'mode' => '',
'mtu' => 0,
'name' => '',
'tagged_vlans' => [
],
'tags' => [
],
'type' => '',
'untagged_vlan' => 0,
'virtual_machine' => 0
]));
$request->setRequestUrl('{{baseUrl}}/virtualization/interfaces/:id/');
$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}}/virtualization/interfaces/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"enabled": false,
"id": 0,
"mac_address": "",
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0,
"virtual_machine": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/virtualization/interfaces/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"enabled": false,
"id": 0,
"mac_address": "",
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0,
"virtual_machine": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/virtualization/interfaces/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/virtualization/interfaces/:id/"
payload = {
"description": "",
"enabled": False,
"id": 0,
"mac_address": "",
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0,
"virtual_machine": 0
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/virtualization/interfaces/:id/"
payload <- "{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\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}}/virtualization/interfaces/:id/")
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 \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/virtualization/interfaces/:id/') do |req|
req.body = "{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\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}}/virtualization/interfaces/:id/";
let payload = json!({
"description": "",
"enabled": false,
"id": 0,
"mac_address": "",
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": (),
"tags": (),
"type": "",
"untagged_vlan": 0,
"virtual_machine": 0
});
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}}/virtualization/interfaces/:id/ \
--header 'content-type: application/json' \
--data '{
"description": "",
"enabled": false,
"id": 0,
"mac_address": "",
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0,
"virtual_machine": 0
}'
echo '{
"description": "",
"enabled": false,
"id": 0,
"mac_address": "",
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0,
"virtual_machine": 0
}' | \
http PATCH {{baseUrl}}/virtualization/interfaces/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "description": "",\n "enabled": false,\n "id": 0,\n "mac_address": "",\n "mode": "",\n "mtu": 0,\n "name": "",\n "tagged_vlans": [],\n "tags": [],\n "type": "",\n "untagged_vlan": 0,\n "virtual_machine": 0\n}' \
--output-document \
- {{baseUrl}}/virtualization/interfaces/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"description": "",
"enabled": false,
"id": 0,
"mac_address": "",
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0,
"virtual_machine": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/virtualization/interfaces/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
virtualization_interfaces_read
{{baseUrl}}/virtualization/interfaces/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/virtualization/interfaces/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/virtualization/interfaces/:id/")
require "http/client"
url = "{{baseUrl}}/virtualization/interfaces/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/virtualization/interfaces/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/virtualization/interfaces/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/virtualization/interfaces/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/virtualization/interfaces/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/virtualization/interfaces/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/virtualization/interfaces/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/virtualization/interfaces/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/virtualization/interfaces/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/virtualization/interfaces/:id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/virtualization/interfaces/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/virtualization/interfaces/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/virtualization/interfaces/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/virtualization/interfaces/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/virtualization/interfaces/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/virtualization/interfaces/:id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/virtualization/interfaces/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/virtualization/interfaces/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/virtualization/interfaces/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/virtualization/interfaces/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/virtualization/interfaces/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/virtualization/interfaces/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/virtualization/interfaces/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/virtualization/interfaces/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/virtualization/interfaces/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/virtualization/interfaces/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/virtualization/interfaces/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/virtualization/interfaces/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/virtualization/interfaces/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/virtualization/interfaces/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/virtualization/interfaces/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/virtualization/interfaces/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/virtualization/interfaces/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/virtualization/interfaces/:id/
http GET {{baseUrl}}/virtualization/interfaces/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/virtualization/interfaces/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/virtualization/interfaces/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
virtualization_interfaces_update
{{baseUrl}}/virtualization/interfaces/:id/
BODY json
{
"description": "",
"enabled": false,
"id": 0,
"mac_address": "",
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0,
"virtual_machine": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/virtualization/interfaces/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/virtualization/interfaces/:id/" {:content-type :json
:form-params {:description ""
:enabled false
:id 0
:mac_address ""
:mode ""
:mtu 0
:name ""
:tagged_vlans []
:tags []
:type ""
:untagged_vlan 0
:virtual_machine 0}})
require "http/client"
url = "{{baseUrl}}/virtualization/interfaces/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\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}}/virtualization/interfaces/:id/"),
Content = new StringContent("{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/virtualization/interfaces/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/virtualization/interfaces/:id/"
payload := strings.NewReader("{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\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/virtualization/interfaces/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 211
{
"description": "",
"enabled": false,
"id": 0,
"mac_address": "",
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0,
"virtual_machine": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/virtualization/interfaces/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/virtualization/interfaces/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/virtualization/interfaces/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/virtualization/interfaces/:id/")
.header("content-type", "application/json")
.body("{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\n}")
.asString();
const data = JSON.stringify({
description: '',
enabled: false,
id: 0,
mac_address: '',
mode: '',
mtu: 0,
name: '',
tagged_vlans: [],
tags: [],
type: '',
untagged_vlan: 0,
virtual_machine: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/virtualization/interfaces/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/virtualization/interfaces/:id/',
headers: {'content-type': 'application/json'},
data: {
description: '',
enabled: false,
id: 0,
mac_address: '',
mode: '',
mtu: 0,
name: '',
tagged_vlans: [],
tags: [],
type: '',
untagged_vlan: 0,
virtual_machine: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/virtualization/interfaces/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"description":"","enabled":false,"id":0,"mac_address":"","mode":"","mtu":0,"name":"","tagged_vlans":[],"tags":[],"type":"","untagged_vlan":0,"virtual_machine":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}}/virtualization/interfaces/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "description": "",\n "enabled": false,\n "id": 0,\n "mac_address": "",\n "mode": "",\n "mtu": 0,\n "name": "",\n "tagged_vlans": [],\n "tags": [],\n "type": "",\n "untagged_vlan": 0,\n "virtual_machine": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/virtualization/interfaces/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/virtualization/interfaces/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
description: '',
enabled: false,
id: 0,
mac_address: '',
mode: '',
mtu: 0,
name: '',
tagged_vlans: [],
tags: [],
type: '',
untagged_vlan: 0,
virtual_machine: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/virtualization/interfaces/:id/',
headers: {'content-type': 'application/json'},
body: {
description: '',
enabled: false,
id: 0,
mac_address: '',
mode: '',
mtu: 0,
name: '',
tagged_vlans: [],
tags: [],
type: '',
untagged_vlan: 0,
virtual_machine: 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('PUT', '{{baseUrl}}/virtualization/interfaces/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
description: '',
enabled: false,
id: 0,
mac_address: '',
mode: '',
mtu: 0,
name: '',
tagged_vlans: [],
tags: [],
type: '',
untagged_vlan: 0,
virtual_machine: 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: 'PUT',
url: '{{baseUrl}}/virtualization/interfaces/:id/',
headers: {'content-type': 'application/json'},
data: {
description: '',
enabled: false,
id: 0,
mac_address: '',
mode: '',
mtu: 0,
name: '',
tagged_vlans: [],
tags: [],
type: '',
untagged_vlan: 0,
virtual_machine: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/virtualization/interfaces/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"description":"","enabled":false,"id":0,"mac_address":"","mode":"","mtu":0,"name":"","tagged_vlans":[],"tags":[],"type":"","untagged_vlan":0,"virtual_machine":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 = @{ @"description": @"",
@"enabled": @NO,
@"id": @0,
@"mac_address": @"",
@"mode": @"",
@"mtu": @0,
@"name": @"",
@"tagged_vlans": @[ ],
@"tags": @[ ],
@"type": @"",
@"untagged_vlan": @0,
@"virtual_machine": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/virtualization/interfaces/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/virtualization/interfaces/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/virtualization/interfaces/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'description' => '',
'enabled' => null,
'id' => 0,
'mac_address' => '',
'mode' => '',
'mtu' => 0,
'name' => '',
'tagged_vlans' => [
],
'tags' => [
],
'type' => '',
'untagged_vlan' => 0,
'virtual_machine' => 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('PUT', '{{baseUrl}}/virtualization/interfaces/:id/', [
'body' => '{
"description": "",
"enabled": false,
"id": 0,
"mac_address": "",
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0,
"virtual_machine": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/virtualization/interfaces/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'description' => '',
'enabled' => null,
'id' => 0,
'mac_address' => '',
'mode' => '',
'mtu' => 0,
'name' => '',
'tagged_vlans' => [
],
'tags' => [
],
'type' => '',
'untagged_vlan' => 0,
'virtual_machine' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'description' => '',
'enabled' => null,
'id' => 0,
'mac_address' => '',
'mode' => '',
'mtu' => 0,
'name' => '',
'tagged_vlans' => [
],
'tags' => [
],
'type' => '',
'untagged_vlan' => 0,
'virtual_machine' => 0
]));
$request->setRequestUrl('{{baseUrl}}/virtualization/interfaces/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/virtualization/interfaces/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"enabled": false,
"id": 0,
"mac_address": "",
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0,
"virtual_machine": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/virtualization/interfaces/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"description": "",
"enabled": false,
"id": 0,
"mac_address": "",
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0,
"virtual_machine": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/virtualization/interfaces/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/virtualization/interfaces/:id/"
payload = {
"description": "",
"enabled": False,
"id": 0,
"mac_address": "",
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0,
"virtual_machine": 0
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/virtualization/interfaces/:id/"
payload <- "{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\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}}/virtualization/interfaces/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/virtualization/interfaces/:id/') do |req|
req.body = "{\n \"description\": \"\",\n \"enabled\": false,\n \"id\": 0,\n \"mac_address\": \"\",\n \"mode\": \"\",\n \"mtu\": 0,\n \"name\": \"\",\n \"tagged_vlans\": [],\n \"tags\": [],\n \"type\": \"\",\n \"untagged_vlan\": 0,\n \"virtual_machine\": 0\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}}/virtualization/interfaces/:id/";
let payload = json!({
"description": "",
"enabled": false,
"id": 0,
"mac_address": "",
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": (),
"tags": (),
"type": "",
"untagged_vlan": 0,
"virtual_machine": 0
});
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}}/virtualization/interfaces/:id/ \
--header 'content-type: application/json' \
--data '{
"description": "",
"enabled": false,
"id": 0,
"mac_address": "",
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0,
"virtual_machine": 0
}'
echo '{
"description": "",
"enabled": false,
"id": 0,
"mac_address": "",
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0,
"virtual_machine": 0
}' | \
http PUT {{baseUrl}}/virtualization/interfaces/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "description": "",\n "enabled": false,\n "id": 0,\n "mac_address": "",\n "mode": "",\n "mtu": 0,\n "name": "",\n "tagged_vlans": [],\n "tags": [],\n "type": "",\n "untagged_vlan": 0,\n "virtual_machine": 0\n}' \
--output-document \
- {{baseUrl}}/virtualization/interfaces/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"description": "",
"enabled": false,
"id": 0,
"mac_address": "",
"mode": "",
"mtu": 0,
"name": "",
"tagged_vlans": [],
"tags": [],
"type": "",
"untagged_vlan": 0,
"virtual_machine": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/virtualization/interfaces/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
virtualization_virtual-machines_create
{{baseUrl}}/virtualization/virtual-machines/
BODY json
{
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"disk": 0,
"id": 0,
"last_updated": "",
"local_context_data": "",
"memory": 0,
"name": "",
"platform": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"role": 0,
"site": "",
"status": "",
"tags": [],
"tenant": 0,
"vcpus": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/virtualization/virtual-machines/");
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 \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/virtualization/virtual-machines/" {:content-type :json
:form-params {:cluster 0
:comments ""
:config_context {}
:created ""
:custom_fields {}
:disk 0
:id 0
:last_updated ""
:local_context_data ""
:memory 0
:name ""
:platform 0
:primary_ip ""
:primary_ip4 0
:primary_ip6 0
:role 0
:site ""
:status ""
:tags []
:tenant 0
:vcpus 0}})
require "http/client"
url = "{{baseUrl}}/virtualization/virtual-machines/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/virtualization/virtual-machines/"),
Content = new StringContent("{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/virtualization/virtual-machines/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/virtualization/virtual-machines/"
payload := strings.NewReader("{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/virtualization/virtual-machines/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 366
{
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"disk": 0,
"id": 0,
"last_updated": "",
"local_context_data": "",
"memory": 0,
"name": "",
"platform": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"role": 0,
"site": "",
"status": "",
"tags": [],
"tenant": 0,
"vcpus": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/virtualization/virtual-machines/")
.setHeader("content-type", "application/json")
.setBody("{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/virtualization/virtual-machines/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/virtualization/virtual-machines/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/virtualization/virtual-machines/")
.header("content-type", "application/json")
.body("{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\n}")
.asString();
const data = JSON.stringify({
cluster: 0,
comments: '',
config_context: {},
created: '',
custom_fields: {},
disk: 0,
id: 0,
last_updated: '',
local_context_data: '',
memory: 0,
name: '',
platform: 0,
primary_ip: '',
primary_ip4: 0,
primary_ip6: 0,
role: 0,
site: '',
status: '',
tags: [],
tenant: 0,
vcpus: 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}}/virtualization/virtual-machines/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/virtualization/virtual-machines/',
headers: {'content-type': 'application/json'},
data: {
cluster: 0,
comments: '',
config_context: {},
created: '',
custom_fields: {},
disk: 0,
id: 0,
last_updated: '',
local_context_data: '',
memory: 0,
name: '',
platform: 0,
primary_ip: '',
primary_ip4: 0,
primary_ip6: 0,
role: 0,
site: '',
status: '',
tags: [],
tenant: 0,
vcpus: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/virtualization/virtual-machines/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cluster":0,"comments":"","config_context":{},"created":"","custom_fields":{},"disk":0,"id":0,"last_updated":"","local_context_data":"","memory":0,"name":"","platform":0,"primary_ip":"","primary_ip4":0,"primary_ip6":0,"role":0,"site":"","status":"","tags":[],"tenant":0,"vcpus":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}}/virtualization/virtual-machines/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cluster": 0,\n "comments": "",\n "config_context": {},\n "created": "",\n "custom_fields": {},\n "disk": 0,\n "id": 0,\n "last_updated": "",\n "local_context_data": "",\n "memory": 0,\n "name": "",\n "platform": 0,\n "primary_ip": "",\n "primary_ip4": 0,\n "primary_ip6": 0,\n "role": 0,\n "site": "",\n "status": "",\n "tags": [],\n "tenant": 0,\n "vcpus": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/virtualization/virtual-machines/")
.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/virtualization/virtual-machines/',
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({
cluster: 0,
comments: '',
config_context: {},
created: '',
custom_fields: {},
disk: 0,
id: 0,
last_updated: '',
local_context_data: '',
memory: 0,
name: '',
platform: 0,
primary_ip: '',
primary_ip4: 0,
primary_ip6: 0,
role: 0,
site: '',
status: '',
tags: [],
tenant: 0,
vcpus: 0
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/virtualization/virtual-machines/',
headers: {'content-type': 'application/json'},
body: {
cluster: 0,
comments: '',
config_context: {},
created: '',
custom_fields: {},
disk: 0,
id: 0,
last_updated: '',
local_context_data: '',
memory: 0,
name: '',
platform: 0,
primary_ip: '',
primary_ip4: 0,
primary_ip6: 0,
role: 0,
site: '',
status: '',
tags: [],
tenant: 0,
vcpus: 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}}/virtualization/virtual-machines/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cluster: 0,
comments: '',
config_context: {},
created: '',
custom_fields: {},
disk: 0,
id: 0,
last_updated: '',
local_context_data: '',
memory: 0,
name: '',
platform: 0,
primary_ip: '',
primary_ip4: 0,
primary_ip6: 0,
role: 0,
site: '',
status: '',
tags: [],
tenant: 0,
vcpus: 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}}/virtualization/virtual-machines/',
headers: {'content-type': 'application/json'},
data: {
cluster: 0,
comments: '',
config_context: {},
created: '',
custom_fields: {},
disk: 0,
id: 0,
last_updated: '',
local_context_data: '',
memory: 0,
name: '',
platform: 0,
primary_ip: '',
primary_ip4: 0,
primary_ip6: 0,
role: 0,
site: '',
status: '',
tags: [],
tenant: 0,
vcpus: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/virtualization/virtual-machines/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cluster":0,"comments":"","config_context":{},"created":"","custom_fields":{},"disk":0,"id":0,"last_updated":"","local_context_data":"","memory":0,"name":"","platform":0,"primary_ip":"","primary_ip4":0,"primary_ip6":0,"role":0,"site":"","status":"","tags":[],"tenant":0,"vcpus":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 = @{ @"cluster": @0,
@"comments": @"",
@"config_context": @{ },
@"created": @"",
@"custom_fields": @{ },
@"disk": @0,
@"id": @0,
@"last_updated": @"",
@"local_context_data": @"",
@"memory": @0,
@"name": @"",
@"platform": @0,
@"primary_ip": @"",
@"primary_ip4": @0,
@"primary_ip6": @0,
@"role": @0,
@"site": @"",
@"status": @"",
@"tags": @[ ],
@"tenant": @0,
@"vcpus": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/virtualization/virtual-machines/"]
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}}/virtualization/virtual-machines/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/virtualization/virtual-machines/",
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([
'cluster' => 0,
'comments' => '',
'config_context' => [
],
'created' => '',
'custom_fields' => [
],
'disk' => 0,
'id' => 0,
'last_updated' => '',
'local_context_data' => '',
'memory' => 0,
'name' => '',
'platform' => 0,
'primary_ip' => '',
'primary_ip4' => 0,
'primary_ip6' => 0,
'role' => 0,
'site' => '',
'status' => '',
'tags' => [
],
'tenant' => 0,
'vcpus' => 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}}/virtualization/virtual-machines/', [
'body' => '{
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"disk": 0,
"id": 0,
"last_updated": "",
"local_context_data": "",
"memory": 0,
"name": "",
"platform": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"role": 0,
"site": "",
"status": "",
"tags": [],
"tenant": 0,
"vcpus": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/virtualization/virtual-machines/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cluster' => 0,
'comments' => '',
'config_context' => [
],
'created' => '',
'custom_fields' => [
],
'disk' => 0,
'id' => 0,
'last_updated' => '',
'local_context_data' => '',
'memory' => 0,
'name' => '',
'platform' => 0,
'primary_ip' => '',
'primary_ip4' => 0,
'primary_ip6' => 0,
'role' => 0,
'site' => '',
'status' => '',
'tags' => [
],
'tenant' => 0,
'vcpus' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cluster' => 0,
'comments' => '',
'config_context' => [
],
'created' => '',
'custom_fields' => [
],
'disk' => 0,
'id' => 0,
'last_updated' => '',
'local_context_data' => '',
'memory' => 0,
'name' => '',
'platform' => 0,
'primary_ip' => '',
'primary_ip4' => 0,
'primary_ip6' => 0,
'role' => 0,
'site' => '',
'status' => '',
'tags' => [
],
'tenant' => 0,
'vcpus' => 0
]));
$request->setRequestUrl('{{baseUrl}}/virtualization/virtual-machines/');
$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}}/virtualization/virtual-machines/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"disk": 0,
"id": 0,
"last_updated": "",
"local_context_data": "",
"memory": 0,
"name": "",
"platform": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"role": 0,
"site": "",
"status": "",
"tags": [],
"tenant": 0,
"vcpus": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/virtualization/virtual-machines/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"disk": 0,
"id": 0,
"last_updated": "",
"local_context_data": "",
"memory": 0,
"name": "",
"platform": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"role": 0,
"site": "",
"status": "",
"tags": [],
"tenant": 0,
"vcpus": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/virtualization/virtual-machines/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/virtualization/virtual-machines/"
payload = {
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"disk": 0,
"id": 0,
"last_updated": "",
"local_context_data": "",
"memory": 0,
"name": "",
"platform": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"role": 0,
"site": "",
"status": "",
"tags": [],
"tenant": 0,
"vcpus": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/virtualization/virtual-machines/"
payload <- "{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/virtualization/virtual-machines/")
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 \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/virtualization/virtual-machines/') do |req|
req.body = "{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/virtualization/virtual-machines/";
let payload = json!({
"cluster": 0,
"comments": "",
"config_context": json!({}),
"created": "",
"custom_fields": json!({}),
"disk": 0,
"id": 0,
"last_updated": "",
"local_context_data": "",
"memory": 0,
"name": "",
"platform": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"role": 0,
"site": "",
"status": "",
"tags": (),
"tenant": 0,
"vcpus": 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}}/virtualization/virtual-machines/ \
--header 'content-type: application/json' \
--data '{
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"disk": 0,
"id": 0,
"last_updated": "",
"local_context_data": "",
"memory": 0,
"name": "",
"platform": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"role": 0,
"site": "",
"status": "",
"tags": [],
"tenant": 0,
"vcpus": 0
}'
echo '{
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"disk": 0,
"id": 0,
"last_updated": "",
"local_context_data": "",
"memory": 0,
"name": "",
"platform": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"role": 0,
"site": "",
"status": "",
"tags": [],
"tenant": 0,
"vcpus": 0
}' | \
http POST {{baseUrl}}/virtualization/virtual-machines/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "cluster": 0,\n "comments": "",\n "config_context": {},\n "created": "",\n "custom_fields": {},\n "disk": 0,\n "id": 0,\n "last_updated": "",\n "local_context_data": "",\n "memory": 0,\n "name": "",\n "platform": 0,\n "primary_ip": "",\n "primary_ip4": 0,\n "primary_ip6": 0,\n "role": 0,\n "site": "",\n "status": "",\n "tags": [],\n "tenant": 0,\n "vcpus": 0\n}' \
--output-document \
- {{baseUrl}}/virtualization/virtual-machines/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cluster": 0,
"comments": "",
"config_context": [],
"created": "",
"custom_fields": [],
"disk": 0,
"id": 0,
"last_updated": "",
"local_context_data": "",
"memory": 0,
"name": "",
"platform": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"role": 0,
"site": "",
"status": "",
"tags": [],
"tenant": 0,
"vcpus": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/virtualization/virtual-machines/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
virtualization_virtual-machines_delete
{{baseUrl}}/virtualization/virtual-machines/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/virtualization/virtual-machines/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/virtualization/virtual-machines/:id/")
require "http/client"
url = "{{baseUrl}}/virtualization/virtual-machines/:id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/virtualization/virtual-machines/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/virtualization/virtual-machines/:id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/virtualization/virtual-machines/:id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/virtualization/virtual-machines/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/virtualization/virtual-machines/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/virtualization/virtual-machines/:id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/virtualization/virtual-machines/:id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/virtualization/virtual-machines/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/virtualization/virtual-machines/:id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/virtualization/virtual-machines/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/virtualization/virtual-machines/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/virtualization/virtual-machines/:id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/virtualization/virtual-machines/:id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/virtualization/virtual-machines/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/virtualization/virtual-machines/:id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/virtualization/virtual-machines/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/virtualization/virtual-machines/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/virtualization/virtual-machines/:id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/virtualization/virtual-machines/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/virtualization/virtual-machines/:id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/virtualization/virtual-machines/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/virtualization/virtual-machines/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/virtualization/virtual-machines/:id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/virtualization/virtual-machines/:id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/virtualization/virtual-machines/:id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/virtualization/virtual-machines/:id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/virtualization/virtual-machines/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/virtualization/virtual-machines/:id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/virtualization/virtual-machines/:id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/virtualization/virtual-machines/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/virtualization/virtual-machines/:id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/virtualization/virtual-machines/:id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/virtualization/virtual-machines/:id/
http DELETE {{baseUrl}}/virtualization/virtual-machines/:id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/virtualization/virtual-machines/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/virtualization/virtual-machines/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
virtualization_virtual-machines_list
{{baseUrl}}/virtualization/virtual-machines/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/virtualization/virtual-machines/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/virtualization/virtual-machines/")
require "http/client"
url = "{{baseUrl}}/virtualization/virtual-machines/"
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}}/virtualization/virtual-machines/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/virtualization/virtual-machines/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/virtualization/virtual-machines/"
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/virtualization/virtual-machines/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/virtualization/virtual-machines/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/virtualization/virtual-machines/"))
.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}}/virtualization/virtual-machines/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/virtualization/virtual-machines/")
.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}}/virtualization/virtual-machines/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/virtualization/virtual-machines/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/virtualization/virtual-machines/';
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}}/virtualization/virtual-machines/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/virtualization/virtual-machines/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/virtualization/virtual-machines/',
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}}/virtualization/virtual-machines/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/virtualization/virtual-machines/');
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}}/virtualization/virtual-machines/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/virtualization/virtual-machines/';
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}}/virtualization/virtual-machines/"]
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}}/virtualization/virtual-machines/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/virtualization/virtual-machines/",
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}}/virtualization/virtual-machines/');
echo $response->getBody();
setUrl('{{baseUrl}}/virtualization/virtual-machines/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/virtualization/virtual-machines/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/virtualization/virtual-machines/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/virtualization/virtual-machines/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/virtualization/virtual-machines/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/virtualization/virtual-machines/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/virtualization/virtual-machines/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/virtualization/virtual-machines/")
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/virtualization/virtual-machines/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/virtualization/virtual-machines/";
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}}/virtualization/virtual-machines/
http GET {{baseUrl}}/virtualization/virtual-machines/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/virtualization/virtual-machines/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/virtualization/virtual-machines/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
virtualization_virtual-machines_partial_update
{{baseUrl}}/virtualization/virtual-machines/:id/
BODY json
{
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"disk": 0,
"id": 0,
"last_updated": "",
"local_context_data": "",
"memory": 0,
"name": "",
"platform": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"role": 0,
"site": "",
"status": "",
"tags": [],
"tenant": 0,
"vcpus": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/virtualization/virtual-machines/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/virtualization/virtual-machines/:id/" {:content-type :json
:form-params {:cluster 0
:comments ""
:config_context {}
:created ""
:custom_fields {}
:disk 0
:id 0
:last_updated ""
:local_context_data ""
:memory 0
:name ""
:platform 0
:primary_ip ""
:primary_ip4 0
:primary_ip6 0
:role 0
:site ""
:status ""
:tags []
:tenant 0
:vcpus 0}})
require "http/client"
url = "{{baseUrl}}/virtualization/virtual-machines/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\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}}/virtualization/virtual-machines/:id/"),
Content = new StringContent("{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/virtualization/virtual-machines/:id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/virtualization/virtual-machines/:id/"
payload := strings.NewReader("{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\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/virtualization/virtual-machines/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 366
{
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"disk": 0,
"id": 0,
"last_updated": "",
"local_context_data": "",
"memory": 0,
"name": "",
"platform": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"role": 0,
"site": "",
"status": "",
"tags": [],
"tenant": 0,
"vcpus": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/virtualization/virtual-machines/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/virtualization/virtual-machines/:id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/virtualization/virtual-machines/:id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/virtualization/virtual-machines/:id/")
.header("content-type", "application/json")
.body("{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\n}")
.asString();
const data = JSON.stringify({
cluster: 0,
comments: '',
config_context: {},
created: '',
custom_fields: {},
disk: 0,
id: 0,
last_updated: '',
local_context_data: '',
memory: 0,
name: '',
platform: 0,
primary_ip: '',
primary_ip4: 0,
primary_ip6: 0,
role: 0,
site: '',
status: '',
tags: [],
tenant: 0,
vcpus: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/virtualization/virtual-machines/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/virtualization/virtual-machines/:id/',
headers: {'content-type': 'application/json'},
data: {
cluster: 0,
comments: '',
config_context: {},
created: '',
custom_fields: {},
disk: 0,
id: 0,
last_updated: '',
local_context_data: '',
memory: 0,
name: '',
platform: 0,
primary_ip: '',
primary_ip4: 0,
primary_ip6: 0,
role: 0,
site: '',
status: '',
tags: [],
tenant: 0,
vcpus: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/virtualization/virtual-machines/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"cluster":0,"comments":"","config_context":{},"created":"","custom_fields":{},"disk":0,"id":0,"last_updated":"","local_context_data":"","memory":0,"name":"","platform":0,"primary_ip":"","primary_ip4":0,"primary_ip6":0,"role":0,"site":"","status":"","tags":[],"tenant":0,"vcpus":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}}/virtualization/virtual-machines/:id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cluster": 0,\n "comments": "",\n "config_context": {},\n "created": "",\n "custom_fields": {},\n "disk": 0,\n "id": 0,\n "last_updated": "",\n "local_context_data": "",\n "memory": 0,\n "name": "",\n "platform": 0,\n "primary_ip": "",\n "primary_ip4": 0,\n "primary_ip6": 0,\n "role": 0,\n "site": "",\n "status": "",\n "tags": [],\n "tenant": 0,\n "vcpus": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/virtualization/virtual-machines/:id/")
.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/virtualization/virtual-machines/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
cluster: 0,
comments: '',
config_context: {},
created: '',
custom_fields: {},
disk: 0,
id: 0,
last_updated: '',
local_context_data: '',
memory: 0,
name: '',
platform: 0,
primary_ip: '',
primary_ip4: 0,
primary_ip6: 0,
role: 0,
site: '',
status: '',
tags: [],
tenant: 0,
vcpus: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/virtualization/virtual-machines/:id/',
headers: {'content-type': 'application/json'},
body: {
cluster: 0,
comments: '',
config_context: {},
created: '',
custom_fields: {},
disk: 0,
id: 0,
last_updated: '',
local_context_data: '',
memory: 0,
name: '',
platform: 0,
primary_ip: '',
primary_ip4: 0,
primary_ip6: 0,
role: 0,
site: '',
status: '',
tags: [],
tenant: 0,
vcpus: 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('PATCH', '{{baseUrl}}/virtualization/virtual-machines/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cluster: 0,
comments: '',
config_context: {},
created: '',
custom_fields: {},
disk: 0,
id: 0,
last_updated: '',
local_context_data: '',
memory: 0,
name: '',
platform: 0,
primary_ip: '',
primary_ip4: 0,
primary_ip6: 0,
role: 0,
site: '',
status: '',
tags: [],
tenant: 0,
vcpus: 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: 'PATCH',
url: '{{baseUrl}}/virtualization/virtual-machines/:id/',
headers: {'content-type': 'application/json'},
data: {
cluster: 0,
comments: '',
config_context: {},
created: '',
custom_fields: {},
disk: 0,
id: 0,
last_updated: '',
local_context_data: '',
memory: 0,
name: '',
platform: 0,
primary_ip: '',
primary_ip4: 0,
primary_ip6: 0,
role: 0,
site: '',
status: '',
tags: [],
tenant: 0,
vcpus: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/virtualization/virtual-machines/:id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"cluster":0,"comments":"","config_context":{},"created":"","custom_fields":{},"disk":0,"id":0,"last_updated":"","local_context_data":"","memory":0,"name":"","platform":0,"primary_ip":"","primary_ip4":0,"primary_ip6":0,"role":0,"site":"","status":"","tags":[],"tenant":0,"vcpus":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 = @{ @"cluster": @0,
@"comments": @"",
@"config_context": @{ },
@"created": @"",
@"custom_fields": @{ },
@"disk": @0,
@"id": @0,
@"last_updated": @"",
@"local_context_data": @"",
@"memory": @0,
@"name": @"",
@"platform": @0,
@"primary_ip": @"",
@"primary_ip4": @0,
@"primary_ip6": @0,
@"role": @0,
@"site": @"",
@"status": @"",
@"tags": @[ ],
@"tenant": @0,
@"vcpus": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/virtualization/virtual-machines/:id/"]
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}}/virtualization/virtual-machines/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/virtualization/virtual-machines/:id/",
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([
'cluster' => 0,
'comments' => '',
'config_context' => [
],
'created' => '',
'custom_fields' => [
],
'disk' => 0,
'id' => 0,
'last_updated' => '',
'local_context_data' => '',
'memory' => 0,
'name' => '',
'platform' => 0,
'primary_ip' => '',
'primary_ip4' => 0,
'primary_ip6' => 0,
'role' => 0,
'site' => '',
'status' => '',
'tags' => [
],
'tenant' => 0,
'vcpus' => 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('PATCH', '{{baseUrl}}/virtualization/virtual-machines/:id/', [
'body' => '{
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"disk": 0,
"id": 0,
"last_updated": "",
"local_context_data": "",
"memory": 0,
"name": "",
"platform": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"role": 0,
"site": "",
"status": "",
"tags": [],
"tenant": 0,
"vcpus": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/virtualization/virtual-machines/:id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cluster' => 0,
'comments' => '',
'config_context' => [
],
'created' => '',
'custom_fields' => [
],
'disk' => 0,
'id' => 0,
'last_updated' => '',
'local_context_data' => '',
'memory' => 0,
'name' => '',
'platform' => 0,
'primary_ip' => '',
'primary_ip4' => 0,
'primary_ip6' => 0,
'role' => 0,
'site' => '',
'status' => '',
'tags' => [
],
'tenant' => 0,
'vcpus' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cluster' => 0,
'comments' => '',
'config_context' => [
],
'created' => '',
'custom_fields' => [
],
'disk' => 0,
'id' => 0,
'last_updated' => '',
'local_context_data' => '',
'memory' => 0,
'name' => '',
'platform' => 0,
'primary_ip' => '',
'primary_ip4' => 0,
'primary_ip6' => 0,
'role' => 0,
'site' => '',
'status' => '',
'tags' => [
],
'tenant' => 0,
'vcpus' => 0
]));
$request->setRequestUrl('{{baseUrl}}/virtualization/virtual-machines/:id/');
$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}}/virtualization/virtual-machines/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"disk": 0,
"id": 0,
"last_updated": "",
"local_context_data": "",
"memory": 0,
"name": "",
"platform": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"role": 0,
"site": "",
"status": "",
"tags": [],
"tenant": 0,
"vcpus": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/virtualization/virtual-machines/:id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"disk": 0,
"id": 0,
"last_updated": "",
"local_context_data": "",
"memory": 0,
"name": "",
"platform": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"role": 0,
"site": "",
"status": "",
"tags": [],
"tenant": 0,
"vcpus": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/virtualization/virtual-machines/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/virtualization/virtual-machines/:id/"
payload = {
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"disk": 0,
"id": 0,
"last_updated": "",
"local_context_data": "",
"memory": 0,
"name": "",
"platform": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"role": 0,
"site": "",
"status": "",
"tags": [],
"tenant": 0,
"vcpus": 0
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/virtualization/virtual-machines/:id/"
payload <- "{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\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}}/virtualization/virtual-machines/:id/")
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 \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/virtualization/virtual-machines/:id/') do |req|
req.body = "{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\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}}/virtualization/virtual-machines/:id/";
let payload = json!({
"cluster": 0,
"comments": "",
"config_context": json!({}),
"created": "",
"custom_fields": json!({}),
"disk": 0,
"id": 0,
"last_updated": "",
"local_context_data": "",
"memory": 0,
"name": "",
"platform": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"role": 0,
"site": "",
"status": "",
"tags": (),
"tenant": 0,
"vcpus": 0
});
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}}/virtualization/virtual-machines/:id/ \
--header 'content-type: application/json' \
--data '{
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"disk": 0,
"id": 0,
"last_updated": "",
"local_context_data": "",
"memory": 0,
"name": "",
"platform": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"role": 0,
"site": "",
"status": "",
"tags": [],
"tenant": 0,
"vcpus": 0
}'
echo '{
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"disk": 0,
"id": 0,
"last_updated": "",
"local_context_data": "",
"memory": 0,
"name": "",
"platform": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"role": 0,
"site": "",
"status": "",
"tags": [],
"tenant": 0,
"vcpus": 0
}' | \
http PATCH {{baseUrl}}/virtualization/virtual-machines/:id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "cluster": 0,\n "comments": "",\n "config_context": {},\n "created": "",\n "custom_fields": {},\n "disk": 0,\n "id": 0,\n "last_updated": "",\n "local_context_data": "",\n "memory": 0,\n "name": "",\n "platform": 0,\n "primary_ip": "",\n "primary_ip4": 0,\n "primary_ip6": 0,\n "role": 0,\n "site": "",\n "status": "",\n "tags": [],\n "tenant": 0,\n "vcpus": 0\n}' \
--output-document \
- {{baseUrl}}/virtualization/virtual-machines/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cluster": 0,
"comments": "",
"config_context": [],
"created": "",
"custom_fields": [],
"disk": 0,
"id": 0,
"last_updated": "",
"local_context_data": "",
"memory": 0,
"name": "",
"platform": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"role": 0,
"site": "",
"status": "",
"tags": [],
"tenant": 0,
"vcpus": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/virtualization/virtual-machines/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
virtualization_virtual-machines_read
{{baseUrl}}/virtualization/virtual-machines/:id/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/virtualization/virtual-machines/:id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/virtualization/virtual-machines/:id/")
require "http/client"
url = "{{baseUrl}}/virtualization/virtual-machines/:id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/virtualization/virtual-machines/:id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/virtualization/virtual-machines/:id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/virtualization/virtual-machines/:id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/virtualization/virtual-machines/:id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/virtualization/virtual-machines/:id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/virtualization/virtual-machines/:id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/virtualization/virtual-machines/:id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/virtualization/virtual-machines/:id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/virtualization/virtual-machines/:id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/virtualization/virtual-machines/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/virtualization/virtual-machines/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/virtualization/virtual-machines/:id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/virtualization/virtual-machines/:id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/virtualization/virtual-machines/:id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/virtualization/virtual-machines/:id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/virtualization/virtual-machines/:id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/virtualization/virtual-machines/:id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/virtualization/virtual-machines/:id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/virtualization/virtual-machines/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/virtualization/virtual-machines/:id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/virtualization/virtual-machines/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/virtualization/virtual-machines/:id/');
echo $response->getBody();
setUrl('{{baseUrl}}/virtualization/virtual-machines/:id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/virtualization/virtual-machines/:id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/virtualization/virtual-machines/:id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/virtualization/virtual-machines/:id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/virtualization/virtual-machines/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/virtualization/virtual-machines/:id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/virtualization/virtual-machines/:id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/virtualization/virtual-machines/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/virtualization/virtual-machines/:id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/virtualization/virtual-machines/:id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/virtualization/virtual-machines/:id/
http GET {{baseUrl}}/virtualization/virtual-machines/:id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/virtualization/virtual-machines/:id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/virtualization/virtual-machines/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
virtualization_virtual-machines_update
{{baseUrl}}/virtualization/virtual-machines/:id/
BODY json
{
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"disk": 0,
"id": 0,
"last_updated": "",
"local_context_data": "",
"memory": 0,
"name": "",
"platform": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"role": 0,
"site": "",
"status": "",
"tags": [],
"tenant": 0,
"vcpus": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/virtualization/virtual-machines/:id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/virtualization/virtual-machines/:id/" {:content-type :json
:form-params {:cluster 0
:comments ""
:config_context {}
:created ""
:custom_fields {}
:disk 0
:id 0
:last_updated ""
:local_context_data ""
:memory 0
:name ""
:platform 0
:primary_ip ""
:primary_ip4 0
:primary_ip6 0
:role 0
:site ""
:status ""
:tags []
:tenant 0
:vcpus 0}})
require "http/client"
url = "{{baseUrl}}/virtualization/virtual-machines/:id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\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}}/virtualization/virtual-machines/:id/"),
Content = new StringContent("{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/virtualization/virtual-machines/:id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/virtualization/virtual-machines/:id/"
payload := strings.NewReader("{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\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/virtualization/virtual-machines/:id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 366
{
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"disk": 0,
"id": 0,
"last_updated": "",
"local_context_data": "",
"memory": 0,
"name": "",
"platform": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"role": 0,
"site": "",
"status": "",
"tags": [],
"tenant": 0,
"vcpus": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/virtualization/virtual-machines/:id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/virtualization/virtual-machines/:id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/virtualization/virtual-machines/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/virtualization/virtual-machines/:id/")
.header("content-type", "application/json")
.body("{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\n}")
.asString();
const data = JSON.stringify({
cluster: 0,
comments: '',
config_context: {},
created: '',
custom_fields: {},
disk: 0,
id: 0,
last_updated: '',
local_context_data: '',
memory: 0,
name: '',
platform: 0,
primary_ip: '',
primary_ip4: 0,
primary_ip6: 0,
role: 0,
site: '',
status: '',
tags: [],
tenant: 0,
vcpus: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/virtualization/virtual-machines/:id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/virtualization/virtual-machines/:id/',
headers: {'content-type': 'application/json'},
data: {
cluster: 0,
comments: '',
config_context: {},
created: '',
custom_fields: {},
disk: 0,
id: 0,
last_updated: '',
local_context_data: '',
memory: 0,
name: '',
platform: 0,
primary_ip: '',
primary_ip4: 0,
primary_ip6: 0,
role: 0,
site: '',
status: '',
tags: [],
tenant: 0,
vcpus: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/virtualization/virtual-machines/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"cluster":0,"comments":"","config_context":{},"created":"","custom_fields":{},"disk":0,"id":0,"last_updated":"","local_context_data":"","memory":0,"name":"","platform":0,"primary_ip":"","primary_ip4":0,"primary_ip6":0,"role":0,"site":"","status":"","tags":[],"tenant":0,"vcpus":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}}/virtualization/virtual-machines/:id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cluster": 0,\n "comments": "",\n "config_context": {},\n "created": "",\n "custom_fields": {},\n "disk": 0,\n "id": 0,\n "last_updated": "",\n "local_context_data": "",\n "memory": 0,\n "name": "",\n "platform": 0,\n "primary_ip": "",\n "primary_ip4": 0,\n "primary_ip6": 0,\n "role": 0,\n "site": "",\n "status": "",\n "tags": [],\n "tenant": 0,\n "vcpus": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/virtualization/virtual-machines/:id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/virtualization/virtual-machines/:id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
cluster: 0,
comments: '',
config_context: {},
created: '',
custom_fields: {},
disk: 0,
id: 0,
last_updated: '',
local_context_data: '',
memory: 0,
name: '',
platform: 0,
primary_ip: '',
primary_ip4: 0,
primary_ip6: 0,
role: 0,
site: '',
status: '',
tags: [],
tenant: 0,
vcpus: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/virtualization/virtual-machines/:id/',
headers: {'content-type': 'application/json'},
body: {
cluster: 0,
comments: '',
config_context: {},
created: '',
custom_fields: {},
disk: 0,
id: 0,
last_updated: '',
local_context_data: '',
memory: 0,
name: '',
platform: 0,
primary_ip: '',
primary_ip4: 0,
primary_ip6: 0,
role: 0,
site: '',
status: '',
tags: [],
tenant: 0,
vcpus: 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('PUT', '{{baseUrl}}/virtualization/virtual-machines/:id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cluster: 0,
comments: '',
config_context: {},
created: '',
custom_fields: {},
disk: 0,
id: 0,
last_updated: '',
local_context_data: '',
memory: 0,
name: '',
platform: 0,
primary_ip: '',
primary_ip4: 0,
primary_ip6: 0,
role: 0,
site: '',
status: '',
tags: [],
tenant: 0,
vcpus: 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: 'PUT',
url: '{{baseUrl}}/virtualization/virtual-machines/:id/',
headers: {'content-type': 'application/json'},
data: {
cluster: 0,
comments: '',
config_context: {},
created: '',
custom_fields: {},
disk: 0,
id: 0,
last_updated: '',
local_context_data: '',
memory: 0,
name: '',
platform: 0,
primary_ip: '',
primary_ip4: 0,
primary_ip6: 0,
role: 0,
site: '',
status: '',
tags: [],
tenant: 0,
vcpus: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/virtualization/virtual-machines/:id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"cluster":0,"comments":"","config_context":{},"created":"","custom_fields":{},"disk":0,"id":0,"last_updated":"","local_context_data":"","memory":0,"name":"","platform":0,"primary_ip":"","primary_ip4":0,"primary_ip6":0,"role":0,"site":"","status":"","tags":[],"tenant":0,"vcpus":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 = @{ @"cluster": @0,
@"comments": @"",
@"config_context": @{ },
@"created": @"",
@"custom_fields": @{ },
@"disk": @0,
@"id": @0,
@"last_updated": @"",
@"local_context_data": @"",
@"memory": @0,
@"name": @"",
@"platform": @0,
@"primary_ip": @"",
@"primary_ip4": @0,
@"primary_ip6": @0,
@"role": @0,
@"site": @"",
@"status": @"",
@"tags": @[ ],
@"tenant": @0,
@"vcpus": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/virtualization/virtual-machines/:id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/virtualization/virtual-machines/:id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/virtualization/virtual-machines/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'cluster' => 0,
'comments' => '',
'config_context' => [
],
'created' => '',
'custom_fields' => [
],
'disk' => 0,
'id' => 0,
'last_updated' => '',
'local_context_data' => '',
'memory' => 0,
'name' => '',
'platform' => 0,
'primary_ip' => '',
'primary_ip4' => 0,
'primary_ip6' => 0,
'role' => 0,
'site' => '',
'status' => '',
'tags' => [
],
'tenant' => 0,
'vcpus' => 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('PUT', '{{baseUrl}}/virtualization/virtual-machines/:id/', [
'body' => '{
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"disk": 0,
"id": 0,
"last_updated": "",
"local_context_data": "",
"memory": 0,
"name": "",
"platform": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"role": 0,
"site": "",
"status": "",
"tags": [],
"tenant": 0,
"vcpus": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/virtualization/virtual-machines/:id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cluster' => 0,
'comments' => '',
'config_context' => [
],
'created' => '',
'custom_fields' => [
],
'disk' => 0,
'id' => 0,
'last_updated' => '',
'local_context_data' => '',
'memory' => 0,
'name' => '',
'platform' => 0,
'primary_ip' => '',
'primary_ip4' => 0,
'primary_ip6' => 0,
'role' => 0,
'site' => '',
'status' => '',
'tags' => [
],
'tenant' => 0,
'vcpus' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cluster' => 0,
'comments' => '',
'config_context' => [
],
'created' => '',
'custom_fields' => [
],
'disk' => 0,
'id' => 0,
'last_updated' => '',
'local_context_data' => '',
'memory' => 0,
'name' => '',
'platform' => 0,
'primary_ip' => '',
'primary_ip4' => 0,
'primary_ip6' => 0,
'role' => 0,
'site' => '',
'status' => '',
'tags' => [
],
'tenant' => 0,
'vcpus' => 0
]));
$request->setRequestUrl('{{baseUrl}}/virtualization/virtual-machines/:id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/virtualization/virtual-machines/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"disk": 0,
"id": 0,
"last_updated": "",
"local_context_data": "",
"memory": 0,
"name": "",
"platform": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"role": 0,
"site": "",
"status": "",
"tags": [],
"tenant": 0,
"vcpus": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/virtualization/virtual-machines/:id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"disk": 0,
"id": 0,
"last_updated": "",
"local_context_data": "",
"memory": 0,
"name": "",
"platform": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"role": 0,
"site": "",
"status": "",
"tags": [],
"tenant": 0,
"vcpus": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/virtualization/virtual-machines/:id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/virtualization/virtual-machines/:id/"
payload = {
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"disk": 0,
"id": 0,
"last_updated": "",
"local_context_data": "",
"memory": 0,
"name": "",
"platform": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"role": 0,
"site": "",
"status": "",
"tags": [],
"tenant": 0,
"vcpus": 0
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/virtualization/virtual-machines/:id/"
payload <- "{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\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}}/virtualization/virtual-machines/:id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/virtualization/virtual-machines/:id/') do |req|
req.body = "{\n \"cluster\": 0,\n \"comments\": \"\",\n \"config_context\": {},\n \"created\": \"\",\n \"custom_fields\": {},\n \"disk\": 0,\n \"id\": 0,\n \"last_updated\": \"\",\n \"local_context_data\": \"\",\n \"memory\": 0,\n \"name\": \"\",\n \"platform\": 0,\n \"primary_ip\": \"\",\n \"primary_ip4\": 0,\n \"primary_ip6\": 0,\n \"role\": 0,\n \"site\": \"\",\n \"status\": \"\",\n \"tags\": [],\n \"tenant\": 0,\n \"vcpus\": 0\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}}/virtualization/virtual-machines/:id/";
let payload = json!({
"cluster": 0,
"comments": "",
"config_context": json!({}),
"created": "",
"custom_fields": json!({}),
"disk": 0,
"id": 0,
"last_updated": "",
"local_context_data": "",
"memory": 0,
"name": "",
"platform": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"role": 0,
"site": "",
"status": "",
"tags": (),
"tenant": 0,
"vcpus": 0
});
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}}/virtualization/virtual-machines/:id/ \
--header 'content-type: application/json' \
--data '{
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"disk": 0,
"id": 0,
"last_updated": "",
"local_context_data": "",
"memory": 0,
"name": "",
"platform": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"role": 0,
"site": "",
"status": "",
"tags": [],
"tenant": 0,
"vcpus": 0
}'
echo '{
"cluster": 0,
"comments": "",
"config_context": {},
"created": "",
"custom_fields": {},
"disk": 0,
"id": 0,
"last_updated": "",
"local_context_data": "",
"memory": 0,
"name": "",
"platform": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"role": 0,
"site": "",
"status": "",
"tags": [],
"tenant": 0,
"vcpus": 0
}' | \
http PUT {{baseUrl}}/virtualization/virtual-machines/:id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "cluster": 0,\n "comments": "",\n "config_context": {},\n "created": "",\n "custom_fields": {},\n "disk": 0,\n "id": 0,\n "last_updated": "",\n "local_context_data": "",\n "memory": 0,\n "name": "",\n "platform": 0,\n "primary_ip": "",\n "primary_ip4": 0,\n "primary_ip6": 0,\n "role": 0,\n "site": "",\n "status": "",\n "tags": [],\n "tenant": 0,\n "vcpus": 0\n}' \
--output-document \
- {{baseUrl}}/virtualization/virtual-machines/:id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cluster": 0,
"comments": "",
"config_context": [],
"created": "",
"custom_fields": [],
"disk": 0,
"id": 0,
"last_updated": "",
"local_context_data": "",
"memory": 0,
"name": "",
"platform": 0,
"primary_ip": "",
"primary_ip4": 0,
"primary_ip6": 0,
"role": 0,
"site": "",
"status": "",
"tags": [],
"tenant": 0,
"vcpus": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/virtualization/virtual-machines/:id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()