Kratos-CMS 后台管理API
POST
AttachmentService_CreateAttachment
{{baseUrl}}/admin/v1/attachments
BODY json
{
"attachment": {
"id": 0,
"name": "",
"path": "",
"fileKey": "",
"thumbPath": "",
"mediaType": "",
"suffix": "",
"width": 0,
"height": 0,
"size": "",
"type": 0,
"createTime": "",
"updateTime": "",
"deleteTime": ""
},
"operatorId": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/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 \"attachment\": {\n \"id\": 0,\n \"name\": \"\",\n \"path\": \"\",\n \"fileKey\": \"\",\n \"thumbPath\": \"\",\n \"mediaType\": \"\",\n \"suffix\": \"\",\n \"width\": 0,\n \"height\": 0,\n \"size\": \"\",\n \"type\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"deleteTime\": \"\"\n },\n \"operatorId\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/admin/v1/attachments" {:content-type :json
:form-params {:attachment {:id 0
:name ""
:path ""
:fileKey ""
:thumbPath ""
:mediaType ""
:suffix ""
:width 0
:height 0
:size ""
:type 0
:createTime ""
:updateTime ""
:deleteTime ""}
:operatorId 0}})
require "http/client"
url = "{{baseUrl}}/admin/v1/attachments"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"attachment\": {\n \"id\": 0,\n \"name\": \"\",\n \"path\": \"\",\n \"fileKey\": \"\",\n \"thumbPath\": \"\",\n \"mediaType\": \"\",\n \"suffix\": \"\",\n \"width\": 0,\n \"height\": 0,\n \"size\": \"\",\n \"type\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"deleteTime\": \"\"\n },\n \"operatorId\": 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}}/admin/v1/attachments"),
Content = new StringContent("{\n \"attachment\": {\n \"id\": 0,\n \"name\": \"\",\n \"path\": \"\",\n \"fileKey\": \"\",\n \"thumbPath\": \"\",\n \"mediaType\": \"\",\n \"suffix\": \"\",\n \"width\": 0,\n \"height\": 0,\n \"size\": \"\",\n \"type\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"deleteTime\": \"\"\n },\n \"operatorId\": 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}}/admin/v1/attachments");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"attachment\": {\n \"id\": 0,\n \"name\": \"\",\n \"path\": \"\",\n \"fileKey\": \"\",\n \"thumbPath\": \"\",\n \"mediaType\": \"\",\n \"suffix\": \"\",\n \"width\": 0,\n \"height\": 0,\n \"size\": \"\",\n \"type\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"deleteTime\": \"\"\n },\n \"operatorId\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/attachments"
payload := strings.NewReader("{\n \"attachment\": {\n \"id\": 0,\n \"name\": \"\",\n \"path\": \"\",\n \"fileKey\": \"\",\n \"thumbPath\": \"\",\n \"mediaType\": \"\",\n \"suffix\": \"\",\n \"width\": 0,\n \"height\": 0,\n \"size\": \"\",\n \"type\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"deleteTime\": \"\"\n },\n \"operatorId\": 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/admin/v1/attachments HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 297
{
"attachment": {
"id": 0,
"name": "",
"path": "",
"fileKey": "",
"thumbPath": "",
"mediaType": "",
"suffix": "",
"width": 0,
"height": 0,
"size": "",
"type": 0,
"createTime": "",
"updateTime": "",
"deleteTime": ""
},
"operatorId": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/admin/v1/attachments")
.setHeader("content-type", "application/json")
.setBody("{\n \"attachment\": {\n \"id\": 0,\n \"name\": \"\",\n \"path\": \"\",\n \"fileKey\": \"\",\n \"thumbPath\": \"\",\n \"mediaType\": \"\",\n \"suffix\": \"\",\n \"width\": 0,\n \"height\": 0,\n \"size\": \"\",\n \"type\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"deleteTime\": \"\"\n },\n \"operatorId\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/attachments"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"attachment\": {\n \"id\": 0,\n \"name\": \"\",\n \"path\": \"\",\n \"fileKey\": \"\",\n \"thumbPath\": \"\",\n \"mediaType\": \"\",\n \"suffix\": \"\",\n \"width\": 0,\n \"height\": 0,\n \"size\": \"\",\n \"type\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"deleteTime\": \"\"\n },\n \"operatorId\": 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 \"attachment\": {\n \"id\": 0,\n \"name\": \"\",\n \"path\": \"\",\n \"fileKey\": \"\",\n \"thumbPath\": \"\",\n \"mediaType\": \"\",\n \"suffix\": \"\",\n \"width\": 0,\n \"height\": 0,\n \"size\": \"\",\n \"type\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"deleteTime\": \"\"\n },\n \"operatorId\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/admin/v1/attachments")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/admin/v1/attachments")
.header("content-type", "application/json")
.body("{\n \"attachment\": {\n \"id\": 0,\n \"name\": \"\",\n \"path\": \"\",\n \"fileKey\": \"\",\n \"thumbPath\": \"\",\n \"mediaType\": \"\",\n \"suffix\": \"\",\n \"width\": 0,\n \"height\": 0,\n \"size\": \"\",\n \"type\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"deleteTime\": \"\"\n },\n \"operatorId\": 0\n}")
.asString();
const data = JSON.stringify({
attachment: {
id: 0,
name: '',
path: '',
fileKey: '',
thumbPath: '',
mediaType: '',
suffix: '',
width: 0,
height: 0,
size: '',
type: 0,
createTime: '',
updateTime: '',
deleteTime: ''
},
operatorId: 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}}/admin/v1/attachments');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/admin/v1/attachments',
headers: {'content-type': 'application/json'},
data: {
attachment: {
id: 0,
name: '',
path: '',
fileKey: '',
thumbPath: '',
mediaType: '',
suffix: '',
width: 0,
height: 0,
size: '',
type: 0,
createTime: '',
updateTime: '',
deleteTime: ''
},
operatorId: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/attachments';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"attachment":{"id":0,"name":"","path":"","fileKey":"","thumbPath":"","mediaType":"","suffix":"","width":0,"height":0,"size":"","type":0,"createTime":"","updateTime":"","deleteTime":""},"operatorId":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}}/admin/v1/attachments',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "attachment": {\n "id": 0,\n "name": "",\n "path": "",\n "fileKey": "",\n "thumbPath": "",\n "mediaType": "",\n "suffix": "",\n "width": 0,\n "height": 0,\n "size": "",\n "type": 0,\n "createTime": "",\n "updateTime": "",\n "deleteTime": ""\n },\n "operatorId": 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 \"attachment\": {\n \"id\": 0,\n \"name\": \"\",\n \"path\": \"\",\n \"fileKey\": \"\",\n \"thumbPath\": \"\",\n \"mediaType\": \"\",\n \"suffix\": \"\",\n \"width\": 0,\n \"height\": 0,\n \"size\": \"\",\n \"type\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"deleteTime\": \"\"\n },\n \"operatorId\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/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/admin/v1/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({
attachment: {
id: 0,
name: '',
path: '',
fileKey: '',
thumbPath: '',
mediaType: '',
suffix: '',
width: 0,
height: 0,
size: '',
type: 0,
createTime: '',
updateTime: '',
deleteTime: ''
},
operatorId: 0
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/admin/v1/attachments',
headers: {'content-type': 'application/json'},
body: {
attachment: {
id: 0,
name: '',
path: '',
fileKey: '',
thumbPath: '',
mediaType: '',
suffix: '',
width: 0,
height: 0,
size: '',
type: 0,
createTime: '',
updateTime: '',
deleteTime: ''
},
operatorId: 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}}/admin/v1/attachments');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
attachment: {
id: 0,
name: '',
path: '',
fileKey: '',
thumbPath: '',
mediaType: '',
suffix: '',
width: 0,
height: 0,
size: '',
type: 0,
createTime: '',
updateTime: '',
deleteTime: ''
},
operatorId: 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}}/admin/v1/attachments',
headers: {'content-type': 'application/json'},
data: {
attachment: {
id: 0,
name: '',
path: '',
fileKey: '',
thumbPath: '',
mediaType: '',
suffix: '',
width: 0,
height: 0,
size: '',
type: 0,
createTime: '',
updateTime: '',
deleteTime: ''
},
operatorId: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/attachments';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"attachment":{"id":0,"name":"","path":"","fileKey":"","thumbPath":"","mediaType":"","suffix":"","width":0,"height":0,"size":"","type":0,"createTime":"","updateTime":"","deleteTime":""},"operatorId":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 = @{ @"attachment": @{ @"id": @0, @"name": @"", @"path": @"", @"fileKey": @"", @"thumbPath": @"", @"mediaType": @"", @"suffix": @"", @"width": @0, @"height": @0, @"size": @"", @"type": @0, @"createTime": @"", @"updateTime": @"", @"deleteTime": @"" },
@"operatorId": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/admin/v1/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}}/admin/v1/attachments" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"attachment\": {\n \"id\": 0,\n \"name\": \"\",\n \"path\": \"\",\n \"fileKey\": \"\",\n \"thumbPath\": \"\",\n \"mediaType\": \"\",\n \"suffix\": \"\",\n \"width\": 0,\n \"height\": 0,\n \"size\": \"\",\n \"type\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"deleteTime\": \"\"\n },\n \"operatorId\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/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([
'attachment' => [
'id' => 0,
'name' => '',
'path' => '',
'fileKey' => '',
'thumbPath' => '',
'mediaType' => '',
'suffix' => '',
'width' => 0,
'height' => 0,
'size' => '',
'type' => 0,
'createTime' => '',
'updateTime' => '',
'deleteTime' => ''
],
'operatorId' => 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}}/admin/v1/attachments', [
'body' => '{
"attachment": {
"id": 0,
"name": "",
"path": "",
"fileKey": "",
"thumbPath": "",
"mediaType": "",
"suffix": "",
"width": 0,
"height": 0,
"size": "",
"type": 0,
"createTime": "",
"updateTime": "",
"deleteTime": ""
},
"operatorId": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/attachments');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'attachment' => [
'id' => 0,
'name' => '',
'path' => '',
'fileKey' => '',
'thumbPath' => '',
'mediaType' => '',
'suffix' => '',
'width' => 0,
'height' => 0,
'size' => '',
'type' => 0,
'createTime' => '',
'updateTime' => '',
'deleteTime' => ''
],
'operatorId' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'attachment' => [
'id' => 0,
'name' => '',
'path' => '',
'fileKey' => '',
'thumbPath' => '',
'mediaType' => '',
'suffix' => '',
'width' => 0,
'height' => 0,
'size' => '',
'type' => 0,
'createTime' => '',
'updateTime' => '',
'deleteTime' => ''
],
'operatorId' => 0
]));
$request->setRequestUrl('{{baseUrl}}/admin/v1/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}}/admin/v1/attachments' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"attachment": {
"id": 0,
"name": "",
"path": "",
"fileKey": "",
"thumbPath": "",
"mediaType": "",
"suffix": "",
"width": 0,
"height": 0,
"size": "",
"type": 0,
"createTime": "",
"updateTime": "",
"deleteTime": ""
},
"operatorId": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/attachments' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"attachment": {
"id": 0,
"name": "",
"path": "",
"fileKey": "",
"thumbPath": "",
"mediaType": "",
"suffix": "",
"width": 0,
"height": 0,
"size": "",
"type": 0,
"createTime": "",
"updateTime": "",
"deleteTime": ""
},
"operatorId": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"attachment\": {\n \"id\": 0,\n \"name\": \"\",\n \"path\": \"\",\n \"fileKey\": \"\",\n \"thumbPath\": \"\",\n \"mediaType\": \"\",\n \"suffix\": \"\",\n \"width\": 0,\n \"height\": 0,\n \"size\": \"\",\n \"type\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"deleteTime\": \"\"\n },\n \"operatorId\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/admin/v1/attachments", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/attachments"
payload = {
"attachment": {
"id": 0,
"name": "",
"path": "",
"fileKey": "",
"thumbPath": "",
"mediaType": "",
"suffix": "",
"width": 0,
"height": 0,
"size": "",
"type": 0,
"createTime": "",
"updateTime": "",
"deleteTime": ""
},
"operatorId": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/attachments"
payload <- "{\n \"attachment\": {\n \"id\": 0,\n \"name\": \"\",\n \"path\": \"\",\n \"fileKey\": \"\",\n \"thumbPath\": \"\",\n \"mediaType\": \"\",\n \"suffix\": \"\",\n \"width\": 0,\n \"height\": 0,\n \"size\": \"\",\n \"type\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"deleteTime\": \"\"\n },\n \"operatorId\": 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}}/admin/v1/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 \"attachment\": {\n \"id\": 0,\n \"name\": \"\",\n \"path\": \"\",\n \"fileKey\": \"\",\n \"thumbPath\": \"\",\n \"mediaType\": \"\",\n \"suffix\": \"\",\n \"width\": 0,\n \"height\": 0,\n \"size\": \"\",\n \"type\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"deleteTime\": \"\"\n },\n \"operatorId\": 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/admin/v1/attachments') do |req|
req.body = "{\n \"attachment\": {\n \"id\": 0,\n \"name\": \"\",\n \"path\": \"\",\n \"fileKey\": \"\",\n \"thumbPath\": \"\",\n \"mediaType\": \"\",\n \"suffix\": \"\",\n \"width\": 0,\n \"height\": 0,\n \"size\": \"\",\n \"type\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"deleteTime\": \"\"\n },\n \"operatorId\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/attachments";
let payload = json!({
"attachment": json!({
"id": 0,
"name": "",
"path": "",
"fileKey": "",
"thumbPath": "",
"mediaType": "",
"suffix": "",
"width": 0,
"height": 0,
"size": "",
"type": 0,
"createTime": "",
"updateTime": "",
"deleteTime": ""
}),
"operatorId": 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}}/admin/v1/attachments \
--header 'content-type: application/json' \
--data '{
"attachment": {
"id": 0,
"name": "",
"path": "",
"fileKey": "",
"thumbPath": "",
"mediaType": "",
"suffix": "",
"width": 0,
"height": 0,
"size": "",
"type": 0,
"createTime": "",
"updateTime": "",
"deleteTime": ""
},
"operatorId": 0
}'
echo '{
"attachment": {
"id": 0,
"name": "",
"path": "",
"fileKey": "",
"thumbPath": "",
"mediaType": "",
"suffix": "",
"width": 0,
"height": 0,
"size": "",
"type": 0,
"createTime": "",
"updateTime": "",
"deleteTime": ""
},
"operatorId": 0
}' | \
http POST {{baseUrl}}/admin/v1/attachments \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "attachment": {\n "id": 0,\n "name": "",\n "path": "",\n "fileKey": "",\n "thumbPath": "",\n "mediaType": "",\n "suffix": "",\n "width": 0,\n "height": 0,\n "size": "",\n "type": 0,\n "createTime": "",\n "updateTime": "",\n "deleteTime": ""\n },\n "operatorId": 0\n}' \
--output-document \
- {{baseUrl}}/admin/v1/attachments
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"attachment": [
"id": 0,
"name": "",
"path": "",
"fileKey": "",
"thumbPath": "",
"mediaType": "",
"suffix": "",
"width": 0,
"height": 0,
"size": "",
"type": 0,
"createTime": "",
"updateTime": "",
"deleteTime": ""
],
"operatorId": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/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
AttachmentService_DeleteAttachment
{{baseUrl}}/admin/v1/attachments/:id
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/attachments/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/admin/v1/attachments/:id")
require "http/client"
url = "{{baseUrl}}/admin/v1/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}}/admin/v1/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}}/admin/v1/attachments/:id");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/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/admin/v1/attachments/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/admin/v1/attachments/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/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}}/admin/v1/attachments/:id")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/admin/v1/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}}/admin/v1/attachments/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/admin/v1/attachments/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/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}}/admin/v1/attachments/:id',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/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/admin/v1/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}}/admin/v1/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}}/admin/v1/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}}/admin/v1/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}}/admin/v1/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}}/admin/v1/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}}/admin/v1/attachments/:id" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/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}}/admin/v1/attachments/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/attachments/:id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/admin/v1/attachments/:id');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/attachments/:id' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/attachments/:id' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/admin/v1/attachments/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/attachments/:id"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/attachments/:id"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/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/admin/v1/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}}/admin/v1/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}}/admin/v1/attachments/:id
http DELETE {{baseUrl}}/admin/v1/attachments/:id
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/admin/v1/attachments/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/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
AttachmentService_GetAttachment
{{baseUrl}}/admin/v1/attachments/:id
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/attachments/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/admin/v1/attachments/:id")
require "http/client"
url = "{{baseUrl}}/admin/v1/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}}/admin/v1/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}}/admin/v1/attachments/:id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/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/admin/v1/attachments/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/admin/v1/attachments/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/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}}/admin/v1/attachments/:id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/admin/v1/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}}/admin/v1/attachments/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/attachments/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/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}}/admin/v1/attachments/:id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/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/admin/v1/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}}/admin/v1/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}}/admin/v1/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}}/admin/v1/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}}/admin/v1/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}}/admin/v1/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}}/admin/v1/attachments/:id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/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}}/admin/v1/attachments/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/attachments/:id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/admin/v1/attachments/:id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/attachments/:id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/attachments/:id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/admin/v1/attachments/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/attachments/:id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/attachments/:id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/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/admin/v1/attachments/:id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/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}}/admin/v1/attachments/:id
http GET {{baseUrl}}/admin/v1/attachments/:id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/admin/v1/attachments/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/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()
GET
AttachmentService_ListAttachment
{{baseUrl}}/admin/v1/attachments
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/attachments");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/admin/v1/attachments")
require "http/client"
url = "{{baseUrl}}/admin/v1/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}}/admin/v1/attachments"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/attachments");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/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/admin/v1/attachments HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/admin/v1/attachments")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/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}}/admin/v1/attachments")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/admin/v1/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}}/admin/v1/attachments');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/attachments'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/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}}/admin/v1/attachments',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/attachments")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/admin/v1/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}}/admin/v1/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}}/admin/v1/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}}/admin/v1/attachments'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/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}}/admin/v1/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}}/admin/v1/attachments" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/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}}/admin/v1/attachments');
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/attachments');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/admin/v1/attachments');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/attachments' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/attachments' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/admin/v1/attachments")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/attachments"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/attachments"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/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/admin/v1/attachments') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/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}}/admin/v1/attachments
http GET {{baseUrl}}/admin/v1/attachments
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/admin/v1/attachments
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/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()
PUT
AttachmentService_UpdateAttachment
{{baseUrl}}/admin/v1/attachments/:id
QUERY PARAMS
id
BODY json
{
"id": 0,
"name": "",
"path": "",
"fileKey": "",
"thumbPath": "",
"mediaType": "",
"suffix": "",
"width": 0,
"height": 0,
"size": "",
"type": 0,
"createTime": "",
"updateTime": "",
"deleteTime": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/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 \"id\": 0,\n \"name\": \"\",\n \"path\": \"\",\n \"fileKey\": \"\",\n \"thumbPath\": \"\",\n \"mediaType\": \"\",\n \"suffix\": \"\",\n \"width\": 0,\n \"height\": 0,\n \"size\": \"\",\n \"type\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"deleteTime\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/admin/v1/attachments/:id" {:content-type :json
:form-params {:id 0
:name ""
:path ""
:fileKey ""
:thumbPath ""
:mediaType ""
:suffix ""
:width 0
:height 0
:size ""
:type 0
:createTime ""
:updateTime ""
:deleteTime ""}})
require "http/client"
url = "{{baseUrl}}/admin/v1/attachments/:id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"id\": 0,\n \"name\": \"\",\n \"path\": \"\",\n \"fileKey\": \"\",\n \"thumbPath\": \"\",\n \"mediaType\": \"\",\n \"suffix\": \"\",\n \"width\": 0,\n \"height\": 0,\n \"size\": \"\",\n \"type\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"deleteTime\": \"\"\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/admin/v1/attachments/:id"),
Content = new StringContent("{\n \"id\": 0,\n \"name\": \"\",\n \"path\": \"\",\n \"fileKey\": \"\",\n \"thumbPath\": \"\",\n \"mediaType\": \"\",\n \"suffix\": \"\",\n \"width\": 0,\n \"height\": 0,\n \"size\": \"\",\n \"type\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"deleteTime\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/attachments/:id");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"id\": 0,\n \"name\": \"\",\n \"path\": \"\",\n \"fileKey\": \"\",\n \"thumbPath\": \"\",\n \"mediaType\": \"\",\n \"suffix\": \"\",\n \"width\": 0,\n \"height\": 0,\n \"size\": \"\",\n \"type\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"deleteTime\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/attachments/:id"
payload := strings.NewReader("{\n \"id\": 0,\n \"name\": \"\",\n \"path\": \"\",\n \"fileKey\": \"\",\n \"thumbPath\": \"\",\n \"mediaType\": \"\",\n \"suffix\": \"\",\n \"width\": 0,\n \"height\": 0,\n \"size\": \"\",\n \"type\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"deleteTime\": \"\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/admin/v1/attachments/:id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 228
{
"id": 0,
"name": "",
"path": "",
"fileKey": "",
"thumbPath": "",
"mediaType": "",
"suffix": "",
"width": 0,
"height": 0,
"size": "",
"type": 0,
"createTime": "",
"updateTime": "",
"deleteTime": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/admin/v1/attachments/:id")
.setHeader("content-type", "application/json")
.setBody("{\n \"id\": 0,\n \"name\": \"\",\n \"path\": \"\",\n \"fileKey\": \"\",\n \"thumbPath\": \"\",\n \"mediaType\": \"\",\n \"suffix\": \"\",\n \"width\": 0,\n \"height\": 0,\n \"size\": \"\",\n \"type\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"deleteTime\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/attachments/:id"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"id\": 0,\n \"name\": \"\",\n \"path\": \"\",\n \"fileKey\": \"\",\n \"thumbPath\": \"\",\n \"mediaType\": \"\",\n \"suffix\": \"\",\n \"width\": 0,\n \"height\": 0,\n \"size\": \"\",\n \"type\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"deleteTime\": \"\"\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 \"path\": \"\",\n \"fileKey\": \"\",\n \"thumbPath\": \"\",\n \"mediaType\": \"\",\n \"suffix\": \"\",\n \"width\": 0,\n \"height\": 0,\n \"size\": \"\",\n \"type\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"deleteTime\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/admin/v1/attachments/:id")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/admin/v1/attachments/:id")
.header("content-type", "application/json")
.body("{\n \"id\": 0,\n \"name\": \"\",\n \"path\": \"\",\n \"fileKey\": \"\",\n \"thumbPath\": \"\",\n \"mediaType\": \"\",\n \"suffix\": \"\",\n \"width\": 0,\n \"height\": 0,\n \"size\": \"\",\n \"type\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"deleteTime\": \"\"\n}")
.asString();
const data = JSON.stringify({
id: 0,
name: '',
path: '',
fileKey: '',
thumbPath: '',
mediaType: '',
suffix: '',
width: 0,
height: 0,
size: '',
type: 0,
createTime: '',
updateTime: '',
deleteTime: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/admin/v1/attachments/:id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/admin/v1/attachments/:id',
headers: {'content-type': 'application/json'},
data: {
id: 0,
name: '',
path: '',
fileKey: '',
thumbPath: '',
mediaType: '',
suffix: '',
width: 0,
height: 0,
size: '',
type: 0,
createTime: '',
updateTime: '',
deleteTime: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/attachments/:id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"id":0,"name":"","path":"","fileKey":"","thumbPath":"","mediaType":"","suffix":"","width":0,"height":0,"size":"","type":0,"createTime":"","updateTime":"","deleteTime":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/admin/v1/attachments/:id',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "id": 0,\n "name": "",\n "path": "",\n "fileKey": "",\n "thumbPath": "",\n "mediaType": "",\n "suffix": "",\n "width": 0,\n "height": 0,\n "size": "",\n "type": 0,\n "createTime": "",\n "updateTime": "",\n "deleteTime": ""\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 \"path\": \"\",\n \"fileKey\": \"\",\n \"thumbPath\": \"\",\n \"mediaType\": \"\",\n \"suffix\": \"\",\n \"width\": 0,\n \"height\": 0,\n \"size\": \"\",\n \"type\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"deleteTime\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/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/admin/v1/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({
id: 0,
name: '',
path: '',
fileKey: '',
thumbPath: '',
mediaType: '',
suffix: '',
width: 0,
height: 0,
size: '',
type: 0,
createTime: '',
updateTime: '',
deleteTime: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/admin/v1/attachments/:id',
headers: {'content-type': 'application/json'},
body: {
id: 0,
name: '',
path: '',
fileKey: '',
thumbPath: '',
mediaType: '',
suffix: '',
width: 0,
height: 0,
size: '',
type: 0,
createTime: '',
updateTime: '',
deleteTime: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/admin/v1/attachments/:id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
id: 0,
name: '',
path: '',
fileKey: '',
thumbPath: '',
mediaType: '',
suffix: '',
width: 0,
height: 0,
size: '',
type: 0,
createTime: '',
updateTime: '',
deleteTime: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/admin/v1/attachments/:id',
headers: {'content-type': 'application/json'},
data: {
id: 0,
name: '',
path: '',
fileKey: '',
thumbPath: '',
mediaType: '',
suffix: '',
width: 0,
height: 0,
size: '',
type: 0,
createTime: '',
updateTime: '',
deleteTime: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/attachments/:id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"id":0,"name":"","path":"","fileKey":"","thumbPath":"","mediaType":"","suffix":"","width":0,"height":0,"size":"","type":0,"createTime":"","updateTime":"","deleteTime":""}'
};
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": @"",
@"path": @"",
@"fileKey": @"",
@"thumbPath": @"",
@"mediaType": @"",
@"suffix": @"",
@"width": @0,
@"height": @0,
@"size": @"",
@"type": @0,
@"createTime": @"",
@"updateTime": @"",
@"deleteTime": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/admin/v1/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}}/admin/v1/attachments/: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 \"path\": \"\",\n \"fileKey\": \"\",\n \"thumbPath\": \"\",\n \"mediaType\": \"\",\n \"suffix\": \"\",\n \"width\": 0,\n \"height\": 0,\n \"size\": \"\",\n \"type\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"deleteTime\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/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([
'id' => 0,
'name' => '',
'path' => '',
'fileKey' => '',
'thumbPath' => '',
'mediaType' => '',
'suffix' => '',
'width' => 0,
'height' => 0,
'size' => '',
'type' => 0,
'createTime' => '',
'updateTime' => '',
'deleteTime' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/admin/v1/attachments/:id', [
'body' => '{
"id": 0,
"name": "",
"path": "",
"fileKey": "",
"thumbPath": "",
"mediaType": "",
"suffix": "",
"width": 0,
"height": 0,
"size": "",
"type": 0,
"createTime": "",
"updateTime": "",
"deleteTime": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/attachments/:id');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'id' => 0,
'name' => '',
'path' => '',
'fileKey' => '',
'thumbPath' => '',
'mediaType' => '',
'suffix' => '',
'width' => 0,
'height' => 0,
'size' => '',
'type' => 0,
'createTime' => '',
'updateTime' => '',
'deleteTime' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'id' => 0,
'name' => '',
'path' => '',
'fileKey' => '',
'thumbPath' => '',
'mediaType' => '',
'suffix' => '',
'width' => 0,
'height' => 0,
'size' => '',
'type' => 0,
'createTime' => '',
'updateTime' => '',
'deleteTime' => ''
]));
$request->setRequestUrl('{{baseUrl}}/admin/v1/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}}/admin/v1/attachments/:id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"id": 0,
"name": "",
"path": "",
"fileKey": "",
"thumbPath": "",
"mediaType": "",
"suffix": "",
"width": 0,
"height": 0,
"size": "",
"type": 0,
"createTime": "",
"updateTime": "",
"deleteTime": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/attachments/:id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"id": 0,
"name": "",
"path": "",
"fileKey": "",
"thumbPath": "",
"mediaType": "",
"suffix": "",
"width": 0,
"height": 0,
"size": "",
"type": 0,
"createTime": "",
"updateTime": "",
"deleteTime": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"id\": 0,\n \"name\": \"\",\n \"path\": \"\",\n \"fileKey\": \"\",\n \"thumbPath\": \"\",\n \"mediaType\": \"\",\n \"suffix\": \"\",\n \"width\": 0,\n \"height\": 0,\n \"size\": \"\",\n \"type\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"deleteTime\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/admin/v1/attachments/:id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/attachments/:id"
payload = {
"id": 0,
"name": "",
"path": "",
"fileKey": "",
"thumbPath": "",
"mediaType": "",
"suffix": "",
"width": 0,
"height": 0,
"size": "",
"type": 0,
"createTime": "",
"updateTime": "",
"deleteTime": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/attachments/:id"
payload <- "{\n \"id\": 0,\n \"name\": \"\",\n \"path\": \"\",\n \"fileKey\": \"\",\n \"thumbPath\": \"\",\n \"mediaType\": \"\",\n \"suffix\": \"\",\n \"width\": 0,\n \"height\": 0,\n \"size\": \"\",\n \"type\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"deleteTime\": \"\"\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/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 \"id\": 0,\n \"name\": \"\",\n \"path\": \"\",\n \"fileKey\": \"\",\n \"thumbPath\": \"\",\n \"mediaType\": \"\",\n \"suffix\": \"\",\n \"width\": 0,\n \"height\": 0,\n \"size\": \"\",\n \"type\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"deleteTime\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/admin/v1/attachments/:id') do |req|
req.body = "{\n \"id\": 0,\n \"name\": \"\",\n \"path\": \"\",\n \"fileKey\": \"\",\n \"thumbPath\": \"\",\n \"mediaType\": \"\",\n \"suffix\": \"\",\n \"width\": 0,\n \"height\": 0,\n \"size\": \"\",\n \"type\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"deleteTime\": \"\"\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/attachments/:id";
let payload = json!({
"id": 0,
"name": "",
"path": "",
"fileKey": "",
"thumbPath": "",
"mediaType": "",
"suffix": "",
"width": 0,
"height": 0,
"size": "",
"type": 0,
"createTime": "",
"updateTime": "",
"deleteTime": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/admin/v1/attachments/:id \
--header 'content-type: application/json' \
--data '{
"id": 0,
"name": "",
"path": "",
"fileKey": "",
"thumbPath": "",
"mediaType": "",
"suffix": "",
"width": 0,
"height": 0,
"size": "",
"type": 0,
"createTime": "",
"updateTime": "",
"deleteTime": ""
}'
echo '{
"id": 0,
"name": "",
"path": "",
"fileKey": "",
"thumbPath": "",
"mediaType": "",
"suffix": "",
"width": 0,
"height": 0,
"size": "",
"type": 0,
"createTime": "",
"updateTime": "",
"deleteTime": ""
}' | \
http PUT {{baseUrl}}/admin/v1/attachments/:id \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "id": 0,\n "name": "",\n "path": "",\n "fileKey": "",\n "thumbPath": "",\n "mediaType": "",\n "suffix": "",\n "width": 0,\n "height": 0,\n "size": "",\n "type": 0,\n "createTime": "",\n "updateTime": "",\n "deleteTime": ""\n}' \
--output-document \
- {{baseUrl}}/admin/v1/attachments/:id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"id": 0,
"name": "",
"path": "",
"fileKey": "",
"thumbPath": "",
"mediaType": "",
"suffix": "",
"width": 0,
"height": 0,
"size": "",
"type": 0,
"createTime": "",
"updateTime": "",
"deleteTime": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/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
AuthenticationService_GetMe
{{baseUrl}}/admin/v1/me
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/me");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/admin/v1/me")
require "http/client"
url = "{{baseUrl}}/admin/v1/me"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/admin/v1/me"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/me");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/me"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/admin/v1/me HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/admin/v1/me")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/me"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/admin/v1/me")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/admin/v1/me")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/admin/v1/me');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/me'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/me';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/admin/v1/me',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/me")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/admin/v1/me',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/me'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/admin/v1/me');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/me'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/me';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/admin/v1/me"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/admin/v1/me" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/me",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/admin/v1/me');
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/me');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/admin/v1/me');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/me' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/me' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/admin/v1/me")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/me"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/me"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/me")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/admin/v1/me') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/me";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/admin/v1/me
http GET {{baseUrl}}/admin/v1/me
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/admin/v1/me
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/me")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
AuthenticationService_Login
{{baseUrl}}/admin/v1/login
BODY json
{
"username": "",
"password": "",
"grant_type": "",
"scope": "",
"client_id": "",
"client_secret": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/login");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"username\": \"\",\n \"password\": \"\",\n \"grant_type\": \"\",\n \"scope\": \"\",\n \"client_id\": \"\",\n \"client_secret\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/admin/v1/login" {:content-type :json
:form-params {:username ""
:password ""
:grant_type ""
:scope ""
:client_id ""
:client_secret ""}})
require "http/client"
url = "{{baseUrl}}/admin/v1/login"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"username\": \"\",\n \"password\": \"\",\n \"grant_type\": \"\",\n \"scope\": \"\",\n \"client_id\": \"\",\n \"client_secret\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/admin/v1/login"),
Content = new StringContent("{\n \"username\": \"\",\n \"password\": \"\",\n \"grant_type\": \"\",\n \"scope\": \"\",\n \"client_id\": \"\",\n \"client_secret\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/login");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"username\": \"\",\n \"password\": \"\",\n \"grant_type\": \"\",\n \"scope\": \"\",\n \"client_id\": \"\",\n \"client_secret\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/login"
payload := strings.NewReader("{\n \"username\": \"\",\n \"password\": \"\",\n \"grant_type\": \"\",\n \"scope\": \"\",\n \"client_id\": \"\",\n \"client_secret\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/admin/v1/login HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 115
{
"username": "",
"password": "",
"grant_type": "",
"scope": "",
"client_id": "",
"client_secret": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/admin/v1/login")
.setHeader("content-type", "application/json")
.setBody("{\n \"username\": \"\",\n \"password\": \"\",\n \"grant_type\": \"\",\n \"scope\": \"\",\n \"client_id\": \"\",\n \"client_secret\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/login"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"username\": \"\",\n \"password\": \"\",\n \"grant_type\": \"\",\n \"scope\": \"\",\n \"client_id\": \"\",\n \"client_secret\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"username\": \"\",\n \"password\": \"\",\n \"grant_type\": \"\",\n \"scope\": \"\",\n \"client_id\": \"\",\n \"client_secret\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/admin/v1/login")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/admin/v1/login")
.header("content-type", "application/json")
.body("{\n \"username\": \"\",\n \"password\": \"\",\n \"grant_type\": \"\",\n \"scope\": \"\",\n \"client_id\": \"\",\n \"client_secret\": \"\"\n}")
.asString();
const data = JSON.stringify({
username: '',
password: '',
grant_type: '',
scope: '',
client_id: '',
client_secret: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/admin/v1/login');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/admin/v1/login',
headers: {'content-type': 'application/json'},
data: {
username: '',
password: '',
grant_type: '',
scope: '',
client_id: '',
client_secret: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/login';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"username":"","password":"","grant_type":"","scope":"","client_id":"","client_secret":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/admin/v1/login',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "username": "",\n "password": "",\n "grant_type": "",\n "scope": "",\n "client_id": "",\n "client_secret": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"username\": \"\",\n \"password\": \"\",\n \"grant_type\": \"\",\n \"scope\": \"\",\n \"client_id\": \"\",\n \"client_secret\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/login")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/admin/v1/login',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
username: '',
password: '',
grant_type: '',
scope: '',
client_id: '',
client_secret: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/admin/v1/login',
headers: {'content-type': 'application/json'},
body: {
username: '',
password: '',
grant_type: '',
scope: '',
client_id: '',
client_secret: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/admin/v1/login');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
username: '',
password: '',
grant_type: '',
scope: '',
client_id: '',
client_secret: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/admin/v1/login',
headers: {'content-type': 'application/json'},
data: {
username: '',
password: '',
grant_type: '',
scope: '',
client_id: '',
client_secret: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/login';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"username":"","password":"","grant_type":"","scope":"","client_id":"","client_secret":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"username": @"",
@"password": @"",
@"grant_type": @"",
@"scope": @"",
@"client_id": @"",
@"client_secret": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/admin/v1/login"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/admin/v1/login" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"username\": \"\",\n \"password\": \"\",\n \"grant_type\": \"\",\n \"scope\": \"\",\n \"client_id\": \"\",\n \"client_secret\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/login",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'username' => '',
'password' => '',
'grant_type' => '',
'scope' => '',
'client_id' => '',
'client_secret' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/admin/v1/login', [
'body' => '{
"username": "",
"password": "",
"grant_type": "",
"scope": "",
"client_id": "",
"client_secret": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/login');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'username' => '',
'password' => '',
'grant_type' => '',
'scope' => '',
'client_id' => '',
'client_secret' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'username' => '',
'password' => '',
'grant_type' => '',
'scope' => '',
'client_id' => '',
'client_secret' => ''
]));
$request->setRequestUrl('{{baseUrl}}/admin/v1/login');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/login' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"username": "",
"password": "",
"grant_type": "",
"scope": "",
"client_id": "",
"client_secret": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/login' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"username": "",
"password": "",
"grant_type": "",
"scope": "",
"client_id": "",
"client_secret": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"username\": \"\",\n \"password\": \"\",\n \"grant_type\": \"\",\n \"scope\": \"\",\n \"client_id\": \"\",\n \"client_secret\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/admin/v1/login", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/login"
payload = {
"username": "",
"password": "",
"grant_type": "",
"scope": "",
"client_id": "",
"client_secret": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/login"
payload <- "{\n \"username\": \"\",\n \"password\": \"\",\n \"grant_type\": \"\",\n \"scope\": \"\",\n \"client_id\": \"\",\n \"client_secret\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/login")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"username\": \"\",\n \"password\": \"\",\n \"grant_type\": \"\",\n \"scope\": \"\",\n \"client_id\": \"\",\n \"client_secret\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/admin/v1/login') do |req|
req.body = "{\n \"username\": \"\",\n \"password\": \"\",\n \"grant_type\": \"\",\n \"scope\": \"\",\n \"client_id\": \"\",\n \"client_secret\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/login";
let payload = json!({
"username": "",
"password": "",
"grant_type": "",
"scope": "",
"client_id": "",
"client_secret": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/admin/v1/login \
--header 'content-type: application/json' \
--data '{
"username": "",
"password": "",
"grant_type": "",
"scope": "",
"client_id": "",
"client_secret": ""
}'
echo '{
"username": "",
"password": "",
"grant_type": "",
"scope": "",
"client_id": "",
"client_secret": ""
}' | \
http POST {{baseUrl}}/admin/v1/login \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "username": "",\n "password": "",\n "grant_type": "",\n "scope": "",\n "client_id": "",\n "client_secret": ""\n}' \
--output-document \
- {{baseUrl}}/admin/v1/login
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"username": "",
"password": "",
"grant_type": "",
"scope": "",
"client_id": "",
"client_secret": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/login")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
AuthenticationService_Logout
{{baseUrl}}/admin/v1/logout
BODY json
{
"id": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/logout");
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}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/admin/v1/logout" {:content-type :json
:form-params {:id 0}})
require "http/client"
url = "{{baseUrl}}/admin/v1/logout"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"id\": 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}}/admin/v1/logout"),
Content = new StringContent("{\n \"id\": 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}}/admin/v1/logout");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"id\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/logout"
payload := strings.NewReader("{\n \"id\": 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/admin/v1/logout HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 13
{
"id": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/admin/v1/logout")
.setHeader("content-type", "application/json")
.setBody("{\n \"id\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/logout"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"id\": 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}");
Request request = new Request.Builder()
.url("{{baseUrl}}/admin/v1/logout")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/admin/v1/logout")
.header("content-type", "application/json")
.body("{\n \"id\": 0\n}")
.asString();
const data = JSON.stringify({
id: 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}}/admin/v1/logout');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/admin/v1/logout',
headers: {'content-type': 'application/json'},
data: {id: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/logout';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"id":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}}/admin/v1/logout',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "id": 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}")
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/logout")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/admin/v1/logout',
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}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/admin/v1/logout',
headers: {'content-type': 'application/json'},
body: {id: 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}}/admin/v1/logout');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
id: 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}}/admin/v1/logout',
headers: {'content-type': 'application/json'},
data: {id: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/logout';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"id":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 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/admin/v1/logout"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/admin/v1/logout" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"id\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/logout",
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
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/admin/v1/logout', [
'body' => '{
"id": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/logout');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'id' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'id' => 0
]));
$request->setRequestUrl('{{baseUrl}}/admin/v1/logout');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/logout' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"id": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/logout' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"id": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"id\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/admin/v1/logout", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/logout"
payload = { "id": 0 }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/logout"
payload <- "{\n \"id\": 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}}/admin/v1/logout")
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}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/admin/v1/logout') do |req|
req.body = "{\n \"id\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/logout";
let payload = json!({"id": 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}}/admin/v1/logout \
--header 'content-type: application/json' \
--data '{
"id": 0
}'
echo '{
"id": 0
}' | \
http POST {{baseUrl}}/admin/v1/logout \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "id": 0\n}' \
--output-document \
- {{baseUrl}}/admin/v1/logout
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["id": 0] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/logout")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
CategoryService_CreateCategory
{{baseUrl}}/admin/v1/categories
BODY json
{
"category": {
"id": 0,
"parentId": 0,
"name": "",
"slug": "",
"description": "",
"thumbnail": "",
"password": "",
"fullPath": "",
"priority": 0,
"createTime": "",
"updateTime": "",
"postCount": 0
},
"operatorId": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/categories");
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 \"category\": {\n \"id\": 0,\n \"parentId\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"description\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"fullPath\": \"\",\n \"priority\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"postCount\": 0\n },\n \"operatorId\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/admin/v1/categories" {:content-type :json
:form-params {:category {:id 0
:parentId 0
:name ""
:slug ""
:description ""
:thumbnail ""
:password ""
:fullPath ""
:priority 0
:createTime ""
:updateTime ""
:postCount 0}
:operatorId 0}})
require "http/client"
url = "{{baseUrl}}/admin/v1/categories"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"category\": {\n \"id\": 0,\n \"parentId\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"description\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"fullPath\": \"\",\n \"priority\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"postCount\": 0\n },\n \"operatorId\": 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}}/admin/v1/categories"),
Content = new StringContent("{\n \"category\": {\n \"id\": 0,\n \"parentId\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"description\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"fullPath\": \"\",\n \"priority\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"postCount\": 0\n },\n \"operatorId\": 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}}/admin/v1/categories");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"category\": {\n \"id\": 0,\n \"parentId\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"description\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"fullPath\": \"\",\n \"priority\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"postCount\": 0\n },\n \"operatorId\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/categories"
payload := strings.NewReader("{\n \"category\": {\n \"id\": 0,\n \"parentId\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"description\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"fullPath\": \"\",\n \"priority\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"postCount\": 0\n },\n \"operatorId\": 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/admin/v1/categories HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 272
{
"category": {
"id": 0,
"parentId": 0,
"name": "",
"slug": "",
"description": "",
"thumbnail": "",
"password": "",
"fullPath": "",
"priority": 0,
"createTime": "",
"updateTime": "",
"postCount": 0
},
"operatorId": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/admin/v1/categories")
.setHeader("content-type", "application/json")
.setBody("{\n \"category\": {\n \"id\": 0,\n \"parentId\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"description\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"fullPath\": \"\",\n \"priority\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"postCount\": 0\n },\n \"operatorId\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/categories"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"category\": {\n \"id\": 0,\n \"parentId\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"description\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"fullPath\": \"\",\n \"priority\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"postCount\": 0\n },\n \"operatorId\": 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 \"category\": {\n \"id\": 0,\n \"parentId\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"description\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"fullPath\": \"\",\n \"priority\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"postCount\": 0\n },\n \"operatorId\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/admin/v1/categories")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/admin/v1/categories")
.header("content-type", "application/json")
.body("{\n \"category\": {\n \"id\": 0,\n \"parentId\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"description\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"fullPath\": \"\",\n \"priority\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"postCount\": 0\n },\n \"operatorId\": 0\n}")
.asString();
const data = JSON.stringify({
category: {
id: 0,
parentId: 0,
name: '',
slug: '',
description: '',
thumbnail: '',
password: '',
fullPath: '',
priority: 0,
createTime: '',
updateTime: '',
postCount: 0
},
operatorId: 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}}/admin/v1/categories');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/admin/v1/categories',
headers: {'content-type': 'application/json'},
data: {
category: {
id: 0,
parentId: 0,
name: '',
slug: '',
description: '',
thumbnail: '',
password: '',
fullPath: '',
priority: 0,
createTime: '',
updateTime: '',
postCount: 0
},
operatorId: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/categories';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"category":{"id":0,"parentId":0,"name":"","slug":"","description":"","thumbnail":"","password":"","fullPath":"","priority":0,"createTime":"","updateTime":"","postCount":0},"operatorId":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}}/admin/v1/categories',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "category": {\n "id": 0,\n "parentId": 0,\n "name": "",\n "slug": "",\n "description": "",\n "thumbnail": "",\n "password": "",\n "fullPath": "",\n "priority": 0,\n "createTime": "",\n "updateTime": "",\n "postCount": 0\n },\n "operatorId": 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 \"category\": {\n \"id\": 0,\n \"parentId\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"description\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"fullPath\": \"\",\n \"priority\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"postCount\": 0\n },\n \"operatorId\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/categories")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/admin/v1/categories',
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({
category: {
id: 0,
parentId: 0,
name: '',
slug: '',
description: '',
thumbnail: '',
password: '',
fullPath: '',
priority: 0,
createTime: '',
updateTime: '',
postCount: 0
},
operatorId: 0
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/admin/v1/categories',
headers: {'content-type': 'application/json'},
body: {
category: {
id: 0,
parentId: 0,
name: '',
slug: '',
description: '',
thumbnail: '',
password: '',
fullPath: '',
priority: 0,
createTime: '',
updateTime: '',
postCount: 0
},
operatorId: 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}}/admin/v1/categories');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
category: {
id: 0,
parentId: 0,
name: '',
slug: '',
description: '',
thumbnail: '',
password: '',
fullPath: '',
priority: 0,
createTime: '',
updateTime: '',
postCount: 0
},
operatorId: 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}}/admin/v1/categories',
headers: {'content-type': 'application/json'},
data: {
category: {
id: 0,
parentId: 0,
name: '',
slug: '',
description: '',
thumbnail: '',
password: '',
fullPath: '',
priority: 0,
createTime: '',
updateTime: '',
postCount: 0
},
operatorId: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/categories';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"category":{"id":0,"parentId":0,"name":"","slug":"","description":"","thumbnail":"","password":"","fullPath":"","priority":0,"createTime":"","updateTime":"","postCount":0},"operatorId":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 = @{ @"category": @{ @"id": @0, @"parentId": @0, @"name": @"", @"slug": @"", @"description": @"", @"thumbnail": @"", @"password": @"", @"fullPath": @"", @"priority": @0, @"createTime": @"", @"updateTime": @"", @"postCount": @0 },
@"operatorId": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/admin/v1/categories"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/admin/v1/categories" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"category\": {\n \"id\": 0,\n \"parentId\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"description\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"fullPath\": \"\",\n \"priority\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"postCount\": 0\n },\n \"operatorId\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/categories",
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([
'category' => [
'id' => 0,
'parentId' => 0,
'name' => '',
'slug' => '',
'description' => '',
'thumbnail' => '',
'password' => '',
'fullPath' => '',
'priority' => 0,
'createTime' => '',
'updateTime' => '',
'postCount' => 0
],
'operatorId' => 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}}/admin/v1/categories', [
'body' => '{
"category": {
"id": 0,
"parentId": 0,
"name": "",
"slug": "",
"description": "",
"thumbnail": "",
"password": "",
"fullPath": "",
"priority": 0,
"createTime": "",
"updateTime": "",
"postCount": 0
},
"operatorId": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/categories');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'category' => [
'id' => 0,
'parentId' => 0,
'name' => '',
'slug' => '',
'description' => '',
'thumbnail' => '',
'password' => '',
'fullPath' => '',
'priority' => 0,
'createTime' => '',
'updateTime' => '',
'postCount' => 0
],
'operatorId' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'category' => [
'id' => 0,
'parentId' => 0,
'name' => '',
'slug' => '',
'description' => '',
'thumbnail' => '',
'password' => '',
'fullPath' => '',
'priority' => 0,
'createTime' => '',
'updateTime' => '',
'postCount' => 0
],
'operatorId' => 0
]));
$request->setRequestUrl('{{baseUrl}}/admin/v1/categories');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/categories' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"category": {
"id": 0,
"parentId": 0,
"name": "",
"slug": "",
"description": "",
"thumbnail": "",
"password": "",
"fullPath": "",
"priority": 0,
"createTime": "",
"updateTime": "",
"postCount": 0
},
"operatorId": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/categories' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"category": {
"id": 0,
"parentId": 0,
"name": "",
"slug": "",
"description": "",
"thumbnail": "",
"password": "",
"fullPath": "",
"priority": 0,
"createTime": "",
"updateTime": "",
"postCount": 0
},
"operatorId": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"category\": {\n \"id\": 0,\n \"parentId\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"description\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"fullPath\": \"\",\n \"priority\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"postCount\": 0\n },\n \"operatorId\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/admin/v1/categories", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/categories"
payload = {
"category": {
"id": 0,
"parentId": 0,
"name": "",
"slug": "",
"description": "",
"thumbnail": "",
"password": "",
"fullPath": "",
"priority": 0,
"createTime": "",
"updateTime": "",
"postCount": 0
},
"operatorId": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/categories"
payload <- "{\n \"category\": {\n \"id\": 0,\n \"parentId\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"description\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"fullPath\": \"\",\n \"priority\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"postCount\": 0\n },\n \"operatorId\": 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}}/admin/v1/categories")
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 \"category\": {\n \"id\": 0,\n \"parentId\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"description\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"fullPath\": \"\",\n \"priority\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"postCount\": 0\n },\n \"operatorId\": 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/admin/v1/categories') do |req|
req.body = "{\n \"category\": {\n \"id\": 0,\n \"parentId\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"description\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"fullPath\": \"\",\n \"priority\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"postCount\": 0\n },\n \"operatorId\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/categories";
let payload = json!({
"category": json!({
"id": 0,
"parentId": 0,
"name": "",
"slug": "",
"description": "",
"thumbnail": "",
"password": "",
"fullPath": "",
"priority": 0,
"createTime": "",
"updateTime": "",
"postCount": 0
}),
"operatorId": 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}}/admin/v1/categories \
--header 'content-type: application/json' \
--data '{
"category": {
"id": 0,
"parentId": 0,
"name": "",
"slug": "",
"description": "",
"thumbnail": "",
"password": "",
"fullPath": "",
"priority": 0,
"createTime": "",
"updateTime": "",
"postCount": 0
},
"operatorId": 0
}'
echo '{
"category": {
"id": 0,
"parentId": 0,
"name": "",
"slug": "",
"description": "",
"thumbnail": "",
"password": "",
"fullPath": "",
"priority": 0,
"createTime": "",
"updateTime": "",
"postCount": 0
},
"operatorId": 0
}' | \
http POST {{baseUrl}}/admin/v1/categories \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "category": {\n "id": 0,\n "parentId": 0,\n "name": "",\n "slug": "",\n "description": "",\n "thumbnail": "",\n "password": "",\n "fullPath": "",\n "priority": 0,\n "createTime": "",\n "updateTime": "",\n "postCount": 0\n },\n "operatorId": 0\n}' \
--output-document \
- {{baseUrl}}/admin/v1/categories
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"category": [
"id": 0,
"parentId": 0,
"name": "",
"slug": "",
"description": "",
"thumbnail": "",
"password": "",
"fullPath": "",
"priority": 0,
"createTime": "",
"updateTime": "",
"postCount": 0
],
"operatorId": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/categories")! 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
CategoryService_DeleteCategory
{{baseUrl}}/admin/v1/categories/:id
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/categories/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/admin/v1/categories/:id")
require "http/client"
url = "{{baseUrl}}/admin/v1/categories/: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}}/admin/v1/categories/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/categories/:id");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/categories/: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/admin/v1/categories/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/admin/v1/categories/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/categories/: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}}/admin/v1/categories/:id")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/admin/v1/categories/: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}}/admin/v1/categories/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/admin/v1/categories/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/categories/: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}}/admin/v1/categories/:id',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/categories/: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/admin/v1/categories/: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}}/admin/v1/categories/: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}}/admin/v1/categories/: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}}/admin/v1/categories/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/categories/: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}}/admin/v1/categories/: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}}/admin/v1/categories/:id" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/categories/: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}}/admin/v1/categories/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/categories/:id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/admin/v1/categories/:id');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/categories/:id' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/categories/:id' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/admin/v1/categories/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/categories/:id"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/categories/:id"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/categories/: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/admin/v1/categories/: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}}/admin/v1/categories/: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}}/admin/v1/categories/:id
http DELETE {{baseUrl}}/admin/v1/categories/:id
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/admin/v1/categories/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/categories/: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
CategoryService_GetCategory
{{baseUrl}}/admin/v1/categories/:id
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/categories/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/admin/v1/categories/:id")
require "http/client"
url = "{{baseUrl}}/admin/v1/categories/: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}}/admin/v1/categories/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/categories/:id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/categories/: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/admin/v1/categories/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/admin/v1/categories/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/categories/: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}}/admin/v1/categories/:id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/admin/v1/categories/: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}}/admin/v1/categories/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/categories/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/categories/: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}}/admin/v1/categories/:id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/categories/:id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/admin/v1/categories/: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}}/admin/v1/categories/: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}}/admin/v1/categories/: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}}/admin/v1/categories/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/categories/: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}}/admin/v1/categories/: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}}/admin/v1/categories/:id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/categories/: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}}/admin/v1/categories/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/categories/:id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/admin/v1/categories/:id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/categories/:id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/categories/:id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/admin/v1/categories/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/categories/:id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/categories/:id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/categories/: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/admin/v1/categories/:id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/categories/: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}}/admin/v1/categories/:id
http GET {{baseUrl}}/admin/v1/categories/:id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/admin/v1/categories/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/categories/: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
CategoryService_ListCategory
{{baseUrl}}/admin/v1/categories
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/categories");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/admin/v1/categories")
require "http/client"
url = "{{baseUrl}}/admin/v1/categories"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/admin/v1/categories"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/categories");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/categories"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/admin/v1/categories HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/admin/v1/categories")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/categories"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/admin/v1/categories")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/admin/v1/categories")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/admin/v1/categories');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/categories'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/categories';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/admin/v1/categories',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/categories")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/admin/v1/categories',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/categories'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/admin/v1/categories');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/categories'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/categories';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/admin/v1/categories"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/admin/v1/categories" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/categories",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/admin/v1/categories');
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/categories');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/admin/v1/categories');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/categories' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/categories' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/admin/v1/categories")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/categories"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/categories"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/categories")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/admin/v1/categories') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/categories";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/admin/v1/categories
http GET {{baseUrl}}/admin/v1/categories
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/admin/v1/categories
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/categories")! 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
CategoryService_UpdateCategory
{{baseUrl}}/admin/v1/categories/:id
QUERY PARAMS
id
BODY json
{
"id": 0,
"parentId": 0,
"name": "",
"slug": "",
"description": "",
"thumbnail": "",
"password": "",
"fullPath": "",
"priority": 0,
"createTime": "",
"updateTime": "",
"postCount": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/categories/: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 \"parentId\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"description\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"fullPath\": \"\",\n \"priority\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"postCount\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/admin/v1/categories/:id" {:content-type :json
:form-params {:id 0
:parentId 0
:name ""
:slug ""
:description ""
:thumbnail ""
:password ""
:fullPath ""
:priority 0
:createTime ""
:updateTime ""
:postCount 0}})
require "http/client"
url = "{{baseUrl}}/admin/v1/categories/:id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"id\": 0,\n \"parentId\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"description\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"fullPath\": \"\",\n \"priority\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"postCount\": 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}}/admin/v1/categories/:id"),
Content = new StringContent("{\n \"id\": 0,\n \"parentId\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"description\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"fullPath\": \"\",\n \"priority\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"postCount\": 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}}/admin/v1/categories/:id");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"id\": 0,\n \"parentId\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"description\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"fullPath\": \"\",\n \"priority\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"postCount\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/categories/:id"
payload := strings.NewReader("{\n \"id\": 0,\n \"parentId\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"description\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"fullPath\": \"\",\n \"priority\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"postCount\": 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/admin/v1/categories/:id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 209
{
"id": 0,
"parentId": 0,
"name": "",
"slug": "",
"description": "",
"thumbnail": "",
"password": "",
"fullPath": "",
"priority": 0,
"createTime": "",
"updateTime": "",
"postCount": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/admin/v1/categories/:id")
.setHeader("content-type", "application/json")
.setBody("{\n \"id\": 0,\n \"parentId\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"description\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"fullPath\": \"\",\n \"priority\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"postCount\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/categories/:id"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"id\": 0,\n \"parentId\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"description\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"fullPath\": \"\",\n \"priority\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"postCount\": 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 \"parentId\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"description\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"fullPath\": \"\",\n \"priority\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"postCount\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/admin/v1/categories/:id")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/admin/v1/categories/:id")
.header("content-type", "application/json")
.body("{\n \"id\": 0,\n \"parentId\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"description\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"fullPath\": \"\",\n \"priority\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"postCount\": 0\n}")
.asString();
const data = JSON.stringify({
id: 0,
parentId: 0,
name: '',
slug: '',
description: '',
thumbnail: '',
password: '',
fullPath: '',
priority: 0,
createTime: '',
updateTime: '',
postCount: 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}}/admin/v1/categories/:id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/admin/v1/categories/:id',
headers: {'content-type': 'application/json'},
data: {
id: 0,
parentId: 0,
name: '',
slug: '',
description: '',
thumbnail: '',
password: '',
fullPath: '',
priority: 0,
createTime: '',
updateTime: '',
postCount: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/categories/:id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"id":0,"parentId":0,"name":"","slug":"","description":"","thumbnail":"","password":"","fullPath":"","priority":0,"createTime":"","updateTime":"","postCount":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}}/admin/v1/categories/:id',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "id": 0,\n "parentId": 0,\n "name": "",\n "slug": "",\n "description": "",\n "thumbnail": "",\n "password": "",\n "fullPath": "",\n "priority": 0,\n "createTime": "",\n "updateTime": "",\n "postCount": 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 \"parentId\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"description\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"fullPath\": \"\",\n \"priority\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"postCount\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/categories/: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/admin/v1/categories/: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,
parentId: 0,
name: '',
slug: '',
description: '',
thumbnail: '',
password: '',
fullPath: '',
priority: 0,
createTime: '',
updateTime: '',
postCount: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/admin/v1/categories/:id',
headers: {'content-type': 'application/json'},
body: {
id: 0,
parentId: 0,
name: '',
slug: '',
description: '',
thumbnail: '',
password: '',
fullPath: '',
priority: 0,
createTime: '',
updateTime: '',
postCount: 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}}/admin/v1/categories/:id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
id: 0,
parentId: 0,
name: '',
slug: '',
description: '',
thumbnail: '',
password: '',
fullPath: '',
priority: 0,
createTime: '',
updateTime: '',
postCount: 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}}/admin/v1/categories/:id',
headers: {'content-type': 'application/json'},
data: {
id: 0,
parentId: 0,
name: '',
slug: '',
description: '',
thumbnail: '',
password: '',
fullPath: '',
priority: 0,
createTime: '',
updateTime: '',
postCount: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/categories/:id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"id":0,"parentId":0,"name":"","slug":"","description":"","thumbnail":"","password":"","fullPath":"","priority":0,"createTime":"","updateTime":"","postCount":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,
@"parentId": @0,
@"name": @"",
@"slug": @"",
@"description": @"",
@"thumbnail": @"",
@"password": @"",
@"fullPath": @"",
@"priority": @0,
@"createTime": @"",
@"updateTime": @"",
@"postCount": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/admin/v1/categories/: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}}/admin/v1/categories/:id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"id\": 0,\n \"parentId\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"description\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"fullPath\": \"\",\n \"priority\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"postCount\": 0\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/categories/: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,
'parentId' => 0,
'name' => '',
'slug' => '',
'description' => '',
'thumbnail' => '',
'password' => '',
'fullPath' => '',
'priority' => 0,
'createTime' => '',
'updateTime' => '',
'postCount' => 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}}/admin/v1/categories/:id', [
'body' => '{
"id": 0,
"parentId": 0,
"name": "",
"slug": "",
"description": "",
"thumbnail": "",
"password": "",
"fullPath": "",
"priority": 0,
"createTime": "",
"updateTime": "",
"postCount": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/categories/:id');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'id' => 0,
'parentId' => 0,
'name' => '',
'slug' => '',
'description' => '',
'thumbnail' => '',
'password' => '',
'fullPath' => '',
'priority' => 0,
'createTime' => '',
'updateTime' => '',
'postCount' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'id' => 0,
'parentId' => 0,
'name' => '',
'slug' => '',
'description' => '',
'thumbnail' => '',
'password' => '',
'fullPath' => '',
'priority' => 0,
'createTime' => '',
'updateTime' => '',
'postCount' => 0
]));
$request->setRequestUrl('{{baseUrl}}/admin/v1/categories/: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}}/admin/v1/categories/:id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"id": 0,
"parentId": 0,
"name": "",
"slug": "",
"description": "",
"thumbnail": "",
"password": "",
"fullPath": "",
"priority": 0,
"createTime": "",
"updateTime": "",
"postCount": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/categories/:id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"id": 0,
"parentId": 0,
"name": "",
"slug": "",
"description": "",
"thumbnail": "",
"password": "",
"fullPath": "",
"priority": 0,
"createTime": "",
"updateTime": "",
"postCount": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"id\": 0,\n \"parentId\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"description\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"fullPath\": \"\",\n \"priority\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"postCount\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/admin/v1/categories/:id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/categories/:id"
payload = {
"id": 0,
"parentId": 0,
"name": "",
"slug": "",
"description": "",
"thumbnail": "",
"password": "",
"fullPath": "",
"priority": 0,
"createTime": "",
"updateTime": "",
"postCount": 0
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/categories/:id"
payload <- "{\n \"id\": 0,\n \"parentId\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"description\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"fullPath\": \"\",\n \"priority\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"postCount\": 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}}/admin/v1/categories/: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 \"parentId\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"description\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"fullPath\": \"\",\n \"priority\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"postCount\": 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/admin/v1/categories/:id') do |req|
req.body = "{\n \"id\": 0,\n \"parentId\": 0,\n \"name\": \"\",\n \"slug\": \"\",\n \"description\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"fullPath\": \"\",\n \"priority\": 0,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"postCount\": 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}}/admin/v1/categories/:id";
let payload = json!({
"id": 0,
"parentId": 0,
"name": "",
"slug": "",
"description": "",
"thumbnail": "",
"password": "",
"fullPath": "",
"priority": 0,
"createTime": "",
"updateTime": "",
"postCount": 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}}/admin/v1/categories/:id \
--header 'content-type: application/json' \
--data '{
"id": 0,
"parentId": 0,
"name": "",
"slug": "",
"description": "",
"thumbnail": "",
"password": "",
"fullPath": "",
"priority": 0,
"createTime": "",
"updateTime": "",
"postCount": 0
}'
echo '{
"id": 0,
"parentId": 0,
"name": "",
"slug": "",
"description": "",
"thumbnail": "",
"password": "",
"fullPath": "",
"priority": 0,
"createTime": "",
"updateTime": "",
"postCount": 0
}' | \
http PUT {{baseUrl}}/admin/v1/categories/:id \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "id": 0,\n "parentId": 0,\n "name": "",\n "slug": "",\n "description": "",\n "thumbnail": "",\n "password": "",\n "fullPath": "",\n "priority": 0,\n "createTime": "",\n "updateTime": "",\n "postCount": 0\n}' \
--output-document \
- {{baseUrl}}/admin/v1/categories/:id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"id": 0,
"parentId": 0,
"name": "",
"slug": "",
"description": "",
"thumbnail": "",
"password": "",
"fullPath": "",
"priority": 0,
"createTime": "",
"updateTime": "",
"postCount": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/categories/: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
CommentService_CreateComment
{{baseUrl}}/admin/v1/comments
BODY json
{
"comment": {
"id": 0,
"author": "",
"email": "",
"ipAddress": "",
"authorUrl": "",
"gravatarMd5": "",
"content": "",
"status": 0,
"userAgent": "",
"parentId": 0,
"isAdmin": false,
"allowNotification": false,
"avatar": "",
"createTime": "",
"updateTime": ""
},
"operatorId": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/comments");
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 \"comment\": {\n \"id\": 0,\n \"author\": \"\",\n \"email\": \"\",\n \"ipAddress\": \"\",\n \"authorUrl\": \"\",\n \"gravatarMd5\": \"\",\n \"content\": \"\",\n \"status\": 0,\n \"userAgent\": \"\",\n \"parentId\": 0,\n \"isAdmin\": false,\n \"allowNotification\": false,\n \"avatar\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n },\n \"operatorId\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/admin/v1/comments" {:content-type :json
:form-params {:comment {:id 0
:author ""
:email ""
:ipAddress ""
:authorUrl ""
:gravatarMd5 ""
:content ""
:status 0
:userAgent ""
:parentId 0
:isAdmin false
:allowNotification false
:avatar ""
:createTime ""
:updateTime ""}
:operatorId 0}})
require "http/client"
url = "{{baseUrl}}/admin/v1/comments"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"comment\": {\n \"id\": 0,\n \"author\": \"\",\n \"email\": \"\",\n \"ipAddress\": \"\",\n \"authorUrl\": \"\",\n \"gravatarMd5\": \"\",\n \"content\": \"\",\n \"status\": 0,\n \"userAgent\": \"\",\n \"parentId\": 0,\n \"isAdmin\": false,\n \"allowNotification\": false,\n \"avatar\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n },\n \"operatorId\": 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}}/admin/v1/comments"),
Content = new StringContent("{\n \"comment\": {\n \"id\": 0,\n \"author\": \"\",\n \"email\": \"\",\n \"ipAddress\": \"\",\n \"authorUrl\": \"\",\n \"gravatarMd5\": \"\",\n \"content\": \"\",\n \"status\": 0,\n \"userAgent\": \"\",\n \"parentId\": 0,\n \"isAdmin\": false,\n \"allowNotification\": false,\n \"avatar\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n },\n \"operatorId\": 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}}/admin/v1/comments");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"comment\": {\n \"id\": 0,\n \"author\": \"\",\n \"email\": \"\",\n \"ipAddress\": \"\",\n \"authorUrl\": \"\",\n \"gravatarMd5\": \"\",\n \"content\": \"\",\n \"status\": 0,\n \"userAgent\": \"\",\n \"parentId\": 0,\n \"isAdmin\": false,\n \"allowNotification\": false,\n \"avatar\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n },\n \"operatorId\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/comments"
payload := strings.NewReader("{\n \"comment\": {\n \"id\": 0,\n \"author\": \"\",\n \"email\": \"\",\n \"ipAddress\": \"\",\n \"authorUrl\": \"\",\n \"gravatarMd5\": \"\",\n \"content\": \"\",\n \"status\": 0,\n \"userAgent\": \"\",\n \"parentId\": 0,\n \"isAdmin\": false,\n \"allowNotification\": false,\n \"avatar\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n },\n \"operatorId\": 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/admin/v1/comments HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 345
{
"comment": {
"id": 0,
"author": "",
"email": "",
"ipAddress": "",
"authorUrl": "",
"gravatarMd5": "",
"content": "",
"status": 0,
"userAgent": "",
"parentId": 0,
"isAdmin": false,
"allowNotification": false,
"avatar": "",
"createTime": "",
"updateTime": ""
},
"operatorId": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/admin/v1/comments")
.setHeader("content-type", "application/json")
.setBody("{\n \"comment\": {\n \"id\": 0,\n \"author\": \"\",\n \"email\": \"\",\n \"ipAddress\": \"\",\n \"authorUrl\": \"\",\n \"gravatarMd5\": \"\",\n \"content\": \"\",\n \"status\": 0,\n \"userAgent\": \"\",\n \"parentId\": 0,\n \"isAdmin\": false,\n \"allowNotification\": false,\n \"avatar\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n },\n \"operatorId\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/comments"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"comment\": {\n \"id\": 0,\n \"author\": \"\",\n \"email\": \"\",\n \"ipAddress\": \"\",\n \"authorUrl\": \"\",\n \"gravatarMd5\": \"\",\n \"content\": \"\",\n \"status\": 0,\n \"userAgent\": \"\",\n \"parentId\": 0,\n \"isAdmin\": false,\n \"allowNotification\": false,\n \"avatar\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n },\n \"operatorId\": 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 \"comment\": {\n \"id\": 0,\n \"author\": \"\",\n \"email\": \"\",\n \"ipAddress\": \"\",\n \"authorUrl\": \"\",\n \"gravatarMd5\": \"\",\n \"content\": \"\",\n \"status\": 0,\n \"userAgent\": \"\",\n \"parentId\": 0,\n \"isAdmin\": false,\n \"allowNotification\": false,\n \"avatar\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n },\n \"operatorId\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/admin/v1/comments")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/admin/v1/comments")
.header("content-type", "application/json")
.body("{\n \"comment\": {\n \"id\": 0,\n \"author\": \"\",\n \"email\": \"\",\n \"ipAddress\": \"\",\n \"authorUrl\": \"\",\n \"gravatarMd5\": \"\",\n \"content\": \"\",\n \"status\": 0,\n \"userAgent\": \"\",\n \"parentId\": 0,\n \"isAdmin\": false,\n \"allowNotification\": false,\n \"avatar\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n },\n \"operatorId\": 0\n}")
.asString();
const data = JSON.stringify({
comment: {
id: 0,
author: '',
email: '',
ipAddress: '',
authorUrl: '',
gravatarMd5: '',
content: '',
status: 0,
userAgent: '',
parentId: 0,
isAdmin: false,
allowNotification: false,
avatar: '',
createTime: '',
updateTime: ''
},
operatorId: 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}}/admin/v1/comments');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/admin/v1/comments',
headers: {'content-type': 'application/json'},
data: {
comment: {
id: 0,
author: '',
email: '',
ipAddress: '',
authorUrl: '',
gravatarMd5: '',
content: '',
status: 0,
userAgent: '',
parentId: 0,
isAdmin: false,
allowNotification: false,
avatar: '',
createTime: '',
updateTime: ''
},
operatorId: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/comments';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"comment":{"id":0,"author":"","email":"","ipAddress":"","authorUrl":"","gravatarMd5":"","content":"","status":0,"userAgent":"","parentId":0,"isAdmin":false,"allowNotification":false,"avatar":"","createTime":"","updateTime":""},"operatorId":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}}/admin/v1/comments',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "comment": {\n "id": 0,\n "author": "",\n "email": "",\n "ipAddress": "",\n "authorUrl": "",\n "gravatarMd5": "",\n "content": "",\n "status": 0,\n "userAgent": "",\n "parentId": 0,\n "isAdmin": false,\n "allowNotification": false,\n "avatar": "",\n "createTime": "",\n "updateTime": ""\n },\n "operatorId": 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 \"comment\": {\n \"id\": 0,\n \"author\": \"\",\n \"email\": \"\",\n \"ipAddress\": \"\",\n \"authorUrl\": \"\",\n \"gravatarMd5\": \"\",\n \"content\": \"\",\n \"status\": 0,\n \"userAgent\": \"\",\n \"parentId\": 0,\n \"isAdmin\": false,\n \"allowNotification\": false,\n \"avatar\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n },\n \"operatorId\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/comments")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/admin/v1/comments',
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({
comment: {
id: 0,
author: '',
email: '',
ipAddress: '',
authorUrl: '',
gravatarMd5: '',
content: '',
status: 0,
userAgent: '',
parentId: 0,
isAdmin: false,
allowNotification: false,
avatar: '',
createTime: '',
updateTime: ''
},
operatorId: 0
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/admin/v1/comments',
headers: {'content-type': 'application/json'},
body: {
comment: {
id: 0,
author: '',
email: '',
ipAddress: '',
authorUrl: '',
gravatarMd5: '',
content: '',
status: 0,
userAgent: '',
parentId: 0,
isAdmin: false,
allowNotification: false,
avatar: '',
createTime: '',
updateTime: ''
},
operatorId: 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}}/admin/v1/comments');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
comment: {
id: 0,
author: '',
email: '',
ipAddress: '',
authorUrl: '',
gravatarMd5: '',
content: '',
status: 0,
userAgent: '',
parentId: 0,
isAdmin: false,
allowNotification: false,
avatar: '',
createTime: '',
updateTime: ''
},
operatorId: 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}}/admin/v1/comments',
headers: {'content-type': 'application/json'},
data: {
comment: {
id: 0,
author: '',
email: '',
ipAddress: '',
authorUrl: '',
gravatarMd5: '',
content: '',
status: 0,
userAgent: '',
parentId: 0,
isAdmin: false,
allowNotification: false,
avatar: '',
createTime: '',
updateTime: ''
},
operatorId: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/comments';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"comment":{"id":0,"author":"","email":"","ipAddress":"","authorUrl":"","gravatarMd5":"","content":"","status":0,"userAgent":"","parentId":0,"isAdmin":false,"allowNotification":false,"avatar":"","createTime":"","updateTime":""},"operatorId":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 = @{ @"comment": @{ @"id": @0, @"author": @"", @"email": @"", @"ipAddress": @"", @"authorUrl": @"", @"gravatarMd5": @"", @"content": @"", @"status": @0, @"userAgent": @"", @"parentId": @0, @"isAdmin": @NO, @"allowNotification": @NO, @"avatar": @"", @"createTime": @"", @"updateTime": @"" },
@"operatorId": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/admin/v1/comments"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/admin/v1/comments" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"comment\": {\n \"id\": 0,\n \"author\": \"\",\n \"email\": \"\",\n \"ipAddress\": \"\",\n \"authorUrl\": \"\",\n \"gravatarMd5\": \"\",\n \"content\": \"\",\n \"status\": 0,\n \"userAgent\": \"\",\n \"parentId\": 0,\n \"isAdmin\": false,\n \"allowNotification\": false,\n \"avatar\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n },\n \"operatorId\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/comments",
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([
'comment' => [
'id' => 0,
'author' => '',
'email' => '',
'ipAddress' => '',
'authorUrl' => '',
'gravatarMd5' => '',
'content' => '',
'status' => 0,
'userAgent' => '',
'parentId' => 0,
'isAdmin' => null,
'allowNotification' => null,
'avatar' => '',
'createTime' => '',
'updateTime' => ''
],
'operatorId' => 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}}/admin/v1/comments', [
'body' => '{
"comment": {
"id": 0,
"author": "",
"email": "",
"ipAddress": "",
"authorUrl": "",
"gravatarMd5": "",
"content": "",
"status": 0,
"userAgent": "",
"parentId": 0,
"isAdmin": false,
"allowNotification": false,
"avatar": "",
"createTime": "",
"updateTime": ""
},
"operatorId": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/comments');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'comment' => [
'id' => 0,
'author' => '',
'email' => '',
'ipAddress' => '',
'authorUrl' => '',
'gravatarMd5' => '',
'content' => '',
'status' => 0,
'userAgent' => '',
'parentId' => 0,
'isAdmin' => null,
'allowNotification' => null,
'avatar' => '',
'createTime' => '',
'updateTime' => ''
],
'operatorId' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'comment' => [
'id' => 0,
'author' => '',
'email' => '',
'ipAddress' => '',
'authorUrl' => '',
'gravatarMd5' => '',
'content' => '',
'status' => 0,
'userAgent' => '',
'parentId' => 0,
'isAdmin' => null,
'allowNotification' => null,
'avatar' => '',
'createTime' => '',
'updateTime' => ''
],
'operatorId' => 0
]));
$request->setRequestUrl('{{baseUrl}}/admin/v1/comments');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/comments' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"comment": {
"id": 0,
"author": "",
"email": "",
"ipAddress": "",
"authorUrl": "",
"gravatarMd5": "",
"content": "",
"status": 0,
"userAgent": "",
"parentId": 0,
"isAdmin": false,
"allowNotification": false,
"avatar": "",
"createTime": "",
"updateTime": ""
},
"operatorId": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/comments' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"comment": {
"id": 0,
"author": "",
"email": "",
"ipAddress": "",
"authorUrl": "",
"gravatarMd5": "",
"content": "",
"status": 0,
"userAgent": "",
"parentId": 0,
"isAdmin": false,
"allowNotification": false,
"avatar": "",
"createTime": "",
"updateTime": ""
},
"operatorId": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"comment\": {\n \"id\": 0,\n \"author\": \"\",\n \"email\": \"\",\n \"ipAddress\": \"\",\n \"authorUrl\": \"\",\n \"gravatarMd5\": \"\",\n \"content\": \"\",\n \"status\": 0,\n \"userAgent\": \"\",\n \"parentId\": 0,\n \"isAdmin\": false,\n \"allowNotification\": false,\n \"avatar\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n },\n \"operatorId\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/admin/v1/comments", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/comments"
payload = {
"comment": {
"id": 0,
"author": "",
"email": "",
"ipAddress": "",
"authorUrl": "",
"gravatarMd5": "",
"content": "",
"status": 0,
"userAgent": "",
"parentId": 0,
"isAdmin": False,
"allowNotification": False,
"avatar": "",
"createTime": "",
"updateTime": ""
},
"operatorId": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/comments"
payload <- "{\n \"comment\": {\n \"id\": 0,\n \"author\": \"\",\n \"email\": \"\",\n \"ipAddress\": \"\",\n \"authorUrl\": \"\",\n \"gravatarMd5\": \"\",\n \"content\": \"\",\n \"status\": 0,\n \"userAgent\": \"\",\n \"parentId\": 0,\n \"isAdmin\": false,\n \"allowNotification\": false,\n \"avatar\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n },\n \"operatorId\": 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}}/admin/v1/comments")
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 \"comment\": {\n \"id\": 0,\n \"author\": \"\",\n \"email\": \"\",\n \"ipAddress\": \"\",\n \"authorUrl\": \"\",\n \"gravatarMd5\": \"\",\n \"content\": \"\",\n \"status\": 0,\n \"userAgent\": \"\",\n \"parentId\": 0,\n \"isAdmin\": false,\n \"allowNotification\": false,\n \"avatar\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n },\n \"operatorId\": 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/admin/v1/comments') do |req|
req.body = "{\n \"comment\": {\n \"id\": 0,\n \"author\": \"\",\n \"email\": \"\",\n \"ipAddress\": \"\",\n \"authorUrl\": \"\",\n \"gravatarMd5\": \"\",\n \"content\": \"\",\n \"status\": 0,\n \"userAgent\": \"\",\n \"parentId\": 0,\n \"isAdmin\": false,\n \"allowNotification\": false,\n \"avatar\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n },\n \"operatorId\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/comments";
let payload = json!({
"comment": json!({
"id": 0,
"author": "",
"email": "",
"ipAddress": "",
"authorUrl": "",
"gravatarMd5": "",
"content": "",
"status": 0,
"userAgent": "",
"parentId": 0,
"isAdmin": false,
"allowNotification": false,
"avatar": "",
"createTime": "",
"updateTime": ""
}),
"operatorId": 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}}/admin/v1/comments \
--header 'content-type: application/json' \
--data '{
"comment": {
"id": 0,
"author": "",
"email": "",
"ipAddress": "",
"authorUrl": "",
"gravatarMd5": "",
"content": "",
"status": 0,
"userAgent": "",
"parentId": 0,
"isAdmin": false,
"allowNotification": false,
"avatar": "",
"createTime": "",
"updateTime": ""
},
"operatorId": 0
}'
echo '{
"comment": {
"id": 0,
"author": "",
"email": "",
"ipAddress": "",
"authorUrl": "",
"gravatarMd5": "",
"content": "",
"status": 0,
"userAgent": "",
"parentId": 0,
"isAdmin": false,
"allowNotification": false,
"avatar": "",
"createTime": "",
"updateTime": ""
},
"operatorId": 0
}' | \
http POST {{baseUrl}}/admin/v1/comments \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "comment": {\n "id": 0,\n "author": "",\n "email": "",\n "ipAddress": "",\n "authorUrl": "",\n "gravatarMd5": "",\n "content": "",\n "status": 0,\n "userAgent": "",\n "parentId": 0,\n "isAdmin": false,\n "allowNotification": false,\n "avatar": "",\n "createTime": "",\n "updateTime": ""\n },\n "operatorId": 0\n}' \
--output-document \
- {{baseUrl}}/admin/v1/comments
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"comment": [
"id": 0,
"author": "",
"email": "",
"ipAddress": "",
"authorUrl": "",
"gravatarMd5": "",
"content": "",
"status": 0,
"userAgent": "",
"parentId": 0,
"isAdmin": false,
"allowNotification": false,
"avatar": "",
"createTime": "",
"updateTime": ""
],
"operatorId": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/comments")! 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
CommentService_DeleteComment
{{baseUrl}}/admin/v1/comments/:id
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/comments/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/admin/v1/comments/:id")
require "http/client"
url = "{{baseUrl}}/admin/v1/comments/: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}}/admin/v1/comments/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/comments/:id");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/comments/: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/admin/v1/comments/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/admin/v1/comments/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/comments/: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}}/admin/v1/comments/:id")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/admin/v1/comments/: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}}/admin/v1/comments/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/admin/v1/comments/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/comments/: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}}/admin/v1/comments/:id',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/comments/: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/admin/v1/comments/: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}}/admin/v1/comments/: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}}/admin/v1/comments/: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}}/admin/v1/comments/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/comments/: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}}/admin/v1/comments/: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}}/admin/v1/comments/:id" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/comments/: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}}/admin/v1/comments/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/comments/:id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/admin/v1/comments/:id');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/comments/:id' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/comments/:id' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/admin/v1/comments/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/comments/:id"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/comments/:id"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/comments/: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/admin/v1/comments/: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}}/admin/v1/comments/: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}}/admin/v1/comments/:id
http DELETE {{baseUrl}}/admin/v1/comments/:id
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/admin/v1/comments/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/comments/: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
CommentService_GetComment
{{baseUrl}}/admin/v1/comments/:id
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/comments/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/admin/v1/comments/:id")
require "http/client"
url = "{{baseUrl}}/admin/v1/comments/: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}}/admin/v1/comments/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/comments/:id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/comments/: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/admin/v1/comments/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/admin/v1/comments/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/comments/: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}}/admin/v1/comments/:id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/admin/v1/comments/: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}}/admin/v1/comments/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/comments/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/comments/: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}}/admin/v1/comments/:id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/comments/:id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/admin/v1/comments/: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}}/admin/v1/comments/: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}}/admin/v1/comments/: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}}/admin/v1/comments/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/comments/: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}}/admin/v1/comments/: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}}/admin/v1/comments/:id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/comments/: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}}/admin/v1/comments/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/comments/:id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/admin/v1/comments/:id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/comments/:id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/comments/:id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/admin/v1/comments/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/comments/:id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/comments/:id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/comments/: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/admin/v1/comments/:id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/comments/: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}}/admin/v1/comments/:id
http GET {{baseUrl}}/admin/v1/comments/:id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/admin/v1/comments/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/comments/: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
CommentService_ListComment
{{baseUrl}}/admin/v1/comments
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/comments");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/admin/v1/comments")
require "http/client"
url = "{{baseUrl}}/admin/v1/comments"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/admin/v1/comments"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/comments");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/comments"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/admin/v1/comments HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/admin/v1/comments")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/comments"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/admin/v1/comments")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/admin/v1/comments")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/admin/v1/comments');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/comments'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/comments';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/admin/v1/comments',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/comments")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/admin/v1/comments',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/comments'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/admin/v1/comments');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/comments'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/comments';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/admin/v1/comments"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/admin/v1/comments" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/comments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/admin/v1/comments');
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/comments');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/admin/v1/comments');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/comments' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/comments' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/admin/v1/comments")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/comments"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/comments"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/comments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/admin/v1/comments') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/comments";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/admin/v1/comments
http GET {{baseUrl}}/admin/v1/comments
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/admin/v1/comments
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/comments")! 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
CommentService_UpdateComment
{{baseUrl}}/admin/v1/comments/:id
QUERY PARAMS
id
BODY json
{
"id": 0,
"author": "",
"email": "",
"ipAddress": "",
"authorUrl": "",
"gravatarMd5": "",
"content": "",
"status": 0,
"userAgent": "",
"parentId": 0,
"isAdmin": false,
"allowNotification": false,
"avatar": "",
"createTime": "",
"updateTime": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/comments/: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 \"author\": \"\",\n \"email\": \"\",\n \"ipAddress\": \"\",\n \"authorUrl\": \"\",\n \"gravatarMd5\": \"\",\n \"content\": \"\",\n \"status\": 0,\n \"userAgent\": \"\",\n \"parentId\": 0,\n \"isAdmin\": false,\n \"allowNotification\": false,\n \"avatar\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/admin/v1/comments/:id" {:content-type :json
:form-params {:id 0
:author ""
:email ""
:ipAddress ""
:authorUrl ""
:gravatarMd5 ""
:content ""
:status 0
:userAgent ""
:parentId 0
:isAdmin false
:allowNotification false
:avatar ""
:createTime ""
:updateTime ""}})
require "http/client"
url = "{{baseUrl}}/admin/v1/comments/:id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"id\": 0,\n \"author\": \"\",\n \"email\": \"\",\n \"ipAddress\": \"\",\n \"authorUrl\": \"\",\n \"gravatarMd5\": \"\",\n \"content\": \"\",\n \"status\": 0,\n \"userAgent\": \"\",\n \"parentId\": 0,\n \"isAdmin\": false,\n \"allowNotification\": false,\n \"avatar\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/admin/v1/comments/:id"),
Content = new StringContent("{\n \"id\": 0,\n \"author\": \"\",\n \"email\": \"\",\n \"ipAddress\": \"\",\n \"authorUrl\": \"\",\n \"gravatarMd5\": \"\",\n \"content\": \"\",\n \"status\": 0,\n \"userAgent\": \"\",\n \"parentId\": 0,\n \"isAdmin\": false,\n \"allowNotification\": false,\n \"avatar\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/comments/:id");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"id\": 0,\n \"author\": \"\",\n \"email\": \"\",\n \"ipAddress\": \"\",\n \"authorUrl\": \"\",\n \"gravatarMd5\": \"\",\n \"content\": \"\",\n \"status\": 0,\n \"userAgent\": \"\",\n \"parentId\": 0,\n \"isAdmin\": false,\n \"allowNotification\": false,\n \"avatar\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/comments/:id"
payload := strings.NewReader("{\n \"id\": 0,\n \"author\": \"\",\n \"email\": \"\",\n \"ipAddress\": \"\",\n \"authorUrl\": \"\",\n \"gravatarMd5\": \"\",\n \"content\": \"\",\n \"status\": 0,\n \"userAgent\": \"\",\n \"parentId\": 0,\n \"isAdmin\": false,\n \"allowNotification\": false,\n \"avatar\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/admin/v1/comments/:id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 277
{
"id": 0,
"author": "",
"email": "",
"ipAddress": "",
"authorUrl": "",
"gravatarMd5": "",
"content": "",
"status": 0,
"userAgent": "",
"parentId": 0,
"isAdmin": false,
"allowNotification": false,
"avatar": "",
"createTime": "",
"updateTime": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/admin/v1/comments/:id")
.setHeader("content-type", "application/json")
.setBody("{\n \"id\": 0,\n \"author\": \"\",\n \"email\": \"\",\n \"ipAddress\": \"\",\n \"authorUrl\": \"\",\n \"gravatarMd5\": \"\",\n \"content\": \"\",\n \"status\": 0,\n \"userAgent\": \"\",\n \"parentId\": 0,\n \"isAdmin\": false,\n \"allowNotification\": false,\n \"avatar\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/comments/:id"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"id\": 0,\n \"author\": \"\",\n \"email\": \"\",\n \"ipAddress\": \"\",\n \"authorUrl\": \"\",\n \"gravatarMd5\": \"\",\n \"content\": \"\",\n \"status\": 0,\n \"userAgent\": \"\",\n \"parentId\": 0,\n \"isAdmin\": false,\n \"allowNotification\": false,\n \"avatar\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\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 \"author\": \"\",\n \"email\": \"\",\n \"ipAddress\": \"\",\n \"authorUrl\": \"\",\n \"gravatarMd5\": \"\",\n \"content\": \"\",\n \"status\": 0,\n \"userAgent\": \"\",\n \"parentId\": 0,\n \"isAdmin\": false,\n \"allowNotification\": false,\n \"avatar\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/admin/v1/comments/:id")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/admin/v1/comments/:id")
.header("content-type", "application/json")
.body("{\n \"id\": 0,\n \"author\": \"\",\n \"email\": \"\",\n \"ipAddress\": \"\",\n \"authorUrl\": \"\",\n \"gravatarMd5\": \"\",\n \"content\": \"\",\n \"status\": 0,\n \"userAgent\": \"\",\n \"parentId\": 0,\n \"isAdmin\": false,\n \"allowNotification\": false,\n \"avatar\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n}")
.asString();
const data = JSON.stringify({
id: 0,
author: '',
email: '',
ipAddress: '',
authorUrl: '',
gravatarMd5: '',
content: '',
status: 0,
userAgent: '',
parentId: 0,
isAdmin: false,
allowNotification: false,
avatar: '',
createTime: '',
updateTime: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/admin/v1/comments/:id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/admin/v1/comments/:id',
headers: {'content-type': 'application/json'},
data: {
id: 0,
author: '',
email: '',
ipAddress: '',
authorUrl: '',
gravatarMd5: '',
content: '',
status: 0,
userAgent: '',
parentId: 0,
isAdmin: false,
allowNotification: false,
avatar: '',
createTime: '',
updateTime: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/comments/:id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"id":0,"author":"","email":"","ipAddress":"","authorUrl":"","gravatarMd5":"","content":"","status":0,"userAgent":"","parentId":0,"isAdmin":false,"allowNotification":false,"avatar":"","createTime":"","updateTime":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/admin/v1/comments/:id',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "id": 0,\n "author": "",\n "email": "",\n "ipAddress": "",\n "authorUrl": "",\n "gravatarMd5": "",\n "content": "",\n "status": 0,\n "userAgent": "",\n "parentId": 0,\n "isAdmin": false,\n "allowNotification": false,\n "avatar": "",\n "createTime": "",\n "updateTime": ""\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 \"author\": \"\",\n \"email\": \"\",\n \"ipAddress\": \"\",\n \"authorUrl\": \"\",\n \"gravatarMd5\": \"\",\n \"content\": \"\",\n \"status\": 0,\n \"userAgent\": \"\",\n \"parentId\": 0,\n \"isAdmin\": false,\n \"allowNotification\": false,\n \"avatar\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/comments/: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/admin/v1/comments/: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,
author: '',
email: '',
ipAddress: '',
authorUrl: '',
gravatarMd5: '',
content: '',
status: 0,
userAgent: '',
parentId: 0,
isAdmin: false,
allowNotification: false,
avatar: '',
createTime: '',
updateTime: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/admin/v1/comments/:id',
headers: {'content-type': 'application/json'},
body: {
id: 0,
author: '',
email: '',
ipAddress: '',
authorUrl: '',
gravatarMd5: '',
content: '',
status: 0,
userAgent: '',
parentId: 0,
isAdmin: false,
allowNotification: false,
avatar: '',
createTime: '',
updateTime: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/admin/v1/comments/:id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
id: 0,
author: '',
email: '',
ipAddress: '',
authorUrl: '',
gravatarMd5: '',
content: '',
status: 0,
userAgent: '',
parentId: 0,
isAdmin: false,
allowNotification: false,
avatar: '',
createTime: '',
updateTime: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/admin/v1/comments/:id',
headers: {'content-type': 'application/json'},
data: {
id: 0,
author: '',
email: '',
ipAddress: '',
authorUrl: '',
gravatarMd5: '',
content: '',
status: 0,
userAgent: '',
parentId: 0,
isAdmin: false,
allowNotification: false,
avatar: '',
createTime: '',
updateTime: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/comments/:id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"id":0,"author":"","email":"","ipAddress":"","authorUrl":"","gravatarMd5":"","content":"","status":0,"userAgent":"","parentId":0,"isAdmin":false,"allowNotification":false,"avatar":"","createTime":"","updateTime":""}'
};
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,
@"author": @"",
@"email": @"",
@"ipAddress": @"",
@"authorUrl": @"",
@"gravatarMd5": @"",
@"content": @"",
@"status": @0,
@"userAgent": @"",
@"parentId": @0,
@"isAdmin": @NO,
@"allowNotification": @NO,
@"avatar": @"",
@"createTime": @"",
@"updateTime": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/admin/v1/comments/: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}}/admin/v1/comments/:id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"id\": 0,\n \"author\": \"\",\n \"email\": \"\",\n \"ipAddress\": \"\",\n \"authorUrl\": \"\",\n \"gravatarMd5\": \"\",\n \"content\": \"\",\n \"status\": 0,\n \"userAgent\": \"\",\n \"parentId\": 0,\n \"isAdmin\": false,\n \"allowNotification\": false,\n \"avatar\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/comments/: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,
'author' => '',
'email' => '',
'ipAddress' => '',
'authorUrl' => '',
'gravatarMd5' => '',
'content' => '',
'status' => 0,
'userAgent' => '',
'parentId' => 0,
'isAdmin' => null,
'allowNotification' => null,
'avatar' => '',
'createTime' => '',
'updateTime' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/admin/v1/comments/:id', [
'body' => '{
"id": 0,
"author": "",
"email": "",
"ipAddress": "",
"authorUrl": "",
"gravatarMd5": "",
"content": "",
"status": 0,
"userAgent": "",
"parentId": 0,
"isAdmin": false,
"allowNotification": false,
"avatar": "",
"createTime": "",
"updateTime": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/comments/:id');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'id' => 0,
'author' => '',
'email' => '',
'ipAddress' => '',
'authorUrl' => '',
'gravatarMd5' => '',
'content' => '',
'status' => 0,
'userAgent' => '',
'parentId' => 0,
'isAdmin' => null,
'allowNotification' => null,
'avatar' => '',
'createTime' => '',
'updateTime' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'id' => 0,
'author' => '',
'email' => '',
'ipAddress' => '',
'authorUrl' => '',
'gravatarMd5' => '',
'content' => '',
'status' => 0,
'userAgent' => '',
'parentId' => 0,
'isAdmin' => null,
'allowNotification' => null,
'avatar' => '',
'createTime' => '',
'updateTime' => ''
]));
$request->setRequestUrl('{{baseUrl}}/admin/v1/comments/: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}}/admin/v1/comments/:id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"id": 0,
"author": "",
"email": "",
"ipAddress": "",
"authorUrl": "",
"gravatarMd5": "",
"content": "",
"status": 0,
"userAgent": "",
"parentId": 0,
"isAdmin": false,
"allowNotification": false,
"avatar": "",
"createTime": "",
"updateTime": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/comments/:id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"id": 0,
"author": "",
"email": "",
"ipAddress": "",
"authorUrl": "",
"gravatarMd5": "",
"content": "",
"status": 0,
"userAgent": "",
"parentId": 0,
"isAdmin": false,
"allowNotification": false,
"avatar": "",
"createTime": "",
"updateTime": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"id\": 0,\n \"author\": \"\",\n \"email\": \"\",\n \"ipAddress\": \"\",\n \"authorUrl\": \"\",\n \"gravatarMd5\": \"\",\n \"content\": \"\",\n \"status\": 0,\n \"userAgent\": \"\",\n \"parentId\": 0,\n \"isAdmin\": false,\n \"allowNotification\": false,\n \"avatar\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/admin/v1/comments/:id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/comments/:id"
payload = {
"id": 0,
"author": "",
"email": "",
"ipAddress": "",
"authorUrl": "",
"gravatarMd5": "",
"content": "",
"status": 0,
"userAgent": "",
"parentId": 0,
"isAdmin": False,
"allowNotification": False,
"avatar": "",
"createTime": "",
"updateTime": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/comments/:id"
payload <- "{\n \"id\": 0,\n \"author\": \"\",\n \"email\": \"\",\n \"ipAddress\": \"\",\n \"authorUrl\": \"\",\n \"gravatarMd5\": \"\",\n \"content\": \"\",\n \"status\": 0,\n \"userAgent\": \"\",\n \"parentId\": 0,\n \"isAdmin\": false,\n \"allowNotification\": false,\n \"avatar\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/comments/: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 \"author\": \"\",\n \"email\": \"\",\n \"ipAddress\": \"\",\n \"authorUrl\": \"\",\n \"gravatarMd5\": \"\",\n \"content\": \"\",\n \"status\": 0,\n \"userAgent\": \"\",\n \"parentId\": 0,\n \"isAdmin\": false,\n \"allowNotification\": false,\n \"avatar\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/admin/v1/comments/:id') do |req|
req.body = "{\n \"id\": 0,\n \"author\": \"\",\n \"email\": \"\",\n \"ipAddress\": \"\",\n \"authorUrl\": \"\",\n \"gravatarMd5\": \"\",\n \"content\": \"\",\n \"status\": 0,\n \"userAgent\": \"\",\n \"parentId\": 0,\n \"isAdmin\": false,\n \"allowNotification\": false,\n \"avatar\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/comments/:id";
let payload = json!({
"id": 0,
"author": "",
"email": "",
"ipAddress": "",
"authorUrl": "",
"gravatarMd5": "",
"content": "",
"status": 0,
"userAgent": "",
"parentId": 0,
"isAdmin": false,
"allowNotification": false,
"avatar": "",
"createTime": "",
"updateTime": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/admin/v1/comments/:id \
--header 'content-type: application/json' \
--data '{
"id": 0,
"author": "",
"email": "",
"ipAddress": "",
"authorUrl": "",
"gravatarMd5": "",
"content": "",
"status": 0,
"userAgent": "",
"parentId": 0,
"isAdmin": false,
"allowNotification": false,
"avatar": "",
"createTime": "",
"updateTime": ""
}'
echo '{
"id": 0,
"author": "",
"email": "",
"ipAddress": "",
"authorUrl": "",
"gravatarMd5": "",
"content": "",
"status": 0,
"userAgent": "",
"parentId": 0,
"isAdmin": false,
"allowNotification": false,
"avatar": "",
"createTime": "",
"updateTime": ""
}' | \
http PUT {{baseUrl}}/admin/v1/comments/:id \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "id": 0,\n "author": "",\n "email": "",\n "ipAddress": "",\n "authorUrl": "",\n "gravatarMd5": "",\n "content": "",\n "status": 0,\n "userAgent": "",\n "parentId": 0,\n "isAdmin": false,\n "allowNotification": false,\n "avatar": "",\n "createTime": "",\n "updateTime": ""\n}' \
--output-document \
- {{baseUrl}}/admin/v1/comments/:id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"id": 0,
"author": "",
"email": "",
"ipAddress": "",
"authorUrl": "",
"gravatarMd5": "",
"content": "",
"status": 0,
"userAgent": "",
"parentId": 0,
"isAdmin": false,
"allowNotification": false,
"avatar": "",
"createTime": "",
"updateTime": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/comments/: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
LinkService_CreateLink
{{baseUrl}}/admin/v1/links
BODY json
{
"link": {
"operationRef": "",
"operationId": "",
"parameters": {
"any": {
"value": {
"@type": ""
},
"yaml": ""
},
"expression": {
"additionalProperties": [
{
"name": "",
"value": ""
}
]
}
},
"requestBody": {},
"description": "",
"server": {
"url": "",
"description": "",
"variables": {
"additionalProperties": [
{
"name": "",
"value": ""
}
]
},
"specificationExtension": [
{}
]
},
"specificationExtension": [
{}
]
},
"operatorId": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/links");
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 \"link\": {\n \"operationRef\": \"\",\n \"operationId\": \"\",\n \"parameters\": {\n \"any\": {\n \"value\": {\n \"@type\": \"\"\n },\n \"yaml\": \"\"\n },\n \"expression\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n }\n },\n \"requestBody\": {},\n \"description\": \"\",\n \"server\": {\n \"url\": \"\",\n \"description\": \"\",\n \"variables\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"operatorId\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/admin/v1/links" {:content-type :json
:form-params {:link {:operationRef ""
:operationId ""
:parameters {:any {:value {:@type ""}
:yaml ""}
:expression {:additionalProperties [{:name ""
:value ""}]}}
:requestBody {}
:description ""
:server {:url ""
:description ""
:variables {:additionalProperties [{:name ""
:value ""}]}
:specificationExtension [{}]}
:specificationExtension [{}]}
:operatorId 0}})
require "http/client"
url = "{{baseUrl}}/admin/v1/links"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"link\": {\n \"operationRef\": \"\",\n \"operationId\": \"\",\n \"parameters\": {\n \"any\": {\n \"value\": {\n \"@type\": \"\"\n },\n \"yaml\": \"\"\n },\n \"expression\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n }\n },\n \"requestBody\": {},\n \"description\": \"\",\n \"server\": {\n \"url\": \"\",\n \"description\": \"\",\n \"variables\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"operatorId\": 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}}/admin/v1/links"),
Content = new StringContent("{\n \"link\": {\n \"operationRef\": \"\",\n \"operationId\": \"\",\n \"parameters\": {\n \"any\": {\n \"value\": {\n \"@type\": \"\"\n },\n \"yaml\": \"\"\n },\n \"expression\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n }\n },\n \"requestBody\": {},\n \"description\": \"\",\n \"server\": {\n \"url\": \"\",\n \"description\": \"\",\n \"variables\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"operatorId\": 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}}/admin/v1/links");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"link\": {\n \"operationRef\": \"\",\n \"operationId\": \"\",\n \"parameters\": {\n \"any\": {\n \"value\": {\n \"@type\": \"\"\n },\n \"yaml\": \"\"\n },\n \"expression\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n }\n },\n \"requestBody\": {},\n \"description\": \"\",\n \"server\": {\n \"url\": \"\",\n \"description\": \"\",\n \"variables\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"operatorId\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/links"
payload := strings.NewReader("{\n \"link\": {\n \"operationRef\": \"\",\n \"operationId\": \"\",\n \"parameters\": {\n \"any\": {\n \"value\": {\n \"@type\": \"\"\n },\n \"yaml\": \"\"\n },\n \"expression\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n }\n },\n \"requestBody\": {},\n \"description\": \"\",\n \"server\": {\n \"url\": \"\",\n \"description\": \"\",\n \"variables\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"operatorId\": 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/admin/v1/links HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 710
{
"link": {
"operationRef": "",
"operationId": "",
"parameters": {
"any": {
"value": {
"@type": ""
},
"yaml": ""
},
"expression": {
"additionalProperties": [
{
"name": "",
"value": ""
}
]
}
},
"requestBody": {},
"description": "",
"server": {
"url": "",
"description": "",
"variables": {
"additionalProperties": [
{
"name": "",
"value": ""
}
]
},
"specificationExtension": [
{}
]
},
"specificationExtension": [
{}
]
},
"operatorId": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/admin/v1/links")
.setHeader("content-type", "application/json")
.setBody("{\n \"link\": {\n \"operationRef\": \"\",\n \"operationId\": \"\",\n \"parameters\": {\n \"any\": {\n \"value\": {\n \"@type\": \"\"\n },\n \"yaml\": \"\"\n },\n \"expression\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n }\n },\n \"requestBody\": {},\n \"description\": \"\",\n \"server\": {\n \"url\": \"\",\n \"description\": \"\",\n \"variables\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"operatorId\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/links"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"link\": {\n \"operationRef\": \"\",\n \"operationId\": \"\",\n \"parameters\": {\n \"any\": {\n \"value\": {\n \"@type\": \"\"\n },\n \"yaml\": \"\"\n },\n \"expression\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n }\n },\n \"requestBody\": {},\n \"description\": \"\",\n \"server\": {\n \"url\": \"\",\n \"description\": \"\",\n \"variables\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"operatorId\": 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 \"link\": {\n \"operationRef\": \"\",\n \"operationId\": \"\",\n \"parameters\": {\n \"any\": {\n \"value\": {\n \"@type\": \"\"\n },\n \"yaml\": \"\"\n },\n \"expression\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n }\n },\n \"requestBody\": {},\n \"description\": \"\",\n \"server\": {\n \"url\": \"\",\n \"description\": \"\",\n \"variables\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"operatorId\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/admin/v1/links")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/admin/v1/links")
.header("content-type", "application/json")
.body("{\n \"link\": {\n \"operationRef\": \"\",\n \"operationId\": \"\",\n \"parameters\": {\n \"any\": {\n \"value\": {\n \"@type\": \"\"\n },\n \"yaml\": \"\"\n },\n \"expression\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n }\n },\n \"requestBody\": {},\n \"description\": \"\",\n \"server\": {\n \"url\": \"\",\n \"description\": \"\",\n \"variables\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"operatorId\": 0\n}")
.asString();
const data = JSON.stringify({
link: {
operationRef: '',
operationId: '',
parameters: {
any: {
value: {
'@type': ''
},
yaml: ''
},
expression: {
additionalProperties: [
{
name: '',
value: ''
}
]
}
},
requestBody: {},
description: '',
server: {
url: '',
description: '',
variables: {
additionalProperties: [
{
name: '',
value: ''
}
]
},
specificationExtension: [
{}
]
},
specificationExtension: [
{}
]
},
operatorId: 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}}/admin/v1/links');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/admin/v1/links',
headers: {'content-type': 'application/json'},
data: {
link: {
operationRef: '',
operationId: '',
parameters: {
any: {value: {'@type': ''}, yaml: ''},
expression: {additionalProperties: [{name: '', value: ''}]}
},
requestBody: {},
description: '',
server: {
url: '',
description: '',
variables: {additionalProperties: [{name: '', value: ''}]},
specificationExtension: [{}]
},
specificationExtension: [{}]
},
operatorId: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/links';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"link":{"operationRef":"","operationId":"","parameters":{"any":{"value":{"@type":""},"yaml":""},"expression":{"additionalProperties":[{"name":"","value":""}]}},"requestBody":{},"description":"","server":{"url":"","description":"","variables":{"additionalProperties":[{"name":"","value":""}]},"specificationExtension":[{}]},"specificationExtension":[{}]},"operatorId":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}}/admin/v1/links',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "link": {\n "operationRef": "",\n "operationId": "",\n "parameters": {\n "any": {\n "value": {\n "@type": ""\n },\n "yaml": ""\n },\n "expression": {\n "additionalProperties": [\n {\n "name": "",\n "value": ""\n }\n ]\n }\n },\n "requestBody": {},\n "description": "",\n "server": {\n "url": "",\n "description": "",\n "variables": {\n "additionalProperties": [\n {\n "name": "",\n "value": ""\n }\n ]\n },\n "specificationExtension": [\n {}\n ]\n },\n "specificationExtension": [\n {}\n ]\n },\n "operatorId": 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 \"link\": {\n \"operationRef\": \"\",\n \"operationId\": \"\",\n \"parameters\": {\n \"any\": {\n \"value\": {\n \"@type\": \"\"\n },\n \"yaml\": \"\"\n },\n \"expression\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n }\n },\n \"requestBody\": {},\n \"description\": \"\",\n \"server\": {\n \"url\": \"\",\n \"description\": \"\",\n \"variables\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"operatorId\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/links")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/admin/v1/links',
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({
link: {
operationRef: '',
operationId: '',
parameters: {
any: {value: {'@type': ''}, yaml: ''},
expression: {additionalProperties: [{name: '', value: ''}]}
},
requestBody: {},
description: '',
server: {
url: '',
description: '',
variables: {additionalProperties: [{name: '', value: ''}]},
specificationExtension: [{}]
},
specificationExtension: [{}]
},
operatorId: 0
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/admin/v1/links',
headers: {'content-type': 'application/json'},
body: {
link: {
operationRef: '',
operationId: '',
parameters: {
any: {value: {'@type': ''}, yaml: ''},
expression: {additionalProperties: [{name: '', value: ''}]}
},
requestBody: {},
description: '',
server: {
url: '',
description: '',
variables: {additionalProperties: [{name: '', value: ''}]},
specificationExtension: [{}]
},
specificationExtension: [{}]
},
operatorId: 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}}/admin/v1/links');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
link: {
operationRef: '',
operationId: '',
parameters: {
any: {
value: {
'@type': ''
},
yaml: ''
},
expression: {
additionalProperties: [
{
name: '',
value: ''
}
]
}
},
requestBody: {},
description: '',
server: {
url: '',
description: '',
variables: {
additionalProperties: [
{
name: '',
value: ''
}
]
},
specificationExtension: [
{}
]
},
specificationExtension: [
{}
]
},
operatorId: 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}}/admin/v1/links',
headers: {'content-type': 'application/json'},
data: {
link: {
operationRef: '',
operationId: '',
parameters: {
any: {value: {'@type': ''}, yaml: ''},
expression: {additionalProperties: [{name: '', value: ''}]}
},
requestBody: {},
description: '',
server: {
url: '',
description: '',
variables: {additionalProperties: [{name: '', value: ''}]},
specificationExtension: [{}]
},
specificationExtension: [{}]
},
operatorId: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/links';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"link":{"operationRef":"","operationId":"","parameters":{"any":{"value":{"@type":""},"yaml":""},"expression":{"additionalProperties":[{"name":"","value":""}]}},"requestBody":{},"description":"","server":{"url":"","description":"","variables":{"additionalProperties":[{"name":"","value":""}]},"specificationExtension":[{}]},"specificationExtension":[{}]},"operatorId":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 = @{ @"link": @{ @"operationRef": @"", @"operationId": @"", @"parameters": @{ @"any": @{ @"value": @{ @"@type": @"" }, @"yaml": @"" }, @"expression": @{ @"additionalProperties": @[ @{ @"name": @"", @"value": @"" } ] } }, @"requestBody": @{ }, @"description": @"", @"server": @{ @"url": @"", @"description": @"", @"variables": @{ @"additionalProperties": @[ @{ @"name": @"", @"value": @"" } ] }, @"specificationExtension": @[ @{ } ] }, @"specificationExtension": @[ @{ } ] },
@"operatorId": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/admin/v1/links"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/admin/v1/links" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"link\": {\n \"operationRef\": \"\",\n \"operationId\": \"\",\n \"parameters\": {\n \"any\": {\n \"value\": {\n \"@type\": \"\"\n },\n \"yaml\": \"\"\n },\n \"expression\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n }\n },\n \"requestBody\": {},\n \"description\": \"\",\n \"server\": {\n \"url\": \"\",\n \"description\": \"\",\n \"variables\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"operatorId\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/links",
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([
'link' => [
'operationRef' => '',
'operationId' => '',
'parameters' => [
'any' => [
'value' => [
'@type' => ''
],
'yaml' => ''
],
'expression' => [
'additionalProperties' => [
[
'name' => '',
'value' => ''
]
]
]
],
'requestBody' => [
],
'description' => '',
'server' => [
'url' => '',
'description' => '',
'variables' => [
'additionalProperties' => [
[
'name' => '',
'value' => ''
]
]
],
'specificationExtension' => [
[
]
]
],
'specificationExtension' => [
[
]
]
],
'operatorId' => 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}}/admin/v1/links', [
'body' => '{
"link": {
"operationRef": "",
"operationId": "",
"parameters": {
"any": {
"value": {
"@type": ""
},
"yaml": ""
},
"expression": {
"additionalProperties": [
{
"name": "",
"value": ""
}
]
}
},
"requestBody": {},
"description": "",
"server": {
"url": "",
"description": "",
"variables": {
"additionalProperties": [
{
"name": "",
"value": ""
}
]
},
"specificationExtension": [
{}
]
},
"specificationExtension": [
{}
]
},
"operatorId": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/links');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'link' => [
'operationRef' => '',
'operationId' => '',
'parameters' => [
'any' => [
'value' => [
'@type' => ''
],
'yaml' => ''
],
'expression' => [
'additionalProperties' => [
[
'name' => '',
'value' => ''
]
]
]
],
'requestBody' => [
],
'description' => '',
'server' => [
'url' => '',
'description' => '',
'variables' => [
'additionalProperties' => [
[
'name' => '',
'value' => ''
]
]
],
'specificationExtension' => [
[
]
]
],
'specificationExtension' => [
[
]
]
],
'operatorId' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'link' => [
'operationRef' => '',
'operationId' => '',
'parameters' => [
'any' => [
'value' => [
'@type' => ''
],
'yaml' => ''
],
'expression' => [
'additionalProperties' => [
[
'name' => '',
'value' => ''
]
]
]
],
'requestBody' => [
],
'description' => '',
'server' => [
'url' => '',
'description' => '',
'variables' => [
'additionalProperties' => [
[
'name' => '',
'value' => ''
]
]
],
'specificationExtension' => [
[
]
]
],
'specificationExtension' => [
[
]
]
],
'operatorId' => 0
]));
$request->setRequestUrl('{{baseUrl}}/admin/v1/links');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/links' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"link": {
"operationRef": "",
"operationId": "",
"parameters": {
"any": {
"value": {
"@type": ""
},
"yaml": ""
},
"expression": {
"additionalProperties": [
{
"name": "",
"value": ""
}
]
}
},
"requestBody": {},
"description": "",
"server": {
"url": "",
"description": "",
"variables": {
"additionalProperties": [
{
"name": "",
"value": ""
}
]
},
"specificationExtension": [
{}
]
},
"specificationExtension": [
{}
]
},
"operatorId": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/links' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"link": {
"operationRef": "",
"operationId": "",
"parameters": {
"any": {
"value": {
"@type": ""
},
"yaml": ""
},
"expression": {
"additionalProperties": [
{
"name": "",
"value": ""
}
]
}
},
"requestBody": {},
"description": "",
"server": {
"url": "",
"description": "",
"variables": {
"additionalProperties": [
{
"name": "",
"value": ""
}
]
},
"specificationExtension": [
{}
]
},
"specificationExtension": [
{}
]
},
"operatorId": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"link\": {\n \"operationRef\": \"\",\n \"operationId\": \"\",\n \"parameters\": {\n \"any\": {\n \"value\": {\n \"@type\": \"\"\n },\n \"yaml\": \"\"\n },\n \"expression\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n }\n },\n \"requestBody\": {},\n \"description\": \"\",\n \"server\": {\n \"url\": \"\",\n \"description\": \"\",\n \"variables\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"operatorId\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/admin/v1/links", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/links"
payload = {
"link": {
"operationRef": "",
"operationId": "",
"parameters": {
"any": {
"value": { "@type": "" },
"yaml": ""
},
"expression": { "additionalProperties": [
{
"name": "",
"value": ""
}
] }
},
"requestBody": {},
"description": "",
"server": {
"url": "",
"description": "",
"variables": { "additionalProperties": [
{
"name": "",
"value": ""
}
] },
"specificationExtension": [{}]
},
"specificationExtension": [{}]
},
"operatorId": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/links"
payload <- "{\n \"link\": {\n \"operationRef\": \"\",\n \"operationId\": \"\",\n \"parameters\": {\n \"any\": {\n \"value\": {\n \"@type\": \"\"\n },\n \"yaml\": \"\"\n },\n \"expression\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n }\n },\n \"requestBody\": {},\n \"description\": \"\",\n \"server\": {\n \"url\": \"\",\n \"description\": \"\",\n \"variables\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"operatorId\": 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}}/admin/v1/links")
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 \"link\": {\n \"operationRef\": \"\",\n \"operationId\": \"\",\n \"parameters\": {\n \"any\": {\n \"value\": {\n \"@type\": \"\"\n },\n \"yaml\": \"\"\n },\n \"expression\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n }\n },\n \"requestBody\": {},\n \"description\": \"\",\n \"server\": {\n \"url\": \"\",\n \"description\": \"\",\n \"variables\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"operatorId\": 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/admin/v1/links') do |req|
req.body = "{\n \"link\": {\n \"operationRef\": \"\",\n \"operationId\": \"\",\n \"parameters\": {\n \"any\": {\n \"value\": {\n \"@type\": \"\"\n },\n \"yaml\": \"\"\n },\n \"expression\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n }\n },\n \"requestBody\": {},\n \"description\": \"\",\n \"server\": {\n \"url\": \"\",\n \"description\": \"\",\n \"variables\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"operatorId\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/links";
let payload = json!({
"link": json!({
"operationRef": "",
"operationId": "",
"parameters": json!({
"any": json!({
"value": json!({"@type": ""}),
"yaml": ""
}),
"expression": json!({"additionalProperties": (
json!({
"name": "",
"value": ""
})
)})
}),
"requestBody": json!({}),
"description": "",
"server": json!({
"url": "",
"description": "",
"variables": json!({"additionalProperties": (
json!({
"name": "",
"value": ""
})
)}),
"specificationExtension": (json!({}))
}),
"specificationExtension": (json!({}))
}),
"operatorId": 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}}/admin/v1/links \
--header 'content-type: application/json' \
--data '{
"link": {
"operationRef": "",
"operationId": "",
"parameters": {
"any": {
"value": {
"@type": ""
},
"yaml": ""
},
"expression": {
"additionalProperties": [
{
"name": "",
"value": ""
}
]
}
},
"requestBody": {},
"description": "",
"server": {
"url": "",
"description": "",
"variables": {
"additionalProperties": [
{
"name": "",
"value": ""
}
]
},
"specificationExtension": [
{}
]
},
"specificationExtension": [
{}
]
},
"operatorId": 0
}'
echo '{
"link": {
"operationRef": "",
"operationId": "",
"parameters": {
"any": {
"value": {
"@type": ""
},
"yaml": ""
},
"expression": {
"additionalProperties": [
{
"name": "",
"value": ""
}
]
}
},
"requestBody": {},
"description": "",
"server": {
"url": "",
"description": "",
"variables": {
"additionalProperties": [
{
"name": "",
"value": ""
}
]
},
"specificationExtension": [
{}
]
},
"specificationExtension": [
{}
]
},
"operatorId": 0
}' | \
http POST {{baseUrl}}/admin/v1/links \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "link": {\n "operationRef": "",\n "operationId": "",\n "parameters": {\n "any": {\n "value": {\n "@type": ""\n },\n "yaml": ""\n },\n "expression": {\n "additionalProperties": [\n {\n "name": "",\n "value": ""\n }\n ]\n }\n },\n "requestBody": {},\n "description": "",\n "server": {\n "url": "",\n "description": "",\n "variables": {\n "additionalProperties": [\n {\n "name": "",\n "value": ""\n }\n ]\n },\n "specificationExtension": [\n {}\n ]\n },\n "specificationExtension": [\n {}\n ]\n },\n "operatorId": 0\n}' \
--output-document \
- {{baseUrl}}/admin/v1/links
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"link": [
"operationRef": "",
"operationId": "",
"parameters": [
"any": [
"value": ["@type": ""],
"yaml": ""
],
"expression": ["additionalProperties": [
[
"name": "",
"value": ""
]
]]
],
"requestBody": [],
"description": "",
"server": [
"url": "",
"description": "",
"variables": ["additionalProperties": [
[
"name": "",
"value": ""
]
]],
"specificationExtension": [[]]
],
"specificationExtension": [[]]
],
"operatorId": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/links")! 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
LinkService_DeleteLink
{{baseUrl}}/admin/v1/links/:id
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/links/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/admin/v1/links/:id")
require "http/client"
url = "{{baseUrl}}/admin/v1/links/: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}}/admin/v1/links/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/links/:id");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/links/: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/admin/v1/links/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/admin/v1/links/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/links/: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}}/admin/v1/links/:id")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/admin/v1/links/: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}}/admin/v1/links/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/admin/v1/links/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/links/: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}}/admin/v1/links/:id',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/links/: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/admin/v1/links/: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}}/admin/v1/links/: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}}/admin/v1/links/: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}}/admin/v1/links/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/links/: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}}/admin/v1/links/: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}}/admin/v1/links/:id" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/links/: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}}/admin/v1/links/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/links/:id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/admin/v1/links/:id');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/links/:id' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/links/:id' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/admin/v1/links/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/links/:id"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/links/:id"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/links/: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/admin/v1/links/: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}}/admin/v1/links/: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}}/admin/v1/links/:id
http DELETE {{baseUrl}}/admin/v1/links/:id
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/admin/v1/links/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/links/: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
LinkService_GetLink
{{baseUrl}}/admin/v1/links/:id
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/links/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/admin/v1/links/:id")
require "http/client"
url = "{{baseUrl}}/admin/v1/links/: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}}/admin/v1/links/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/links/:id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/links/: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/admin/v1/links/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/admin/v1/links/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/links/: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}}/admin/v1/links/:id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/admin/v1/links/: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}}/admin/v1/links/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/links/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/links/: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}}/admin/v1/links/:id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/links/:id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/admin/v1/links/: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}}/admin/v1/links/: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}}/admin/v1/links/: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}}/admin/v1/links/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/links/: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}}/admin/v1/links/: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}}/admin/v1/links/:id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/links/: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}}/admin/v1/links/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/links/:id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/admin/v1/links/:id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/links/:id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/links/:id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/admin/v1/links/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/links/:id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/links/:id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/links/: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/admin/v1/links/:id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/links/: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}}/admin/v1/links/:id
http GET {{baseUrl}}/admin/v1/links/:id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/admin/v1/links/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/links/: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
LinkService_ListLink
{{baseUrl}}/admin/v1/links
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/links");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/admin/v1/links")
require "http/client"
url = "{{baseUrl}}/admin/v1/links"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/admin/v1/links"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/links");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/links"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/admin/v1/links HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/admin/v1/links")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/links"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/admin/v1/links")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/admin/v1/links")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/admin/v1/links');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/links'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/links';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/admin/v1/links',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/links")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/admin/v1/links',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/links'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/admin/v1/links');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/links'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/links';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/admin/v1/links"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/admin/v1/links" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/links",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/admin/v1/links');
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/links');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/admin/v1/links');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/links' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/links' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/admin/v1/links")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/links"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/links"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/links")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/admin/v1/links') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/links";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/admin/v1/links
http GET {{baseUrl}}/admin/v1/links
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/admin/v1/links
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/links")! 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
LinkService_UpdateLink
{{baseUrl}}/admin/v1/links/:id
QUERY PARAMS
id
BODY json
{
"operationRef": "",
"operationId": "",
"parameters": {
"any": {
"value": {
"@type": ""
},
"yaml": ""
},
"expression": {
"additionalProperties": [
{
"name": "",
"value": ""
}
]
}
},
"requestBody": {},
"description": "",
"server": {
"url": "",
"description": "",
"variables": {
"additionalProperties": [
{
"name": "",
"value": ""
}
]
},
"specificationExtension": [
{}
]
},
"specificationExtension": [
{}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/links/: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 \"operationRef\": \"\",\n \"operationId\": \"\",\n \"parameters\": {\n \"any\": {\n \"value\": {\n \"@type\": \"\"\n },\n \"yaml\": \"\"\n },\n \"expression\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n }\n },\n \"requestBody\": {},\n \"description\": \"\",\n \"server\": {\n \"url\": \"\",\n \"description\": \"\",\n \"variables\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/admin/v1/links/:id" {:content-type :json
:form-params {:operationRef ""
:operationId ""
:parameters {:any {:value {:@type ""}
:yaml ""}
:expression {:additionalProperties [{:name ""
:value ""}]}}
:requestBody {}
:description ""
:server {:url ""
:description ""
:variables {:additionalProperties [{:name ""
:value ""}]}
:specificationExtension [{}]}
:specificationExtension [{}]}})
require "http/client"
url = "{{baseUrl}}/admin/v1/links/:id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"operationRef\": \"\",\n \"operationId\": \"\",\n \"parameters\": {\n \"any\": {\n \"value\": {\n \"@type\": \"\"\n },\n \"yaml\": \"\"\n },\n \"expression\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n }\n },\n \"requestBody\": {},\n \"description\": \"\",\n \"server\": {\n \"url\": \"\",\n \"description\": \"\",\n \"variables\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/admin/v1/links/:id"),
Content = new StringContent("{\n \"operationRef\": \"\",\n \"operationId\": \"\",\n \"parameters\": {\n \"any\": {\n \"value\": {\n \"@type\": \"\"\n },\n \"yaml\": \"\"\n },\n \"expression\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n }\n },\n \"requestBody\": {},\n \"description\": \"\",\n \"server\": {\n \"url\": \"\",\n \"description\": \"\",\n \"variables\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/links/:id");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"operationRef\": \"\",\n \"operationId\": \"\",\n \"parameters\": {\n \"any\": {\n \"value\": {\n \"@type\": \"\"\n },\n \"yaml\": \"\"\n },\n \"expression\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n }\n },\n \"requestBody\": {},\n \"description\": \"\",\n \"server\": {\n \"url\": \"\",\n \"description\": \"\",\n \"variables\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/links/:id"
payload := strings.NewReader("{\n \"operationRef\": \"\",\n \"operationId\": \"\",\n \"parameters\": {\n \"any\": {\n \"value\": {\n \"@type\": \"\"\n },\n \"yaml\": \"\"\n },\n \"expression\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n }\n },\n \"requestBody\": {},\n \"description\": \"\",\n \"server\": {\n \"url\": \"\",\n \"description\": \"\",\n \"variables\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/admin/v1/links/:id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 599
{
"operationRef": "",
"operationId": "",
"parameters": {
"any": {
"value": {
"@type": ""
},
"yaml": ""
},
"expression": {
"additionalProperties": [
{
"name": "",
"value": ""
}
]
}
},
"requestBody": {},
"description": "",
"server": {
"url": "",
"description": "",
"variables": {
"additionalProperties": [
{
"name": "",
"value": ""
}
]
},
"specificationExtension": [
{}
]
},
"specificationExtension": [
{}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/admin/v1/links/:id")
.setHeader("content-type", "application/json")
.setBody("{\n \"operationRef\": \"\",\n \"operationId\": \"\",\n \"parameters\": {\n \"any\": {\n \"value\": {\n \"@type\": \"\"\n },\n \"yaml\": \"\"\n },\n \"expression\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n }\n },\n \"requestBody\": {},\n \"description\": \"\",\n \"server\": {\n \"url\": \"\",\n \"description\": \"\",\n \"variables\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/links/:id"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"operationRef\": \"\",\n \"operationId\": \"\",\n \"parameters\": {\n \"any\": {\n \"value\": {\n \"@type\": \"\"\n },\n \"yaml\": \"\"\n },\n \"expression\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n }\n },\n \"requestBody\": {},\n \"description\": \"\",\n \"server\": {\n \"url\": \"\",\n \"description\": \"\",\n \"variables\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"operationRef\": \"\",\n \"operationId\": \"\",\n \"parameters\": {\n \"any\": {\n \"value\": {\n \"@type\": \"\"\n },\n \"yaml\": \"\"\n },\n \"expression\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n }\n },\n \"requestBody\": {},\n \"description\": \"\",\n \"server\": {\n \"url\": \"\",\n \"description\": \"\",\n \"variables\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/admin/v1/links/:id")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/admin/v1/links/:id")
.header("content-type", "application/json")
.body("{\n \"operationRef\": \"\",\n \"operationId\": \"\",\n \"parameters\": {\n \"any\": {\n \"value\": {\n \"@type\": \"\"\n },\n \"yaml\": \"\"\n },\n \"expression\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n }\n },\n \"requestBody\": {},\n \"description\": \"\",\n \"server\": {\n \"url\": \"\",\n \"description\": \"\",\n \"variables\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n}")
.asString();
const data = JSON.stringify({
operationRef: '',
operationId: '',
parameters: {
any: {
value: {
'@type': ''
},
yaml: ''
},
expression: {
additionalProperties: [
{
name: '',
value: ''
}
]
}
},
requestBody: {},
description: '',
server: {
url: '',
description: '',
variables: {
additionalProperties: [
{
name: '',
value: ''
}
]
},
specificationExtension: [
{}
]
},
specificationExtension: [
{}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/admin/v1/links/:id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/admin/v1/links/:id',
headers: {'content-type': 'application/json'},
data: {
operationRef: '',
operationId: '',
parameters: {
any: {value: {'@type': ''}, yaml: ''},
expression: {additionalProperties: [{name: '', value: ''}]}
},
requestBody: {},
description: '',
server: {
url: '',
description: '',
variables: {additionalProperties: [{name: '', value: ''}]},
specificationExtension: [{}]
},
specificationExtension: [{}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/links/:id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"operationRef":"","operationId":"","parameters":{"any":{"value":{"@type":""},"yaml":""},"expression":{"additionalProperties":[{"name":"","value":""}]}},"requestBody":{},"description":"","server":{"url":"","description":"","variables":{"additionalProperties":[{"name":"","value":""}]},"specificationExtension":[{}]},"specificationExtension":[{}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/admin/v1/links/:id',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "operationRef": "",\n "operationId": "",\n "parameters": {\n "any": {\n "value": {\n "@type": ""\n },\n "yaml": ""\n },\n "expression": {\n "additionalProperties": [\n {\n "name": "",\n "value": ""\n }\n ]\n }\n },\n "requestBody": {},\n "description": "",\n "server": {\n "url": "",\n "description": "",\n "variables": {\n "additionalProperties": [\n {\n "name": "",\n "value": ""\n }\n ]\n },\n "specificationExtension": [\n {}\n ]\n },\n "specificationExtension": [\n {}\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"operationRef\": \"\",\n \"operationId\": \"\",\n \"parameters\": {\n \"any\": {\n \"value\": {\n \"@type\": \"\"\n },\n \"yaml\": \"\"\n },\n \"expression\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n }\n },\n \"requestBody\": {},\n \"description\": \"\",\n \"server\": {\n \"url\": \"\",\n \"description\": \"\",\n \"variables\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/links/: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/admin/v1/links/: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({
operationRef: '',
operationId: '',
parameters: {
any: {value: {'@type': ''}, yaml: ''},
expression: {additionalProperties: [{name: '', value: ''}]}
},
requestBody: {},
description: '',
server: {
url: '',
description: '',
variables: {additionalProperties: [{name: '', value: ''}]},
specificationExtension: [{}]
},
specificationExtension: [{}]
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/admin/v1/links/:id',
headers: {'content-type': 'application/json'},
body: {
operationRef: '',
operationId: '',
parameters: {
any: {value: {'@type': ''}, yaml: ''},
expression: {additionalProperties: [{name: '', value: ''}]}
},
requestBody: {},
description: '',
server: {
url: '',
description: '',
variables: {additionalProperties: [{name: '', value: ''}]},
specificationExtension: [{}]
},
specificationExtension: [{}]
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/admin/v1/links/:id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
operationRef: '',
operationId: '',
parameters: {
any: {
value: {
'@type': ''
},
yaml: ''
},
expression: {
additionalProperties: [
{
name: '',
value: ''
}
]
}
},
requestBody: {},
description: '',
server: {
url: '',
description: '',
variables: {
additionalProperties: [
{
name: '',
value: ''
}
]
},
specificationExtension: [
{}
]
},
specificationExtension: [
{}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/admin/v1/links/:id',
headers: {'content-type': 'application/json'},
data: {
operationRef: '',
operationId: '',
parameters: {
any: {value: {'@type': ''}, yaml: ''},
expression: {additionalProperties: [{name: '', value: ''}]}
},
requestBody: {},
description: '',
server: {
url: '',
description: '',
variables: {additionalProperties: [{name: '', value: ''}]},
specificationExtension: [{}]
},
specificationExtension: [{}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/links/:id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"operationRef":"","operationId":"","parameters":{"any":{"value":{"@type":""},"yaml":""},"expression":{"additionalProperties":[{"name":"","value":""}]}},"requestBody":{},"description":"","server":{"url":"","description":"","variables":{"additionalProperties":[{"name":"","value":""}]},"specificationExtension":[{}]},"specificationExtension":[{}]}'
};
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 = @{ @"operationRef": @"",
@"operationId": @"",
@"parameters": @{ @"any": @{ @"value": @{ @"@type": @"" }, @"yaml": @"" }, @"expression": @{ @"additionalProperties": @[ @{ @"name": @"", @"value": @"" } ] } },
@"requestBody": @{ },
@"description": @"",
@"server": @{ @"url": @"", @"description": @"", @"variables": @{ @"additionalProperties": @[ @{ @"name": @"", @"value": @"" } ] }, @"specificationExtension": @[ @{ } ] },
@"specificationExtension": @[ @{ } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/admin/v1/links/: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}}/admin/v1/links/:id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"operationRef\": \"\",\n \"operationId\": \"\",\n \"parameters\": {\n \"any\": {\n \"value\": {\n \"@type\": \"\"\n },\n \"yaml\": \"\"\n },\n \"expression\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n }\n },\n \"requestBody\": {},\n \"description\": \"\",\n \"server\": {\n \"url\": \"\",\n \"description\": \"\",\n \"variables\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/links/: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([
'operationRef' => '',
'operationId' => '',
'parameters' => [
'any' => [
'value' => [
'@type' => ''
],
'yaml' => ''
],
'expression' => [
'additionalProperties' => [
[
'name' => '',
'value' => ''
]
]
]
],
'requestBody' => [
],
'description' => '',
'server' => [
'url' => '',
'description' => '',
'variables' => [
'additionalProperties' => [
[
'name' => '',
'value' => ''
]
]
],
'specificationExtension' => [
[
]
]
],
'specificationExtension' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/admin/v1/links/:id', [
'body' => '{
"operationRef": "",
"operationId": "",
"parameters": {
"any": {
"value": {
"@type": ""
},
"yaml": ""
},
"expression": {
"additionalProperties": [
{
"name": "",
"value": ""
}
]
}
},
"requestBody": {},
"description": "",
"server": {
"url": "",
"description": "",
"variables": {
"additionalProperties": [
{
"name": "",
"value": ""
}
]
},
"specificationExtension": [
{}
]
},
"specificationExtension": [
{}
]
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/links/:id');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'operationRef' => '',
'operationId' => '',
'parameters' => [
'any' => [
'value' => [
'@type' => ''
],
'yaml' => ''
],
'expression' => [
'additionalProperties' => [
[
'name' => '',
'value' => ''
]
]
]
],
'requestBody' => [
],
'description' => '',
'server' => [
'url' => '',
'description' => '',
'variables' => [
'additionalProperties' => [
[
'name' => '',
'value' => ''
]
]
],
'specificationExtension' => [
[
]
]
],
'specificationExtension' => [
[
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'operationRef' => '',
'operationId' => '',
'parameters' => [
'any' => [
'value' => [
'@type' => ''
],
'yaml' => ''
],
'expression' => [
'additionalProperties' => [
[
'name' => '',
'value' => ''
]
]
]
],
'requestBody' => [
],
'description' => '',
'server' => [
'url' => '',
'description' => '',
'variables' => [
'additionalProperties' => [
[
'name' => '',
'value' => ''
]
]
],
'specificationExtension' => [
[
]
]
],
'specificationExtension' => [
[
]
]
]));
$request->setRequestUrl('{{baseUrl}}/admin/v1/links/: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}}/admin/v1/links/:id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"operationRef": "",
"operationId": "",
"parameters": {
"any": {
"value": {
"@type": ""
},
"yaml": ""
},
"expression": {
"additionalProperties": [
{
"name": "",
"value": ""
}
]
}
},
"requestBody": {},
"description": "",
"server": {
"url": "",
"description": "",
"variables": {
"additionalProperties": [
{
"name": "",
"value": ""
}
]
},
"specificationExtension": [
{}
]
},
"specificationExtension": [
{}
]
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/links/:id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"operationRef": "",
"operationId": "",
"parameters": {
"any": {
"value": {
"@type": ""
},
"yaml": ""
},
"expression": {
"additionalProperties": [
{
"name": "",
"value": ""
}
]
}
},
"requestBody": {},
"description": "",
"server": {
"url": "",
"description": "",
"variables": {
"additionalProperties": [
{
"name": "",
"value": ""
}
]
},
"specificationExtension": [
{}
]
},
"specificationExtension": [
{}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"operationRef\": \"\",\n \"operationId\": \"\",\n \"parameters\": {\n \"any\": {\n \"value\": {\n \"@type\": \"\"\n },\n \"yaml\": \"\"\n },\n \"expression\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n }\n },\n \"requestBody\": {},\n \"description\": \"\",\n \"server\": {\n \"url\": \"\",\n \"description\": \"\",\n \"variables\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/admin/v1/links/:id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/links/:id"
payload = {
"operationRef": "",
"operationId": "",
"parameters": {
"any": {
"value": { "@type": "" },
"yaml": ""
},
"expression": { "additionalProperties": [
{
"name": "",
"value": ""
}
] }
},
"requestBody": {},
"description": "",
"server": {
"url": "",
"description": "",
"variables": { "additionalProperties": [
{
"name": "",
"value": ""
}
] },
"specificationExtension": [{}]
},
"specificationExtension": [{}]
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/links/:id"
payload <- "{\n \"operationRef\": \"\",\n \"operationId\": \"\",\n \"parameters\": {\n \"any\": {\n \"value\": {\n \"@type\": \"\"\n },\n \"yaml\": \"\"\n },\n \"expression\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n }\n },\n \"requestBody\": {},\n \"description\": \"\",\n \"server\": {\n \"url\": \"\",\n \"description\": \"\",\n \"variables\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/links/: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 \"operationRef\": \"\",\n \"operationId\": \"\",\n \"parameters\": {\n \"any\": {\n \"value\": {\n \"@type\": \"\"\n },\n \"yaml\": \"\"\n },\n \"expression\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n }\n },\n \"requestBody\": {},\n \"description\": \"\",\n \"server\": {\n \"url\": \"\",\n \"description\": \"\",\n \"variables\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/admin/v1/links/:id') do |req|
req.body = "{\n \"operationRef\": \"\",\n \"operationId\": \"\",\n \"parameters\": {\n \"any\": {\n \"value\": {\n \"@type\": \"\"\n },\n \"yaml\": \"\"\n },\n \"expression\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n }\n },\n \"requestBody\": {},\n \"description\": \"\",\n \"server\": {\n \"url\": \"\",\n \"description\": \"\",\n \"variables\": {\n \"additionalProperties\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/links/:id";
let payload = json!({
"operationRef": "",
"operationId": "",
"parameters": json!({
"any": json!({
"value": json!({"@type": ""}),
"yaml": ""
}),
"expression": json!({"additionalProperties": (
json!({
"name": "",
"value": ""
})
)})
}),
"requestBody": json!({}),
"description": "",
"server": json!({
"url": "",
"description": "",
"variables": json!({"additionalProperties": (
json!({
"name": "",
"value": ""
})
)}),
"specificationExtension": (json!({}))
}),
"specificationExtension": (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}}/admin/v1/links/:id \
--header 'content-type: application/json' \
--data '{
"operationRef": "",
"operationId": "",
"parameters": {
"any": {
"value": {
"@type": ""
},
"yaml": ""
},
"expression": {
"additionalProperties": [
{
"name": "",
"value": ""
}
]
}
},
"requestBody": {},
"description": "",
"server": {
"url": "",
"description": "",
"variables": {
"additionalProperties": [
{
"name": "",
"value": ""
}
]
},
"specificationExtension": [
{}
]
},
"specificationExtension": [
{}
]
}'
echo '{
"operationRef": "",
"operationId": "",
"parameters": {
"any": {
"value": {
"@type": ""
},
"yaml": ""
},
"expression": {
"additionalProperties": [
{
"name": "",
"value": ""
}
]
}
},
"requestBody": {},
"description": "",
"server": {
"url": "",
"description": "",
"variables": {
"additionalProperties": [
{
"name": "",
"value": ""
}
]
},
"specificationExtension": [
{}
]
},
"specificationExtension": [
{}
]
}' | \
http PUT {{baseUrl}}/admin/v1/links/:id \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "operationRef": "",\n "operationId": "",\n "parameters": {\n "any": {\n "value": {\n "@type": ""\n },\n "yaml": ""\n },\n "expression": {\n "additionalProperties": [\n {\n "name": "",\n "value": ""\n }\n ]\n }\n },\n "requestBody": {},\n "description": "",\n "server": {\n "url": "",\n "description": "",\n "variables": {\n "additionalProperties": [\n {\n "name": "",\n "value": ""\n }\n ]\n },\n "specificationExtension": [\n {}\n ]\n },\n "specificationExtension": [\n {}\n ]\n}' \
--output-document \
- {{baseUrl}}/admin/v1/links/:id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"operationRef": "",
"operationId": "",
"parameters": [
"any": [
"value": ["@type": ""],
"yaml": ""
],
"expression": ["additionalProperties": [
[
"name": "",
"value": ""
]
]]
],
"requestBody": [],
"description": "",
"server": [
"url": "",
"description": "",
"variables": ["additionalProperties": [
[
"name": "",
"value": ""
]
]],
"specificationExtension": [[]]
],
"specificationExtension": [[]]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/links/: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()
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/menus");
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 \"menu\": {\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\",\n \"priority\": 0,\n \"target\": \"\",\n \"icon\": \"\",\n \"parentId\": 0,\n \"team\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n },\n \"operatorId\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/admin/v1/menus" {:content-type :json
:form-params {:menu {:id 0
:name ""
:url ""
:priority 0
:target ""
:icon ""
:parentId 0
:team ""
:createTime ""
:updateTime ""}
:operatorId 0}})
require "http/client"
url = "{{baseUrl}}/admin/v1/menus"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"menu\": {\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\",\n \"priority\": 0,\n \"target\": \"\",\n \"icon\": \"\",\n \"parentId\": 0,\n \"team\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n },\n \"operatorId\": 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}}/admin/v1/menus"),
Content = new StringContent("{\n \"menu\": {\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\",\n \"priority\": 0,\n \"target\": \"\",\n \"icon\": \"\",\n \"parentId\": 0,\n \"team\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n },\n \"operatorId\": 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}}/admin/v1/menus");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"menu\": {\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\",\n \"priority\": 0,\n \"target\": \"\",\n \"icon\": \"\",\n \"parentId\": 0,\n \"team\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n },\n \"operatorId\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/menus"
payload := strings.NewReader("{\n \"menu\": {\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\",\n \"priority\": 0,\n \"target\": \"\",\n \"icon\": \"\",\n \"parentId\": 0,\n \"team\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n },\n \"operatorId\": 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/admin/v1/menus HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 213
{
"menu": {
"id": 0,
"name": "",
"url": "",
"priority": 0,
"target": "",
"icon": "",
"parentId": 0,
"team": "",
"createTime": "",
"updateTime": ""
},
"operatorId": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/admin/v1/menus")
.setHeader("content-type", "application/json")
.setBody("{\n \"menu\": {\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\",\n \"priority\": 0,\n \"target\": \"\",\n \"icon\": \"\",\n \"parentId\": 0,\n \"team\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n },\n \"operatorId\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/menus"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"menu\": {\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\",\n \"priority\": 0,\n \"target\": \"\",\n \"icon\": \"\",\n \"parentId\": 0,\n \"team\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n },\n \"operatorId\": 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 \"menu\": {\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\",\n \"priority\": 0,\n \"target\": \"\",\n \"icon\": \"\",\n \"parentId\": 0,\n \"team\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n },\n \"operatorId\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/admin/v1/menus")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/admin/v1/menus")
.header("content-type", "application/json")
.body("{\n \"menu\": {\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\",\n \"priority\": 0,\n \"target\": \"\",\n \"icon\": \"\",\n \"parentId\": 0,\n \"team\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n },\n \"operatorId\": 0\n}")
.asString();
const data = JSON.stringify({
menu: {
id: 0,
name: '',
url: '',
priority: 0,
target: '',
icon: '',
parentId: 0,
team: '',
createTime: '',
updateTime: ''
},
operatorId: 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}}/admin/v1/menus');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/admin/v1/menus',
headers: {'content-type': 'application/json'},
data: {
menu: {
id: 0,
name: '',
url: '',
priority: 0,
target: '',
icon: '',
parentId: 0,
team: '',
createTime: '',
updateTime: ''
},
operatorId: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/menus';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"menu":{"id":0,"name":"","url":"","priority":0,"target":"","icon":"","parentId":0,"team":"","createTime":"","updateTime":""},"operatorId":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}}/admin/v1/menus',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "menu": {\n "id": 0,\n "name": "",\n "url": "",\n "priority": 0,\n "target": "",\n "icon": "",\n "parentId": 0,\n "team": "",\n "createTime": "",\n "updateTime": ""\n },\n "operatorId": 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 \"menu\": {\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\",\n \"priority\": 0,\n \"target\": \"\",\n \"icon\": \"\",\n \"parentId\": 0,\n \"team\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n },\n \"operatorId\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/menus")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/admin/v1/menus',
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({
menu: {
id: 0,
name: '',
url: '',
priority: 0,
target: '',
icon: '',
parentId: 0,
team: '',
createTime: '',
updateTime: ''
},
operatorId: 0
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/admin/v1/menus',
headers: {'content-type': 'application/json'},
body: {
menu: {
id: 0,
name: '',
url: '',
priority: 0,
target: '',
icon: '',
parentId: 0,
team: '',
createTime: '',
updateTime: ''
},
operatorId: 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}}/admin/v1/menus');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
menu: {
id: 0,
name: '',
url: '',
priority: 0,
target: '',
icon: '',
parentId: 0,
team: '',
createTime: '',
updateTime: ''
},
operatorId: 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}}/admin/v1/menus',
headers: {'content-type': 'application/json'},
data: {
menu: {
id: 0,
name: '',
url: '',
priority: 0,
target: '',
icon: '',
parentId: 0,
team: '',
createTime: '',
updateTime: ''
},
operatorId: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/menus';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"menu":{"id":0,"name":"","url":"","priority":0,"target":"","icon":"","parentId":0,"team":"","createTime":"","updateTime":""},"operatorId":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 = @{ @"menu": @{ @"id": @0, @"name": @"", @"url": @"", @"priority": @0, @"target": @"", @"icon": @"", @"parentId": @0, @"team": @"", @"createTime": @"", @"updateTime": @"" },
@"operatorId": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/admin/v1/menus"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/admin/v1/menus" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"menu\": {\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\",\n \"priority\": 0,\n \"target\": \"\",\n \"icon\": \"\",\n \"parentId\": 0,\n \"team\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n },\n \"operatorId\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/menus",
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([
'menu' => [
'id' => 0,
'name' => '',
'url' => '',
'priority' => 0,
'target' => '',
'icon' => '',
'parentId' => 0,
'team' => '',
'createTime' => '',
'updateTime' => ''
],
'operatorId' => 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}}/admin/v1/menus', [
'body' => '{
"menu": {
"id": 0,
"name": "",
"url": "",
"priority": 0,
"target": "",
"icon": "",
"parentId": 0,
"team": "",
"createTime": "",
"updateTime": ""
},
"operatorId": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/menus');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'menu' => [
'id' => 0,
'name' => '',
'url' => '',
'priority' => 0,
'target' => '',
'icon' => '',
'parentId' => 0,
'team' => '',
'createTime' => '',
'updateTime' => ''
],
'operatorId' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'menu' => [
'id' => 0,
'name' => '',
'url' => '',
'priority' => 0,
'target' => '',
'icon' => '',
'parentId' => 0,
'team' => '',
'createTime' => '',
'updateTime' => ''
],
'operatorId' => 0
]));
$request->setRequestUrl('{{baseUrl}}/admin/v1/menus');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/menus' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"menu": {
"id": 0,
"name": "",
"url": "",
"priority": 0,
"target": "",
"icon": "",
"parentId": 0,
"team": "",
"createTime": "",
"updateTime": ""
},
"operatorId": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/menus' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"menu": {
"id": 0,
"name": "",
"url": "",
"priority": 0,
"target": "",
"icon": "",
"parentId": 0,
"team": "",
"createTime": "",
"updateTime": ""
},
"operatorId": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"menu\": {\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\",\n \"priority\": 0,\n \"target\": \"\",\n \"icon\": \"\",\n \"parentId\": 0,\n \"team\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n },\n \"operatorId\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/admin/v1/menus", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/menus"
payload = {
"menu": {
"id": 0,
"name": "",
"url": "",
"priority": 0,
"target": "",
"icon": "",
"parentId": 0,
"team": "",
"createTime": "",
"updateTime": ""
},
"operatorId": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/menus"
payload <- "{\n \"menu\": {\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\",\n \"priority\": 0,\n \"target\": \"\",\n \"icon\": \"\",\n \"parentId\": 0,\n \"team\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n },\n \"operatorId\": 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}}/admin/v1/menus")
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 \"menu\": {\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\",\n \"priority\": 0,\n \"target\": \"\",\n \"icon\": \"\",\n \"parentId\": 0,\n \"team\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n },\n \"operatorId\": 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/admin/v1/menus') do |req|
req.body = "{\n \"menu\": {\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\",\n \"priority\": 0,\n \"target\": \"\",\n \"icon\": \"\",\n \"parentId\": 0,\n \"team\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n },\n \"operatorId\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/menus";
let payload = json!({
"menu": json!({
"id": 0,
"name": "",
"url": "",
"priority": 0,
"target": "",
"icon": "",
"parentId": 0,
"team": "",
"createTime": "",
"updateTime": ""
}),
"operatorId": 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}}/admin/v1/menus \
--header 'content-type: application/json' \
--data '{
"menu": {
"id": 0,
"name": "",
"url": "",
"priority": 0,
"target": "",
"icon": "",
"parentId": 0,
"team": "",
"createTime": "",
"updateTime": ""
},
"operatorId": 0
}'
echo '{
"menu": {
"id": 0,
"name": "",
"url": "",
"priority": 0,
"target": "",
"icon": "",
"parentId": 0,
"team": "",
"createTime": "",
"updateTime": ""
},
"operatorId": 0
}' | \
http POST {{baseUrl}}/admin/v1/menus \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "menu": {\n "id": 0,\n "name": "",\n "url": "",\n "priority": 0,\n "target": "",\n "icon": "",\n "parentId": 0,\n "team": "",\n "createTime": "",\n "updateTime": ""\n },\n "operatorId": 0\n}' \
--output-document \
- {{baseUrl}}/admin/v1/menus
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"menu": [
"id": 0,
"name": "",
"url": "",
"priority": 0,
"target": "",
"icon": "",
"parentId": 0,
"team": "",
"createTime": "",
"updateTime": ""
],
"operatorId": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/menus")! 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()
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/menus/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/admin/v1/menus/:id")
require "http/client"
url = "{{baseUrl}}/admin/v1/menus/: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}}/admin/v1/menus/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/menus/:id");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/menus/: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/admin/v1/menus/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/admin/v1/menus/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/menus/: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}}/admin/v1/menus/:id")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/admin/v1/menus/: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}}/admin/v1/menus/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/admin/v1/menus/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/menus/: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}}/admin/v1/menus/:id',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/menus/: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/admin/v1/menus/: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}}/admin/v1/menus/: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}}/admin/v1/menus/: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}}/admin/v1/menus/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/menus/: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}}/admin/v1/menus/: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}}/admin/v1/menus/:id" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/menus/: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}}/admin/v1/menus/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/menus/:id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/admin/v1/menus/:id');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/menus/:id' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/menus/:id' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/admin/v1/menus/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/menus/:id"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/menus/:id"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/menus/: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/admin/v1/menus/: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}}/admin/v1/menus/: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}}/admin/v1/menus/:id
http DELETE {{baseUrl}}/admin/v1/menus/:id
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/admin/v1/menus/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/menus/: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()
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/menus/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/admin/v1/menus/:id")
require "http/client"
url = "{{baseUrl}}/admin/v1/menus/: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}}/admin/v1/menus/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/menus/:id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/menus/: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/admin/v1/menus/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/admin/v1/menus/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/menus/: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}}/admin/v1/menus/:id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/admin/v1/menus/: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}}/admin/v1/menus/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/menus/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/menus/: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}}/admin/v1/menus/:id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/menus/:id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/admin/v1/menus/: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}}/admin/v1/menus/: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}}/admin/v1/menus/: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}}/admin/v1/menus/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/menus/: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}}/admin/v1/menus/: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}}/admin/v1/menus/:id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/menus/: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}}/admin/v1/menus/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/menus/:id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/admin/v1/menus/:id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/menus/:id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/menus/:id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/admin/v1/menus/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/menus/:id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/menus/:id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/menus/: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/admin/v1/menus/:id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/menus/: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}}/admin/v1/menus/:id
http GET {{baseUrl}}/admin/v1/menus/:id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/admin/v1/menus/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/menus/: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()
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/menus");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/admin/v1/menus")
require "http/client"
url = "{{baseUrl}}/admin/v1/menus"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/admin/v1/menus"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/menus");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/menus"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/admin/v1/menus HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/admin/v1/menus")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/menus"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/admin/v1/menus")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/admin/v1/menus")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/admin/v1/menus');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/menus'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/menus';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/admin/v1/menus',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/menus")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/admin/v1/menus',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/menus'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/admin/v1/menus');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/menus'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/menus';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/admin/v1/menus"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/admin/v1/menus" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/menus",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/admin/v1/menus');
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/menus');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/admin/v1/menus');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/menus' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/menus' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/admin/v1/menus")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/menus"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/menus"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/menus")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/admin/v1/menus') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/menus";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/admin/v1/menus
http GET {{baseUrl}}/admin/v1/menus
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/admin/v1/menus
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/menus")! 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()
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/menus/: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 \"url\": \"\",\n \"priority\": 0,\n \"target\": \"\",\n \"icon\": \"\",\n \"parentId\": 0,\n \"team\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/admin/v1/menus/:id" {:content-type :json
:form-params {:id 0
:name ""
:url ""
:priority 0
:target ""
:icon ""
:parentId 0
:team ""
:createTime ""
:updateTime ""}})
require "http/client"
url = "{{baseUrl}}/admin/v1/menus/:id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\",\n \"priority\": 0,\n \"target\": \"\",\n \"icon\": \"\",\n \"parentId\": 0,\n \"team\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/admin/v1/menus/:id"),
Content = new StringContent("{\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\",\n \"priority\": 0,\n \"target\": \"\",\n \"icon\": \"\",\n \"parentId\": 0,\n \"team\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/menus/:id");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\",\n \"priority\": 0,\n \"target\": \"\",\n \"icon\": \"\",\n \"parentId\": 0,\n \"team\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/menus/:id"
payload := strings.NewReader("{\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\",\n \"priority\": 0,\n \"target\": \"\",\n \"icon\": \"\",\n \"parentId\": 0,\n \"team\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/admin/v1/menus/:id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 158
{
"id": 0,
"name": "",
"url": "",
"priority": 0,
"target": "",
"icon": "",
"parentId": 0,
"team": "",
"createTime": "",
"updateTime": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/admin/v1/menus/:id")
.setHeader("content-type", "application/json")
.setBody("{\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\",\n \"priority\": 0,\n \"target\": \"\",\n \"icon\": \"\",\n \"parentId\": 0,\n \"team\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/menus/:id"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\",\n \"priority\": 0,\n \"target\": \"\",\n \"icon\": \"\",\n \"parentId\": 0,\n \"team\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\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 \"url\": \"\",\n \"priority\": 0,\n \"target\": \"\",\n \"icon\": \"\",\n \"parentId\": 0,\n \"team\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/admin/v1/menus/:id")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/admin/v1/menus/:id")
.header("content-type", "application/json")
.body("{\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\",\n \"priority\": 0,\n \"target\": \"\",\n \"icon\": \"\",\n \"parentId\": 0,\n \"team\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n}")
.asString();
const data = JSON.stringify({
id: 0,
name: '',
url: '',
priority: 0,
target: '',
icon: '',
parentId: 0,
team: '',
createTime: '',
updateTime: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/admin/v1/menus/:id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/admin/v1/menus/:id',
headers: {'content-type': 'application/json'},
data: {
id: 0,
name: '',
url: '',
priority: 0,
target: '',
icon: '',
parentId: 0,
team: '',
createTime: '',
updateTime: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/menus/:id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"id":0,"name":"","url":"","priority":0,"target":"","icon":"","parentId":0,"team":"","createTime":"","updateTime":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/admin/v1/menus/:id',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "id": 0,\n "name": "",\n "url": "",\n "priority": 0,\n "target": "",\n "icon": "",\n "parentId": 0,\n "team": "",\n "createTime": "",\n "updateTime": ""\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 \"url\": \"\",\n \"priority\": 0,\n \"target\": \"\",\n \"icon\": \"\",\n \"parentId\": 0,\n \"team\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/menus/: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/admin/v1/menus/: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: '',
url: '',
priority: 0,
target: '',
icon: '',
parentId: 0,
team: '',
createTime: '',
updateTime: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/admin/v1/menus/:id',
headers: {'content-type': 'application/json'},
body: {
id: 0,
name: '',
url: '',
priority: 0,
target: '',
icon: '',
parentId: 0,
team: '',
createTime: '',
updateTime: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/admin/v1/menus/:id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
id: 0,
name: '',
url: '',
priority: 0,
target: '',
icon: '',
parentId: 0,
team: '',
createTime: '',
updateTime: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/admin/v1/menus/:id',
headers: {'content-type': 'application/json'},
data: {
id: 0,
name: '',
url: '',
priority: 0,
target: '',
icon: '',
parentId: 0,
team: '',
createTime: '',
updateTime: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/menus/:id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"id":0,"name":"","url":"","priority":0,"target":"","icon":"","parentId":0,"team":"","createTime":"","updateTime":""}'
};
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": @"",
@"url": @"",
@"priority": @0,
@"target": @"",
@"icon": @"",
@"parentId": @0,
@"team": @"",
@"createTime": @"",
@"updateTime": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/admin/v1/menus/: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}}/admin/v1/menus/: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 \"url\": \"\",\n \"priority\": 0,\n \"target\": \"\",\n \"icon\": \"\",\n \"parentId\": 0,\n \"team\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/menus/: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' => '',
'url' => '',
'priority' => 0,
'target' => '',
'icon' => '',
'parentId' => 0,
'team' => '',
'createTime' => '',
'updateTime' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/admin/v1/menus/:id', [
'body' => '{
"id": 0,
"name": "",
"url": "",
"priority": 0,
"target": "",
"icon": "",
"parentId": 0,
"team": "",
"createTime": "",
"updateTime": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/menus/:id');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'id' => 0,
'name' => '',
'url' => '',
'priority' => 0,
'target' => '',
'icon' => '',
'parentId' => 0,
'team' => '',
'createTime' => '',
'updateTime' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'id' => 0,
'name' => '',
'url' => '',
'priority' => 0,
'target' => '',
'icon' => '',
'parentId' => 0,
'team' => '',
'createTime' => '',
'updateTime' => ''
]));
$request->setRequestUrl('{{baseUrl}}/admin/v1/menus/: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}}/admin/v1/menus/:id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"id": 0,
"name": "",
"url": "",
"priority": 0,
"target": "",
"icon": "",
"parentId": 0,
"team": "",
"createTime": "",
"updateTime": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/menus/:id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"id": 0,
"name": "",
"url": "",
"priority": 0,
"target": "",
"icon": "",
"parentId": 0,
"team": "",
"createTime": "",
"updateTime": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\",\n \"priority\": 0,\n \"target\": \"\",\n \"icon\": \"\",\n \"parentId\": 0,\n \"team\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/admin/v1/menus/:id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/menus/:id"
payload = {
"id": 0,
"name": "",
"url": "",
"priority": 0,
"target": "",
"icon": "",
"parentId": 0,
"team": "",
"createTime": "",
"updateTime": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/menus/:id"
payload <- "{\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\",\n \"priority\": 0,\n \"target\": \"\",\n \"icon\": \"\",\n \"parentId\": 0,\n \"team\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/menus/: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 \"url\": \"\",\n \"priority\": 0,\n \"target\": \"\",\n \"icon\": \"\",\n \"parentId\": 0,\n \"team\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/admin/v1/menus/:id') do |req|
req.body = "{\n \"id\": 0,\n \"name\": \"\",\n \"url\": \"\",\n \"priority\": 0,\n \"target\": \"\",\n \"icon\": \"\",\n \"parentId\": 0,\n \"team\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\"\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/menus/:id";
let payload = json!({
"id": 0,
"name": "",
"url": "",
"priority": 0,
"target": "",
"icon": "",
"parentId": 0,
"team": "",
"createTime": "",
"updateTime": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/admin/v1/menus/:id \
--header 'content-type: application/json' \
--data '{
"id": 0,
"name": "",
"url": "",
"priority": 0,
"target": "",
"icon": "",
"parentId": 0,
"team": "",
"createTime": "",
"updateTime": ""
}'
echo '{
"id": 0,
"name": "",
"url": "",
"priority": 0,
"target": "",
"icon": "",
"parentId": 0,
"team": "",
"createTime": "",
"updateTime": ""
}' | \
http PUT {{baseUrl}}/admin/v1/menus/:id \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "id": 0,\n "name": "",\n "url": "",\n "priority": 0,\n "target": "",\n "icon": "",\n "parentId": 0,\n "team": "",\n "createTime": "",\n "updateTime": ""\n}' \
--output-document \
- {{baseUrl}}/admin/v1/menus/:id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"id": 0,
"name": "",
"url": "",
"priority": 0,
"target": "",
"icon": "",
"parentId": 0,
"team": "",
"createTime": "",
"updateTime": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/menus/: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
PhotoService_CreatePhoto
{{baseUrl}}/admin/v1/photos
BODY json
{
"photo": {
"id": 0,
"name": "",
"thumbnail": "",
"url": "",
"team": "",
"location": "",
"description": "",
"likes": 0,
"takeTime": "",
"createTime": ""
},
"operatorId": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/photos");
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 \"photo\": {\n \"id\": 0,\n \"name\": \"\",\n \"thumbnail\": \"\",\n \"url\": \"\",\n \"team\": \"\",\n \"location\": \"\",\n \"description\": \"\",\n \"likes\": 0,\n \"takeTime\": \"\",\n \"createTime\": \"\"\n },\n \"operatorId\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/admin/v1/photos" {:content-type :json
:form-params {:photo {:id 0
:name ""
:thumbnail ""
:url ""
:team ""
:location ""
:description ""
:likes 0
:takeTime ""
:createTime ""}
:operatorId 0}})
require "http/client"
url = "{{baseUrl}}/admin/v1/photos"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"photo\": {\n \"id\": 0,\n \"name\": \"\",\n \"thumbnail\": \"\",\n \"url\": \"\",\n \"team\": \"\",\n \"location\": \"\",\n \"description\": \"\",\n \"likes\": 0,\n \"takeTime\": \"\",\n \"createTime\": \"\"\n },\n \"operatorId\": 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}}/admin/v1/photos"),
Content = new StringContent("{\n \"photo\": {\n \"id\": 0,\n \"name\": \"\",\n \"thumbnail\": \"\",\n \"url\": \"\",\n \"team\": \"\",\n \"location\": \"\",\n \"description\": \"\",\n \"likes\": 0,\n \"takeTime\": \"\",\n \"createTime\": \"\"\n },\n \"operatorId\": 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}}/admin/v1/photos");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"photo\": {\n \"id\": 0,\n \"name\": \"\",\n \"thumbnail\": \"\",\n \"url\": \"\",\n \"team\": \"\",\n \"location\": \"\",\n \"description\": \"\",\n \"likes\": 0,\n \"takeTime\": \"\",\n \"createTime\": \"\"\n },\n \"operatorId\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/photos"
payload := strings.NewReader("{\n \"photo\": {\n \"id\": 0,\n \"name\": \"\",\n \"thumbnail\": \"\",\n \"url\": \"\",\n \"team\": \"\",\n \"location\": \"\",\n \"description\": \"\",\n \"likes\": 0,\n \"takeTime\": \"\",\n \"createTime\": \"\"\n },\n \"operatorId\": 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/admin/v1/photos HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 220
{
"photo": {
"id": 0,
"name": "",
"thumbnail": "",
"url": "",
"team": "",
"location": "",
"description": "",
"likes": 0,
"takeTime": "",
"createTime": ""
},
"operatorId": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/admin/v1/photos")
.setHeader("content-type", "application/json")
.setBody("{\n \"photo\": {\n \"id\": 0,\n \"name\": \"\",\n \"thumbnail\": \"\",\n \"url\": \"\",\n \"team\": \"\",\n \"location\": \"\",\n \"description\": \"\",\n \"likes\": 0,\n \"takeTime\": \"\",\n \"createTime\": \"\"\n },\n \"operatorId\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/photos"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"photo\": {\n \"id\": 0,\n \"name\": \"\",\n \"thumbnail\": \"\",\n \"url\": \"\",\n \"team\": \"\",\n \"location\": \"\",\n \"description\": \"\",\n \"likes\": 0,\n \"takeTime\": \"\",\n \"createTime\": \"\"\n },\n \"operatorId\": 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 \"photo\": {\n \"id\": 0,\n \"name\": \"\",\n \"thumbnail\": \"\",\n \"url\": \"\",\n \"team\": \"\",\n \"location\": \"\",\n \"description\": \"\",\n \"likes\": 0,\n \"takeTime\": \"\",\n \"createTime\": \"\"\n },\n \"operatorId\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/admin/v1/photos")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/admin/v1/photos")
.header("content-type", "application/json")
.body("{\n \"photo\": {\n \"id\": 0,\n \"name\": \"\",\n \"thumbnail\": \"\",\n \"url\": \"\",\n \"team\": \"\",\n \"location\": \"\",\n \"description\": \"\",\n \"likes\": 0,\n \"takeTime\": \"\",\n \"createTime\": \"\"\n },\n \"operatorId\": 0\n}")
.asString();
const data = JSON.stringify({
photo: {
id: 0,
name: '',
thumbnail: '',
url: '',
team: '',
location: '',
description: '',
likes: 0,
takeTime: '',
createTime: ''
},
operatorId: 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}}/admin/v1/photos');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/admin/v1/photos',
headers: {'content-type': 'application/json'},
data: {
photo: {
id: 0,
name: '',
thumbnail: '',
url: '',
team: '',
location: '',
description: '',
likes: 0,
takeTime: '',
createTime: ''
},
operatorId: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/photos';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"photo":{"id":0,"name":"","thumbnail":"","url":"","team":"","location":"","description":"","likes":0,"takeTime":"","createTime":""},"operatorId":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}}/admin/v1/photos',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "photo": {\n "id": 0,\n "name": "",\n "thumbnail": "",\n "url": "",\n "team": "",\n "location": "",\n "description": "",\n "likes": 0,\n "takeTime": "",\n "createTime": ""\n },\n "operatorId": 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 \"photo\": {\n \"id\": 0,\n \"name\": \"\",\n \"thumbnail\": \"\",\n \"url\": \"\",\n \"team\": \"\",\n \"location\": \"\",\n \"description\": \"\",\n \"likes\": 0,\n \"takeTime\": \"\",\n \"createTime\": \"\"\n },\n \"operatorId\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/photos")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/admin/v1/photos',
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({
photo: {
id: 0,
name: '',
thumbnail: '',
url: '',
team: '',
location: '',
description: '',
likes: 0,
takeTime: '',
createTime: ''
},
operatorId: 0
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/admin/v1/photos',
headers: {'content-type': 'application/json'},
body: {
photo: {
id: 0,
name: '',
thumbnail: '',
url: '',
team: '',
location: '',
description: '',
likes: 0,
takeTime: '',
createTime: ''
},
operatorId: 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}}/admin/v1/photos');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
photo: {
id: 0,
name: '',
thumbnail: '',
url: '',
team: '',
location: '',
description: '',
likes: 0,
takeTime: '',
createTime: ''
},
operatorId: 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}}/admin/v1/photos',
headers: {'content-type': 'application/json'},
data: {
photo: {
id: 0,
name: '',
thumbnail: '',
url: '',
team: '',
location: '',
description: '',
likes: 0,
takeTime: '',
createTime: ''
},
operatorId: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/photos';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"photo":{"id":0,"name":"","thumbnail":"","url":"","team":"","location":"","description":"","likes":0,"takeTime":"","createTime":""},"operatorId":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 = @{ @"photo": @{ @"id": @0, @"name": @"", @"thumbnail": @"", @"url": @"", @"team": @"", @"location": @"", @"description": @"", @"likes": @0, @"takeTime": @"", @"createTime": @"" },
@"operatorId": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/admin/v1/photos"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/admin/v1/photos" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"photo\": {\n \"id\": 0,\n \"name\": \"\",\n \"thumbnail\": \"\",\n \"url\": \"\",\n \"team\": \"\",\n \"location\": \"\",\n \"description\": \"\",\n \"likes\": 0,\n \"takeTime\": \"\",\n \"createTime\": \"\"\n },\n \"operatorId\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/photos",
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([
'photo' => [
'id' => 0,
'name' => '',
'thumbnail' => '',
'url' => '',
'team' => '',
'location' => '',
'description' => '',
'likes' => 0,
'takeTime' => '',
'createTime' => ''
],
'operatorId' => 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}}/admin/v1/photos', [
'body' => '{
"photo": {
"id": 0,
"name": "",
"thumbnail": "",
"url": "",
"team": "",
"location": "",
"description": "",
"likes": 0,
"takeTime": "",
"createTime": ""
},
"operatorId": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/photos');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'photo' => [
'id' => 0,
'name' => '',
'thumbnail' => '',
'url' => '',
'team' => '',
'location' => '',
'description' => '',
'likes' => 0,
'takeTime' => '',
'createTime' => ''
],
'operatorId' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'photo' => [
'id' => 0,
'name' => '',
'thumbnail' => '',
'url' => '',
'team' => '',
'location' => '',
'description' => '',
'likes' => 0,
'takeTime' => '',
'createTime' => ''
],
'operatorId' => 0
]));
$request->setRequestUrl('{{baseUrl}}/admin/v1/photos');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/photos' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"photo": {
"id": 0,
"name": "",
"thumbnail": "",
"url": "",
"team": "",
"location": "",
"description": "",
"likes": 0,
"takeTime": "",
"createTime": ""
},
"operatorId": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/photos' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"photo": {
"id": 0,
"name": "",
"thumbnail": "",
"url": "",
"team": "",
"location": "",
"description": "",
"likes": 0,
"takeTime": "",
"createTime": ""
},
"operatorId": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"photo\": {\n \"id\": 0,\n \"name\": \"\",\n \"thumbnail\": \"\",\n \"url\": \"\",\n \"team\": \"\",\n \"location\": \"\",\n \"description\": \"\",\n \"likes\": 0,\n \"takeTime\": \"\",\n \"createTime\": \"\"\n },\n \"operatorId\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/admin/v1/photos", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/photos"
payload = {
"photo": {
"id": 0,
"name": "",
"thumbnail": "",
"url": "",
"team": "",
"location": "",
"description": "",
"likes": 0,
"takeTime": "",
"createTime": ""
},
"operatorId": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/photos"
payload <- "{\n \"photo\": {\n \"id\": 0,\n \"name\": \"\",\n \"thumbnail\": \"\",\n \"url\": \"\",\n \"team\": \"\",\n \"location\": \"\",\n \"description\": \"\",\n \"likes\": 0,\n \"takeTime\": \"\",\n \"createTime\": \"\"\n },\n \"operatorId\": 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}}/admin/v1/photos")
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 \"photo\": {\n \"id\": 0,\n \"name\": \"\",\n \"thumbnail\": \"\",\n \"url\": \"\",\n \"team\": \"\",\n \"location\": \"\",\n \"description\": \"\",\n \"likes\": 0,\n \"takeTime\": \"\",\n \"createTime\": \"\"\n },\n \"operatorId\": 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/admin/v1/photos') do |req|
req.body = "{\n \"photo\": {\n \"id\": 0,\n \"name\": \"\",\n \"thumbnail\": \"\",\n \"url\": \"\",\n \"team\": \"\",\n \"location\": \"\",\n \"description\": \"\",\n \"likes\": 0,\n \"takeTime\": \"\",\n \"createTime\": \"\"\n },\n \"operatorId\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/photos";
let payload = json!({
"photo": json!({
"id": 0,
"name": "",
"thumbnail": "",
"url": "",
"team": "",
"location": "",
"description": "",
"likes": 0,
"takeTime": "",
"createTime": ""
}),
"operatorId": 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}}/admin/v1/photos \
--header 'content-type: application/json' \
--data '{
"photo": {
"id": 0,
"name": "",
"thumbnail": "",
"url": "",
"team": "",
"location": "",
"description": "",
"likes": 0,
"takeTime": "",
"createTime": ""
},
"operatorId": 0
}'
echo '{
"photo": {
"id": 0,
"name": "",
"thumbnail": "",
"url": "",
"team": "",
"location": "",
"description": "",
"likes": 0,
"takeTime": "",
"createTime": ""
},
"operatorId": 0
}' | \
http POST {{baseUrl}}/admin/v1/photos \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "photo": {\n "id": 0,\n "name": "",\n "thumbnail": "",\n "url": "",\n "team": "",\n "location": "",\n "description": "",\n "likes": 0,\n "takeTime": "",\n "createTime": ""\n },\n "operatorId": 0\n}' \
--output-document \
- {{baseUrl}}/admin/v1/photos
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"photo": [
"id": 0,
"name": "",
"thumbnail": "",
"url": "",
"team": "",
"location": "",
"description": "",
"likes": 0,
"takeTime": "",
"createTime": ""
],
"operatorId": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/photos")! 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
PhotoService_DeletePhoto
{{baseUrl}}/admin/v1/photos/:id
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/photos/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/admin/v1/photos/:id")
require "http/client"
url = "{{baseUrl}}/admin/v1/photos/: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}}/admin/v1/photos/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/photos/:id");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/photos/: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/admin/v1/photos/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/admin/v1/photos/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/photos/: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}}/admin/v1/photos/:id")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/admin/v1/photos/: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}}/admin/v1/photos/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/admin/v1/photos/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/photos/: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}}/admin/v1/photos/:id',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/photos/: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/admin/v1/photos/: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}}/admin/v1/photos/: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}}/admin/v1/photos/: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}}/admin/v1/photos/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/photos/: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}}/admin/v1/photos/: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}}/admin/v1/photos/:id" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/photos/: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}}/admin/v1/photos/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/photos/:id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/admin/v1/photos/:id');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/photos/:id' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/photos/:id' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/admin/v1/photos/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/photos/:id"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/photos/:id"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/photos/: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/admin/v1/photos/: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}}/admin/v1/photos/: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}}/admin/v1/photos/:id
http DELETE {{baseUrl}}/admin/v1/photos/:id
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/admin/v1/photos/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/photos/: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
PhotoService_GetPhoto
{{baseUrl}}/admin/v1/photos/:id
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/photos/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/admin/v1/photos/:id")
require "http/client"
url = "{{baseUrl}}/admin/v1/photos/: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}}/admin/v1/photos/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/photos/:id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/photos/: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/admin/v1/photos/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/admin/v1/photos/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/photos/: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}}/admin/v1/photos/:id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/admin/v1/photos/: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}}/admin/v1/photos/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/photos/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/photos/: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}}/admin/v1/photos/:id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/photos/:id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/admin/v1/photos/: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}}/admin/v1/photos/: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}}/admin/v1/photos/: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}}/admin/v1/photos/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/photos/: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}}/admin/v1/photos/: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}}/admin/v1/photos/:id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/photos/: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}}/admin/v1/photos/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/photos/:id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/admin/v1/photos/:id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/photos/:id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/photos/:id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/admin/v1/photos/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/photos/:id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/photos/:id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/photos/: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/admin/v1/photos/:id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/photos/: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}}/admin/v1/photos/:id
http GET {{baseUrl}}/admin/v1/photos/:id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/admin/v1/photos/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/photos/: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
PhotoService_ListPhoto
{{baseUrl}}/admin/v1/photos
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/photos");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/admin/v1/photos")
require "http/client"
url = "{{baseUrl}}/admin/v1/photos"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/admin/v1/photos"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/photos");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/photos"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/admin/v1/photos HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/admin/v1/photos")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/photos"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/admin/v1/photos")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/admin/v1/photos")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/admin/v1/photos');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/photos'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/photos';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/admin/v1/photos',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/photos")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/admin/v1/photos',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/photos'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/admin/v1/photos');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/photos'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/photos';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/admin/v1/photos"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/admin/v1/photos" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/photos",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/admin/v1/photos');
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/photos');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/admin/v1/photos');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/photos' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/photos' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/admin/v1/photos")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/photos"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/photos"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/photos")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/admin/v1/photos') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/photos";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/admin/v1/photos
http GET {{baseUrl}}/admin/v1/photos
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/admin/v1/photos
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/photos")! 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
PhotoService_UpdatePhoto
{{baseUrl}}/admin/v1/photos/:id
QUERY PARAMS
id
BODY json
{
"id": 0,
"name": "",
"thumbnail": "",
"url": "",
"team": "",
"location": "",
"description": "",
"likes": 0,
"takeTime": "",
"createTime": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/photos/: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 \"thumbnail\": \"\",\n \"url\": \"\",\n \"team\": \"\",\n \"location\": \"\",\n \"description\": \"\",\n \"likes\": 0,\n \"takeTime\": \"\",\n \"createTime\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/admin/v1/photos/:id" {:content-type :json
:form-params {:id 0
:name ""
:thumbnail ""
:url ""
:team ""
:location ""
:description ""
:likes 0
:takeTime ""
:createTime ""}})
require "http/client"
url = "{{baseUrl}}/admin/v1/photos/:id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"id\": 0,\n \"name\": \"\",\n \"thumbnail\": \"\",\n \"url\": \"\",\n \"team\": \"\",\n \"location\": \"\",\n \"description\": \"\",\n \"likes\": 0,\n \"takeTime\": \"\",\n \"createTime\": \"\"\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/admin/v1/photos/:id"),
Content = new StringContent("{\n \"id\": 0,\n \"name\": \"\",\n \"thumbnail\": \"\",\n \"url\": \"\",\n \"team\": \"\",\n \"location\": \"\",\n \"description\": \"\",\n \"likes\": 0,\n \"takeTime\": \"\",\n \"createTime\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/photos/:id");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"id\": 0,\n \"name\": \"\",\n \"thumbnail\": \"\",\n \"url\": \"\",\n \"team\": \"\",\n \"location\": \"\",\n \"description\": \"\",\n \"likes\": 0,\n \"takeTime\": \"\",\n \"createTime\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/photos/:id"
payload := strings.NewReader("{\n \"id\": 0,\n \"name\": \"\",\n \"thumbnail\": \"\",\n \"url\": \"\",\n \"team\": \"\",\n \"location\": \"\",\n \"description\": \"\",\n \"likes\": 0,\n \"takeTime\": \"\",\n \"createTime\": \"\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/admin/v1/photos/:id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 164
{
"id": 0,
"name": "",
"thumbnail": "",
"url": "",
"team": "",
"location": "",
"description": "",
"likes": 0,
"takeTime": "",
"createTime": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/admin/v1/photos/:id")
.setHeader("content-type", "application/json")
.setBody("{\n \"id\": 0,\n \"name\": \"\",\n \"thumbnail\": \"\",\n \"url\": \"\",\n \"team\": \"\",\n \"location\": \"\",\n \"description\": \"\",\n \"likes\": 0,\n \"takeTime\": \"\",\n \"createTime\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/photos/:id"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"id\": 0,\n \"name\": \"\",\n \"thumbnail\": \"\",\n \"url\": \"\",\n \"team\": \"\",\n \"location\": \"\",\n \"description\": \"\",\n \"likes\": 0,\n \"takeTime\": \"\",\n \"createTime\": \"\"\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 \"thumbnail\": \"\",\n \"url\": \"\",\n \"team\": \"\",\n \"location\": \"\",\n \"description\": \"\",\n \"likes\": 0,\n \"takeTime\": \"\",\n \"createTime\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/admin/v1/photos/:id")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/admin/v1/photos/:id")
.header("content-type", "application/json")
.body("{\n \"id\": 0,\n \"name\": \"\",\n \"thumbnail\": \"\",\n \"url\": \"\",\n \"team\": \"\",\n \"location\": \"\",\n \"description\": \"\",\n \"likes\": 0,\n \"takeTime\": \"\",\n \"createTime\": \"\"\n}")
.asString();
const data = JSON.stringify({
id: 0,
name: '',
thumbnail: '',
url: '',
team: '',
location: '',
description: '',
likes: 0,
takeTime: '',
createTime: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/admin/v1/photos/:id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/admin/v1/photos/:id',
headers: {'content-type': 'application/json'},
data: {
id: 0,
name: '',
thumbnail: '',
url: '',
team: '',
location: '',
description: '',
likes: 0,
takeTime: '',
createTime: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/photos/:id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"id":0,"name":"","thumbnail":"","url":"","team":"","location":"","description":"","likes":0,"takeTime":"","createTime":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/admin/v1/photos/:id',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "id": 0,\n "name": "",\n "thumbnail": "",\n "url": "",\n "team": "",\n "location": "",\n "description": "",\n "likes": 0,\n "takeTime": "",\n "createTime": ""\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 \"thumbnail\": \"\",\n \"url\": \"\",\n \"team\": \"\",\n \"location\": \"\",\n \"description\": \"\",\n \"likes\": 0,\n \"takeTime\": \"\",\n \"createTime\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/photos/: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/admin/v1/photos/: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: '',
thumbnail: '',
url: '',
team: '',
location: '',
description: '',
likes: 0,
takeTime: '',
createTime: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/admin/v1/photos/:id',
headers: {'content-type': 'application/json'},
body: {
id: 0,
name: '',
thumbnail: '',
url: '',
team: '',
location: '',
description: '',
likes: 0,
takeTime: '',
createTime: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/admin/v1/photos/:id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
id: 0,
name: '',
thumbnail: '',
url: '',
team: '',
location: '',
description: '',
likes: 0,
takeTime: '',
createTime: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/admin/v1/photos/:id',
headers: {'content-type': 'application/json'},
data: {
id: 0,
name: '',
thumbnail: '',
url: '',
team: '',
location: '',
description: '',
likes: 0,
takeTime: '',
createTime: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/photos/:id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"id":0,"name":"","thumbnail":"","url":"","team":"","location":"","description":"","likes":0,"takeTime":"","createTime":""}'
};
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": @"",
@"thumbnail": @"",
@"url": @"",
@"team": @"",
@"location": @"",
@"description": @"",
@"likes": @0,
@"takeTime": @"",
@"createTime": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/admin/v1/photos/: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}}/admin/v1/photos/: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 \"thumbnail\": \"\",\n \"url\": \"\",\n \"team\": \"\",\n \"location\": \"\",\n \"description\": \"\",\n \"likes\": 0,\n \"takeTime\": \"\",\n \"createTime\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/photos/: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' => '',
'thumbnail' => '',
'url' => '',
'team' => '',
'location' => '',
'description' => '',
'likes' => 0,
'takeTime' => '',
'createTime' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/admin/v1/photos/:id', [
'body' => '{
"id": 0,
"name": "",
"thumbnail": "",
"url": "",
"team": "",
"location": "",
"description": "",
"likes": 0,
"takeTime": "",
"createTime": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/photos/:id');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'id' => 0,
'name' => '',
'thumbnail' => '',
'url' => '',
'team' => '',
'location' => '',
'description' => '',
'likes' => 0,
'takeTime' => '',
'createTime' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'id' => 0,
'name' => '',
'thumbnail' => '',
'url' => '',
'team' => '',
'location' => '',
'description' => '',
'likes' => 0,
'takeTime' => '',
'createTime' => ''
]));
$request->setRequestUrl('{{baseUrl}}/admin/v1/photos/: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}}/admin/v1/photos/:id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"id": 0,
"name": "",
"thumbnail": "",
"url": "",
"team": "",
"location": "",
"description": "",
"likes": 0,
"takeTime": "",
"createTime": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/photos/:id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"id": 0,
"name": "",
"thumbnail": "",
"url": "",
"team": "",
"location": "",
"description": "",
"likes": 0,
"takeTime": "",
"createTime": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"id\": 0,\n \"name\": \"\",\n \"thumbnail\": \"\",\n \"url\": \"\",\n \"team\": \"\",\n \"location\": \"\",\n \"description\": \"\",\n \"likes\": 0,\n \"takeTime\": \"\",\n \"createTime\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/admin/v1/photos/:id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/photos/:id"
payload = {
"id": 0,
"name": "",
"thumbnail": "",
"url": "",
"team": "",
"location": "",
"description": "",
"likes": 0,
"takeTime": "",
"createTime": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/photos/:id"
payload <- "{\n \"id\": 0,\n \"name\": \"\",\n \"thumbnail\": \"\",\n \"url\": \"\",\n \"team\": \"\",\n \"location\": \"\",\n \"description\": \"\",\n \"likes\": 0,\n \"takeTime\": \"\",\n \"createTime\": \"\"\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/photos/: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 \"thumbnail\": \"\",\n \"url\": \"\",\n \"team\": \"\",\n \"location\": \"\",\n \"description\": \"\",\n \"likes\": 0,\n \"takeTime\": \"\",\n \"createTime\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/admin/v1/photos/:id') do |req|
req.body = "{\n \"id\": 0,\n \"name\": \"\",\n \"thumbnail\": \"\",\n \"url\": \"\",\n \"team\": \"\",\n \"location\": \"\",\n \"description\": \"\",\n \"likes\": 0,\n \"takeTime\": \"\",\n \"createTime\": \"\"\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/photos/:id";
let payload = json!({
"id": 0,
"name": "",
"thumbnail": "",
"url": "",
"team": "",
"location": "",
"description": "",
"likes": 0,
"takeTime": "",
"createTime": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/admin/v1/photos/:id \
--header 'content-type: application/json' \
--data '{
"id": 0,
"name": "",
"thumbnail": "",
"url": "",
"team": "",
"location": "",
"description": "",
"likes": 0,
"takeTime": "",
"createTime": ""
}'
echo '{
"id": 0,
"name": "",
"thumbnail": "",
"url": "",
"team": "",
"location": "",
"description": "",
"likes": 0,
"takeTime": "",
"createTime": ""
}' | \
http PUT {{baseUrl}}/admin/v1/photos/:id \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "id": 0,\n "name": "",\n "thumbnail": "",\n "url": "",\n "team": "",\n "location": "",\n "description": "",\n "likes": 0,\n "takeTime": "",\n "createTime": ""\n}' \
--output-document \
- {{baseUrl}}/admin/v1/photos/:id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"id": 0,
"name": "",
"thumbnail": "",
"url": "",
"team": "",
"location": "",
"description": "",
"likes": 0,
"takeTime": "",
"createTime": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/photos/: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
PostService_CreatePost
{{baseUrl}}/admin/v1/posts
BODY json
{
"post": {
"id": 0,
"title": "",
"status": 0,
"slug": "",
"editorType": 0,
"metaKeywords": "",
"metaDescription": "",
"fullPath": "",
"summary": "",
"thumbnail": "",
"password": "",
"template": "",
"content": "",
"originalContent": "",
"visits": 0,
"topPriority": 0,
"likes": 0,
"wordCount": 0,
"commentCount": 0,
"disallowComment": false,
"inProgress": false,
"createTime": "",
"updateTime": "",
"editTime": ""
},
"operatorId": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/posts");
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 \"post\": {\n \"id\": 0,\n \"title\": \"\",\n \"status\": 0,\n \"slug\": \"\",\n \"editorType\": 0,\n \"metaKeywords\": \"\",\n \"metaDescription\": \"\",\n \"fullPath\": \"\",\n \"summary\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"template\": \"\",\n \"content\": \"\",\n \"originalContent\": \"\",\n \"visits\": 0,\n \"topPriority\": 0,\n \"likes\": 0,\n \"wordCount\": 0,\n \"commentCount\": 0,\n \"disallowComment\": false,\n \"inProgress\": false,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"editTime\": \"\"\n },\n \"operatorId\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/admin/v1/posts" {:content-type :json
:form-params {:post {:id 0
:title ""
:status 0
:slug ""
:editorType 0
:metaKeywords ""
:metaDescription ""
:fullPath ""
:summary ""
:thumbnail ""
:password ""
:template ""
:content ""
:originalContent ""
:visits 0
:topPriority 0
:likes 0
:wordCount 0
:commentCount 0
:disallowComment false
:inProgress false
:createTime ""
:updateTime ""
:editTime ""}
:operatorId 0}})
require "http/client"
url = "{{baseUrl}}/admin/v1/posts"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"post\": {\n \"id\": 0,\n \"title\": \"\",\n \"status\": 0,\n \"slug\": \"\",\n \"editorType\": 0,\n \"metaKeywords\": \"\",\n \"metaDescription\": \"\",\n \"fullPath\": \"\",\n \"summary\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"template\": \"\",\n \"content\": \"\",\n \"originalContent\": \"\",\n \"visits\": 0,\n \"topPriority\": 0,\n \"likes\": 0,\n \"wordCount\": 0,\n \"commentCount\": 0,\n \"disallowComment\": false,\n \"inProgress\": false,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"editTime\": \"\"\n },\n \"operatorId\": 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}}/admin/v1/posts"),
Content = new StringContent("{\n \"post\": {\n \"id\": 0,\n \"title\": \"\",\n \"status\": 0,\n \"slug\": \"\",\n \"editorType\": 0,\n \"metaKeywords\": \"\",\n \"metaDescription\": \"\",\n \"fullPath\": \"\",\n \"summary\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"template\": \"\",\n \"content\": \"\",\n \"originalContent\": \"\",\n \"visits\": 0,\n \"topPriority\": 0,\n \"likes\": 0,\n \"wordCount\": 0,\n \"commentCount\": 0,\n \"disallowComment\": false,\n \"inProgress\": false,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"editTime\": \"\"\n },\n \"operatorId\": 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}}/admin/v1/posts");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"post\": {\n \"id\": 0,\n \"title\": \"\",\n \"status\": 0,\n \"slug\": \"\",\n \"editorType\": 0,\n \"metaKeywords\": \"\",\n \"metaDescription\": \"\",\n \"fullPath\": \"\",\n \"summary\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"template\": \"\",\n \"content\": \"\",\n \"originalContent\": \"\",\n \"visits\": 0,\n \"topPriority\": 0,\n \"likes\": 0,\n \"wordCount\": 0,\n \"commentCount\": 0,\n \"disallowComment\": false,\n \"inProgress\": false,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"editTime\": \"\"\n },\n \"operatorId\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/posts"
payload := strings.NewReader("{\n \"post\": {\n \"id\": 0,\n \"title\": \"\",\n \"status\": 0,\n \"slug\": \"\",\n \"editorType\": 0,\n \"metaKeywords\": \"\",\n \"metaDescription\": \"\",\n \"fullPath\": \"\",\n \"summary\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"template\": \"\",\n \"content\": \"\",\n \"originalContent\": \"\",\n \"visits\": 0,\n \"topPriority\": 0,\n \"likes\": 0,\n \"wordCount\": 0,\n \"commentCount\": 0,\n \"disallowComment\": false,\n \"inProgress\": false,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"editTime\": \"\"\n },\n \"operatorId\": 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/admin/v1/posts HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 535
{
"post": {
"id": 0,
"title": "",
"status": 0,
"slug": "",
"editorType": 0,
"metaKeywords": "",
"metaDescription": "",
"fullPath": "",
"summary": "",
"thumbnail": "",
"password": "",
"template": "",
"content": "",
"originalContent": "",
"visits": 0,
"topPriority": 0,
"likes": 0,
"wordCount": 0,
"commentCount": 0,
"disallowComment": false,
"inProgress": false,
"createTime": "",
"updateTime": "",
"editTime": ""
},
"operatorId": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/admin/v1/posts")
.setHeader("content-type", "application/json")
.setBody("{\n \"post\": {\n \"id\": 0,\n \"title\": \"\",\n \"status\": 0,\n \"slug\": \"\",\n \"editorType\": 0,\n \"metaKeywords\": \"\",\n \"metaDescription\": \"\",\n \"fullPath\": \"\",\n \"summary\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"template\": \"\",\n \"content\": \"\",\n \"originalContent\": \"\",\n \"visits\": 0,\n \"topPriority\": 0,\n \"likes\": 0,\n \"wordCount\": 0,\n \"commentCount\": 0,\n \"disallowComment\": false,\n \"inProgress\": false,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"editTime\": \"\"\n },\n \"operatorId\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/posts"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"post\": {\n \"id\": 0,\n \"title\": \"\",\n \"status\": 0,\n \"slug\": \"\",\n \"editorType\": 0,\n \"metaKeywords\": \"\",\n \"metaDescription\": \"\",\n \"fullPath\": \"\",\n \"summary\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"template\": \"\",\n \"content\": \"\",\n \"originalContent\": \"\",\n \"visits\": 0,\n \"topPriority\": 0,\n \"likes\": 0,\n \"wordCount\": 0,\n \"commentCount\": 0,\n \"disallowComment\": false,\n \"inProgress\": false,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"editTime\": \"\"\n },\n \"operatorId\": 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 \"post\": {\n \"id\": 0,\n \"title\": \"\",\n \"status\": 0,\n \"slug\": \"\",\n \"editorType\": 0,\n \"metaKeywords\": \"\",\n \"metaDescription\": \"\",\n \"fullPath\": \"\",\n \"summary\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"template\": \"\",\n \"content\": \"\",\n \"originalContent\": \"\",\n \"visits\": 0,\n \"topPriority\": 0,\n \"likes\": 0,\n \"wordCount\": 0,\n \"commentCount\": 0,\n \"disallowComment\": false,\n \"inProgress\": false,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"editTime\": \"\"\n },\n \"operatorId\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/admin/v1/posts")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/admin/v1/posts")
.header("content-type", "application/json")
.body("{\n \"post\": {\n \"id\": 0,\n \"title\": \"\",\n \"status\": 0,\n \"slug\": \"\",\n \"editorType\": 0,\n \"metaKeywords\": \"\",\n \"metaDescription\": \"\",\n \"fullPath\": \"\",\n \"summary\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"template\": \"\",\n \"content\": \"\",\n \"originalContent\": \"\",\n \"visits\": 0,\n \"topPriority\": 0,\n \"likes\": 0,\n \"wordCount\": 0,\n \"commentCount\": 0,\n \"disallowComment\": false,\n \"inProgress\": false,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"editTime\": \"\"\n },\n \"operatorId\": 0\n}")
.asString();
const data = JSON.stringify({
post: {
id: 0,
title: '',
status: 0,
slug: '',
editorType: 0,
metaKeywords: '',
metaDescription: '',
fullPath: '',
summary: '',
thumbnail: '',
password: '',
template: '',
content: '',
originalContent: '',
visits: 0,
topPriority: 0,
likes: 0,
wordCount: 0,
commentCount: 0,
disallowComment: false,
inProgress: false,
createTime: '',
updateTime: '',
editTime: ''
},
operatorId: 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}}/admin/v1/posts');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/admin/v1/posts',
headers: {'content-type': 'application/json'},
data: {
post: {
id: 0,
title: '',
status: 0,
slug: '',
editorType: 0,
metaKeywords: '',
metaDescription: '',
fullPath: '',
summary: '',
thumbnail: '',
password: '',
template: '',
content: '',
originalContent: '',
visits: 0,
topPriority: 0,
likes: 0,
wordCount: 0,
commentCount: 0,
disallowComment: false,
inProgress: false,
createTime: '',
updateTime: '',
editTime: ''
},
operatorId: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/posts';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"post":{"id":0,"title":"","status":0,"slug":"","editorType":0,"metaKeywords":"","metaDescription":"","fullPath":"","summary":"","thumbnail":"","password":"","template":"","content":"","originalContent":"","visits":0,"topPriority":0,"likes":0,"wordCount":0,"commentCount":0,"disallowComment":false,"inProgress":false,"createTime":"","updateTime":"","editTime":""},"operatorId":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}}/admin/v1/posts',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "post": {\n "id": 0,\n "title": "",\n "status": 0,\n "slug": "",\n "editorType": 0,\n "metaKeywords": "",\n "metaDescription": "",\n "fullPath": "",\n "summary": "",\n "thumbnail": "",\n "password": "",\n "template": "",\n "content": "",\n "originalContent": "",\n "visits": 0,\n "topPriority": 0,\n "likes": 0,\n "wordCount": 0,\n "commentCount": 0,\n "disallowComment": false,\n "inProgress": false,\n "createTime": "",\n "updateTime": "",\n "editTime": ""\n },\n "operatorId": 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 \"post\": {\n \"id\": 0,\n \"title\": \"\",\n \"status\": 0,\n \"slug\": \"\",\n \"editorType\": 0,\n \"metaKeywords\": \"\",\n \"metaDescription\": \"\",\n \"fullPath\": \"\",\n \"summary\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"template\": \"\",\n \"content\": \"\",\n \"originalContent\": \"\",\n \"visits\": 0,\n \"topPriority\": 0,\n \"likes\": 0,\n \"wordCount\": 0,\n \"commentCount\": 0,\n \"disallowComment\": false,\n \"inProgress\": false,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"editTime\": \"\"\n },\n \"operatorId\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/posts")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/admin/v1/posts',
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({
post: {
id: 0,
title: '',
status: 0,
slug: '',
editorType: 0,
metaKeywords: '',
metaDescription: '',
fullPath: '',
summary: '',
thumbnail: '',
password: '',
template: '',
content: '',
originalContent: '',
visits: 0,
topPriority: 0,
likes: 0,
wordCount: 0,
commentCount: 0,
disallowComment: false,
inProgress: false,
createTime: '',
updateTime: '',
editTime: ''
},
operatorId: 0
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/admin/v1/posts',
headers: {'content-type': 'application/json'},
body: {
post: {
id: 0,
title: '',
status: 0,
slug: '',
editorType: 0,
metaKeywords: '',
metaDescription: '',
fullPath: '',
summary: '',
thumbnail: '',
password: '',
template: '',
content: '',
originalContent: '',
visits: 0,
topPriority: 0,
likes: 0,
wordCount: 0,
commentCount: 0,
disallowComment: false,
inProgress: false,
createTime: '',
updateTime: '',
editTime: ''
},
operatorId: 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}}/admin/v1/posts');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
post: {
id: 0,
title: '',
status: 0,
slug: '',
editorType: 0,
metaKeywords: '',
metaDescription: '',
fullPath: '',
summary: '',
thumbnail: '',
password: '',
template: '',
content: '',
originalContent: '',
visits: 0,
topPriority: 0,
likes: 0,
wordCount: 0,
commentCount: 0,
disallowComment: false,
inProgress: false,
createTime: '',
updateTime: '',
editTime: ''
},
operatorId: 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}}/admin/v1/posts',
headers: {'content-type': 'application/json'},
data: {
post: {
id: 0,
title: '',
status: 0,
slug: '',
editorType: 0,
metaKeywords: '',
metaDescription: '',
fullPath: '',
summary: '',
thumbnail: '',
password: '',
template: '',
content: '',
originalContent: '',
visits: 0,
topPriority: 0,
likes: 0,
wordCount: 0,
commentCount: 0,
disallowComment: false,
inProgress: false,
createTime: '',
updateTime: '',
editTime: ''
},
operatorId: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/posts';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"post":{"id":0,"title":"","status":0,"slug":"","editorType":0,"metaKeywords":"","metaDescription":"","fullPath":"","summary":"","thumbnail":"","password":"","template":"","content":"","originalContent":"","visits":0,"topPriority":0,"likes":0,"wordCount":0,"commentCount":0,"disallowComment":false,"inProgress":false,"createTime":"","updateTime":"","editTime":""},"operatorId":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 = @{ @"post": @{ @"id": @0, @"title": @"", @"status": @0, @"slug": @"", @"editorType": @0, @"metaKeywords": @"", @"metaDescription": @"", @"fullPath": @"", @"summary": @"", @"thumbnail": @"", @"password": @"", @"template": @"", @"content": @"", @"originalContent": @"", @"visits": @0, @"topPriority": @0, @"likes": @0, @"wordCount": @0, @"commentCount": @0, @"disallowComment": @NO, @"inProgress": @NO, @"createTime": @"", @"updateTime": @"", @"editTime": @"" },
@"operatorId": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/admin/v1/posts"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/admin/v1/posts" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"post\": {\n \"id\": 0,\n \"title\": \"\",\n \"status\": 0,\n \"slug\": \"\",\n \"editorType\": 0,\n \"metaKeywords\": \"\",\n \"metaDescription\": \"\",\n \"fullPath\": \"\",\n \"summary\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"template\": \"\",\n \"content\": \"\",\n \"originalContent\": \"\",\n \"visits\": 0,\n \"topPriority\": 0,\n \"likes\": 0,\n \"wordCount\": 0,\n \"commentCount\": 0,\n \"disallowComment\": false,\n \"inProgress\": false,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"editTime\": \"\"\n },\n \"operatorId\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/posts",
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([
'post' => [
'id' => 0,
'title' => '',
'status' => 0,
'slug' => '',
'editorType' => 0,
'metaKeywords' => '',
'metaDescription' => '',
'fullPath' => '',
'summary' => '',
'thumbnail' => '',
'password' => '',
'template' => '',
'content' => '',
'originalContent' => '',
'visits' => 0,
'topPriority' => 0,
'likes' => 0,
'wordCount' => 0,
'commentCount' => 0,
'disallowComment' => null,
'inProgress' => null,
'createTime' => '',
'updateTime' => '',
'editTime' => ''
],
'operatorId' => 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}}/admin/v1/posts', [
'body' => '{
"post": {
"id": 0,
"title": "",
"status": 0,
"slug": "",
"editorType": 0,
"metaKeywords": "",
"metaDescription": "",
"fullPath": "",
"summary": "",
"thumbnail": "",
"password": "",
"template": "",
"content": "",
"originalContent": "",
"visits": 0,
"topPriority": 0,
"likes": 0,
"wordCount": 0,
"commentCount": 0,
"disallowComment": false,
"inProgress": false,
"createTime": "",
"updateTime": "",
"editTime": ""
},
"operatorId": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/posts');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'post' => [
'id' => 0,
'title' => '',
'status' => 0,
'slug' => '',
'editorType' => 0,
'metaKeywords' => '',
'metaDescription' => '',
'fullPath' => '',
'summary' => '',
'thumbnail' => '',
'password' => '',
'template' => '',
'content' => '',
'originalContent' => '',
'visits' => 0,
'topPriority' => 0,
'likes' => 0,
'wordCount' => 0,
'commentCount' => 0,
'disallowComment' => null,
'inProgress' => null,
'createTime' => '',
'updateTime' => '',
'editTime' => ''
],
'operatorId' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'post' => [
'id' => 0,
'title' => '',
'status' => 0,
'slug' => '',
'editorType' => 0,
'metaKeywords' => '',
'metaDescription' => '',
'fullPath' => '',
'summary' => '',
'thumbnail' => '',
'password' => '',
'template' => '',
'content' => '',
'originalContent' => '',
'visits' => 0,
'topPriority' => 0,
'likes' => 0,
'wordCount' => 0,
'commentCount' => 0,
'disallowComment' => null,
'inProgress' => null,
'createTime' => '',
'updateTime' => '',
'editTime' => ''
],
'operatorId' => 0
]));
$request->setRequestUrl('{{baseUrl}}/admin/v1/posts');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/posts' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"post": {
"id": 0,
"title": "",
"status": 0,
"slug": "",
"editorType": 0,
"metaKeywords": "",
"metaDescription": "",
"fullPath": "",
"summary": "",
"thumbnail": "",
"password": "",
"template": "",
"content": "",
"originalContent": "",
"visits": 0,
"topPriority": 0,
"likes": 0,
"wordCount": 0,
"commentCount": 0,
"disallowComment": false,
"inProgress": false,
"createTime": "",
"updateTime": "",
"editTime": ""
},
"operatorId": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/posts' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"post": {
"id": 0,
"title": "",
"status": 0,
"slug": "",
"editorType": 0,
"metaKeywords": "",
"metaDescription": "",
"fullPath": "",
"summary": "",
"thumbnail": "",
"password": "",
"template": "",
"content": "",
"originalContent": "",
"visits": 0,
"topPriority": 0,
"likes": 0,
"wordCount": 0,
"commentCount": 0,
"disallowComment": false,
"inProgress": false,
"createTime": "",
"updateTime": "",
"editTime": ""
},
"operatorId": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"post\": {\n \"id\": 0,\n \"title\": \"\",\n \"status\": 0,\n \"slug\": \"\",\n \"editorType\": 0,\n \"metaKeywords\": \"\",\n \"metaDescription\": \"\",\n \"fullPath\": \"\",\n \"summary\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"template\": \"\",\n \"content\": \"\",\n \"originalContent\": \"\",\n \"visits\": 0,\n \"topPriority\": 0,\n \"likes\": 0,\n \"wordCount\": 0,\n \"commentCount\": 0,\n \"disallowComment\": false,\n \"inProgress\": false,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"editTime\": \"\"\n },\n \"operatorId\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/admin/v1/posts", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/posts"
payload = {
"post": {
"id": 0,
"title": "",
"status": 0,
"slug": "",
"editorType": 0,
"metaKeywords": "",
"metaDescription": "",
"fullPath": "",
"summary": "",
"thumbnail": "",
"password": "",
"template": "",
"content": "",
"originalContent": "",
"visits": 0,
"topPriority": 0,
"likes": 0,
"wordCount": 0,
"commentCount": 0,
"disallowComment": False,
"inProgress": False,
"createTime": "",
"updateTime": "",
"editTime": ""
},
"operatorId": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/posts"
payload <- "{\n \"post\": {\n \"id\": 0,\n \"title\": \"\",\n \"status\": 0,\n \"slug\": \"\",\n \"editorType\": 0,\n \"metaKeywords\": \"\",\n \"metaDescription\": \"\",\n \"fullPath\": \"\",\n \"summary\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"template\": \"\",\n \"content\": \"\",\n \"originalContent\": \"\",\n \"visits\": 0,\n \"topPriority\": 0,\n \"likes\": 0,\n \"wordCount\": 0,\n \"commentCount\": 0,\n \"disallowComment\": false,\n \"inProgress\": false,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"editTime\": \"\"\n },\n \"operatorId\": 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}}/admin/v1/posts")
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 \"post\": {\n \"id\": 0,\n \"title\": \"\",\n \"status\": 0,\n \"slug\": \"\",\n \"editorType\": 0,\n \"metaKeywords\": \"\",\n \"metaDescription\": \"\",\n \"fullPath\": \"\",\n \"summary\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"template\": \"\",\n \"content\": \"\",\n \"originalContent\": \"\",\n \"visits\": 0,\n \"topPriority\": 0,\n \"likes\": 0,\n \"wordCount\": 0,\n \"commentCount\": 0,\n \"disallowComment\": false,\n \"inProgress\": false,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"editTime\": \"\"\n },\n \"operatorId\": 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/admin/v1/posts') do |req|
req.body = "{\n \"post\": {\n \"id\": 0,\n \"title\": \"\",\n \"status\": 0,\n \"slug\": \"\",\n \"editorType\": 0,\n \"metaKeywords\": \"\",\n \"metaDescription\": \"\",\n \"fullPath\": \"\",\n \"summary\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"template\": \"\",\n \"content\": \"\",\n \"originalContent\": \"\",\n \"visits\": 0,\n \"topPriority\": 0,\n \"likes\": 0,\n \"wordCount\": 0,\n \"commentCount\": 0,\n \"disallowComment\": false,\n \"inProgress\": false,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"editTime\": \"\"\n },\n \"operatorId\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/posts";
let payload = json!({
"post": json!({
"id": 0,
"title": "",
"status": 0,
"slug": "",
"editorType": 0,
"metaKeywords": "",
"metaDescription": "",
"fullPath": "",
"summary": "",
"thumbnail": "",
"password": "",
"template": "",
"content": "",
"originalContent": "",
"visits": 0,
"topPriority": 0,
"likes": 0,
"wordCount": 0,
"commentCount": 0,
"disallowComment": false,
"inProgress": false,
"createTime": "",
"updateTime": "",
"editTime": ""
}),
"operatorId": 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}}/admin/v1/posts \
--header 'content-type: application/json' \
--data '{
"post": {
"id": 0,
"title": "",
"status": 0,
"slug": "",
"editorType": 0,
"metaKeywords": "",
"metaDescription": "",
"fullPath": "",
"summary": "",
"thumbnail": "",
"password": "",
"template": "",
"content": "",
"originalContent": "",
"visits": 0,
"topPriority": 0,
"likes": 0,
"wordCount": 0,
"commentCount": 0,
"disallowComment": false,
"inProgress": false,
"createTime": "",
"updateTime": "",
"editTime": ""
},
"operatorId": 0
}'
echo '{
"post": {
"id": 0,
"title": "",
"status": 0,
"slug": "",
"editorType": 0,
"metaKeywords": "",
"metaDescription": "",
"fullPath": "",
"summary": "",
"thumbnail": "",
"password": "",
"template": "",
"content": "",
"originalContent": "",
"visits": 0,
"topPriority": 0,
"likes": 0,
"wordCount": 0,
"commentCount": 0,
"disallowComment": false,
"inProgress": false,
"createTime": "",
"updateTime": "",
"editTime": ""
},
"operatorId": 0
}' | \
http POST {{baseUrl}}/admin/v1/posts \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "post": {\n "id": 0,\n "title": "",\n "status": 0,\n "slug": "",\n "editorType": 0,\n "metaKeywords": "",\n "metaDescription": "",\n "fullPath": "",\n "summary": "",\n "thumbnail": "",\n "password": "",\n "template": "",\n "content": "",\n "originalContent": "",\n "visits": 0,\n "topPriority": 0,\n "likes": 0,\n "wordCount": 0,\n "commentCount": 0,\n "disallowComment": false,\n "inProgress": false,\n "createTime": "",\n "updateTime": "",\n "editTime": ""\n },\n "operatorId": 0\n}' \
--output-document \
- {{baseUrl}}/admin/v1/posts
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"post": [
"id": 0,
"title": "",
"status": 0,
"slug": "",
"editorType": 0,
"metaKeywords": "",
"metaDescription": "",
"fullPath": "",
"summary": "",
"thumbnail": "",
"password": "",
"template": "",
"content": "",
"originalContent": "",
"visits": 0,
"topPriority": 0,
"likes": 0,
"wordCount": 0,
"commentCount": 0,
"disallowComment": false,
"inProgress": false,
"createTime": "",
"updateTime": "",
"editTime": ""
],
"operatorId": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/posts")! 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
PostService_DeletePost
{{baseUrl}}/admin/v1/posts/:id
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/posts/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/admin/v1/posts/:id")
require "http/client"
url = "{{baseUrl}}/admin/v1/posts/: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}}/admin/v1/posts/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/posts/:id");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/posts/: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/admin/v1/posts/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/admin/v1/posts/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/posts/: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}}/admin/v1/posts/:id")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/admin/v1/posts/: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}}/admin/v1/posts/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/admin/v1/posts/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/posts/: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}}/admin/v1/posts/:id',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/posts/: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/admin/v1/posts/: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}}/admin/v1/posts/: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}}/admin/v1/posts/: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}}/admin/v1/posts/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/posts/: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}}/admin/v1/posts/: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}}/admin/v1/posts/:id" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/posts/: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}}/admin/v1/posts/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/posts/:id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/admin/v1/posts/:id');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/posts/:id' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/posts/:id' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/admin/v1/posts/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/posts/:id"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/posts/:id"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/posts/: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/admin/v1/posts/: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}}/admin/v1/posts/: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}}/admin/v1/posts/:id
http DELETE {{baseUrl}}/admin/v1/posts/:id
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/admin/v1/posts/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/posts/: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
PostService_GetPost
{{baseUrl}}/admin/v1/posts/:id
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/posts/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/admin/v1/posts/:id")
require "http/client"
url = "{{baseUrl}}/admin/v1/posts/: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}}/admin/v1/posts/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/posts/:id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/posts/: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/admin/v1/posts/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/admin/v1/posts/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/posts/: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}}/admin/v1/posts/:id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/admin/v1/posts/: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}}/admin/v1/posts/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/posts/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/posts/: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}}/admin/v1/posts/:id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/posts/:id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/admin/v1/posts/: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}}/admin/v1/posts/: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}}/admin/v1/posts/: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}}/admin/v1/posts/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/posts/: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}}/admin/v1/posts/: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}}/admin/v1/posts/:id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/posts/: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}}/admin/v1/posts/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/posts/:id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/admin/v1/posts/:id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/posts/:id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/posts/:id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/admin/v1/posts/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/posts/:id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/posts/:id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/posts/: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/admin/v1/posts/:id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/posts/: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}}/admin/v1/posts/:id
http GET {{baseUrl}}/admin/v1/posts/:id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/admin/v1/posts/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/posts/: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
PostService_ListPost
{{baseUrl}}/admin/v1/posts
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/posts");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/admin/v1/posts")
require "http/client"
url = "{{baseUrl}}/admin/v1/posts"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/admin/v1/posts"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/posts");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/posts"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/admin/v1/posts HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/admin/v1/posts")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/posts"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/admin/v1/posts")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/admin/v1/posts")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/admin/v1/posts');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/posts'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/posts';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/admin/v1/posts',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/posts")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/admin/v1/posts',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/posts'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/admin/v1/posts');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/posts'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/posts';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/admin/v1/posts"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/admin/v1/posts" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/posts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/admin/v1/posts');
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/posts');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/admin/v1/posts');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/posts' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/posts' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/admin/v1/posts")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/posts"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/posts"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/posts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/admin/v1/posts') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/posts";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/admin/v1/posts
http GET {{baseUrl}}/admin/v1/posts
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/admin/v1/posts
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/posts")! 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
PostService_UpdatePost
{{baseUrl}}/admin/v1/posts/:id
QUERY PARAMS
id
BODY json
{
"id": 0,
"title": "",
"status": 0,
"slug": "",
"editorType": 0,
"metaKeywords": "",
"metaDescription": "",
"fullPath": "",
"summary": "",
"thumbnail": "",
"password": "",
"template": "",
"content": "",
"originalContent": "",
"visits": 0,
"topPriority": 0,
"likes": 0,
"wordCount": 0,
"commentCount": 0,
"disallowComment": false,
"inProgress": false,
"createTime": "",
"updateTime": "",
"editTime": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/posts/: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 \"title\": \"\",\n \"status\": 0,\n \"slug\": \"\",\n \"editorType\": 0,\n \"metaKeywords\": \"\",\n \"metaDescription\": \"\",\n \"fullPath\": \"\",\n \"summary\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"template\": \"\",\n \"content\": \"\",\n \"originalContent\": \"\",\n \"visits\": 0,\n \"topPriority\": 0,\n \"likes\": 0,\n \"wordCount\": 0,\n \"commentCount\": 0,\n \"disallowComment\": false,\n \"inProgress\": false,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"editTime\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/admin/v1/posts/:id" {:content-type :json
:form-params {:id 0
:title ""
:status 0
:slug ""
:editorType 0
:metaKeywords ""
:metaDescription ""
:fullPath ""
:summary ""
:thumbnail ""
:password ""
:template ""
:content ""
:originalContent ""
:visits 0
:topPriority 0
:likes 0
:wordCount 0
:commentCount 0
:disallowComment false
:inProgress false
:createTime ""
:updateTime ""
:editTime ""}})
require "http/client"
url = "{{baseUrl}}/admin/v1/posts/:id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"id\": 0,\n \"title\": \"\",\n \"status\": 0,\n \"slug\": \"\",\n \"editorType\": 0,\n \"metaKeywords\": \"\",\n \"metaDescription\": \"\",\n \"fullPath\": \"\",\n \"summary\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"template\": \"\",\n \"content\": \"\",\n \"originalContent\": \"\",\n \"visits\": 0,\n \"topPriority\": 0,\n \"likes\": 0,\n \"wordCount\": 0,\n \"commentCount\": 0,\n \"disallowComment\": false,\n \"inProgress\": false,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"editTime\": \"\"\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/admin/v1/posts/:id"),
Content = new StringContent("{\n \"id\": 0,\n \"title\": \"\",\n \"status\": 0,\n \"slug\": \"\",\n \"editorType\": 0,\n \"metaKeywords\": \"\",\n \"metaDescription\": \"\",\n \"fullPath\": \"\",\n \"summary\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"template\": \"\",\n \"content\": \"\",\n \"originalContent\": \"\",\n \"visits\": 0,\n \"topPriority\": 0,\n \"likes\": 0,\n \"wordCount\": 0,\n \"commentCount\": 0,\n \"disallowComment\": false,\n \"inProgress\": false,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"editTime\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/posts/:id");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"id\": 0,\n \"title\": \"\",\n \"status\": 0,\n \"slug\": \"\",\n \"editorType\": 0,\n \"metaKeywords\": \"\",\n \"metaDescription\": \"\",\n \"fullPath\": \"\",\n \"summary\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"template\": \"\",\n \"content\": \"\",\n \"originalContent\": \"\",\n \"visits\": 0,\n \"topPriority\": 0,\n \"likes\": 0,\n \"wordCount\": 0,\n \"commentCount\": 0,\n \"disallowComment\": false,\n \"inProgress\": false,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"editTime\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/posts/:id"
payload := strings.NewReader("{\n \"id\": 0,\n \"title\": \"\",\n \"status\": 0,\n \"slug\": \"\",\n \"editorType\": 0,\n \"metaKeywords\": \"\",\n \"metaDescription\": \"\",\n \"fullPath\": \"\",\n \"summary\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"template\": \"\",\n \"content\": \"\",\n \"originalContent\": \"\",\n \"visits\": 0,\n \"topPriority\": 0,\n \"likes\": 0,\n \"wordCount\": 0,\n \"commentCount\": 0,\n \"disallowComment\": false,\n \"inProgress\": false,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"editTime\": \"\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/admin/v1/posts/:id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 452
{
"id": 0,
"title": "",
"status": 0,
"slug": "",
"editorType": 0,
"metaKeywords": "",
"metaDescription": "",
"fullPath": "",
"summary": "",
"thumbnail": "",
"password": "",
"template": "",
"content": "",
"originalContent": "",
"visits": 0,
"topPriority": 0,
"likes": 0,
"wordCount": 0,
"commentCount": 0,
"disallowComment": false,
"inProgress": false,
"createTime": "",
"updateTime": "",
"editTime": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/admin/v1/posts/:id")
.setHeader("content-type", "application/json")
.setBody("{\n \"id\": 0,\n \"title\": \"\",\n \"status\": 0,\n \"slug\": \"\",\n \"editorType\": 0,\n \"metaKeywords\": \"\",\n \"metaDescription\": \"\",\n \"fullPath\": \"\",\n \"summary\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"template\": \"\",\n \"content\": \"\",\n \"originalContent\": \"\",\n \"visits\": 0,\n \"topPriority\": 0,\n \"likes\": 0,\n \"wordCount\": 0,\n \"commentCount\": 0,\n \"disallowComment\": false,\n \"inProgress\": false,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"editTime\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/posts/:id"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"id\": 0,\n \"title\": \"\",\n \"status\": 0,\n \"slug\": \"\",\n \"editorType\": 0,\n \"metaKeywords\": \"\",\n \"metaDescription\": \"\",\n \"fullPath\": \"\",\n \"summary\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"template\": \"\",\n \"content\": \"\",\n \"originalContent\": \"\",\n \"visits\": 0,\n \"topPriority\": 0,\n \"likes\": 0,\n \"wordCount\": 0,\n \"commentCount\": 0,\n \"disallowComment\": false,\n \"inProgress\": false,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"editTime\": \"\"\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 \"title\": \"\",\n \"status\": 0,\n \"slug\": \"\",\n \"editorType\": 0,\n \"metaKeywords\": \"\",\n \"metaDescription\": \"\",\n \"fullPath\": \"\",\n \"summary\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"template\": \"\",\n \"content\": \"\",\n \"originalContent\": \"\",\n \"visits\": 0,\n \"topPriority\": 0,\n \"likes\": 0,\n \"wordCount\": 0,\n \"commentCount\": 0,\n \"disallowComment\": false,\n \"inProgress\": false,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"editTime\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/admin/v1/posts/:id")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/admin/v1/posts/:id")
.header("content-type", "application/json")
.body("{\n \"id\": 0,\n \"title\": \"\",\n \"status\": 0,\n \"slug\": \"\",\n \"editorType\": 0,\n \"metaKeywords\": \"\",\n \"metaDescription\": \"\",\n \"fullPath\": \"\",\n \"summary\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"template\": \"\",\n \"content\": \"\",\n \"originalContent\": \"\",\n \"visits\": 0,\n \"topPriority\": 0,\n \"likes\": 0,\n \"wordCount\": 0,\n \"commentCount\": 0,\n \"disallowComment\": false,\n \"inProgress\": false,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"editTime\": \"\"\n}")
.asString();
const data = JSON.stringify({
id: 0,
title: '',
status: 0,
slug: '',
editorType: 0,
metaKeywords: '',
metaDescription: '',
fullPath: '',
summary: '',
thumbnail: '',
password: '',
template: '',
content: '',
originalContent: '',
visits: 0,
topPriority: 0,
likes: 0,
wordCount: 0,
commentCount: 0,
disallowComment: false,
inProgress: false,
createTime: '',
updateTime: '',
editTime: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/admin/v1/posts/:id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/admin/v1/posts/:id',
headers: {'content-type': 'application/json'},
data: {
id: 0,
title: '',
status: 0,
slug: '',
editorType: 0,
metaKeywords: '',
metaDescription: '',
fullPath: '',
summary: '',
thumbnail: '',
password: '',
template: '',
content: '',
originalContent: '',
visits: 0,
topPriority: 0,
likes: 0,
wordCount: 0,
commentCount: 0,
disallowComment: false,
inProgress: false,
createTime: '',
updateTime: '',
editTime: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/posts/:id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"id":0,"title":"","status":0,"slug":"","editorType":0,"metaKeywords":"","metaDescription":"","fullPath":"","summary":"","thumbnail":"","password":"","template":"","content":"","originalContent":"","visits":0,"topPriority":0,"likes":0,"wordCount":0,"commentCount":0,"disallowComment":false,"inProgress":false,"createTime":"","updateTime":"","editTime":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/admin/v1/posts/:id',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "id": 0,\n "title": "",\n "status": 0,\n "slug": "",\n "editorType": 0,\n "metaKeywords": "",\n "metaDescription": "",\n "fullPath": "",\n "summary": "",\n "thumbnail": "",\n "password": "",\n "template": "",\n "content": "",\n "originalContent": "",\n "visits": 0,\n "topPriority": 0,\n "likes": 0,\n "wordCount": 0,\n "commentCount": 0,\n "disallowComment": false,\n "inProgress": false,\n "createTime": "",\n "updateTime": "",\n "editTime": ""\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 \"title\": \"\",\n \"status\": 0,\n \"slug\": \"\",\n \"editorType\": 0,\n \"metaKeywords\": \"\",\n \"metaDescription\": \"\",\n \"fullPath\": \"\",\n \"summary\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"template\": \"\",\n \"content\": \"\",\n \"originalContent\": \"\",\n \"visits\": 0,\n \"topPriority\": 0,\n \"likes\": 0,\n \"wordCount\": 0,\n \"commentCount\": 0,\n \"disallowComment\": false,\n \"inProgress\": false,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"editTime\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/posts/: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/admin/v1/posts/: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,
title: '',
status: 0,
slug: '',
editorType: 0,
metaKeywords: '',
metaDescription: '',
fullPath: '',
summary: '',
thumbnail: '',
password: '',
template: '',
content: '',
originalContent: '',
visits: 0,
topPriority: 0,
likes: 0,
wordCount: 0,
commentCount: 0,
disallowComment: false,
inProgress: false,
createTime: '',
updateTime: '',
editTime: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/admin/v1/posts/:id',
headers: {'content-type': 'application/json'},
body: {
id: 0,
title: '',
status: 0,
slug: '',
editorType: 0,
metaKeywords: '',
metaDescription: '',
fullPath: '',
summary: '',
thumbnail: '',
password: '',
template: '',
content: '',
originalContent: '',
visits: 0,
topPriority: 0,
likes: 0,
wordCount: 0,
commentCount: 0,
disallowComment: false,
inProgress: false,
createTime: '',
updateTime: '',
editTime: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/admin/v1/posts/:id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
id: 0,
title: '',
status: 0,
slug: '',
editorType: 0,
metaKeywords: '',
metaDescription: '',
fullPath: '',
summary: '',
thumbnail: '',
password: '',
template: '',
content: '',
originalContent: '',
visits: 0,
topPriority: 0,
likes: 0,
wordCount: 0,
commentCount: 0,
disallowComment: false,
inProgress: false,
createTime: '',
updateTime: '',
editTime: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/admin/v1/posts/:id',
headers: {'content-type': 'application/json'},
data: {
id: 0,
title: '',
status: 0,
slug: '',
editorType: 0,
metaKeywords: '',
metaDescription: '',
fullPath: '',
summary: '',
thumbnail: '',
password: '',
template: '',
content: '',
originalContent: '',
visits: 0,
topPriority: 0,
likes: 0,
wordCount: 0,
commentCount: 0,
disallowComment: false,
inProgress: false,
createTime: '',
updateTime: '',
editTime: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/posts/:id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"id":0,"title":"","status":0,"slug":"","editorType":0,"metaKeywords":"","metaDescription":"","fullPath":"","summary":"","thumbnail":"","password":"","template":"","content":"","originalContent":"","visits":0,"topPriority":0,"likes":0,"wordCount":0,"commentCount":0,"disallowComment":false,"inProgress":false,"createTime":"","updateTime":"","editTime":""}'
};
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,
@"title": @"",
@"status": @0,
@"slug": @"",
@"editorType": @0,
@"metaKeywords": @"",
@"metaDescription": @"",
@"fullPath": @"",
@"summary": @"",
@"thumbnail": @"",
@"password": @"",
@"template": @"",
@"content": @"",
@"originalContent": @"",
@"visits": @0,
@"topPriority": @0,
@"likes": @0,
@"wordCount": @0,
@"commentCount": @0,
@"disallowComment": @NO,
@"inProgress": @NO,
@"createTime": @"",
@"updateTime": @"",
@"editTime": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/admin/v1/posts/: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}}/admin/v1/posts/:id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"id\": 0,\n \"title\": \"\",\n \"status\": 0,\n \"slug\": \"\",\n \"editorType\": 0,\n \"metaKeywords\": \"\",\n \"metaDescription\": \"\",\n \"fullPath\": \"\",\n \"summary\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"template\": \"\",\n \"content\": \"\",\n \"originalContent\": \"\",\n \"visits\": 0,\n \"topPriority\": 0,\n \"likes\": 0,\n \"wordCount\": 0,\n \"commentCount\": 0,\n \"disallowComment\": false,\n \"inProgress\": false,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"editTime\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/posts/: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,
'title' => '',
'status' => 0,
'slug' => '',
'editorType' => 0,
'metaKeywords' => '',
'metaDescription' => '',
'fullPath' => '',
'summary' => '',
'thumbnail' => '',
'password' => '',
'template' => '',
'content' => '',
'originalContent' => '',
'visits' => 0,
'topPriority' => 0,
'likes' => 0,
'wordCount' => 0,
'commentCount' => 0,
'disallowComment' => null,
'inProgress' => null,
'createTime' => '',
'updateTime' => '',
'editTime' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/admin/v1/posts/:id', [
'body' => '{
"id": 0,
"title": "",
"status": 0,
"slug": "",
"editorType": 0,
"metaKeywords": "",
"metaDescription": "",
"fullPath": "",
"summary": "",
"thumbnail": "",
"password": "",
"template": "",
"content": "",
"originalContent": "",
"visits": 0,
"topPriority": 0,
"likes": 0,
"wordCount": 0,
"commentCount": 0,
"disallowComment": false,
"inProgress": false,
"createTime": "",
"updateTime": "",
"editTime": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/posts/:id');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'id' => 0,
'title' => '',
'status' => 0,
'slug' => '',
'editorType' => 0,
'metaKeywords' => '',
'metaDescription' => '',
'fullPath' => '',
'summary' => '',
'thumbnail' => '',
'password' => '',
'template' => '',
'content' => '',
'originalContent' => '',
'visits' => 0,
'topPriority' => 0,
'likes' => 0,
'wordCount' => 0,
'commentCount' => 0,
'disallowComment' => null,
'inProgress' => null,
'createTime' => '',
'updateTime' => '',
'editTime' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'id' => 0,
'title' => '',
'status' => 0,
'slug' => '',
'editorType' => 0,
'metaKeywords' => '',
'metaDescription' => '',
'fullPath' => '',
'summary' => '',
'thumbnail' => '',
'password' => '',
'template' => '',
'content' => '',
'originalContent' => '',
'visits' => 0,
'topPriority' => 0,
'likes' => 0,
'wordCount' => 0,
'commentCount' => 0,
'disallowComment' => null,
'inProgress' => null,
'createTime' => '',
'updateTime' => '',
'editTime' => ''
]));
$request->setRequestUrl('{{baseUrl}}/admin/v1/posts/: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}}/admin/v1/posts/:id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"id": 0,
"title": "",
"status": 0,
"slug": "",
"editorType": 0,
"metaKeywords": "",
"metaDescription": "",
"fullPath": "",
"summary": "",
"thumbnail": "",
"password": "",
"template": "",
"content": "",
"originalContent": "",
"visits": 0,
"topPriority": 0,
"likes": 0,
"wordCount": 0,
"commentCount": 0,
"disallowComment": false,
"inProgress": false,
"createTime": "",
"updateTime": "",
"editTime": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/posts/:id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"id": 0,
"title": "",
"status": 0,
"slug": "",
"editorType": 0,
"metaKeywords": "",
"metaDescription": "",
"fullPath": "",
"summary": "",
"thumbnail": "",
"password": "",
"template": "",
"content": "",
"originalContent": "",
"visits": 0,
"topPriority": 0,
"likes": 0,
"wordCount": 0,
"commentCount": 0,
"disallowComment": false,
"inProgress": false,
"createTime": "",
"updateTime": "",
"editTime": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"id\": 0,\n \"title\": \"\",\n \"status\": 0,\n \"slug\": \"\",\n \"editorType\": 0,\n \"metaKeywords\": \"\",\n \"metaDescription\": \"\",\n \"fullPath\": \"\",\n \"summary\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"template\": \"\",\n \"content\": \"\",\n \"originalContent\": \"\",\n \"visits\": 0,\n \"topPriority\": 0,\n \"likes\": 0,\n \"wordCount\": 0,\n \"commentCount\": 0,\n \"disallowComment\": false,\n \"inProgress\": false,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"editTime\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/admin/v1/posts/:id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/posts/:id"
payload = {
"id": 0,
"title": "",
"status": 0,
"slug": "",
"editorType": 0,
"metaKeywords": "",
"metaDescription": "",
"fullPath": "",
"summary": "",
"thumbnail": "",
"password": "",
"template": "",
"content": "",
"originalContent": "",
"visits": 0,
"topPriority": 0,
"likes": 0,
"wordCount": 0,
"commentCount": 0,
"disallowComment": False,
"inProgress": False,
"createTime": "",
"updateTime": "",
"editTime": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/posts/:id"
payload <- "{\n \"id\": 0,\n \"title\": \"\",\n \"status\": 0,\n \"slug\": \"\",\n \"editorType\": 0,\n \"metaKeywords\": \"\",\n \"metaDescription\": \"\",\n \"fullPath\": \"\",\n \"summary\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"template\": \"\",\n \"content\": \"\",\n \"originalContent\": \"\",\n \"visits\": 0,\n \"topPriority\": 0,\n \"likes\": 0,\n \"wordCount\": 0,\n \"commentCount\": 0,\n \"disallowComment\": false,\n \"inProgress\": false,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"editTime\": \"\"\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/posts/: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 \"title\": \"\",\n \"status\": 0,\n \"slug\": \"\",\n \"editorType\": 0,\n \"metaKeywords\": \"\",\n \"metaDescription\": \"\",\n \"fullPath\": \"\",\n \"summary\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"template\": \"\",\n \"content\": \"\",\n \"originalContent\": \"\",\n \"visits\": 0,\n \"topPriority\": 0,\n \"likes\": 0,\n \"wordCount\": 0,\n \"commentCount\": 0,\n \"disallowComment\": false,\n \"inProgress\": false,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"editTime\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/admin/v1/posts/:id') do |req|
req.body = "{\n \"id\": 0,\n \"title\": \"\",\n \"status\": 0,\n \"slug\": \"\",\n \"editorType\": 0,\n \"metaKeywords\": \"\",\n \"metaDescription\": \"\",\n \"fullPath\": \"\",\n \"summary\": \"\",\n \"thumbnail\": \"\",\n \"password\": \"\",\n \"template\": \"\",\n \"content\": \"\",\n \"originalContent\": \"\",\n \"visits\": 0,\n \"topPriority\": 0,\n \"likes\": 0,\n \"wordCount\": 0,\n \"commentCount\": 0,\n \"disallowComment\": false,\n \"inProgress\": false,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"editTime\": \"\"\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/posts/:id";
let payload = json!({
"id": 0,
"title": "",
"status": 0,
"slug": "",
"editorType": 0,
"metaKeywords": "",
"metaDescription": "",
"fullPath": "",
"summary": "",
"thumbnail": "",
"password": "",
"template": "",
"content": "",
"originalContent": "",
"visits": 0,
"topPriority": 0,
"likes": 0,
"wordCount": 0,
"commentCount": 0,
"disallowComment": false,
"inProgress": false,
"createTime": "",
"updateTime": "",
"editTime": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/admin/v1/posts/:id \
--header 'content-type: application/json' \
--data '{
"id": 0,
"title": "",
"status": 0,
"slug": "",
"editorType": 0,
"metaKeywords": "",
"metaDescription": "",
"fullPath": "",
"summary": "",
"thumbnail": "",
"password": "",
"template": "",
"content": "",
"originalContent": "",
"visits": 0,
"topPriority": 0,
"likes": 0,
"wordCount": 0,
"commentCount": 0,
"disallowComment": false,
"inProgress": false,
"createTime": "",
"updateTime": "",
"editTime": ""
}'
echo '{
"id": 0,
"title": "",
"status": 0,
"slug": "",
"editorType": 0,
"metaKeywords": "",
"metaDescription": "",
"fullPath": "",
"summary": "",
"thumbnail": "",
"password": "",
"template": "",
"content": "",
"originalContent": "",
"visits": 0,
"topPriority": 0,
"likes": 0,
"wordCount": 0,
"commentCount": 0,
"disallowComment": false,
"inProgress": false,
"createTime": "",
"updateTime": "",
"editTime": ""
}' | \
http PUT {{baseUrl}}/admin/v1/posts/:id \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "id": 0,\n "title": "",\n "status": 0,\n "slug": "",\n "editorType": 0,\n "metaKeywords": "",\n "metaDescription": "",\n "fullPath": "",\n "summary": "",\n "thumbnail": "",\n "password": "",\n "template": "",\n "content": "",\n "originalContent": "",\n "visits": 0,\n "topPriority": 0,\n "likes": 0,\n "wordCount": 0,\n "commentCount": 0,\n "disallowComment": false,\n "inProgress": false,\n "createTime": "",\n "updateTime": "",\n "editTime": ""\n}' \
--output-document \
- {{baseUrl}}/admin/v1/posts/:id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"id": 0,
"title": "",
"status": 0,
"slug": "",
"editorType": 0,
"metaKeywords": "",
"metaDescription": "",
"fullPath": "",
"summary": "",
"thumbnail": "",
"password": "",
"template": "",
"content": "",
"originalContent": "",
"visits": 0,
"topPriority": 0,
"likes": 0,
"wordCount": 0,
"commentCount": 0,
"disallowComment": false,
"inProgress": false,
"createTime": "",
"updateTime": "",
"editTime": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/posts/: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
SystemService_CreateSystem
{{baseUrl}}/admin/v1/system
BODY json
{
"system": {
"id": "",
"theme": 0,
"title": "",
"keywords": "",
"description": "",
"recordNumber": ""
},
"operatorId": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/system");
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 \"system\": {\n \"id\": \"\",\n \"theme\": 0,\n \"title\": \"\",\n \"keywords\": \"\",\n \"description\": \"\",\n \"recordNumber\": \"\"\n },\n \"operatorId\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/admin/v1/system" {:content-type :json
:form-params {:system {:id ""
:theme 0
:title ""
:keywords ""
:description ""
:recordNumber ""}
:operatorId ""}})
require "http/client"
url = "{{baseUrl}}/admin/v1/system"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"system\": {\n \"id\": \"\",\n \"theme\": 0,\n \"title\": \"\",\n \"keywords\": \"\",\n \"description\": \"\",\n \"recordNumber\": \"\"\n },\n \"operatorId\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/admin/v1/system"),
Content = new StringContent("{\n \"system\": {\n \"id\": \"\",\n \"theme\": 0,\n \"title\": \"\",\n \"keywords\": \"\",\n \"description\": \"\",\n \"recordNumber\": \"\"\n },\n \"operatorId\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/system");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"system\": {\n \"id\": \"\",\n \"theme\": 0,\n \"title\": \"\",\n \"keywords\": \"\",\n \"description\": \"\",\n \"recordNumber\": \"\"\n },\n \"operatorId\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/system"
payload := strings.NewReader("{\n \"system\": {\n \"id\": \"\",\n \"theme\": 0,\n \"title\": \"\",\n \"keywords\": \"\",\n \"description\": \"\",\n \"recordNumber\": \"\"\n },\n \"operatorId\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/admin/v1/system HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 154
{
"system": {
"id": "",
"theme": 0,
"title": "",
"keywords": "",
"description": "",
"recordNumber": ""
},
"operatorId": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/admin/v1/system")
.setHeader("content-type", "application/json")
.setBody("{\n \"system\": {\n \"id\": \"\",\n \"theme\": 0,\n \"title\": \"\",\n \"keywords\": \"\",\n \"description\": \"\",\n \"recordNumber\": \"\"\n },\n \"operatorId\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/system"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"system\": {\n \"id\": \"\",\n \"theme\": 0,\n \"title\": \"\",\n \"keywords\": \"\",\n \"description\": \"\",\n \"recordNumber\": \"\"\n },\n \"operatorId\": \"\"\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 \"system\": {\n \"id\": \"\",\n \"theme\": 0,\n \"title\": \"\",\n \"keywords\": \"\",\n \"description\": \"\",\n \"recordNumber\": \"\"\n },\n \"operatorId\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/admin/v1/system")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/admin/v1/system")
.header("content-type", "application/json")
.body("{\n \"system\": {\n \"id\": \"\",\n \"theme\": 0,\n \"title\": \"\",\n \"keywords\": \"\",\n \"description\": \"\",\n \"recordNumber\": \"\"\n },\n \"operatorId\": \"\"\n}")
.asString();
const data = JSON.stringify({
system: {
id: '',
theme: 0,
title: '',
keywords: '',
description: '',
recordNumber: ''
},
operatorId: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/admin/v1/system');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/admin/v1/system',
headers: {'content-type': 'application/json'},
data: {
system: {id: '', theme: 0, title: '', keywords: '', description: '', recordNumber: ''},
operatorId: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/system';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"system":{"id":"","theme":0,"title":"","keywords":"","description":"","recordNumber":""},"operatorId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/admin/v1/system',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "system": {\n "id": "",\n "theme": 0,\n "title": "",\n "keywords": "",\n "description": "",\n "recordNumber": ""\n },\n "operatorId": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"system\": {\n \"id\": \"\",\n \"theme\": 0,\n \"title\": \"\",\n \"keywords\": \"\",\n \"description\": \"\",\n \"recordNumber\": \"\"\n },\n \"operatorId\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/system")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/admin/v1/system',
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({
system: {id: '', theme: 0, title: '', keywords: '', description: '', recordNumber: ''},
operatorId: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/admin/v1/system',
headers: {'content-type': 'application/json'},
body: {
system: {id: '', theme: 0, title: '', keywords: '', description: '', recordNumber: ''},
operatorId: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/admin/v1/system');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
system: {
id: '',
theme: 0,
title: '',
keywords: '',
description: '',
recordNumber: ''
},
operatorId: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/admin/v1/system',
headers: {'content-type': 'application/json'},
data: {
system: {id: '', theme: 0, title: '', keywords: '', description: '', recordNumber: ''},
operatorId: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/system';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"system":{"id":"","theme":0,"title":"","keywords":"","description":"","recordNumber":""},"operatorId":""}'
};
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 = @{ @"system": @{ @"id": @"", @"theme": @0, @"title": @"", @"keywords": @"", @"description": @"", @"recordNumber": @"" },
@"operatorId": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/admin/v1/system"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/admin/v1/system" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"system\": {\n \"id\": \"\",\n \"theme\": 0,\n \"title\": \"\",\n \"keywords\": \"\",\n \"description\": \"\",\n \"recordNumber\": \"\"\n },\n \"operatorId\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/system",
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([
'system' => [
'id' => '',
'theme' => 0,
'title' => '',
'keywords' => '',
'description' => '',
'recordNumber' => ''
],
'operatorId' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/admin/v1/system', [
'body' => '{
"system": {
"id": "",
"theme": 0,
"title": "",
"keywords": "",
"description": "",
"recordNumber": ""
},
"operatorId": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/system');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'system' => [
'id' => '',
'theme' => 0,
'title' => '',
'keywords' => '',
'description' => '',
'recordNumber' => ''
],
'operatorId' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'system' => [
'id' => '',
'theme' => 0,
'title' => '',
'keywords' => '',
'description' => '',
'recordNumber' => ''
],
'operatorId' => ''
]));
$request->setRequestUrl('{{baseUrl}}/admin/v1/system');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/system' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"system": {
"id": "",
"theme": 0,
"title": "",
"keywords": "",
"description": "",
"recordNumber": ""
},
"operatorId": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/system' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"system": {
"id": "",
"theme": 0,
"title": "",
"keywords": "",
"description": "",
"recordNumber": ""
},
"operatorId": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"system\": {\n \"id\": \"\",\n \"theme\": 0,\n \"title\": \"\",\n \"keywords\": \"\",\n \"description\": \"\",\n \"recordNumber\": \"\"\n },\n \"operatorId\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/admin/v1/system", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/system"
payload = {
"system": {
"id": "",
"theme": 0,
"title": "",
"keywords": "",
"description": "",
"recordNumber": ""
},
"operatorId": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/system"
payload <- "{\n \"system\": {\n \"id\": \"\",\n \"theme\": 0,\n \"title\": \"\",\n \"keywords\": \"\",\n \"description\": \"\",\n \"recordNumber\": \"\"\n },\n \"operatorId\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/system")
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 \"system\": {\n \"id\": \"\",\n \"theme\": 0,\n \"title\": \"\",\n \"keywords\": \"\",\n \"description\": \"\",\n \"recordNumber\": \"\"\n },\n \"operatorId\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/admin/v1/system') do |req|
req.body = "{\n \"system\": {\n \"id\": \"\",\n \"theme\": 0,\n \"title\": \"\",\n \"keywords\": \"\",\n \"description\": \"\",\n \"recordNumber\": \"\"\n },\n \"operatorId\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/system";
let payload = json!({
"system": json!({
"id": "",
"theme": 0,
"title": "",
"keywords": "",
"description": "",
"recordNumber": ""
}),
"operatorId": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/admin/v1/system \
--header 'content-type: application/json' \
--data '{
"system": {
"id": "",
"theme": 0,
"title": "",
"keywords": "",
"description": "",
"recordNumber": ""
},
"operatorId": ""
}'
echo '{
"system": {
"id": "",
"theme": 0,
"title": "",
"keywords": "",
"description": "",
"recordNumber": ""
},
"operatorId": ""
}' | \
http POST {{baseUrl}}/admin/v1/system \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "system": {\n "id": "",\n "theme": 0,\n "title": "",\n "keywords": "",\n "description": "",\n "recordNumber": ""\n },\n "operatorId": ""\n}' \
--output-document \
- {{baseUrl}}/admin/v1/system
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"system": [
"id": "",
"theme": 0,
"title": "",
"keywords": "",
"description": "",
"recordNumber": ""
],
"operatorId": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/system")! 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
SystemService_DeleteSystem
{{baseUrl}}/admin/v1/system/:id
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/system/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/admin/v1/system/:id")
require "http/client"
url = "{{baseUrl}}/admin/v1/system/: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}}/admin/v1/system/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/system/:id");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/system/: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/admin/v1/system/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/admin/v1/system/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/system/: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}}/admin/v1/system/:id")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/admin/v1/system/: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}}/admin/v1/system/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/admin/v1/system/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/system/: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}}/admin/v1/system/:id',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/system/: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/admin/v1/system/: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}}/admin/v1/system/: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}}/admin/v1/system/: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}}/admin/v1/system/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/system/: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}}/admin/v1/system/: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}}/admin/v1/system/:id" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/system/: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}}/admin/v1/system/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/system/:id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/admin/v1/system/:id');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/system/:id' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/system/:id' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/admin/v1/system/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/system/:id"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/system/:id"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/system/: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/admin/v1/system/: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}}/admin/v1/system/: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}}/admin/v1/system/:id
http DELETE {{baseUrl}}/admin/v1/system/:id
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/admin/v1/system/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/system/: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
SystemService_GetSystem
{{baseUrl}}/admin/v1/system/:id
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/system/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/admin/v1/system/:id")
require "http/client"
url = "{{baseUrl}}/admin/v1/system/: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}}/admin/v1/system/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/system/:id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/system/: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/admin/v1/system/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/admin/v1/system/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/system/: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}}/admin/v1/system/:id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/admin/v1/system/: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}}/admin/v1/system/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/system/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/system/: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}}/admin/v1/system/:id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/system/:id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/admin/v1/system/: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}}/admin/v1/system/: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}}/admin/v1/system/: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}}/admin/v1/system/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/system/: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}}/admin/v1/system/: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}}/admin/v1/system/:id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/system/: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}}/admin/v1/system/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/system/:id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/admin/v1/system/:id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/system/:id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/system/:id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/admin/v1/system/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/system/:id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/system/:id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/system/: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/admin/v1/system/:id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/system/: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}}/admin/v1/system/:id
http GET {{baseUrl}}/admin/v1/system/:id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/admin/v1/system/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/system/: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
SystemService_ListSystem
{{baseUrl}}/admin/v1/system
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/system");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/admin/v1/system")
require "http/client"
url = "{{baseUrl}}/admin/v1/system"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/admin/v1/system"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/system");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/system"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/admin/v1/system HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/admin/v1/system")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/system"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/admin/v1/system")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/admin/v1/system")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/admin/v1/system');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/system'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/system';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/admin/v1/system',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/system")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/admin/v1/system',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/system'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/admin/v1/system');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/system'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/system';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/admin/v1/system"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/admin/v1/system" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/system",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/admin/v1/system');
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/system');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/admin/v1/system');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/system' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/system' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/admin/v1/system")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/system"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/system"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/system")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/admin/v1/system') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/system";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/admin/v1/system
http GET {{baseUrl}}/admin/v1/system
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/admin/v1/system
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/system")! 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
SystemService_UpdateSystem
{{baseUrl}}/admin/v1/system/:id
QUERY PARAMS
id
BODY json
{
"id": "",
"theme": 0,
"title": "",
"keywords": "",
"description": "",
"recordNumber": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/system/: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\": \"\",\n \"theme\": 0,\n \"title\": \"\",\n \"keywords\": \"\",\n \"description\": \"\",\n \"recordNumber\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/admin/v1/system/:id" {:content-type :json
:form-params {:id ""
:theme 0
:title ""
:keywords ""
:description ""
:recordNumber ""}})
require "http/client"
url = "{{baseUrl}}/admin/v1/system/:id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"id\": \"\",\n \"theme\": 0,\n \"title\": \"\",\n \"keywords\": \"\",\n \"description\": \"\",\n \"recordNumber\": \"\"\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/admin/v1/system/:id"),
Content = new StringContent("{\n \"id\": \"\",\n \"theme\": 0,\n \"title\": \"\",\n \"keywords\": \"\",\n \"description\": \"\",\n \"recordNumber\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/system/:id");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"id\": \"\",\n \"theme\": 0,\n \"title\": \"\",\n \"keywords\": \"\",\n \"description\": \"\",\n \"recordNumber\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/system/:id"
payload := strings.NewReader("{\n \"id\": \"\",\n \"theme\": 0,\n \"title\": \"\",\n \"keywords\": \"\",\n \"description\": \"\",\n \"recordNumber\": \"\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/admin/v1/system/:id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 104
{
"id": "",
"theme": 0,
"title": "",
"keywords": "",
"description": "",
"recordNumber": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/admin/v1/system/:id")
.setHeader("content-type", "application/json")
.setBody("{\n \"id\": \"\",\n \"theme\": 0,\n \"title\": \"\",\n \"keywords\": \"\",\n \"description\": \"\",\n \"recordNumber\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/system/:id"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"id\": \"\",\n \"theme\": 0,\n \"title\": \"\",\n \"keywords\": \"\",\n \"description\": \"\",\n \"recordNumber\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"id\": \"\",\n \"theme\": 0,\n \"title\": \"\",\n \"keywords\": \"\",\n \"description\": \"\",\n \"recordNumber\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/admin/v1/system/:id")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/admin/v1/system/:id")
.header("content-type", "application/json")
.body("{\n \"id\": \"\",\n \"theme\": 0,\n \"title\": \"\",\n \"keywords\": \"\",\n \"description\": \"\",\n \"recordNumber\": \"\"\n}")
.asString();
const data = JSON.stringify({
id: '',
theme: 0,
title: '',
keywords: '',
description: '',
recordNumber: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/admin/v1/system/:id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/admin/v1/system/:id',
headers: {'content-type': 'application/json'},
data: {id: '', theme: 0, title: '', keywords: '', description: '', recordNumber: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/system/:id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"id":"","theme":0,"title":"","keywords":"","description":"","recordNumber":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/admin/v1/system/:id',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "id": "",\n "theme": 0,\n "title": "",\n "keywords": "",\n "description": "",\n "recordNumber": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"id\": \"\",\n \"theme\": 0,\n \"title\": \"\",\n \"keywords\": \"\",\n \"description\": \"\",\n \"recordNumber\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/system/: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/admin/v1/system/: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: '', theme: 0, title: '', keywords: '', description: '', recordNumber: ''}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/admin/v1/system/:id',
headers: {'content-type': 'application/json'},
body: {id: '', theme: 0, title: '', keywords: '', description: '', recordNumber: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/admin/v1/system/:id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
id: '',
theme: 0,
title: '',
keywords: '',
description: '',
recordNumber: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/admin/v1/system/:id',
headers: {'content-type': 'application/json'},
data: {id: '', theme: 0, title: '', keywords: '', description: '', recordNumber: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/system/:id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"id":"","theme":0,"title":"","keywords":"","description":"","recordNumber":""}'
};
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": @"",
@"theme": @0,
@"title": @"",
@"keywords": @"",
@"description": @"",
@"recordNumber": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/admin/v1/system/: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}}/admin/v1/system/:id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"id\": \"\",\n \"theme\": 0,\n \"title\": \"\",\n \"keywords\": \"\",\n \"description\": \"\",\n \"recordNumber\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/system/: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' => '',
'theme' => 0,
'title' => '',
'keywords' => '',
'description' => '',
'recordNumber' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/admin/v1/system/:id', [
'body' => '{
"id": "",
"theme": 0,
"title": "",
"keywords": "",
"description": "",
"recordNumber": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/system/:id');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'id' => '',
'theme' => 0,
'title' => '',
'keywords' => '',
'description' => '',
'recordNumber' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'id' => '',
'theme' => 0,
'title' => '',
'keywords' => '',
'description' => '',
'recordNumber' => ''
]));
$request->setRequestUrl('{{baseUrl}}/admin/v1/system/: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}}/admin/v1/system/:id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"id": "",
"theme": 0,
"title": "",
"keywords": "",
"description": "",
"recordNumber": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/system/:id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"id": "",
"theme": 0,
"title": "",
"keywords": "",
"description": "",
"recordNumber": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"id\": \"\",\n \"theme\": 0,\n \"title\": \"\",\n \"keywords\": \"\",\n \"description\": \"\",\n \"recordNumber\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/admin/v1/system/:id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/system/:id"
payload = {
"id": "",
"theme": 0,
"title": "",
"keywords": "",
"description": "",
"recordNumber": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/system/:id"
payload <- "{\n \"id\": \"\",\n \"theme\": 0,\n \"title\": \"\",\n \"keywords\": \"\",\n \"description\": \"\",\n \"recordNumber\": \"\"\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/system/: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\": \"\",\n \"theme\": 0,\n \"title\": \"\",\n \"keywords\": \"\",\n \"description\": \"\",\n \"recordNumber\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/admin/v1/system/:id') do |req|
req.body = "{\n \"id\": \"\",\n \"theme\": 0,\n \"title\": \"\",\n \"keywords\": \"\",\n \"description\": \"\",\n \"recordNumber\": \"\"\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/system/:id";
let payload = json!({
"id": "",
"theme": 0,
"title": "",
"keywords": "",
"description": "",
"recordNumber": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/admin/v1/system/:id \
--header 'content-type: application/json' \
--data '{
"id": "",
"theme": 0,
"title": "",
"keywords": "",
"description": "",
"recordNumber": ""
}'
echo '{
"id": "",
"theme": 0,
"title": "",
"keywords": "",
"description": "",
"recordNumber": ""
}' | \
http PUT {{baseUrl}}/admin/v1/system/:id \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "id": "",\n "theme": 0,\n "title": "",\n "keywords": "",\n "description": "",\n "recordNumber": ""\n}' \
--output-document \
- {{baseUrl}}/admin/v1/system/:id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"id": "",
"theme": 0,
"title": "",
"keywords": "",
"description": "",
"recordNumber": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/system/: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
TagService_CreateTag
{{baseUrl}}/admin/v1/tags
BODY json
{
"tag": {
"name": "",
"description": "",
"externalDocs": {
"description": "",
"url": "",
"specificationExtension": [
{
"name": "",
"value": ""
}
]
},
"specificationExtension": [
{}
]
},
"operatorId": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/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 \"tag\": {\n \"name\": \"\",\n \"description\": \"\",\n \"externalDocs\": {\n \"description\": \"\",\n \"url\": \"\",\n \"specificationExtension\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"operatorId\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/admin/v1/tags" {:content-type :json
:form-params {:tag {:name ""
:description ""
:externalDocs {:description ""
:url ""
:specificationExtension [{:name ""
:value ""}]}
:specificationExtension [{}]}
:operatorId 0}})
require "http/client"
url = "{{baseUrl}}/admin/v1/tags"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"tag\": {\n \"name\": \"\",\n \"description\": \"\",\n \"externalDocs\": {\n \"description\": \"\",\n \"url\": \"\",\n \"specificationExtension\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"operatorId\": 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}}/admin/v1/tags"),
Content = new StringContent("{\n \"tag\": {\n \"name\": \"\",\n \"description\": \"\",\n \"externalDocs\": {\n \"description\": \"\",\n \"url\": \"\",\n \"specificationExtension\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"operatorId\": 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}}/admin/v1/tags");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"tag\": {\n \"name\": \"\",\n \"description\": \"\",\n \"externalDocs\": {\n \"description\": \"\",\n \"url\": \"\",\n \"specificationExtension\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"operatorId\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/tags"
payload := strings.NewReader("{\n \"tag\": {\n \"name\": \"\",\n \"description\": \"\",\n \"externalDocs\": {\n \"description\": \"\",\n \"url\": \"\",\n \"specificationExtension\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"operatorId\": 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/admin/v1/tags HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 300
{
"tag": {
"name": "",
"description": "",
"externalDocs": {
"description": "",
"url": "",
"specificationExtension": [
{
"name": "",
"value": ""
}
]
},
"specificationExtension": [
{}
]
},
"operatorId": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/admin/v1/tags")
.setHeader("content-type", "application/json")
.setBody("{\n \"tag\": {\n \"name\": \"\",\n \"description\": \"\",\n \"externalDocs\": {\n \"description\": \"\",\n \"url\": \"\",\n \"specificationExtension\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"operatorId\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/tags"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"tag\": {\n \"name\": \"\",\n \"description\": \"\",\n \"externalDocs\": {\n \"description\": \"\",\n \"url\": \"\",\n \"specificationExtension\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"operatorId\": 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 \"tag\": {\n \"name\": \"\",\n \"description\": \"\",\n \"externalDocs\": {\n \"description\": \"\",\n \"url\": \"\",\n \"specificationExtension\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"operatorId\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/admin/v1/tags")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/admin/v1/tags")
.header("content-type", "application/json")
.body("{\n \"tag\": {\n \"name\": \"\",\n \"description\": \"\",\n \"externalDocs\": {\n \"description\": \"\",\n \"url\": \"\",\n \"specificationExtension\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"operatorId\": 0\n}")
.asString();
const data = JSON.stringify({
tag: {
name: '',
description: '',
externalDocs: {
description: '',
url: '',
specificationExtension: [
{
name: '',
value: ''
}
]
},
specificationExtension: [
{}
]
},
operatorId: 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}}/admin/v1/tags');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/admin/v1/tags',
headers: {'content-type': 'application/json'},
data: {
tag: {
name: '',
description: '',
externalDocs: {description: '', url: '', specificationExtension: [{name: '', value: ''}]},
specificationExtension: [{}]
},
operatorId: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/tags';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"tag":{"name":"","description":"","externalDocs":{"description":"","url":"","specificationExtension":[{"name":"","value":""}]},"specificationExtension":[{}]},"operatorId":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}}/admin/v1/tags',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "tag": {\n "name": "",\n "description": "",\n "externalDocs": {\n "description": "",\n "url": "",\n "specificationExtension": [\n {\n "name": "",\n "value": ""\n }\n ]\n },\n "specificationExtension": [\n {}\n ]\n },\n "operatorId": 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 \"tag\": {\n \"name\": \"\",\n \"description\": \"\",\n \"externalDocs\": {\n \"description\": \"\",\n \"url\": \"\",\n \"specificationExtension\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"operatorId\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/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/admin/v1/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({
tag: {
name: '',
description: '',
externalDocs: {description: '', url: '', specificationExtension: [{name: '', value: ''}]},
specificationExtension: [{}]
},
operatorId: 0
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/admin/v1/tags',
headers: {'content-type': 'application/json'},
body: {
tag: {
name: '',
description: '',
externalDocs: {description: '', url: '', specificationExtension: [{name: '', value: ''}]},
specificationExtension: [{}]
},
operatorId: 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}}/admin/v1/tags');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
tag: {
name: '',
description: '',
externalDocs: {
description: '',
url: '',
specificationExtension: [
{
name: '',
value: ''
}
]
},
specificationExtension: [
{}
]
},
operatorId: 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}}/admin/v1/tags',
headers: {'content-type': 'application/json'},
data: {
tag: {
name: '',
description: '',
externalDocs: {description: '', url: '', specificationExtension: [{name: '', value: ''}]},
specificationExtension: [{}]
},
operatorId: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/tags';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"tag":{"name":"","description":"","externalDocs":{"description":"","url":"","specificationExtension":[{"name":"","value":""}]},"specificationExtension":[{}]},"operatorId":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 = @{ @"tag": @{ @"name": @"", @"description": @"", @"externalDocs": @{ @"description": @"", @"url": @"", @"specificationExtension": @[ @{ @"name": @"", @"value": @"" } ] }, @"specificationExtension": @[ @{ } ] },
@"operatorId": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/admin/v1/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}}/admin/v1/tags" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"tag\": {\n \"name\": \"\",\n \"description\": \"\",\n \"externalDocs\": {\n \"description\": \"\",\n \"url\": \"\",\n \"specificationExtension\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"operatorId\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/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([
'tag' => [
'name' => '',
'description' => '',
'externalDocs' => [
'description' => '',
'url' => '',
'specificationExtension' => [
[
'name' => '',
'value' => ''
]
]
],
'specificationExtension' => [
[
]
]
],
'operatorId' => 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}}/admin/v1/tags', [
'body' => '{
"tag": {
"name": "",
"description": "",
"externalDocs": {
"description": "",
"url": "",
"specificationExtension": [
{
"name": "",
"value": ""
}
]
},
"specificationExtension": [
{}
]
},
"operatorId": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/tags');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'tag' => [
'name' => '',
'description' => '',
'externalDocs' => [
'description' => '',
'url' => '',
'specificationExtension' => [
[
'name' => '',
'value' => ''
]
]
],
'specificationExtension' => [
[
]
]
],
'operatorId' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'tag' => [
'name' => '',
'description' => '',
'externalDocs' => [
'description' => '',
'url' => '',
'specificationExtension' => [
[
'name' => '',
'value' => ''
]
]
],
'specificationExtension' => [
[
]
]
],
'operatorId' => 0
]));
$request->setRequestUrl('{{baseUrl}}/admin/v1/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}}/admin/v1/tags' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"tag": {
"name": "",
"description": "",
"externalDocs": {
"description": "",
"url": "",
"specificationExtension": [
{
"name": "",
"value": ""
}
]
},
"specificationExtension": [
{}
]
},
"operatorId": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/tags' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"tag": {
"name": "",
"description": "",
"externalDocs": {
"description": "",
"url": "",
"specificationExtension": [
{
"name": "",
"value": ""
}
]
},
"specificationExtension": [
{}
]
},
"operatorId": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"tag\": {\n \"name\": \"\",\n \"description\": \"\",\n \"externalDocs\": {\n \"description\": \"\",\n \"url\": \"\",\n \"specificationExtension\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"operatorId\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/admin/v1/tags", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/tags"
payload = {
"tag": {
"name": "",
"description": "",
"externalDocs": {
"description": "",
"url": "",
"specificationExtension": [
{
"name": "",
"value": ""
}
]
},
"specificationExtension": [{}]
},
"operatorId": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/tags"
payload <- "{\n \"tag\": {\n \"name\": \"\",\n \"description\": \"\",\n \"externalDocs\": {\n \"description\": \"\",\n \"url\": \"\",\n \"specificationExtension\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"operatorId\": 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}}/admin/v1/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 \"tag\": {\n \"name\": \"\",\n \"description\": \"\",\n \"externalDocs\": {\n \"description\": \"\",\n \"url\": \"\",\n \"specificationExtension\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"operatorId\": 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/admin/v1/tags') do |req|
req.body = "{\n \"tag\": {\n \"name\": \"\",\n \"description\": \"\",\n \"externalDocs\": {\n \"description\": \"\",\n \"url\": \"\",\n \"specificationExtension\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n },\n \"operatorId\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/tags";
let payload = json!({
"tag": json!({
"name": "",
"description": "",
"externalDocs": json!({
"description": "",
"url": "",
"specificationExtension": (
json!({
"name": "",
"value": ""
})
)
}),
"specificationExtension": (json!({}))
}),
"operatorId": 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}}/admin/v1/tags \
--header 'content-type: application/json' \
--data '{
"tag": {
"name": "",
"description": "",
"externalDocs": {
"description": "",
"url": "",
"specificationExtension": [
{
"name": "",
"value": ""
}
]
},
"specificationExtension": [
{}
]
},
"operatorId": 0
}'
echo '{
"tag": {
"name": "",
"description": "",
"externalDocs": {
"description": "",
"url": "",
"specificationExtension": [
{
"name": "",
"value": ""
}
]
},
"specificationExtension": [
{}
]
},
"operatorId": 0
}' | \
http POST {{baseUrl}}/admin/v1/tags \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "tag": {\n "name": "",\n "description": "",\n "externalDocs": {\n "description": "",\n "url": "",\n "specificationExtension": [\n {\n "name": "",\n "value": ""\n }\n ]\n },\n "specificationExtension": [\n {}\n ]\n },\n "operatorId": 0\n}' \
--output-document \
- {{baseUrl}}/admin/v1/tags
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"tag": [
"name": "",
"description": "",
"externalDocs": [
"description": "",
"url": "",
"specificationExtension": [
[
"name": "",
"value": ""
]
]
],
"specificationExtension": [[]]
],
"operatorId": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/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
TagService_DeleteTag
{{baseUrl}}/admin/v1/tags/:id
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/tags/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/admin/v1/tags/:id")
require "http/client"
url = "{{baseUrl}}/admin/v1/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}}/admin/v1/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}}/admin/v1/tags/:id");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/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/admin/v1/tags/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/admin/v1/tags/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/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}}/admin/v1/tags/:id")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/admin/v1/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}}/admin/v1/tags/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/admin/v1/tags/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/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}}/admin/v1/tags/:id',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/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/admin/v1/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}}/admin/v1/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}}/admin/v1/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}}/admin/v1/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}}/admin/v1/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}}/admin/v1/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}}/admin/v1/tags/:id" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/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}}/admin/v1/tags/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/tags/:id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/admin/v1/tags/:id');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/tags/:id' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/tags/:id' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/admin/v1/tags/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/tags/:id"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/tags/:id"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/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/admin/v1/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}}/admin/v1/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}}/admin/v1/tags/:id
http DELETE {{baseUrl}}/admin/v1/tags/:id
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/admin/v1/tags/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/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
TagService_GetTag
{{baseUrl}}/admin/v1/tags/:id
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/tags/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/admin/v1/tags/:id")
require "http/client"
url = "{{baseUrl}}/admin/v1/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}}/admin/v1/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}}/admin/v1/tags/:id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/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/admin/v1/tags/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/admin/v1/tags/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/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}}/admin/v1/tags/:id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/admin/v1/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}}/admin/v1/tags/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/tags/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/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}}/admin/v1/tags/:id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/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/admin/v1/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}}/admin/v1/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}}/admin/v1/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}}/admin/v1/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}}/admin/v1/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}}/admin/v1/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}}/admin/v1/tags/:id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/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}}/admin/v1/tags/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/tags/:id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/admin/v1/tags/:id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/tags/:id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/tags/:id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/admin/v1/tags/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/tags/:id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/tags/:id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/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/admin/v1/tags/:id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/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}}/admin/v1/tags/:id
http GET {{baseUrl}}/admin/v1/tags/:id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/admin/v1/tags/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/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()
GET
TagService_ListTag
{{baseUrl}}/admin/v1/tags
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/tags");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/admin/v1/tags")
require "http/client"
url = "{{baseUrl}}/admin/v1/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}}/admin/v1/tags"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/tags");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/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/admin/v1/tags HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/admin/v1/tags")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/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}}/admin/v1/tags")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/admin/v1/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}}/admin/v1/tags');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/tags'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/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}}/admin/v1/tags',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/tags")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/admin/v1/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}}/admin/v1/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}}/admin/v1/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}}/admin/v1/tags'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/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}}/admin/v1/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}}/admin/v1/tags" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/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}}/admin/v1/tags');
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/tags');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/admin/v1/tags');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/tags' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/tags' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/admin/v1/tags")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/tags"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/tags"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/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/admin/v1/tags') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/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}}/admin/v1/tags
http GET {{baseUrl}}/admin/v1/tags
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/admin/v1/tags
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/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()
PUT
TagService_UpdateTag
{{baseUrl}}/admin/v1/tags/:id
QUERY PARAMS
id
BODY json
{
"name": "",
"description": "",
"externalDocs": {
"description": "",
"url": "",
"specificationExtension": [
{
"name": "",
"value": ""
}
]
},
"specificationExtension": [
{}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/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 \"name\": \"\",\n \"description\": \"\",\n \"externalDocs\": {\n \"description\": \"\",\n \"url\": \"\",\n \"specificationExtension\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/admin/v1/tags/:id" {:content-type :json
:form-params {:name ""
:description ""
:externalDocs {:description ""
:url ""
:specificationExtension [{:name ""
:value ""}]}
:specificationExtension [{}]}})
require "http/client"
url = "{{baseUrl}}/admin/v1/tags/:id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"name\": \"\",\n \"description\": \"\",\n \"externalDocs\": {\n \"description\": \"\",\n \"url\": \"\",\n \"specificationExtension\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/admin/v1/tags/:id"),
Content = new StringContent("{\n \"name\": \"\",\n \"description\": \"\",\n \"externalDocs\": {\n \"description\": \"\",\n \"url\": \"\",\n \"specificationExtension\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/tags/:id");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"name\": \"\",\n \"description\": \"\",\n \"externalDocs\": {\n \"description\": \"\",\n \"url\": \"\",\n \"specificationExtension\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/tags/:id"
payload := strings.NewReader("{\n \"name\": \"\",\n \"description\": \"\",\n \"externalDocs\": {\n \"description\": \"\",\n \"url\": \"\",\n \"specificationExtension\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/admin/v1/tags/:id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 236
{
"name": "",
"description": "",
"externalDocs": {
"description": "",
"url": "",
"specificationExtension": [
{
"name": "",
"value": ""
}
]
},
"specificationExtension": [
{}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/admin/v1/tags/:id")
.setHeader("content-type", "application/json")
.setBody("{\n \"name\": \"\",\n \"description\": \"\",\n \"externalDocs\": {\n \"description\": \"\",\n \"url\": \"\",\n \"specificationExtension\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/tags/:id"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"name\": \"\",\n \"description\": \"\",\n \"externalDocs\": {\n \"description\": \"\",\n \"url\": \"\",\n \"specificationExtension\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"name\": \"\",\n \"description\": \"\",\n \"externalDocs\": {\n \"description\": \"\",\n \"url\": \"\",\n \"specificationExtension\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/admin/v1/tags/:id")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/admin/v1/tags/:id")
.header("content-type", "application/json")
.body("{\n \"name\": \"\",\n \"description\": \"\",\n \"externalDocs\": {\n \"description\": \"\",\n \"url\": \"\",\n \"specificationExtension\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n}")
.asString();
const data = JSON.stringify({
name: '',
description: '',
externalDocs: {
description: '',
url: '',
specificationExtension: [
{
name: '',
value: ''
}
]
},
specificationExtension: [
{}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/admin/v1/tags/:id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/admin/v1/tags/:id',
headers: {'content-type': 'application/json'},
data: {
name: '',
description: '',
externalDocs: {description: '', url: '', specificationExtension: [{name: '', value: ''}]},
specificationExtension: [{}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/tags/:id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"name":"","description":"","externalDocs":{"description":"","url":"","specificationExtension":[{"name":"","value":""}]},"specificationExtension":[{}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/admin/v1/tags/:id',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "name": "",\n "description": "",\n "externalDocs": {\n "description": "",\n "url": "",\n "specificationExtension": [\n {\n "name": "",\n "value": ""\n }\n ]\n },\n "specificationExtension": [\n {}\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"name\": \"\",\n \"description\": \"\",\n \"externalDocs\": {\n \"description\": \"\",\n \"url\": \"\",\n \"specificationExtension\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/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/admin/v1/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({
name: '',
description: '',
externalDocs: {description: '', url: '', specificationExtension: [{name: '', value: ''}]},
specificationExtension: [{}]
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/admin/v1/tags/:id',
headers: {'content-type': 'application/json'},
body: {
name: '',
description: '',
externalDocs: {description: '', url: '', specificationExtension: [{name: '', value: ''}]},
specificationExtension: [{}]
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/admin/v1/tags/:id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
name: '',
description: '',
externalDocs: {
description: '',
url: '',
specificationExtension: [
{
name: '',
value: ''
}
]
},
specificationExtension: [
{}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/admin/v1/tags/:id',
headers: {'content-type': 'application/json'},
data: {
name: '',
description: '',
externalDocs: {description: '', url: '', specificationExtension: [{name: '', value: ''}]},
specificationExtension: [{}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/tags/:id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"name":"","description":"","externalDocs":{"description":"","url":"","specificationExtension":[{"name":"","value":""}]},"specificationExtension":[{}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"name": @"",
@"description": @"",
@"externalDocs": @{ @"description": @"", @"url": @"", @"specificationExtension": @[ @{ @"name": @"", @"value": @"" } ] },
@"specificationExtension": @[ @{ } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/admin/v1/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}}/admin/v1/tags/:id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"name\": \"\",\n \"description\": \"\",\n \"externalDocs\": {\n \"description\": \"\",\n \"url\": \"\",\n \"specificationExtension\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/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([
'name' => '',
'description' => '',
'externalDocs' => [
'description' => '',
'url' => '',
'specificationExtension' => [
[
'name' => '',
'value' => ''
]
]
],
'specificationExtension' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/admin/v1/tags/:id', [
'body' => '{
"name": "",
"description": "",
"externalDocs": {
"description": "",
"url": "",
"specificationExtension": [
{
"name": "",
"value": ""
}
]
},
"specificationExtension": [
{}
]
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/tags/:id');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'name' => '',
'description' => '',
'externalDocs' => [
'description' => '',
'url' => '',
'specificationExtension' => [
[
'name' => '',
'value' => ''
]
]
],
'specificationExtension' => [
[
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'name' => '',
'description' => '',
'externalDocs' => [
'description' => '',
'url' => '',
'specificationExtension' => [
[
'name' => '',
'value' => ''
]
]
],
'specificationExtension' => [
[
]
]
]));
$request->setRequestUrl('{{baseUrl}}/admin/v1/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}}/admin/v1/tags/:id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"name": "",
"description": "",
"externalDocs": {
"description": "",
"url": "",
"specificationExtension": [
{
"name": "",
"value": ""
}
]
},
"specificationExtension": [
{}
]
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/tags/:id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"name": "",
"description": "",
"externalDocs": {
"description": "",
"url": "",
"specificationExtension": [
{
"name": "",
"value": ""
}
]
},
"specificationExtension": [
{}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"name\": \"\",\n \"description\": \"\",\n \"externalDocs\": {\n \"description\": \"\",\n \"url\": \"\",\n \"specificationExtension\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/admin/v1/tags/:id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/tags/:id"
payload = {
"name": "",
"description": "",
"externalDocs": {
"description": "",
"url": "",
"specificationExtension": [
{
"name": "",
"value": ""
}
]
},
"specificationExtension": [{}]
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/tags/:id"
payload <- "{\n \"name\": \"\",\n \"description\": \"\",\n \"externalDocs\": {\n \"description\": \"\",\n \"url\": \"\",\n \"specificationExtension\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/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 \"name\": \"\",\n \"description\": \"\",\n \"externalDocs\": {\n \"description\": \"\",\n \"url\": \"\",\n \"specificationExtension\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/admin/v1/tags/:id') do |req|
req.body = "{\n \"name\": \"\",\n \"description\": \"\",\n \"externalDocs\": {\n \"description\": \"\",\n \"url\": \"\",\n \"specificationExtension\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"specificationExtension\": [\n {}\n ]\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/tags/:id";
let payload = json!({
"name": "",
"description": "",
"externalDocs": json!({
"description": "",
"url": "",
"specificationExtension": (
json!({
"name": "",
"value": ""
})
)
}),
"specificationExtension": (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}}/admin/v1/tags/:id \
--header 'content-type: application/json' \
--data '{
"name": "",
"description": "",
"externalDocs": {
"description": "",
"url": "",
"specificationExtension": [
{
"name": "",
"value": ""
}
]
},
"specificationExtension": [
{}
]
}'
echo '{
"name": "",
"description": "",
"externalDocs": {
"description": "",
"url": "",
"specificationExtension": [
{
"name": "",
"value": ""
}
]
},
"specificationExtension": [
{}
]
}' | \
http PUT {{baseUrl}}/admin/v1/tags/:id \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "name": "",\n "description": "",\n "externalDocs": {\n "description": "",\n "url": "",\n "specificationExtension": [\n {\n "name": "",\n "value": ""\n }\n ]\n },\n "specificationExtension": [\n {}\n ]\n}' \
--output-document \
- {{baseUrl}}/admin/v1/tags/:id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"name": "",
"description": "",
"externalDocs": [
"description": "",
"url": "",
"specificationExtension": [
[
"name": "",
"value": ""
]
]
],
"specificationExtension": [[]]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/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
UserService_CreateUser
{{baseUrl}}/admin/v1/users
BODY json
{
"id": 0,
"userName": "",
"nickName": "",
"email": "",
"avatar": "",
"description": "",
"password": "",
"createTime": "",
"updateTime": "",
"status": "",
"roleId": 0,
"creatorId": 0,
"authority": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/users");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"id\": 0,\n \"userName\": \"\",\n \"nickName\": \"\",\n \"email\": \"\",\n \"avatar\": \"\",\n \"description\": \"\",\n \"password\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"status\": \"\",\n \"roleId\": 0,\n \"creatorId\": 0,\n \"authority\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/admin/v1/users" {:content-type :json
:form-params {:id 0
:userName ""
:nickName ""
:email ""
:avatar ""
:description ""
:password ""
:createTime ""
:updateTime ""
:status ""
:roleId 0
:creatorId 0
:authority ""}})
require "http/client"
url = "{{baseUrl}}/admin/v1/users"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"id\": 0,\n \"userName\": \"\",\n \"nickName\": \"\",\n \"email\": \"\",\n \"avatar\": \"\",\n \"description\": \"\",\n \"password\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"status\": \"\",\n \"roleId\": 0,\n \"creatorId\": 0,\n \"authority\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/admin/v1/users"),
Content = new StringContent("{\n \"id\": 0,\n \"userName\": \"\",\n \"nickName\": \"\",\n \"email\": \"\",\n \"avatar\": \"\",\n \"description\": \"\",\n \"password\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"status\": \"\",\n \"roleId\": 0,\n \"creatorId\": 0,\n \"authority\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/users");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"id\": 0,\n \"userName\": \"\",\n \"nickName\": \"\",\n \"email\": \"\",\n \"avatar\": \"\",\n \"description\": \"\",\n \"password\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"status\": \"\",\n \"roleId\": 0,\n \"creatorId\": 0,\n \"authority\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/users"
payload := strings.NewReader("{\n \"id\": 0,\n \"userName\": \"\",\n \"nickName\": \"\",\n \"email\": \"\",\n \"avatar\": \"\",\n \"description\": \"\",\n \"password\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"status\": \"\",\n \"roleId\": 0,\n \"creatorId\": 0,\n \"authority\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/admin/v1/users HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 227
{
"id": 0,
"userName": "",
"nickName": "",
"email": "",
"avatar": "",
"description": "",
"password": "",
"createTime": "",
"updateTime": "",
"status": "",
"roleId": 0,
"creatorId": 0,
"authority": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/admin/v1/users")
.setHeader("content-type", "application/json")
.setBody("{\n \"id\": 0,\n \"userName\": \"\",\n \"nickName\": \"\",\n \"email\": \"\",\n \"avatar\": \"\",\n \"description\": \"\",\n \"password\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"status\": \"\",\n \"roleId\": 0,\n \"creatorId\": 0,\n \"authority\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/users"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"id\": 0,\n \"userName\": \"\",\n \"nickName\": \"\",\n \"email\": \"\",\n \"avatar\": \"\",\n \"description\": \"\",\n \"password\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"status\": \"\",\n \"roleId\": 0,\n \"creatorId\": 0,\n \"authority\": \"\"\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 \"userName\": \"\",\n \"nickName\": \"\",\n \"email\": \"\",\n \"avatar\": \"\",\n \"description\": \"\",\n \"password\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"status\": \"\",\n \"roleId\": 0,\n \"creatorId\": 0,\n \"authority\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/admin/v1/users")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/admin/v1/users")
.header("content-type", "application/json")
.body("{\n \"id\": 0,\n \"userName\": \"\",\n \"nickName\": \"\",\n \"email\": \"\",\n \"avatar\": \"\",\n \"description\": \"\",\n \"password\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"status\": \"\",\n \"roleId\": 0,\n \"creatorId\": 0,\n \"authority\": \"\"\n}")
.asString();
const data = JSON.stringify({
id: 0,
userName: '',
nickName: '',
email: '',
avatar: '',
description: '',
password: '',
createTime: '',
updateTime: '',
status: '',
roleId: 0,
creatorId: 0,
authority: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/admin/v1/users');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/admin/v1/users',
headers: {'content-type': 'application/json'},
data: {
id: 0,
userName: '',
nickName: '',
email: '',
avatar: '',
description: '',
password: '',
createTime: '',
updateTime: '',
status: '',
roleId: 0,
creatorId: 0,
authority: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/users';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"id":0,"userName":"","nickName":"","email":"","avatar":"","description":"","password":"","createTime":"","updateTime":"","status":"","roleId":0,"creatorId":0,"authority":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/admin/v1/users',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "id": 0,\n "userName": "",\n "nickName": "",\n "email": "",\n "avatar": "",\n "description": "",\n "password": "",\n "createTime": "",\n "updateTime": "",\n "status": "",\n "roleId": 0,\n "creatorId": 0,\n "authority": ""\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 \"userName\": \"\",\n \"nickName\": \"\",\n \"email\": \"\",\n \"avatar\": \"\",\n \"description\": \"\",\n \"password\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"status\": \"\",\n \"roleId\": 0,\n \"creatorId\": 0,\n \"authority\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/users")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/admin/v1/users',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
id: 0,
userName: '',
nickName: '',
email: '',
avatar: '',
description: '',
password: '',
createTime: '',
updateTime: '',
status: '',
roleId: 0,
creatorId: 0,
authority: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/admin/v1/users',
headers: {'content-type': 'application/json'},
body: {
id: 0,
userName: '',
nickName: '',
email: '',
avatar: '',
description: '',
password: '',
createTime: '',
updateTime: '',
status: '',
roleId: 0,
creatorId: 0,
authority: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/admin/v1/users');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
id: 0,
userName: '',
nickName: '',
email: '',
avatar: '',
description: '',
password: '',
createTime: '',
updateTime: '',
status: '',
roleId: 0,
creatorId: 0,
authority: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/admin/v1/users',
headers: {'content-type': 'application/json'},
data: {
id: 0,
userName: '',
nickName: '',
email: '',
avatar: '',
description: '',
password: '',
createTime: '',
updateTime: '',
status: '',
roleId: 0,
creatorId: 0,
authority: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/users';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"id":0,"userName":"","nickName":"","email":"","avatar":"","description":"","password":"","createTime":"","updateTime":"","status":"","roleId":0,"creatorId":0,"authority":""}'
};
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,
@"userName": @"",
@"nickName": @"",
@"email": @"",
@"avatar": @"",
@"description": @"",
@"password": @"",
@"createTime": @"",
@"updateTime": @"",
@"status": @"",
@"roleId": @0,
@"creatorId": @0,
@"authority": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/admin/v1/users"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/admin/v1/users" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"id\": 0,\n \"userName\": \"\",\n \"nickName\": \"\",\n \"email\": \"\",\n \"avatar\": \"\",\n \"description\": \"\",\n \"password\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"status\": \"\",\n \"roleId\": 0,\n \"creatorId\": 0,\n \"authority\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/users",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'id' => 0,
'userName' => '',
'nickName' => '',
'email' => '',
'avatar' => '',
'description' => '',
'password' => '',
'createTime' => '',
'updateTime' => '',
'status' => '',
'roleId' => 0,
'creatorId' => 0,
'authority' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/admin/v1/users', [
'body' => '{
"id": 0,
"userName": "",
"nickName": "",
"email": "",
"avatar": "",
"description": "",
"password": "",
"createTime": "",
"updateTime": "",
"status": "",
"roleId": 0,
"creatorId": 0,
"authority": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/users');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'id' => 0,
'userName' => '',
'nickName' => '',
'email' => '',
'avatar' => '',
'description' => '',
'password' => '',
'createTime' => '',
'updateTime' => '',
'status' => '',
'roleId' => 0,
'creatorId' => 0,
'authority' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'id' => 0,
'userName' => '',
'nickName' => '',
'email' => '',
'avatar' => '',
'description' => '',
'password' => '',
'createTime' => '',
'updateTime' => '',
'status' => '',
'roleId' => 0,
'creatorId' => 0,
'authority' => ''
]));
$request->setRequestUrl('{{baseUrl}}/admin/v1/users');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/users' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"id": 0,
"userName": "",
"nickName": "",
"email": "",
"avatar": "",
"description": "",
"password": "",
"createTime": "",
"updateTime": "",
"status": "",
"roleId": 0,
"creatorId": 0,
"authority": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/users' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"id": 0,
"userName": "",
"nickName": "",
"email": "",
"avatar": "",
"description": "",
"password": "",
"createTime": "",
"updateTime": "",
"status": "",
"roleId": 0,
"creatorId": 0,
"authority": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"id\": 0,\n \"userName\": \"\",\n \"nickName\": \"\",\n \"email\": \"\",\n \"avatar\": \"\",\n \"description\": \"\",\n \"password\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"status\": \"\",\n \"roleId\": 0,\n \"creatorId\": 0,\n \"authority\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/admin/v1/users", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/users"
payload = {
"id": 0,
"userName": "",
"nickName": "",
"email": "",
"avatar": "",
"description": "",
"password": "",
"createTime": "",
"updateTime": "",
"status": "",
"roleId": 0,
"creatorId": 0,
"authority": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/users"
payload <- "{\n \"id\": 0,\n \"userName\": \"\",\n \"nickName\": \"\",\n \"email\": \"\",\n \"avatar\": \"\",\n \"description\": \"\",\n \"password\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"status\": \"\",\n \"roleId\": 0,\n \"creatorId\": 0,\n \"authority\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/users")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"id\": 0,\n \"userName\": \"\",\n \"nickName\": \"\",\n \"email\": \"\",\n \"avatar\": \"\",\n \"description\": \"\",\n \"password\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"status\": \"\",\n \"roleId\": 0,\n \"creatorId\": 0,\n \"authority\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/admin/v1/users') do |req|
req.body = "{\n \"id\": 0,\n \"userName\": \"\",\n \"nickName\": \"\",\n \"email\": \"\",\n \"avatar\": \"\",\n \"description\": \"\",\n \"password\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"status\": \"\",\n \"roleId\": 0,\n \"creatorId\": 0,\n \"authority\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/users";
let payload = json!({
"id": 0,
"userName": "",
"nickName": "",
"email": "",
"avatar": "",
"description": "",
"password": "",
"createTime": "",
"updateTime": "",
"status": "",
"roleId": 0,
"creatorId": 0,
"authority": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/admin/v1/users \
--header 'content-type: application/json' \
--data '{
"id": 0,
"userName": "",
"nickName": "",
"email": "",
"avatar": "",
"description": "",
"password": "",
"createTime": "",
"updateTime": "",
"status": "",
"roleId": 0,
"creatorId": 0,
"authority": ""
}'
echo '{
"id": 0,
"userName": "",
"nickName": "",
"email": "",
"avatar": "",
"description": "",
"password": "",
"createTime": "",
"updateTime": "",
"status": "",
"roleId": 0,
"creatorId": 0,
"authority": ""
}' | \
http POST {{baseUrl}}/admin/v1/users \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "id": 0,\n "userName": "",\n "nickName": "",\n "email": "",\n "avatar": "",\n "description": "",\n "password": "",\n "createTime": "",\n "updateTime": "",\n "status": "",\n "roleId": 0,\n "creatorId": 0,\n "authority": ""\n}' \
--output-document \
- {{baseUrl}}/admin/v1/users
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"id": 0,
"userName": "",
"nickName": "",
"email": "",
"avatar": "",
"description": "",
"password": "",
"createTime": "",
"updateTime": "",
"status": "",
"roleId": 0,
"creatorId": 0,
"authority": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/users")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
UserService_DeleteUser
{{baseUrl}}/admin/v1/users/:id
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/users/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/admin/v1/users/:id")
require "http/client"
url = "{{baseUrl}}/admin/v1/users/: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}}/admin/v1/users/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/users/:id");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/users/: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/admin/v1/users/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/admin/v1/users/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/users/: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}}/admin/v1/users/:id")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/admin/v1/users/: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}}/admin/v1/users/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/admin/v1/users/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/users/: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}}/admin/v1/users/:id',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/users/: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/admin/v1/users/: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}}/admin/v1/users/: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}}/admin/v1/users/: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}}/admin/v1/users/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/users/: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}}/admin/v1/users/: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}}/admin/v1/users/:id" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/users/: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}}/admin/v1/users/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/users/:id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/admin/v1/users/:id');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/users/:id' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/users/:id' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/admin/v1/users/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/users/:id"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/users/:id"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/users/: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/admin/v1/users/: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}}/admin/v1/users/: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}}/admin/v1/users/:id
http DELETE {{baseUrl}}/admin/v1/users/:id
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/admin/v1/users/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/users/: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
UserService_GetUser
{{baseUrl}}/admin/v1/users/:id
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/users/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/admin/v1/users/:id")
require "http/client"
url = "{{baseUrl}}/admin/v1/users/: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}}/admin/v1/users/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/users/:id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/users/: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/admin/v1/users/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/admin/v1/users/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/users/: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}}/admin/v1/users/:id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/admin/v1/users/: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}}/admin/v1/users/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/users/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/users/: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}}/admin/v1/users/:id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/users/:id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/admin/v1/users/: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}}/admin/v1/users/: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}}/admin/v1/users/: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}}/admin/v1/users/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/users/: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}}/admin/v1/users/: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}}/admin/v1/users/:id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/users/: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}}/admin/v1/users/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/users/:id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/admin/v1/users/:id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/users/:id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/users/:id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/admin/v1/users/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/users/:id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/users/:id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/users/: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/admin/v1/users/:id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/users/: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}}/admin/v1/users/:id
http GET {{baseUrl}}/admin/v1/users/:id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/admin/v1/users/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/users/: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
UserService_ListUser
{{baseUrl}}/admin/v1/users
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/users");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/admin/v1/users")
require "http/client"
url = "{{baseUrl}}/admin/v1/users"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/admin/v1/users"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/users");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/users"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/admin/v1/users HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/admin/v1/users")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/users"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/admin/v1/users")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/admin/v1/users")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/admin/v1/users');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/users'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/users';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/admin/v1/users',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/users")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/admin/v1/users',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/users'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/admin/v1/users');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/admin/v1/users'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/users';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/admin/v1/users"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/admin/v1/users" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/users",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/admin/v1/users');
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/users');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/admin/v1/users');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/admin/v1/users' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/users' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/admin/v1/users")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/users"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/users"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/users")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/admin/v1/users') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/users";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/admin/v1/users
http GET {{baseUrl}}/admin/v1/users
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/admin/v1/users
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/users")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
UserService_UpdateUser
{{baseUrl}}/admin/v1/users/:id
QUERY PARAMS
id
BODY json
{
"id": 0,
"userName": "",
"nickName": "",
"email": "",
"avatar": "",
"description": "",
"password": "",
"createTime": "",
"updateTime": "",
"status": "",
"roleId": 0,
"creatorId": 0,
"authority": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/admin/v1/users/: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 \"userName\": \"\",\n \"nickName\": \"\",\n \"email\": \"\",\n \"avatar\": \"\",\n \"description\": \"\",\n \"password\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"status\": \"\",\n \"roleId\": 0,\n \"creatorId\": 0,\n \"authority\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/admin/v1/users/:id" {:content-type :json
:form-params {:id 0
:userName ""
:nickName ""
:email ""
:avatar ""
:description ""
:password ""
:createTime ""
:updateTime ""
:status ""
:roleId 0
:creatorId 0
:authority ""}})
require "http/client"
url = "{{baseUrl}}/admin/v1/users/:id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"id\": 0,\n \"userName\": \"\",\n \"nickName\": \"\",\n \"email\": \"\",\n \"avatar\": \"\",\n \"description\": \"\",\n \"password\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"status\": \"\",\n \"roleId\": 0,\n \"creatorId\": 0,\n \"authority\": \"\"\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/admin/v1/users/:id"),
Content = new StringContent("{\n \"id\": 0,\n \"userName\": \"\",\n \"nickName\": \"\",\n \"email\": \"\",\n \"avatar\": \"\",\n \"description\": \"\",\n \"password\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"status\": \"\",\n \"roleId\": 0,\n \"creatorId\": 0,\n \"authority\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/admin/v1/users/:id");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"id\": 0,\n \"userName\": \"\",\n \"nickName\": \"\",\n \"email\": \"\",\n \"avatar\": \"\",\n \"description\": \"\",\n \"password\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"status\": \"\",\n \"roleId\": 0,\n \"creatorId\": 0,\n \"authority\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/admin/v1/users/:id"
payload := strings.NewReader("{\n \"id\": 0,\n \"userName\": \"\",\n \"nickName\": \"\",\n \"email\": \"\",\n \"avatar\": \"\",\n \"description\": \"\",\n \"password\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"status\": \"\",\n \"roleId\": 0,\n \"creatorId\": 0,\n \"authority\": \"\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/admin/v1/users/:id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 227
{
"id": 0,
"userName": "",
"nickName": "",
"email": "",
"avatar": "",
"description": "",
"password": "",
"createTime": "",
"updateTime": "",
"status": "",
"roleId": 0,
"creatorId": 0,
"authority": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/admin/v1/users/:id")
.setHeader("content-type", "application/json")
.setBody("{\n \"id\": 0,\n \"userName\": \"\",\n \"nickName\": \"\",\n \"email\": \"\",\n \"avatar\": \"\",\n \"description\": \"\",\n \"password\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"status\": \"\",\n \"roleId\": 0,\n \"creatorId\": 0,\n \"authority\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/admin/v1/users/:id"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"id\": 0,\n \"userName\": \"\",\n \"nickName\": \"\",\n \"email\": \"\",\n \"avatar\": \"\",\n \"description\": \"\",\n \"password\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"status\": \"\",\n \"roleId\": 0,\n \"creatorId\": 0,\n \"authority\": \"\"\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 \"userName\": \"\",\n \"nickName\": \"\",\n \"email\": \"\",\n \"avatar\": \"\",\n \"description\": \"\",\n \"password\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"status\": \"\",\n \"roleId\": 0,\n \"creatorId\": 0,\n \"authority\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/admin/v1/users/:id")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/admin/v1/users/:id")
.header("content-type", "application/json")
.body("{\n \"id\": 0,\n \"userName\": \"\",\n \"nickName\": \"\",\n \"email\": \"\",\n \"avatar\": \"\",\n \"description\": \"\",\n \"password\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"status\": \"\",\n \"roleId\": 0,\n \"creatorId\": 0,\n \"authority\": \"\"\n}")
.asString();
const data = JSON.stringify({
id: 0,
userName: '',
nickName: '',
email: '',
avatar: '',
description: '',
password: '',
createTime: '',
updateTime: '',
status: '',
roleId: 0,
creatorId: 0,
authority: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/admin/v1/users/:id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/admin/v1/users/:id',
headers: {'content-type': 'application/json'},
data: {
id: 0,
userName: '',
nickName: '',
email: '',
avatar: '',
description: '',
password: '',
createTime: '',
updateTime: '',
status: '',
roleId: 0,
creatorId: 0,
authority: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/admin/v1/users/:id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"id":0,"userName":"","nickName":"","email":"","avatar":"","description":"","password":"","createTime":"","updateTime":"","status":"","roleId":0,"creatorId":0,"authority":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/admin/v1/users/:id',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "id": 0,\n "userName": "",\n "nickName": "",\n "email": "",\n "avatar": "",\n "description": "",\n "password": "",\n "createTime": "",\n "updateTime": "",\n "status": "",\n "roleId": 0,\n "creatorId": 0,\n "authority": ""\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 \"userName\": \"\",\n \"nickName\": \"\",\n \"email\": \"\",\n \"avatar\": \"\",\n \"description\": \"\",\n \"password\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"status\": \"\",\n \"roleId\": 0,\n \"creatorId\": 0,\n \"authority\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/admin/v1/users/: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/admin/v1/users/: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,
userName: '',
nickName: '',
email: '',
avatar: '',
description: '',
password: '',
createTime: '',
updateTime: '',
status: '',
roleId: 0,
creatorId: 0,
authority: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/admin/v1/users/:id',
headers: {'content-type': 'application/json'},
body: {
id: 0,
userName: '',
nickName: '',
email: '',
avatar: '',
description: '',
password: '',
createTime: '',
updateTime: '',
status: '',
roleId: 0,
creatorId: 0,
authority: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/admin/v1/users/:id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
id: 0,
userName: '',
nickName: '',
email: '',
avatar: '',
description: '',
password: '',
createTime: '',
updateTime: '',
status: '',
roleId: 0,
creatorId: 0,
authority: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/admin/v1/users/:id',
headers: {'content-type': 'application/json'},
data: {
id: 0,
userName: '',
nickName: '',
email: '',
avatar: '',
description: '',
password: '',
createTime: '',
updateTime: '',
status: '',
roleId: 0,
creatorId: 0,
authority: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/admin/v1/users/:id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"id":0,"userName":"","nickName":"","email":"","avatar":"","description":"","password":"","createTime":"","updateTime":"","status":"","roleId":0,"creatorId":0,"authority":""}'
};
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,
@"userName": @"",
@"nickName": @"",
@"email": @"",
@"avatar": @"",
@"description": @"",
@"password": @"",
@"createTime": @"",
@"updateTime": @"",
@"status": @"",
@"roleId": @0,
@"creatorId": @0,
@"authority": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/admin/v1/users/: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}}/admin/v1/users/:id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"id\": 0,\n \"userName\": \"\",\n \"nickName\": \"\",\n \"email\": \"\",\n \"avatar\": \"\",\n \"description\": \"\",\n \"password\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"status\": \"\",\n \"roleId\": 0,\n \"creatorId\": 0,\n \"authority\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/admin/v1/users/: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,
'userName' => '',
'nickName' => '',
'email' => '',
'avatar' => '',
'description' => '',
'password' => '',
'createTime' => '',
'updateTime' => '',
'status' => '',
'roleId' => 0,
'creatorId' => 0,
'authority' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/admin/v1/users/:id', [
'body' => '{
"id": 0,
"userName": "",
"nickName": "",
"email": "",
"avatar": "",
"description": "",
"password": "",
"createTime": "",
"updateTime": "",
"status": "",
"roleId": 0,
"creatorId": 0,
"authority": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/admin/v1/users/:id');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'id' => 0,
'userName' => '',
'nickName' => '',
'email' => '',
'avatar' => '',
'description' => '',
'password' => '',
'createTime' => '',
'updateTime' => '',
'status' => '',
'roleId' => 0,
'creatorId' => 0,
'authority' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'id' => 0,
'userName' => '',
'nickName' => '',
'email' => '',
'avatar' => '',
'description' => '',
'password' => '',
'createTime' => '',
'updateTime' => '',
'status' => '',
'roleId' => 0,
'creatorId' => 0,
'authority' => ''
]));
$request->setRequestUrl('{{baseUrl}}/admin/v1/users/: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}}/admin/v1/users/:id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"id": 0,
"userName": "",
"nickName": "",
"email": "",
"avatar": "",
"description": "",
"password": "",
"createTime": "",
"updateTime": "",
"status": "",
"roleId": 0,
"creatorId": 0,
"authority": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/admin/v1/users/:id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"id": 0,
"userName": "",
"nickName": "",
"email": "",
"avatar": "",
"description": "",
"password": "",
"createTime": "",
"updateTime": "",
"status": "",
"roleId": 0,
"creatorId": 0,
"authority": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"id\": 0,\n \"userName\": \"\",\n \"nickName\": \"\",\n \"email\": \"\",\n \"avatar\": \"\",\n \"description\": \"\",\n \"password\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"status\": \"\",\n \"roleId\": 0,\n \"creatorId\": 0,\n \"authority\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/admin/v1/users/:id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/admin/v1/users/:id"
payload = {
"id": 0,
"userName": "",
"nickName": "",
"email": "",
"avatar": "",
"description": "",
"password": "",
"createTime": "",
"updateTime": "",
"status": "",
"roleId": 0,
"creatorId": 0,
"authority": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/admin/v1/users/:id"
payload <- "{\n \"id\": 0,\n \"userName\": \"\",\n \"nickName\": \"\",\n \"email\": \"\",\n \"avatar\": \"\",\n \"description\": \"\",\n \"password\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"status\": \"\",\n \"roleId\": 0,\n \"creatorId\": 0,\n \"authority\": \"\"\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/admin/v1/users/: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 \"userName\": \"\",\n \"nickName\": \"\",\n \"email\": \"\",\n \"avatar\": \"\",\n \"description\": \"\",\n \"password\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"status\": \"\",\n \"roleId\": 0,\n \"creatorId\": 0,\n \"authority\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/admin/v1/users/:id') do |req|
req.body = "{\n \"id\": 0,\n \"userName\": \"\",\n \"nickName\": \"\",\n \"email\": \"\",\n \"avatar\": \"\",\n \"description\": \"\",\n \"password\": \"\",\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"status\": \"\",\n \"roleId\": 0,\n \"creatorId\": 0,\n \"authority\": \"\"\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/admin/v1/users/:id";
let payload = json!({
"id": 0,
"userName": "",
"nickName": "",
"email": "",
"avatar": "",
"description": "",
"password": "",
"createTime": "",
"updateTime": "",
"status": "",
"roleId": 0,
"creatorId": 0,
"authority": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/admin/v1/users/:id \
--header 'content-type: application/json' \
--data '{
"id": 0,
"userName": "",
"nickName": "",
"email": "",
"avatar": "",
"description": "",
"password": "",
"createTime": "",
"updateTime": "",
"status": "",
"roleId": 0,
"creatorId": 0,
"authority": ""
}'
echo '{
"id": 0,
"userName": "",
"nickName": "",
"email": "",
"avatar": "",
"description": "",
"password": "",
"createTime": "",
"updateTime": "",
"status": "",
"roleId": 0,
"creatorId": 0,
"authority": ""
}' | \
http PUT {{baseUrl}}/admin/v1/users/:id \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "id": 0,\n "userName": "",\n "nickName": "",\n "email": "",\n "avatar": "",\n "description": "",\n "password": "",\n "createTime": "",\n "updateTime": "",\n "status": "",\n "roleId": 0,\n "creatorId": 0,\n "authority": ""\n}' \
--output-document \
- {{baseUrl}}/admin/v1/users/:id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"id": 0,
"userName": "",
"nickName": "",
"email": "",
"avatar": "",
"description": "",
"password": "",
"createTime": "",
"updateTime": "",
"status": "",
"roleId": 0,
"creatorId": 0,
"authority": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/admin/v1/users/: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()