Stream Chat API
POST
Create campaign
{{baseUrl}}/campaigns
BODY json
{
"campaign": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"channel_type": "",
"defaults": {},
"description": "",
"name": "",
"segment_id": "",
"sender_id": "",
"text": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/campaigns");
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 \"campaign\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"channel_type\": \"\",\n \"defaults\": {},\n \"description\": \"\",\n \"name\": \"\",\n \"segment_id\": \"\",\n \"sender_id\": \"\",\n \"text\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/campaigns" {:content-type :json
:form-params {:campaign {:attachments [{:actions [{:name ""
:style ""
:text ""
:type ""
:value ""}]
:asset_url ""
:author_icon ""
:author_link ""
:author_name ""
:color ""
:fallback ""
:fields [{:short false
:title ""
:value ""}]
:footer ""
:footer_icon ""
:giphy {:fixed_height {:frames ""
:height ""
:size ""
:url ""
:width ""}
:fixed_height_downsampled {}
:fixed_height_still {}
:fixed_width {}
:fixed_width_downsampled {}
:fixed_width_still {}
:original {}}
:image_url ""
:og_scrape_url ""
:original_height ""
:original_width ""
:pretext ""
:text ""
:thumb_url ""
:title ""
:title_link ""
:type ""}]
:channel_type ""
:defaults {}
:description ""
:name ""
:segment_id ""
:sender_id ""
:text ""}}})
require "http/client"
url = "{{baseUrl}}/campaigns"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"campaign\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"channel_type\": \"\",\n \"defaults\": {},\n \"description\": \"\",\n \"name\": \"\",\n \"segment_id\": \"\",\n \"sender_id\": \"\",\n \"text\": \"\"\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/campaigns"),
Content = new StringContent("{\n \"campaign\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"channel_type\": \"\",\n \"defaults\": {},\n \"description\": \"\",\n \"name\": \"\",\n \"segment_id\": \"\",\n \"sender_id\": \"\",\n \"text\": \"\"\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}}/campaigns");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"campaign\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"channel_type\": \"\",\n \"defaults\": {},\n \"description\": \"\",\n \"name\": \"\",\n \"segment_id\": \"\",\n \"sender_id\": \"\",\n \"text\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/campaigns"
payload := strings.NewReader("{\n \"campaign\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"channel_type\": \"\",\n \"defaults\": {},\n \"description\": \"\",\n \"name\": \"\",\n \"segment_id\": \"\",\n \"sender_id\": \"\",\n \"text\": \"\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/campaigns HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 1368
{
"campaign": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"channel_type": "",
"defaults": {},
"description": "",
"name": "",
"segment_id": "",
"sender_id": "",
"text": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/campaigns")
.setHeader("content-type", "application/json")
.setBody("{\n \"campaign\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"channel_type\": \"\",\n \"defaults\": {},\n \"description\": \"\",\n \"name\": \"\",\n \"segment_id\": \"\",\n \"sender_id\": \"\",\n \"text\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/campaigns"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"campaign\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"channel_type\": \"\",\n \"defaults\": {},\n \"description\": \"\",\n \"name\": \"\",\n \"segment_id\": \"\",\n \"sender_id\": \"\",\n \"text\": \"\"\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 \"campaign\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"channel_type\": \"\",\n \"defaults\": {},\n \"description\": \"\",\n \"name\": \"\",\n \"segment_id\": \"\",\n \"sender_id\": \"\",\n \"text\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/campaigns")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/campaigns")
.header("content-type", "application/json")
.body("{\n \"campaign\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"channel_type\": \"\",\n \"defaults\": {},\n \"description\": \"\",\n \"name\": \"\",\n \"segment_id\": \"\",\n \"sender_id\": \"\",\n \"text\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
campaign: {
attachments: [
{
actions: [
{
name: '',
style: '',
text: '',
type: '',
value: ''
}
],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [
{
short: false,
title: '',
value: ''
}
],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {
frames: '',
height: '',
size: '',
url: '',
width: ''
},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
channel_type: '',
defaults: {},
description: '',
name: '',
segment_id: '',
sender_id: '',
text: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/campaigns');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/campaigns',
headers: {'content-type': 'application/json'},
data: {
campaign: {
attachments: [
{
actions: [{name: '', style: '', text: '', type: '', value: ''}],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [{short: false, title: '', value: ''}],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {frames: '', height: '', size: '', url: '', width: ''},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
channel_type: '',
defaults: {},
description: '',
name: '',
segment_id: '',
sender_id: '',
text: ''
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/campaigns';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"campaign":{"attachments":[{"actions":[{"name":"","style":"","text":"","type":"","value":""}],"asset_url":"","author_icon":"","author_link":"","author_name":"","color":"","fallback":"","fields":[{"short":false,"title":"","value":""}],"footer":"","footer_icon":"","giphy":{"fixed_height":{"frames":"","height":"","size":"","url":"","width":""},"fixed_height_downsampled":{},"fixed_height_still":{},"fixed_width":{},"fixed_width_downsampled":{},"fixed_width_still":{},"original":{}},"image_url":"","og_scrape_url":"","original_height":"","original_width":"","pretext":"","text":"","thumb_url":"","title":"","title_link":"","type":""}],"channel_type":"","defaults":{},"description":"","name":"","segment_id":"","sender_id":"","text":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/campaigns',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "campaign": {\n "attachments": [\n {\n "actions": [\n {\n "name": "",\n "style": "",\n "text": "",\n "type": "",\n "value": ""\n }\n ],\n "asset_url": "",\n "author_icon": "",\n "author_link": "",\n "author_name": "",\n "color": "",\n "fallback": "",\n "fields": [\n {\n "short": false,\n "title": "",\n "value": ""\n }\n ],\n "footer": "",\n "footer_icon": "",\n "giphy": {\n "fixed_height": {\n "frames": "",\n "height": "",\n "size": "",\n "url": "",\n "width": ""\n },\n "fixed_height_downsampled": {},\n "fixed_height_still": {},\n "fixed_width": {},\n "fixed_width_downsampled": {},\n "fixed_width_still": {},\n "original": {}\n },\n "image_url": "",\n "og_scrape_url": "",\n "original_height": "",\n "original_width": "",\n "pretext": "",\n "text": "",\n "thumb_url": "",\n "title": "",\n "title_link": "",\n "type": ""\n }\n ],\n "channel_type": "",\n "defaults": {},\n "description": "",\n "name": "",\n "segment_id": "",\n "sender_id": "",\n "text": ""\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 \"campaign\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"channel_type\": \"\",\n \"defaults\": {},\n \"description\": \"\",\n \"name\": \"\",\n \"segment_id\": \"\",\n \"sender_id\": \"\",\n \"text\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/campaigns")
.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/campaigns',
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({
campaign: {
attachments: [
{
actions: [{name: '', style: '', text: '', type: '', value: ''}],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [{short: false, title: '', value: ''}],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {frames: '', height: '', size: '', url: '', width: ''},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
channel_type: '',
defaults: {},
description: '',
name: '',
segment_id: '',
sender_id: '',
text: ''
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/campaigns',
headers: {'content-type': 'application/json'},
body: {
campaign: {
attachments: [
{
actions: [{name: '', style: '', text: '', type: '', value: ''}],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [{short: false, title: '', value: ''}],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {frames: '', height: '', size: '', url: '', width: ''},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
channel_type: '',
defaults: {},
description: '',
name: '',
segment_id: '',
sender_id: '',
text: ''
}
},
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}}/campaigns');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
campaign: {
attachments: [
{
actions: [
{
name: '',
style: '',
text: '',
type: '',
value: ''
}
],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [
{
short: false,
title: '',
value: ''
}
],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {
frames: '',
height: '',
size: '',
url: '',
width: ''
},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
channel_type: '',
defaults: {},
description: '',
name: '',
segment_id: '',
sender_id: '',
text: ''
}
});
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}}/campaigns',
headers: {'content-type': 'application/json'},
data: {
campaign: {
attachments: [
{
actions: [{name: '', style: '', text: '', type: '', value: ''}],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [{short: false, title: '', value: ''}],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {frames: '', height: '', size: '', url: '', width: ''},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
channel_type: '',
defaults: {},
description: '',
name: '',
segment_id: '',
sender_id: '',
text: ''
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/campaigns';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"campaign":{"attachments":[{"actions":[{"name":"","style":"","text":"","type":"","value":""}],"asset_url":"","author_icon":"","author_link":"","author_name":"","color":"","fallback":"","fields":[{"short":false,"title":"","value":""}],"footer":"","footer_icon":"","giphy":{"fixed_height":{"frames":"","height":"","size":"","url":"","width":""},"fixed_height_downsampled":{},"fixed_height_still":{},"fixed_width":{},"fixed_width_downsampled":{},"fixed_width_still":{},"original":{}},"image_url":"","og_scrape_url":"","original_height":"","original_width":"","pretext":"","text":"","thumb_url":"","title":"","title_link":"","type":""}],"channel_type":"","defaults":{},"description":"","name":"","segment_id":"","sender_id":"","text":""}}'
};
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 = @{ @"campaign": @{ @"attachments": @[ @{ @"actions": @[ @{ @"name": @"", @"style": @"", @"text": @"", @"type": @"", @"value": @"" } ], @"asset_url": @"", @"author_icon": @"", @"author_link": @"", @"author_name": @"", @"color": @"", @"fallback": @"", @"fields": @[ @{ @"short": @NO, @"title": @"", @"value": @"" } ], @"footer": @"", @"footer_icon": @"", @"giphy": @{ @"fixed_height": @{ @"frames": @"", @"height": @"", @"size": @"", @"url": @"", @"width": @"" }, @"fixed_height_downsampled": @{ }, @"fixed_height_still": @{ }, @"fixed_width": @{ }, @"fixed_width_downsampled": @{ }, @"fixed_width_still": @{ }, @"original": @{ } }, @"image_url": @"", @"og_scrape_url": @"", @"original_height": @"", @"original_width": @"", @"pretext": @"", @"text": @"", @"thumb_url": @"", @"title": @"", @"title_link": @"", @"type": @"" } ], @"channel_type": @"", @"defaults": @{ }, @"description": @"", @"name": @"", @"segment_id": @"", @"sender_id": @"", @"text": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/campaigns"]
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}}/campaigns" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"campaign\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"channel_type\": \"\",\n \"defaults\": {},\n \"description\": \"\",\n \"name\": \"\",\n \"segment_id\": \"\",\n \"sender_id\": \"\",\n \"text\": \"\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/campaigns",
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([
'campaign' => [
'attachments' => [
[
'actions' => [
[
'name' => '',
'style' => '',
'text' => '',
'type' => '',
'value' => ''
]
],
'asset_url' => '',
'author_icon' => '',
'author_link' => '',
'author_name' => '',
'color' => '',
'fallback' => '',
'fields' => [
[
'short' => null,
'title' => '',
'value' => ''
]
],
'footer' => '',
'footer_icon' => '',
'giphy' => [
'fixed_height' => [
'frames' => '',
'height' => '',
'size' => '',
'url' => '',
'width' => ''
],
'fixed_height_downsampled' => [
],
'fixed_height_still' => [
],
'fixed_width' => [
],
'fixed_width_downsampled' => [
],
'fixed_width_still' => [
],
'original' => [
]
],
'image_url' => '',
'og_scrape_url' => '',
'original_height' => '',
'original_width' => '',
'pretext' => '',
'text' => '',
'thumb_url' => '',
'title' => '',
'title_link' => '',
'type' => ''
]
],
'channel_type' => '',
'defaults' => [
],
'description' => '',
'name' => '',
'segment_id' => '',
'sender_id' => '',
'text' => ''
]
]),
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}}/campaigns', [
'body' => '{
"campaign": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"channel_type": "",
"defaults": {},
"description": "",
"name": "",
"segment_id": "",
"sender_id": "",
"text": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/campaigns');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'campaign' => [
'attachments' => [
[
'actions' => [
[
'name' => '',
'style' => '',
'text' => '',
'type' => '',
'value' => ''
]
],
'asset_url' => '',
'author_icon' => '',
'author_link' => '',
'author_name' => '',
'color' => '',
'fallback' => '',
'fields' => [
[
'short' => null,
'title' => '',
'value' => ''
]
],
'footer' => '',
'footer_icon' => '',
'giphy' => [
'fixed_height' => [
'frames' => '',
'height' => '',
'size' => '',
'url' => '',
'width' => ''
],
'fixed_height_downsampled' => [
],
'fixed_height_still' => [
],
'fixed_width' => [
],
'fixed_width_downsampled' => [
],
'fixed_width_still' => [
],
'original' => [
]
],
'image_url' => '',
'og_scrape_url' => '',
'original_height' => '',
'original_width' => '',
'pretext' => '',
'text' => '',
'thumb_url' => '',
'title' => '',
'title_link' => '',
'type' => ''
]
],
'channel_type' => '',
'defaults' => [
],
'description' => '',
'name' => '',
'segment_id' => '',
'sender_id' => '',
'text' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'campaign' => [
'attachments' => [
[
'actions' => [
[
'name' => '',
'style' => '',
'text' => '',
'type' => '',
'value' => ''
]
],
'asset_url' => '',
'author_icon' => '',
'author_link' => '',
'author_name' => '',
'color' => '',
'fallback' => '',
'fields' => [
[
'short' => null,
'title' => '',
'value' => ''
]
],
'footer' => '',
'footer_icon' => '',
'giphy' => [
'fixed_height' => [
'frames' => '',
'height' => '',
'size' => '',
'url' => '',
'width' => ''
],
'fixed_height_downsampled' => [
],
'fixed_height_still' => [
],
'fixed_width' => [
],
'fixed_width_downsampled' => [
],
'fixed_width_still' => [
],
'original' => [
]
],
'image_url' => '',
'og_scrape_url' => '',
'original_height' => '',
'original_width' => '',
'pretext' => '',
'text' => '',
'thumb_url' => '',
'title' => '',
'title_link' => '',
'type' => ''
]
],
'channel_type' => '',
'defaults' => [
],
'description' => '',
'name' => '',
'segment_id' => '',
'sender_id' => '',
'text' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/campaigns');
$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}}/campaigns' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"campaign": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"channel_type": "",
"defaults": {},
"description": "",
"name": "",
"segment_id": "",
"sender_id": "",
"text": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/campaigns' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"campaign": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"channel_type": "",
"defaults": {},
"description": "",
"name": "",
"segment_id": "",
"sender_id": "",
"text": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"campaign\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"channel_type\": \"\",\n \"defaults\": {},\n \"description\": \"\",\n \"name\": \"\",\n \"segment_id\": \"\",\n \"sender_id\": \"\",\n \"text\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/campaigns", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/campaigns"
payload = { "campaign": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": False,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"channel_type": "",
"defaults": {},
"description": "",
"name": "",
"segment_id": "",
"sender_id": "",
"text": ""
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/campaigns"
payload <- "{\n \"campaign\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"channel_type\": \"\",\n \"defaults\": {},\n \"description\": \"\",\n \"name\": \"\",\n \"segment_id\": \"\",\n \"sender_id\": \"\",\n \"text\": \"\"\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/campaigns")
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 \"campaign\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"channel_type\": \"\",\n \"defaults\": {},\n \"description\": \"\",\n \"name\": \"\",\n \"segment_id\": \"\",\n \"sender_id\": \"\",\n \"text\": \"\"\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/campaigns') do |req|
req.body = "{\n \"campaign\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"channel_type\": \"\",\n \"defaults\": {},\n \"description\": \"\",\n \"name\": \"\",\n \"segment_id\": \"\",\n \"sender_id\": \"\",\n \"text\": \"\"\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/campaigns";
let payload = json!({"campaign": json!({
"attachments": (
json!({
"actions": (
json!({
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
})
),
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": (
json!({
"short": false,
"title": "",
"value": ""
})
),
"footer": "",
"footer_icon": "",
"giphy": json!({
"fixed_height": json!({
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
}),
"fixed_height_downsampled": json!({}),
"fixed_height_still": json!({}),
"fixed_width": json!({}),
"fixed_width_downsampled": json!({}),
"fixed_width_still": json!({}),
"original": json!({})
}),
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
})
),
"channel_type": "",
"defaults": json!({}),
"description": "",
"name": "",
"segment_id": "",
"sender_id": "",
"text": ""
})});
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}}/campaigns \
--header 'content-type: application/json' \
--data '{
"campaign": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"channel_type": "",
"defaults": {},
"description": "",
"name": "",
"segment_id": "",
"sender_id": "",
"text": ""
}
}'
echo '{
"campaign": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"channel_type": "",
"defaults": {},
"description": "",
"name": "",
"segment_id": "",
"sender_id": "",
"text": ""
}
}' | \
http POST {{baseUrl}}/campaigns \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "campaign": {\n "attachments": [\n {\n "actions": [\n {\n "name": "",\n "style": "",\n "text": "",\n "type": "",\n "value": ""\n }\n ],\n "asset_url": "",\n "author_icon": "",\n "author_link": "",\n "author_name": "",\n "color": "",\n "fallback": "",\n "fields": [\n {\n "short": false,\n "title": "",\n "value": ""\n }\n ],\n "footer": "",\n "footer_icon": "",\n "giphy": {\n "fixed_height": {\n "frames": "",\n "height": "",\n "size": "",\n "url": "",\n "width": ""\n },\n "fixed_height_downsampled": {},\n "fixed_height_still": {},\n "fixed_width": {},\n "fixed_width_downsampled": {},\n "fixed_width_still": {},\n "original": {}\n },\n "image_url": "",\n "og_scrape_url": "",\n "original_height": "",\n "original_width": "",\n "pretext": "",\n "text": "",\n "thumb_url": "",\n "title": "",\n "title_link": "",\n "type": ""\n }\n ],\n "channel_type": "",\n "defaults": {},\n "description": "",\n "name": "",\n "segment_id": "",\n "sender_id": "",\n "text": ""\n }\n}' \
--output-document \
- {{baseUrl}}/campaigns
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["campaign": [
"attachments": [
[
"actions": [
[
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
]
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
[
"short": false,
"title": "",
"value": ""
]
],
"footer": "",
"footer_icon": "",
"giphy": [
"fixed_height": [
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
],
"fixed_height_downsampled": [],
"fixed_height_still": [],
"fixed_width": [],
"fixed_width_downsampled": [],
"fixed_width_still": [],
"original": []
],
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
]
],
"channel_type": "",
"defaults": [],
"description": "",
"name": "",
"segment_id": "",
"sender_id": "",
"text": ""
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/campaigns")! 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
Create segment
{{baseUrl}}/segments
BODY json
{
"segment": {
"description": "",
"filter": {},
"name": "",
"type": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/segments");
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 \"segment\": {\n \"description\": \"\",\n \"filter\": {},\n \"name\": \"\",\n \"type\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/segments" {:content-type :json
:form-params {:segment {:description ""
:filter {}
:name ""
:type ""}}})
require "http/client"
url = "{{baseUrl}}/segments"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"segment\": {\n \"description\": \"\",\n \"filter\": {},\n \"name\": \"\",\n \"type\": \"\"\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/segments"),
Content = new StringContent("{\n \"segment\": {\n \"description\": \"\",\n \"filter\": {},\n \"name\": \"\",\n \"type\": \"\"\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/segments");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"segment\": {\n \"description\": \"\",\n \"filter\": {},\n \"name\": \"\",\n \"type\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/segments"
payload := strings.NewReader("{\n \"segment\": {\n \"description\": \"\",\n \"filter\": {},\n \"name\": \"\",\n \"type\": \"\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/segments HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 94
{
"segment": {
"description": "",
"filter": {},
"name": "",
"type": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/segments")
.setHeader("content-type", "application/json")
.setBody("{\n \"segment\": {\n \"description\": \"\",\n \"filter\": {},\n \"name\": \"\",\n \"type\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/segments"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"segment\": {\n \"description\": \"\",\n \"filter\": {},\n \"name\": \"\",\n \"type\": \"\"\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"segment\": {\n \"description\": \"\",\n \"filter\": {},\n \"name\": \"\",\n \"type\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/segments")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/segments")
.header("content-type", "application/json")
.body("{\n \"segment\": {\n \"description\": \"\",\n \"filter\": {},\n \"name\": \"\",\n \"type\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
segment: {
description: '',
filter: {},
name: '',
type: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/segments');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/segments',
headers: {'content-type': 'application/json'},
data: {segment: {description: '', filter: {}, name: '', type: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/segments';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"segment":{"description":"","filter":{},"name":"","type":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/segments',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "segment": {\n "description": "",\n "filter": {},\n "name": "",\n "type": ""\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"segment\": {\n \"description\": \"\",\n \"filter\": {},\n \"name\": \"\",\n \"type\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/segments")
.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/segments',
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({segment: {description: '', filter: {}, name: '', type: ''}}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/segments',
headers: {'content-type': 'application/json'},
body: {segment: {description: '', filter: {}, name: '', type: ''}},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/segments');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
segment: {
description: '',
filter: {},
name: '',
type: ''
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/segments',
headers: {'content-type': 'application/json'},
data: {segment: {description: '', filter: {}, name: '', type: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/segments';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"segment":{"description":"","filter":{},"name":"","type":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"segment": @{ @"description": @"", @"filter": @{ }, @"name": @"", @"type": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/segments"]
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}}/segments" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"segment\": {\n \"description\": \"\",\n \"filter\": {},\n \"name\": \"\",\n \"type\": \"\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/segments",
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([
'segment' => [
'description' => '',
'filter' => [
],
'name' => '',
'type' => ''
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/segments', [
'body' => '{
"segment": {
"description": "",
"filter": {},
"name": "",
"type": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/segments');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'segment' => [
'description' => '',
'filter' => [
],
'name' => '',
'type' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'segment' => [
'description' => '',
'filter' => [
],
'name' => '',
'type' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/segments');
$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}}/segments' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"segment": {
"description": "",
"filter": {},
"name": "",
"type": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/segments' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"segment": {
"description": "",
"filter": {},
"name": "",
"type": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"segment\": {\n \"description\": \"\",\n \"filter\": {},\n \"name\": \"\",\n \"type\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/segments", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/segments"
payload = { "segment": {
"description": "",
"filter": {},
"name": "",
"type": ""
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/segments"
payload <- "{\n \"segment\": {\n \"description\": \"\",\n \"filter\": {},\n \"name\": \"\",\n \"type\": \"\"\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/segments")
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 \"segment\": {\n \"description\": \"\",\n \"filter\": {},\n \"name\": \"\",\n \"type\": \"\"\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/segments') do |req|
req.body = "{\n \"segment\": {\n \"description\": \"\",\n \"filter\": {},\n \"name\": \"\",\n \"type\": \"\"\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/segments";
let payload = json!({"segment": json!({
"description": "",
"filter": json!({}),
"name": "",
"type": ""
})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/segments \
--header 'content-type: application/json' \
--data '{
"segment": {
"description": "",
"filter": {},
"name": "",
"type": ""
}
}'
echo '{
"segment": {
"description": "",
"filter": {},
"name": "",
"type": ""
}
}' | \
http POST {{baseUrl}}/segments \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "segment": {\n "description": "",\n "filter": {},\n "name": "",\n "type": ""\n }\n}' \
--output-document \
- {{baseUrl}}/segments
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["segment": [
"description": "",
"filter": [],
"name": "",
"type": ""
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/segments")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
Delete campaign
{{baseUrl}}/campaigns/: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}}/campaigns/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/campaigns/:id")
require "http/client"
url = "{{baseUrl}}/campaigns/: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}}/campaigns/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/campaigns/:id");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/campaigns/: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/campaigns/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/campaigns/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/campaigns/: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}}/campaigns/:id")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/campaigns/: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}}/campaigns/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/campaigns/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/campaigns/: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}}/campaigns/:id',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/campaigns/: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/campaigns/: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}}/campaigns/: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}}/campaigns/: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}}/campaigns/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/campaigns/: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}}/campaigns/: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}}/campaigns/:id" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/campaigns/: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}}/campaigns/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/campaigns/:id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/campaigns/:id');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/campaigns/:id' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/campaigns/:id' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/campaigns/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/campaigns/:id"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/campaigns/:id"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/campaigns/: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/campaigns/: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}}/campaigns/: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}}/campaigns/:id
http DELETE {{baseUrl}}/campaigns/:id
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/campaigns/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/campaigns/: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()
DELETE
Delete segment
{{baseUrl}}/segments/: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}}/segments/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/segments/:id")
require "http/client"
url = "{{baseUrl}}/segments/: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}}/segments/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/segments/:id");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/segments/: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/segments/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/segments/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/segments/: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}}/segments/:id")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/segments/: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}}/segments/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/segments/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/segments/: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}}/segments/:id',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/segments/: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/segments/: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}}/segments/: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}}/segments/: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}}/segments/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/segments/: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}}/segments/: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}}/segments/:id" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/segments/: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}}/segments/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/segments/:id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/segments/:id');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/segments/:id' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/segments/:id' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/segments/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/segments/:id"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/segments/:id"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/segments/: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/segments/: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}}/segments/: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}}/segments/:id
http DELETE {{baseUrl}}/segments/:id
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/segments/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/segments/: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
Query campaigns
{{baseUrl}}/campaigns
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/campaigns");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/campaigns")
require "http/client"
url = "{{baseUrl}}/campaigns"
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}}/campaigns"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/campaigns");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/campaigns"
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/campaigns HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/campaigns")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/campaigns"))
.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}}/campaigns")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/campaigns")
.asString();
const 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}}/campaigns');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/campaigns'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/campaigns';
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}}/campaigns',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/campaigns")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/campaigns',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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}}/campaigns'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/campaigns');
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}}/campaigns'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/campaigns';
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}}/campaigns"]
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}}/campaigns" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/campaigns",
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}}/campaigns');
echo $response->getBody();
setUrl('{{baseUrl}}/campaigns');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/campaigns');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/campaigns' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/campaigns' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/campaigns")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/campaigns"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/campaigns"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/campaigns")
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/campaigns') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/campaigns";
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}}/campaigns
http GET {{baseUrl}}/campaigns
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/campaigns
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/campaigns")! 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
Query recipients
{{baseUrl}}/recipients
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/recipients");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/recipients")
require "http/client"
url = "{{baseUrl}}/recipients"
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}}/recipients"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/recipients");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/recipients"
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/recipients HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/recipients")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/recipients"))
.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}}/recipients")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/recipients")
.asString();
const 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}}/recipients');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/recipients'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/recipients';
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}}/recipients',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/recipients")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/recipients',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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}}/recipients'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/recipients');
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}}/recipients'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/recipients';
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}}/recipients"]
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}}/recipients" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/recipients",
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}}/recipients');
echo $response->getBody();
setUrl('{{baseUrl}}/recipients');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/recipients');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/recipients' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/recipients' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/recipients")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/recipients"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/recipients"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/recipients")
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/recipients') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/recipients";
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}}/recipients
http GET {{baseUrl}}/recipients
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/recipients
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/recipients")! 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
Query segments
{{baseUrl}}/segments
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/segments");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/segments")
require "http/client"
url = "{{baseUrl}}/segments"
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}}/segments"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/segments");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/segments"
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/segments HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/segments")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/segments"))
.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}}/segments")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/segments")
.asString();
const 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}}/segments');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/segments'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/segments';
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}}/segments',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/segments")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/segments',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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}}/segments'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/segments');
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}}/segments'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/segments';
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}}/segments"]
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}}/segments" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/segments",
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}}/segments');
echo $response->getBody();
setUrl('{{baseUrl}}/segments');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/segments');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/segments' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/segments' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/segments")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/segments"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/segments"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/segments")
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/segments') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/segments";
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}}/segments
http GET {{baseUrl}}/segments
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/segments
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/segments")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
Resume campaign
{{baseUrl}}/campaigns/:id/resume
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/campaigns/:id/resume");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/campaigns/:id/resume")
require "http/client"
url = "{{baseUrl}}/campaigns/:id/resume"
response = HTTP::Client.patch url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Patch,
RequestUri = new Uri("{{baseUrl}}/campaigns/:id/resume"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/campaigns/:id/resume");
var request = new RestRequest("", Method.Patch);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/campaigns/:id/resume"
req, _ := http.NewRequest("PATCH", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PATCH /baseUrl/campaigns/:id/resume HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/campaigns/:id/resume")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/campaigns/:id/resume"))
.method("PATCH", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/campaigns/:id/resume")
.patch(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/campaigns/:id/resume")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/campaigns/:id/resume');
xhr.send(data);
import axios from 'axios';
const options = {method: 'PATCH', url: '{{baseUrl}}/campaigns/:id/resume'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/campaigns/:id/resume';
const options = {method: 'PATCH'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/campaigns/:id/resume',
method: 'PATCH',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/campaigns/:id/resume")
.patch(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PATCH',
hostname: 'example.com',
port: null,
path: '/baseUrl/campaigns/:id/resume',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'PATCH', url: '{{baseUrl}}/campaigns/:id/resume'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/campaigns/:id/resume');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'PATCH', url: '{{baseUrl}}/campaigns/:id/resume'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/campaigns/:id/resume';
const options = {method: 'PATCH'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/campaigns/:id/resume"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PATCH"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/campaigns/:id/resume" in
Client.call `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/campaigns/:id/resume",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/campaigns/:id/resume');
echo $response->getBody();
setUrl('{{baseUrl}}/campaigns/:id/resume');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/campaigns/:id/resume');
$request->setRequestMethod('PATCH');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/campaigns/:id/resume' -Method PATCH
$response = Invoke-RestMethod -Uri '{{baseUrl}}/campaigns/:id/resume' -Method PATCH
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("PATCH", "/baseUrl/campaigns/:id/resume")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/campaigns/:id/resume"
response = requests.patch(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/campaigns/:id/resume"
response <- VERB("PATCH", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/campaigns/:id/resume")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.patch('/baseUrl/campaigns/:id/resume') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/campaigns/:id/resume";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/campaigns/:id/resume
http PATCH {{baseUrl}}/campaigns/:id/resume
wget --quiet \
--method PATCH \
--output-document \
- {{baseUrl}}/campaigns/:id/resume
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/campaigns/:id/resume")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
Schedule campaign
{{baseUrl}}/campaigns/:id/schedule
QUERY PARAMS
id
BODY json
{
"scheduled_for": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/campaigns/:id/schedule");
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 \"scheduled_for\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/campaigns/:id/schedule" {:content-type :json
:form-params {:scheduled_for ""}})
require "http/client"
url = "{{baseUrl}}/campaigns/:id/schedule"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"scheduled_for\": \"\"\n}"
response = HTTP::Client.patch url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Patch,
RequestUri = new Uri("{{baseUrl}}/campaigns/:id/schedule"),
Content = new StringContent("{\n \"scheduled_for\": \"\"\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}}/campaigns/:id/schedule");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"scheduled_for\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/campaigns/:id/schedule"
payload := strings.NewReader("{\n \"scheduled_for\": \"\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PATCH /baseUrl/campaigns/:id/schedule HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 25
{
"scheduled_for": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/campaigns/:id/schedule")
.setHeader("content-type", "application/json")
.setBody("{\n \"scheduled_for\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/campaigns/:id/schedule"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"scheduled_for\": \"\"\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 \"scheduled_for\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/campaigns/:id/schedule")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/campaigns/:id/schedule")
.header("content-type", "application/json")
.body("{\n \"scheduled_for\": \"\"\n}")
.asString();
const data = JSON.stringify({
scheduled_for: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/campaigns/:id/schedule');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/campaigns/:id/schedule',
headers: {'content-type': 'application/json'},
data: {scheduled_for: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/campaigns/:id/schedule';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"scheduled_for":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/campaigns/:id/schedule',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "scheduled_for": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"scheduled_for\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/campaigns/:id/schedule")
.patch(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PATCH',
hostname: 'example.com',
port: null,
path: '/baseUrl/campaigns/:id/schedule',
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({scheduled_for: ''}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/campaigns/:id/schedule',
headers: {'content-type': 'application/json'},
body: {scheduled_for: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/campaigns/:id/schedule');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
scheduled_for: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/campaigns/:id/schedule',
headers: {'content-type': 'application/json'},
data: {scheduled_for: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/campaigns/:id/schedule';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"scheduled_for":""}'
};
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 = @{ @"scheduled_for": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/campaigns/:id/schedule"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PATCH"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/campaigns/:id/schedule" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"scheduled_for\": \"\"\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/campaigns/:id/schedule",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'scheduled_for' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/campaigns/:id/schedule', [
'body' => '{
"scheduled_for": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/campaigns/:id/schedule');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'scheduled_for' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'scheduled_for' => ''
]));
$request->setRequestUrl('{{baseUrl}}/campaigns/:id/schedule');
$request->setRequestMethod('PATCH');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/campaigns/:id/schedule' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"scheduled_for": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/campaigns/:id/schedule' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"scheduled_for": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"scheduled_for\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/campaigns/:id/schedule", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/campaigns/:id/schedule"
payload = { "scheduled_for": "" }
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/campaigns/:id/schedule"
payload <- "{\n \"scheduled_for\": \"\"\n}"
encode <- "json"
response <- VERB("PATCH", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/campaigns/:id/schedule")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"scheduled_for\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/campaigns/:id/schedule') do |req|
req.body = "{\n \"scheduled_for\": \"\"\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}}/campaigns/:id/schedule";
let payload = json!({"scheduled_for": ""});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/campaigns/:id/schedule \
--header 'content-type: application/json' \
--data '{
"scheduled_for": ""
}'
echo '{
"scheduled_for": ""
}' | \
http PATCH {{baseUrl}}/campaigns/:id/schedule \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "scheduled_for": ""\n}' \
--output-document \
- {{baseUrl}}/campaigns/:id/schedule
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["scheduled_for": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/campaigns/:id/schedule")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
Stop campaign
{{baseUrl}}/campaigns/:id/stop
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/campaigns/:id/stop");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/campaigns/:id/stop")
require "http/client"
url = "{{baseUrl}}/campaigns/:id/stop"
response = HTTP::Client.patch url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Patch,
RequestUri = new Uri("{{baseUrl}}/campaigns/:id/stop"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/campaigns/:id/stop");
var request = new RestRequest("", Method.Patch);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/campaigns/:id/stop"
req, _ := http.NewRequest("PATCH", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PATCH /baseUrl/campaigns/:id/stop HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/campaigns/:id/stop")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/campaigns/:id/stop"))
.method("PATCH", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/campaigns/:id/stop")
.patch(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/campaigns/:id/stop")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/campaigns/:id/stop');
xhr.send(data);
import axios from 'axios';
const options = {method: 'PATCH', url: '{{baseUrl}}/campaigns/:id/stop'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/campaigns/:id/stop';
const options = {method: 'PATCH'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/campaigns/:id/stop',
method: 'PATCH',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/campaigns/:id/stop")
.patch(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PATCH',
hostname: 'example.com',
port: null,
path: '/baseUrl/campaigns/:id/stop',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'PATCH', url: '{{baseUrl}}/campaigns/:id/stop'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/campaigns/:id/stop');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'PATCH', url: '{{baseUrl}}/campaigns/:id/stop'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/campaigns/:id/stop';
const options = {method: 'PATCH'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/campaigns/:id/stop"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PATCH"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/campaigns/:id/stop" in
Client.call `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/campaigns/:id/stop",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/campaigns/:id/stop');
echo $response->getBody();
setUrl('{{baseUrl}}/campaigns/:id/stop');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/campaigns/:id/stop');
$request->setRequestMethod('PATCH');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/campaigns/:id/stop' -Method PATCH
$response = Invoke-RestMethod -Uri '{{baseUrl}}/campaigns/:id/stop' -Method PATCH
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("PATCH", "/baseUrl/campaigns/:id/stop")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/campaigns/:id/stop"
response = requests.patch(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/campaigns/:id/stop"
response <- VERB("PATCH", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/campaigns/:id/stop")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.patch('/baseUrl/campaigns/:id/stop') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/campaigns/:id/stop";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/campaigns/:id/stop
http PATCH {{baseUrl}}/campaigns/:id/stop
wget --quiet \
--method PATCH \
--output-document \
- {{baseUrl}}/campaigns/:id/stop
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/campaigns/:id/stop")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as 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
Test campaign
{{baseUrl}}/campaigns/:id/test
QUERY PARAMS
id
BODY json
{
"users": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/campaigns/:id/test");
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 \"users\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/campaigns/:id/test" {:content-type :json
:form-params {:users []}})
require "http/client"
url = "{{baseUrl}}/campaigns/:id/test"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"users\": []\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}}/campaigns/:id/test"),
Content = new StringContent("{\n \"users\": []\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}}/campaigns/:id/test");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"users\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/campaigns/:id/test"
payload := strings.NewReader("{\n \"users\": []\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/campaigns/:id/test HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 17
{
"users": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/campaigns/:id/test")
.setHeader("content-type", "application/json")
.setBody("{\n \"users\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/campaigns/:id/test"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"users\": []\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 \"users\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/campaigns/:id/test")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/campaigns/:id/test")
.header("content-type", "application/json")
.body("{\n \"users\": []\n}")
.asString();
const data = JSON.stringify({
users: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/campaigns/:id/test');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/campaigns/:id/test',
headers: {'content-type': 'application/json'},
data: {users: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/campaigns/:id/test';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"users":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/campaigns/:id/test',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "users": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"users\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/campaigns/:id/test")
.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/campaigns/:id/test',
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({users: []}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/campaigns/:id/test',
headers: {'content-type': 'application/json'},
body: {users: []},
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}}/campaigns/:id/test');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
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: 'POST',
url: '{{baseUrl}}/campaigns/:id/test',
headers: {'content-type': 'application/json'},
data: {users: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/campaigns/:id/test';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"users":[]}'
};
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 = @{ @"users": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/campaigns/:id/test"]
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}}/campaigns/:id/test" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"users\": []\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/campaigns/:id/test",
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([
'users' => [
]
]),
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}}/campaigns/:id/test', [
'body' => '{
"users": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/campaigns/:id/test');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'users' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'users' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/campaigns/:id/test');
$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}}/campaigns/:id/test' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"users": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/campaigns/:id/test' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"users": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"users\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/campaigns/:id/test", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/campaigns/:id/test"
payload = { "users": [] }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/campaigns/:id/test"
payload <- "{\n \"users\": []\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}}/campaigns/:id/test")
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 \"users\": []\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/campaigns/:id/test') do |req|
req.body = "{\n \"users\": []\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/campaigns/:id/test";
let payload = json!({"users": ()});
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}}/campaigns/:id/test \
--header 'content-type: application/json' \
--data '{
"users": []
}'
echo '{
"users": []
}' | \
http POST {{baseUrl}}/campaigns/:id/test \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "users": []\n}' \
--output-document \
- {{baseUrl}}/campaigns/:id/test
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["users": []] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/campaigns/:id/test")! 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()
PUT
Update campaign
{{baseUrl}}/campaigns/:id
QUERY PARAMS
id
BODY json
{
"campaign": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"channel_type": "",
"defaults": {},
"description": "",
"name": "",
"segment_id": "",
"sender_id": "",
"text": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/campaigns/: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 \"campaign\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"channel_type\": \"\",\n \"defaults\": {},\n \"description\": \"\",\n \"name\": \"\",\n \"segment_id\": \"\",\n \"sender_id\": \"\",\n \"text\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/campaigns/:id" {:content-type :json
:form-params {:campaign {:attachments [{:actions [{:name ""
:style ""
:text ""
:type ""
:value ""}]
:asset_url ""
:author_icon ""
:author_link ""
:author_name ""
:color ""
:fallback ""
:fields [{:short false
:title ""
:value ""}]
:footer ""
:footer_icon ""
:giphy {:fixed_height {:frames ""
:height ""
:size ""
:url ""
:width ""}
:fixed_height_downsampled {}
:fixed_height_still {}
:fixed_width {}
:fixed_width_downsampled {}
:fixed_width_still {}
:original {}}
:image_url ""
:og_scrape_url ""
:original_height ""
:original_width ""
:pretext ""
:text ""
:thumb_url ""
:title ""
:title_link ""
:type ""}]
:channel_type ""
:defaults {}
:description ""
:name ""
:segment_id ""
:sender_id ""
:text ""}}})
require "http/client"
url = "{{baseUrl}}/campaigns/:id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"campaign\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"channel_type\": \"\",\n \"defaults\": {},\n \"description\": \"\",\n \"name\": \"\",\n \"segment_id\": \"\",\n \"sender_id\": \"\",\n \"text\": \"\"\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}}/campaigns/:id"),
Content = new StringContent("{\n \"campaign\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"channel_type\": \"\",\n \"defaults\": {},\n \"description\": \"\",\n \"name\": \"\",\n \"segment_id\": \"\",\n \"sender_id\": \"\",\n \"text\": \"\"\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}}/campaigns/:id");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"campaign\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"channel_type\": \"\",\n \"defaults\": {},\n \"description\": \"\",\n \"name\": \"\",\n \"segment_id\": \"\",\n \"sender_id\": \"\",\n \"text\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/campaigns/:id"
payload := strings.NewReader("{\n \"campaign\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"channel_type\": \"\",\n \"defaults\": {},\n \"description\": \"\",\n \"name\": \"\",\n \"segment_id\": \"\",\n \"sender_id\": \"\",\n \"text\": \"\"\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/campaigns/:id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 1368
{
"campaign": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"channel_type": "",
"defaults": {},
"description": "",
"name": "",
"segment_id": "",
"sender_id": "",
"text": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/campaigns/:id")
.setHeader("content-type", "application/json")
.setBody("{\n \"campaign\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"channel_type\": \"\",\n \"defaults\": {},\n \"description\": \"\",\n \"name\": \"\",\n \"segment_id\": \"\",\n \"sender_id\": \"\",\n \"text\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/campaigns/:id"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"campaign\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"channel_type\": \"\",\n \"defaults\": {},\n \"description\": \"\",\n \"name\": \"\",\n \"segment_id\": \"\",\n \"sender_id\": \"\",\n \"text\": \"\"\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 \"campaign\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"channel_type\": \"\",\n \"defaults\": {},\n \"description\": \"\",\n \"name\": \"\",\n \"segment_id\": \"\",\n \"sender_id\": \"\",\n \"text\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/campaigns/:id")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/campaigns/:id")
.header("content-type", "application/json")
.body("{\n \"campaign\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"channel_type\": \"\",\n \"defaults\": {},\n \"description\": \"\",\n \"name\": \"\",\n \"segment_id\": \"\",\n \"sender_id\": \"\",\n \"text\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
campaign: {
attachments: [
{
actions: [
{
name: '',
style: '',
text: '',
type: '',
value: ''
}
],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [
{
short: false,
title: '',
value: ''
}
],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {
frames: '',
height: '',
size: '',
url: '',
width: ''
},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
channel_type: '',
defaults: {},
description: '',
name: '',
segment_id: '',
sender_id: '',
text: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/campaigns/:id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/campaigns/:id',
headers: {'content-type': 'application/json'},
data: {
campaign: {
attachments: [
{
actions: [{name: '', style: '', text: '', type: '', value: ''}],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [{short: false, title: '', value: ''}],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {frames: '', height: '', size: '', url: '', width: ''},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
channel_type: '',
defaults: {},
description: '',
name: '',
segment_id: '',
sender_id: '',
text: ''
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/campaigns/:id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"campaign":{"attachments":[{"actions":[{"name":"","style":"","text":"","type":"","value":""}],"asset_url":"","author_icon":"","author_link":"","author_name":"","color":"","fallback":"","fields":[{"short":false,"title":"","value":""}],"footer":"","footer_icon":"","giphy":{"fixed_height":{"frames":"","height":"","size":"","url":"","width":""},"fixed_height_downsampled":{},"fixed_height_still":{},"fixed_width":{},"fixed_width_downsampled":{},"fixed_width_still":{},"original":{}},"image_url":"","og_scrape_url":"","original_height":"","original_width":"","pretext":"","text":"","thumb_url":"","title":"","title_link":"","type":""}],"channel_type":"","defaults":{},"description":"","name":"","segment_id":"","sender_id":"","text":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/campaigns/:id',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "campaign": {\n "attachments": [\n {\n "actions": [\n {\n "name": "",\n "style": "",\n "text": "",\n "type": "",\n "value": ""\n }\n ],\n "asset_url": "",\n "author_icon": "",\n "author_link": "",\n "author_name": "",\n "color": "",\n "fallback": "",\n "fields": [\n {\n "short": false,\n "title": "",\n "value": ""\n }\n ],\n "footer": "",\n "footer_icon": "",\n "giphy": {\n "fixed_height": {\n "frames": "",\n "height": "",\n "size": "",\n "url": "",\n "width": ""\n },\n "fixed_height_downsampled": {},\n "fixed_height_still": {},\n "fixed_width": {},\n "fixed_width_downsampled": {},\n "fixed_width_still": {},\n "original": {}\n },\n "image_url": "",\n "og_scrape_url": "",\n "original_height": "",\n "original_width": "",\n "pretext": "",\n "text": "",\n "thumb_url": "",\n "title": "",\n "title_link": "",\n "type": ""\n }\n ],\n "channel_type": "",\n "defaults": {},\n "description": "",\n "name": "",\n "segment_id": "",\n "sender_id": "",\n "text": ""\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 \"campaign\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"channel_type\": \"\",\n \"defaults\": {},\n \"description\": \"\",\n \"name\": \"\",\n \"segment_id\": \"\",\n \"sender_id\": \"\",\n \"text\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/campaigns/: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/campaigns/: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({
campaign: {
attachments: [
{
actions: [{name: '', style: '', text: '', type: '', value: ''}],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [{short: false, title: '', value: ''}],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {frames: '', height: '', size: '', url: '', width: ''},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
channel_type: '',
defaults: {},
description: '',
name: '',
segment_id: '',
sender_id: '',
text: ''
}
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/campaigns/:id',
headers: {'content-type': 'application/json'},
body: {
campaign: {
attachments: [
{
actions: [{name: '', style: '', text: '', type: '', value: ''}],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [{short: false, title: '', value: ''}],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {frames: '', height: '', size: '', url: '', width: ''},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
channel_type: '',
defaults: {},
description: '',
name: '',
segment_id: '',
sender_id: '',
text: ''
}
},
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}}/campaigns/:id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
campaign: {
attachments: [
{
actions: [
{
name: '',
style: '',
text: '',
type: '',
value: ''
}
],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [
{
short: false,
title: '',
value: ''
}
],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {
frames: '',
height: '',
size: '',
url: '',
width: ''
},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
channel_type: '',
defaults: {},
description: '',
name: '',
segment_id: '',
sender_id: '',
text: ''
}
});
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}}/campaigns/:id',
headers: {'content-type': 'application/json'},
data: {
campaign: {
attachments: [
{
actions: [{name: '', style: '', text: '', type: '', value: ''}],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [{short: false, title: '', value: ''}],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {frames: '', height: '', size: '', url: '', width: ''},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
channel_type: '',
defaults: {},
description: '',
name: '',
segment_id: '',
sender_id: '',
text: ''
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/campaigns/:id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"campaign":{"attachments":[{"actions":[{"name":"","style":"","text":"","type":"","value":""}],"asset_url":"","author_icon":"","author_link":"","author_name":"","color":"","fallback":"","fields":[{"short":false,"title":"","value":""}],"footer":"","footer_icon":"","giphy":{"fixed_height":{"frames":"","height":"","size":"","url":"","width":""},"fixed_height_downsampled":{},"fixed_height_still":{},"fixed_width":{},"fixed_width_downsampled":{},"fixed_width_still":{},"original":{}},"image_url":"","og_scrape_url":"","original_height":"","original_width":"","pretext":"","text":"","thumb_url":"","title":"","title_link":"","type":""}],"channel_type":"","defaults":{},"description":"","name":"","segment_id":"","sender_id":"","text":""}}'
};
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 = @{ @"campaign": @{ @"attachments": @[ @{ @"actions": @[ @{ @"name": @"", @"style": @"", @"text": @"", @"type": @"", @"value": @"" } ], @"asset_url": @"", @"author_icon": @"", @"author_link": @"", @"author_name": @"", @"color": @"", @"fallback": @"", @"fields": @[ @{ @"short": @NO, @"title": @"", @"value": @"" } ], @"footer": @"", @"footer_icon": @"", @"giphy": @{ @"fixed_height": @{ @"frames": @"", @"height": @"", @"size": @"", @"url": @"", @"width": @"" }, @"fixed_height_downsampled": @{ }, @"fixed_height_still": @{ }, @"fixed_width": @{ }, @"fixed_width_downsampled": @{ }, @"fixed_width_still": @{ }, @"original": @{ } }, @"image_url": @"", @"og_scrape_url": @"", @"original_height": @"", @"original_width": @"", @"pretext": @"", @"text": @"", @"thumb_url": @"", @"title": @"", @"title_link": @"", @"type": @"" } ], @"channel_type": @"", @"defaults": @{ }, @"description": @"", @"name": @"", @"segment_id": @"", @"sender_id": @"", @"text": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/campaigns/: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}}/campaigns/:id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"campaign\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"channel_type\": \"\",\n \"defaults\": {},\n \"description\": \"\",\n \"name\": \"\",\n \"segment_id\": \"\",\n \"sender_id\": \"\",\n \"text\": \"\"\n }\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/campaigns/: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([
'campaign' => [
'attachments' => [
[
'actions' => [
[
'name' => '',
'style' => '',
'text' => '',
'type' => '',
'value' => ''
]
],
'asset_url' => '',
'author_icon' => '',
'author_link' => '',
'author_name' => '',
'color' => '',
'fallback' => '',
'fields' => [
[
'short' => null,
'title' => '',
'value' => ''
]
],
'footer' => '',
'footer_icon' => '',
'giphy' => [
'fixed_height' => [
'frames' => '',
'height' => '',
'size' => '',
'url' => '',
'width' => ''
],
'fixed_height_downsampled' => [
],
'fixed_height_still' => [
],
'fixed_width' => [
],
'fixed_width_downsampled' => [
],
'fixed_width_still' => [
],
'original' => [
]
],
'image_url' => '',
'og_scrape_url' => '',
'original_height' => '',
'original_width' => '',
'pretext' => '',
'text' => '',
'thumb_url' => '',
'title' => '',
'title_link' => '',
'type' => ''
]
],
'channel_type' => '',
'defaults' => [
],
'description' => '',
'name' => '',
'segment_id' => '',
'sender_id' => '',
'text' => ''
]
]),
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}}/campaigns/:id', [
'body' => '{
"campaign": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"channel_type": "",
"defaults": {},
"description": "",
"name": "",
"segment_id": "",
"sender_id": "",
"text": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/campaigns/:id');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'campaign' => [
'attachments' => [
[
'actions' => [
[
'name' => '',
'style' => '',
'text' => '',
'type' => '',
'value' => ''
]
],
'asset_url' => '',
'author_icon' => '',
'author_link' => '',
'author_name' => '',
'color' => '',
'fallback' => '',
'fields' => [
[
'short' => null,
'title' => '',
'value' => ''
]
],
'footer' => '',
'footer_icon' => '',
'giphy' => [
'fixed_height' => [
'frames' => '',
'height' => '',
'size' => '',
'url' => '',
'width' => ''
],
'fixed_height_downsampled' => [
],
'fixed_height_still' => [
],
'fixed_width' => [
],
'fixed_width_downsampled' => [
],
'fixed_width_still' => [
],
'original' => [
]
],
'image_url' => '',
'og_scrape_url' => '',
'original_height' => '',
'original_width' => '',
'pretext' => '',
'text' => '',
'thumb_url' => '',
'title' => '',
'title_link' => '',
'type' => ''
]
],
'channel_type' => '',
'defaults' => [
],
'description' => '',
'name' => '',
'segment_id' => '',
'sender_id' => '',
'text' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'campaign' => [
'attachments' => [
[
'actions' => [
[
'name' => '',
'style' => '',
'text' => '',
'type' => '',
'value' => ''
]
],
'asset_url' => '',
'author_icon' => '',
'author_link' => '',
'author_name' => '',
'color' => '',
'fallback' => '',
'fields' => [
[
'short' => null,
'title' => '',
'value' => ''
]
],
'footer' => '',
'footer_icon' => '',
'giphy' => [
'fixed_height' => [
'frames' => '',
'height' => '',
'size' => '',
'url' => '',
'width' => ''
],
'fixed_height_downsampled' => [
],
'fixed_height_still' => [
],
'fixed_width' => [
],
'fixed_width_downsampled' => [
],
'fixed_width_still' => [
],
'original' => [
]
],
'image_url' => '',
'og_scrape_url' => '',
'original_height' => '',
'original_width' => '',
'pretext' => '',
'text' => '',
'thumb_url' => '',
'title' => '',
'title_link' => '',
'type' => ''
]
],
'channel_type' => '',
'defaults' => [
],
'description' => '',
'name' => '',
'segment_id' => '',
'sender_id' => '',
'text' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/campaigns/: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}}/campaigns/:id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"campaign": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"channel_type": "",
"defaults": {},
"description": "",
"name": "",
"segment_id": "",
"sender_id": "",
"text": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/campaigns/:id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"campaign": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"channel_type": "",
"defaults": {},
"description": "",
"name": "",
"segment_id": "",
"sender_id": "",
"text": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"campaign\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"channel_type\": \"\",\n \"defaults\": {},\n \"description\": \"\",\n \"name\": \"\",\n \"segment_id\": \"\",\n \"sender_id\": \"\",\n \"text\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/campaigns/:id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/campaigns/:id"
payload = { "campaign": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": False,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"channel_type": "",
"defaults": {},
"description": "",
"name": "",
"segment_id": "",
"sender_id": "",
"text": ""
} }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/campaigns/:id"
payload <- "{\n \"campaign\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"channel_type\": \"\",\n \"defaults\": {},\n \"description\": \"\",\n \"name\": \"\",\n \"segment_id\": \"\",\n \"sender_id\": \"\",\n \"text\": \"\"\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}}/campaigns/: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 \"campaign\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"channel_type\": \"\",\n \"defaults\": {},\n \"description\": \"\",\n \"name\": \"\",\n \"segment_id\": \"\",\n \"sender_id\": \"\",\n \"text\": \"\"\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/campaigns/:id') do |req|
req.body = "{\n \"campaign\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"channel_type\": \"\",\n \"defaults\": {},\n \"description\": \"\",\n \"name\": \"\",\n \"segment_id\": \"\",\n \"sender_id\": \"\",\n \"text\": \"\"\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}}/campaigns/:id";
let payload = json!({"campaign": json!({
"attachments": (
json!({
"actions": (
json!({
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
})
),
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": (
json!({
"short": false,
"title": "",
"value": ""
})
),
"footer": "",
"footer_icon": "",
"giphy": json!({
"fixed_height": json!({
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
}),
"fixed_height_downsampled": json!({}),
"fixed_height_still": json!({}),
"fixed_width": json!({}),
"fixed_width_downsampled": json!({}),
"fixed_width_still": json!({}),
"original": json!({})
}),
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
})
),
"channel_type": "",
"defaults": json!({}),
"description": "",
"name": "",
"segment_id": "",
"sender_id": "",
"text": ""
})});
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}}/campaigns/:id \
--header 'content-type: application/json' \
--data '{
"campaign": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"channel_type": "",
"defaults": {},
"description": "",
"name": "",
"segment_id": "",
"sender_id": "",
"text": ""
}
}'
echo '{
"campaign": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"channel_type": "",
"defaults": {},
"description": "",
"name": "",
"segment_id": "",
"sender_id": "",
"text": ""
}
}' | \
http PUT {{baseUrl}}/campaigns/:id \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "campaign": {\n "attachments": [\n {\n "actions": [\n {\n "name": "",\n "style": "",\n "text": "",\n "type": "",\n "value": ""\n }\n ],\n "asset_url": "",\n "author_icon": "",\n "author_link": "",\n "author_name": "",\n "color": "",\n "fallback": "",\n "fields": [\n {\n "short": false,\n "title": "",\n "value": ""\n }\n ],\n "footer": "",\n "footer_icon": "",\n "giphy": {\n "fixed_height": {\n "frames": "",\n "height": "",\n "size": "",\n "url": "",\n "width": ""\n },\n "fixed_height_downsampled": {},\n "fixed_height_still": {},\n "fixed_width": {},\n "fixed_width_downsampled": {},\n "fixed_width_still": {},\n "original": {}\n },\n "image_url": "",\n "og_scrape_url": "",\n "original_height": "",\n "original_width": "",\n "pretext": "",\n "text": "",\n "thumb_url": "",\n "title": "",\n "title_link": "",\n "type": ""\n }\n ],\n "channel_type": "",\n "defaults": {},\n "description": "",\n "name": "",\n "segment_id": "",\n "sender_id": "",\n "text": ""\n }\n}' \
--output-document \
- {{baseUrl}}/campaigns/:id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["campaign": [
"attachments": [
[
"actions": [
[
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
]
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
[
"short": false,
"title": "",
"value": ""
]
],
"footer": "",
"footer_icon": "",
"giphy": [
"fixed_height": [
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
],
"fixed_height_downsampled": [],
"fixed_height_still": [],
"fixed_width": [],
"fixed_width_downsampled": [],
"fixed_width_still": [],
"original": []
],
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
]
],
"channel_type": "",
"defaults": [],
"description": "",
"name": "",
"segment_id": "",
"sender_id": "",
"text": ""
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/campaigns/: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()
PUT
Update segment
{{baseUrl}}/segments/:id
QUERY PARAMS
id
BODY json
{
"segment": {
"description": "",
"filter": {},
"name": "",
"type": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/segments/: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 \"segment\": {\n \"description\": \"\",\n \"filter\": {},\n \"name\": \"\",\n \"type\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/segments/:id" {:content-type :json
:form-params {:segment {:description ""
:filter {}
:name ""
:type ""}}})
require "http/client"
url = "{{baseUrl}}/segments/:id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"segment\": {\n \"description\": \"\",\n \"filter\": {},\n \"name\": \"\",\n \"type\": \"\"\n }\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/segments/:id"),
Content = new StringContent("{\n \"segment\": {\n \"description\": \"\",\n \"filter\": {},\n \"name\": \"\",\n \"type\": \"\"\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/segments/:id");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"segment\": {\n \"description\": \"\",\n \"filter\": {},\n \"name\": \"\",\n \"type\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/segments/:id"
payload := strings.NewReader("{\n \"segment\": {\n \"description\": \"\",\n \"filter\": {},\n \"name\": \"\",\n \"type\": \"\"\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/segments/:id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 94
{
"segment": {
"description": "",
"filter": {},
"name": "",
"type": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/segments/:id")
.setHeader("content-type", "application/json")
.setBody("{\n \"segment\": {\n \"description\": \"\",\n \"filter\": {},\n \"name\": \"\",\n \"type\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/segments/:id"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"segment\": {\n \"description\": \"\",\n \"filter\": {},\n \"name\": \"\",\n \"type\": \"\"\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"segment\": {\n \"description\": \"\",\n \"filter\": {},\n \"name\": \"\",\n \"type\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/segments/:id")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/segments/:id")
.header("content-type", "application/json")
.body("{\n \"segment\": {\n \"description\": \"\",\n \"filter\": {},\n \"name\": \"\",\n \"type\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
segment: {
description: '',
filter: {},
name: '',
type: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/segments/:id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/segments/:id',
headers: {'content-type': 'application/json'},
data: {segment: {description: '', filter: {}, name: '', type: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/segments/:id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"segment":{"description":"","filter":{},"name":"","type":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/segments/:id',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "segment": {\n "description": "",\n "filter": {},\n "name": "",\n "type": ""\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"segment\": {\n \"description\": \"\",\n \"filter\": {},\n \"name\": \"\",\n \"type\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/segments/: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/segments/: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({segment: {description: '', filter: {}, name: '', type: ''}}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/segments/:id',
headers: {'content-type': 'application/json'},
body: {segment: {description: '', filter: {}, name: '', type: ''}},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/segments/:id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
segment: {
description: '',
filter: {},
name: '',
type: ''
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/segments/:id',
headers: {'content-type': 'application/json'},
data: {segment: {description: '', filter: {}, name: '', type: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/segments/:id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"segment":{"description":"","filter":{},"name":"","type":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"segment": @{ @"description": @"", @"filter": @{ }, @"name": @"", @"type": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/segments/: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}}/segments/:id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"segment\": {\n \"description\": \"\",\n \"filter\": {},\n \"name\": \"\",\n \"type\": \"\"\n }\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/segments/: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([
'segment' => [
'description' => '',
'filter' => [
],
'name' => '',
'type' => ''
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/segments/:id', [
'body' => '{
"segment": {
"description": "",
"filter": {},
"name": "",
"type": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/segments/:id');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'segment' => [
'description' => '',
'filter' => [
],
'name' => '',
'type' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'segment' => [
'description' => '',
'filter' => [
],
'name' => '',
'type' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/segments/: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}}/segments/:id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"segment": {
"description": "",
"filter": {},
"name": "",
"type": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/segments/:id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"segment": {
"description": "",
"filter": {},
"name": "",
"type": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"segment\": {\n \"description\": \"\",\n \"filter\": {},\n \"name\": \"\",\n \"type\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/segments/:id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/segments/:id"
payload = { "segment": {
"description": "",
"filter": {},
"name": "",
"type": ""
} }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/segments/:id"
payload <- "{\n \"segment\": {\n \"description\": \"\",\n \"filter\": {},\n \"name\": \"\",\n \"type\": \"\"\n }\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/segments/: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 \"segment\": {\n \"description\": \"\",\n \"filter\": {},\n \"name\": \"\",\n \"type\": \"\"\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/segments/:id') do |req|
req.body = "{\n \"segment\": {\n \"description\": \"\",\n \"filter\": {},\n \"name\": \"\",\n \"type\": \"\"\n }\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/segments/:id";
let payload = json!({"segment": json!({
"description": "",
"filter": json!({}),
"name": "",
"type": ""
})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/segments/:id \
--header 'content-type: application/json' \
--data '{
"segment": {
"description": "",
"filter": {},
"name": "",
"type": ""
}
}'
echo '{
"segment": {
"description": "",
"filter": {},
"name": "",
"type": ""
}
}' | \
http PUT {{baseUrl}}/segments/:id \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "segment": {\n "description": "",\n "filter": {},\n "name": "",\n "type": ""\n }\n}' \
--output-document \
- {{baseUrl}}/segments/:id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["segment": [
"description": "",
"filter": [],
"name": "",
"type": ""
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/segments/: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()
DELETE
Delete channel
{{baseUrl}}/channels/:type/:id
QUERY PARAMS
type
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/channels/:type/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/channels/:type/:id")
require "http/client"
url = "{{baseUrl}}/channels/:type/: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}}/channels/:type/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/channels/:type/:id");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/channels/:type/: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/channels/:type/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/channels/:type/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/channels/:type/: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}}/channels/:type/:id")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/channels/:type/: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}}/channels/:type/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/channels/:type/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/channels/:type/: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}}/channels/:type/:id',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/channels/:type/: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/channels/:type/: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}}/channels/:type/: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}}/channels/:type/: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}}/channels/:type/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/channels/:type/: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}}/channels/:type/: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}}/channels/:type/:id" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/channels/:type/: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}}/channels/:type/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/channels/:type/:id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/channels/:type/:id');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/channels/:type/:id' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/channels/:type/:id' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/channels/:type/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/channels/:type/:id"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/channels/:type/:id"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/channels/:type/: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/channels/:type/: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}}/channels/:type/: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}}/channels/:type/:id
http DELETE {{baseUrl}}/channels/:type/:id
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/channels/:type/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/channels/:type/: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()
POST
Deletes channels asynchronously
{{baseUrl}}/channels/delete
BODY json
{
"cids": [],
"hard_delete": false
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/channels/delete");
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 \"cids\": [],\n \"hard_delete\": false\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/channels/delete" {:content-type :json
:form-params {:cids []
:hard_delete false}})
require "http/client"
url = "{{baseUrl}}/channels/delete"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cids\": [],\n \"hard_delete\": false\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/channels/delete"),
Content = new StringContent("{\n \"cids\": [],\n \"hard_delete\": false\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/channels/delete");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cids\": [],\n \"hard_delete\": false\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/channels/delete"
payload := strings.NewReader("{\n \"cids\": [],\n \"hard_delete\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/channels/delete HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 40
{
"cids": [],
"hard_delete": false
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/channels/delete")
.setHeader("content-type", "application/json")
.setBody("{\n \"cids\": [],\n \"hard_delete\": false\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/channels/delete"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"cids\": [],\n \"hard_delete\": false\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cids\": [],\n \"hard_delete\": false\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/channels/delete")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/channels/delete")
.header("content-type", "application/json")
.body("{\n \"cids\": [],\n \"hard_delete\": false\n}")
.asString();
const data = JSON.stringify({
cids: [],
hard_delete: false
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/channels/delete');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/delete',
headers: {'content-type': 'application/json'},
data: {cids: [], hard_delete: false}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/channels/delete';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cids":[],"hard_delete":false}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/channels/delete',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cids": [],\n "hard_delete": false\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cids\": [],\n \"hard_delete\": false\n}")
val request = Request.Builder()
.url("{{baseUrl}}/channels/delete")
.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/channels/delete',
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({cids: [], hard_delete: false}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/delete',
headers: {'content-type': 'application/json'},
body: {cids: [], hard_delete: false},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/channels/delete');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cids: [],
hard_delete: false
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/delete',
headers: {'content-type': 'application/json'},
data: {cids: [], hard_delete: false}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/channels/delete';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cids":[],"hard_delete":false}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"cids": @[ ],
@"hard_delete": @NO };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/channels/delete"]
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}}/channels/delete" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cids\": [],\n \"hard_delete\": false\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/channels/delete",
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([
'cids' => [
],
'hard_delete' => null
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/channels/delete', [
'body' => '{
"cids": [],
"hard_delete": false
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/channels/delete');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cids' => [
],
'hard_delete' => null
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cids' => [
],
'hard_delete' => null
]));
$request->setRequestUrl('{{baseUrl}}/channels/delete');
$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}}/channels/delete' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cids": [],
"hard_delete": false
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/channels/delete' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cids": [],
"hard_delete": false
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cids\": [],\n \"hard_delete\": false\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/channels/delete", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/channels/delete"
payload = {
"cids": [],
"hard_delete": False
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/channels/delete"
payload <- "{\n \"cids\": [],\n \"hard_delete\": false\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/channels/delete")
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 \"cids\": [],\n \"hard_delete\": false\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/channels/delete') do |req|
req.body = "{\n \"cids\": [],\n \"hard_delete\": false\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/channels/delete";
let payload = json!({
"cids": (),
"hard_delete": false
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/channels/delete \
--header 'content-type: application/json' \
--data '{
"cids": [],
"hard_delete": false
}'
echo '{
"cids": [],
"hard_delete": false
}' | \
http POST {{baseUrl}}/channels/delete \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "cids": [],\n "hard_delete": false\n}' \
--output-document \
- {{baseUrl}}/channels/delete
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cids": [],
"hard_delete": false
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/channels/delete")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Export channels status
{{baseUrl}}/export_channels/: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}}/export_channels/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/export_channels/:id")
require "http/client"
url = "{{baseUrl}}/export_channels/: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}}/export_channels/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/export_channels/:id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/export_channels/: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/export_channels/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/export_channels/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/export_channels/: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}}/export_channels/:id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/export_channels/: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}}/export_channels/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/export_channels/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/export_channels/: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}}/export_channels/:id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/export_channels/:id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/export_channels/: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}}/export_channels/: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}}/export_channels/: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}}/export_channels/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/export_channels/: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}}/export_channels/: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}}/export_channels/:id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/export_channels/: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}}/export_channels/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/export_channels/:id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/export_channels/:id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/export_channels/:id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/export_channels/:id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/export_channels/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/export_channels/:id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/export_channels/:id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/export_channels/: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/export_channels/:id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/export_channels/: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}}/export_channels/:id
http GET {{baseUrl}}/export_channels/:id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/export_channels/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/export_channels/:id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Export channels
{{baseUrl}}/export_channels
BODY json
{
"channels": [
{
"cid": "",
"id": "",
"messages_since": "",
"messages_until": "",
"type": ""
}
],
"clear_deleted_message_text": false,
"export_users": false,
"include_truncated_messages": false,
"version": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/export_channels");
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 \"channels\": [\n {\n \"cid\": \"\",\n \"id\": \"\",\n \"messages_since\": \"\",\n \"messages_until\": \"\",\n \"type\": \"\"\n }\n ],\n \"clear_deleted_message_text\": false,\n \"export_users\": false,\n \"include_truncated_messages\": false,\n \"version\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/export_channels" {:content-type :json
:form-params {:channels [{:cid ""
:id ""
:messages_since ""
:messages_until ""
:type ""}]
:clear_deleted_message_text false
:export_users false
:include_truncated_messages false
:version ""}})
require "http/client"
url = "{{baseUrl}}/export_channels"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"channels\": [\n {\n \"cid\": \"\",\n \"id\": \"\",\n \"messages_since\": \"\",\n \"messages_until\": \"\",\n \"type\": \"\"\n }\n ],\n \"clear_deleted_message_text\": false,\n \"export_users\": false,\n \"include_truncated_messages\": false,\n \"version\": \"\"\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}}/export_channels"),
Content = new StringContent("{\n \"channels\": [\n {\n \"cid\": \"\",\n \"id\": \"\",\n \"messages_since\": \"\",\n \"messages_until\": \"\",\n \"type\": \"\"\n }\n ],\n \"clear_deleted_message_text\": false,\n \"export_users\": false,\n \"include_truncated_messages\": false,\n \"version\": \"\"\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}}/export_channels");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"channels\": [\n {\n \"cid\": \"\",\n \"id\": \"\",\n \"messages_since\": \"\",\n \"messages_until\": \"\",\n \"type\": \"\"\n }\n ],\n \"clear_deleted_message_text\": false,\n \"export_users\": false,\n \"include_truncated_messages\": false,\n \"version\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/export_channels"
payload := strings.NewReader("{\n \"channels\": [\n {\n \"cid\": \"\",\n \"id\": \"\",\n \"messages_since\": \"\",\n \"messages_until\": \"\",\n \"type\": \"\"\n }\n ],\n \"clear_deleted_message_text\": false,\n \"export_users\": false,\n \"include_truncated_messages\": false,\n \"version\": \"\"\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/export_channels HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 261
{
"channels": [
{
"cid": "",
"id": "",
"messages_since": "",
"messages_until": "",
"type": ""
}
],
"clear_deleted_message_text": false,
"export_users": false,
"include_truncated_messages": false,
"version": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/export_channels")
.setHeader("content-type", "application/json")
.setBody("{\n \"channels\": [\n {\n \"cid\": \"\",\n \"id\": \"\",\n \"messages_since\": \"\",\n \"messages_until\": \"\",\n \"type\": \"\"\n }\n ],\n \"clear_deleted_message_text\": false,\n \"export_users\": false,\n \"include_truncated_messages\": false,\n \"version\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/export_channels"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"channels\": [\n {\n \"cid\": \"\",\n \"id\": \"\",\n \"messages_since\": \"\",\n \"messages_until\": \"\",\n \"type\": \"\"\n }\n ],\n \"clear_deleted_message_text\": false,\n \"export_users\": false,\n \"include_truncated_messages\": false,\n \"version\": \"\"\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 \"channels\": [\n {\n \"cid\": \"\",\n \"id\": \"\",\n \"messages_since\": \"\",\n \"messages_until\": \"\",\n \"type\": \"\"\n }\n ],\n \"clear_deleted_message_text\": false,\n \"export_users\": false,\n \"include_truncated_messages\": false,\n \"version\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/export_channels")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/export_channels")
.header("content-type", "application/json")
.body("{\n \"channels\": [\n {\n \"cid\": \"\",\n \"id\": \"\",\n \"messages_since\": \"\",\n \"messages_until\": \"\",\n \"type\": \"\"\n }\n ],\n \"clear_deleted_message_text\": false,\n \"export_users\": false,\n \"include_truncated_messages\": false,\n \"version\": \"\"\n}")
.asString();
const data = JSON.stringify({
channels: [
{
cid: '',
id: '',
messages_since: '',
messages_until: '',
type: ''
}
],
clear_deleted_message_text: false,
export_users: false,
include_truncated_messages: false,
version: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/export_channels');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/export_channels',
headers: {'content-type': 'application/json'},
data: {
channels: [{cid: '', id: '', messages_since: '', messages_until: '', type: ''}],
clear_deleted_message_text: false,
export_users: false,
include_truncated_messages: false,
version: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/export_channels';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"channels":[{"cid":"","id":"","messages_since":"","messages_until":"","type":""}],"clear_deleted_message_text":false,"export_users":false,"include_truncated_messages":false,"version":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/export_channels',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "channels": [\n {\n "cid": "",\n "id": "",\n "messages_since": "",\n "messages_until": "",\n "type": ""\n }\n ],\n "clear_deleted_message_text": false,\n "export_users": false,\n "include_truncated_messages": false,\n "version": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"channels\": [\n {\n \"cid\": \"\",\n \"id\": \"\",\n \"messages_since\": \"\",\n \"messages_until\": \"\",\n \"type\": \"\"\n }\n ],\n \"clear_deleted_message_text\": false,\n \"export_users\": false,\n \"include_truncated_messages\": false,\n \"version\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/export_channels")
.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/export_channels',
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({
channels: [{cid: '', id: '', messages_since: '', messages_until: '', type: ''}],
clear_deleted_message_text: false,
export_users: false,
include_truncated_messages: false,
version: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/export_channels',
headers: {'content-type': 'application/json'},
body: {
channels: [{cid: '', id: '', messages_since: '', messages_until: '', type: ''}],
clear_deleted_message_text: false,
export_users: false,
include_truncated_messages: false,
version: ''
},
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}}/export_channels');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
channels: [
{
cid: '',
id: '',
messages_since: '',
messages_until: '',
type: ''
}
],
clear_deleted_message_text: false,
export_users: false,
include_truncated_messages: false,
version: ''
});
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}}/export_channels',
headers: {'content-type': 'application/json'},
data: {
channels: [{cid: '', id: '', messages_since: '', messages_until: '', type: ''}],
clear_deleted_message_text: false,
export_users: false,
include_truncated_messages: false,
version: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/export_channels';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"channels":[{"cid":"","id":"","messages_since":"","messages_until":"","type":""}],"clear_deleted_message_text":false,"export_users":false,"include_truncated_messages":false,"version":""}'
};
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 = @{ @"channels": @[ @{ @"cid": @"", @"id": @"", @"messages_since": @"", @"messages_until": @"", @"type": @"" } ],
@"clear_deleted_message_text": @NO,
@"export_users": @NO,
@"include_truncated_messages": @NO,
@"version": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/export_channels"]
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}}/export_channels" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"channels\": [\n {\n \"cid\": \"\",\n \"id\": \"\",\n \"messages_since\": \"\",\n \"messages_until\": \"\",\n \"type\": \"\"\n }\n ],\n \"clear_deleted_message_text\": false,\n \"export_users\": false,\n \"include_truncated_messages\": false,\n \"version\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/export_channels",
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([
'channels' => [
[
'cid' => '',
'id' => '',
'messages_since' => '',
'messages_until' => '',
'type' => ''
]
],
'clear_deleted_message_text' => null,
'export_users' => null,
'include_truncated_messages' => null,
'version' => ''
]),
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}}/export_channels', [
'body' => '{
"channels": [
{
"cid": "",
"id": "",
"messages_since": "",
"messages_until": "",
"type": ""
}
],
"clear_deleted_message_text": false,
"export_users": false,
"include_truncated_messages": false,
"version": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/export_channels');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'channels' => [
[
'cid' => '',
'id' => '',
'messages_since' => '',
'messages_until' => '',
'type' => ''
]
],
'clear_deleted_message_text' => null,
'export_users' => null,
'include_truncated_messages' => null,
'version' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'channels' => [
[
'cid' => '',
'id' => '',
'messages_since' => '',
'messages_until' => '',
'type' => ''
]
],
'clear_deleted_message_text' => null,
'export_users' => null,
'include_truncated_messages' => null,
'version' => ''
]));
$request->setRequestUrl('{{baseUrl}}/export_channels');
$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}}/export_channels' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"channels": [
{
"cid": "",
"id": "",
"messages_since": "",
"messages_until": "",
"type": ""
}
],
"clear_deleted_message_text": false,
"export_users": false,
"include_truncated_messages": false,
"version": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/export_channels' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"channels": [
{
"cid": "",
"id": "",
"messages_since": "",
"messages_until": "",
"type": ""
}
],
"clear_deleted_message_text": false,
"export_users": false,
"include_truncated_messages": false,
"version": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"channels\": [\n {\n \"cid\": \"\",\n \"id\": \"\",\n \"messages_since\": \"\",\n \"messages_until\": \"\",\n \"type\": \"\"\n }\n ],\n \"clear_deleted_message_text\": false,\n \"export_users\": false,\n \"include_truncated_messages\": false,\n \"version\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/export_channels", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/export_channels"
payload = {
"channels": [
{
"cid": "",
"id": "",
"messages_since": "",
"messages_until": "",
"type": ""
}
],
"clear_deleted_message_text": False,
"export_users": False,
"include_truncated_messages": False,
"version": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/export_channels"
payload <- "{\n \"channels\": [\n {\n \"cid\": \"\",\n \"id\": \"\",\n \"messages_since\": \"\",\n \"messages_until\": \"\",\n \"type\": \"\"\n }\n ],\n \"clear_deleted_message_text\": false,\n \"export_users\": false,\n \"include_truncated_messages\": false,\n \"version\": \"\"\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}}/export_channels")
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 \"channels\": [\n {\n \"cid\": \"\",\n \"id\": \"\",\n \"messages_since\": \"\",\n \"messages_until\": \"\",\n \"type\": \"\"\n }\n ],\n \"clear_deleted_message_text\": false,\n \"export_users\": false,\n \"include_truncated_messages\": false,\n \"version\": \"\"\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/export_channels') do |req|
req.body = "{\n \"channels\": [\n {\n \"cid\": \"\",\n \"id\": \"\",\n \"messages_since\": \"\",\n \"messages_until\": \"\",\n \"type\": \"\"\n }\n ],\n \"clear_deleted_message_text\": false,\n \"export_users\": false,\n \"include_truncated_messages\": false,\n \"version\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/export_channels";
let payload = json!({
"channels": (
json!({
"cid": "",
"id": "",
"messages_since": "",
"messages_until": "",
"type": ""
})
),
"clear_deleted_message_text": false,
"export_users": false,
"include_truncated_messages": false,
"version": ""
});
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}}/export_channels \
--header 'content-type: application/json' \
--data '{
"channels": [
{
"cid": "",
"id": "",
"messages_since": "",
"messages_until": "",
"type": ""
}
],
"clear_deleted_message_text": false,
"export_users": false,
"include_truncated_messages": false,
"version": ""
}'
echo '{
"channels": [
{
"cid": "",
"id": "",
"messages_since": "",
"messages_until": "",
"type": ""
}
],
"clear_deleted_message_text": false,
"export_users": false,
"include_truncated_messages": false,
"version": ""
}' | \
http POST {{baseUrl}}/export_channels \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "channels": [\n {\n "cid": "",\n "id": "",\n "messages_since": "",\n "messages_until": "",\n "type": ""\n }\n ],\n "clear_deleted_message_text": false,\n "export_users": false,\n "include_truncated_messages": false,\n "version": ""\n}' \
--output-document \
- {{baseUrl}}/export_channels
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"channels": [
[
"cid": "",
"id": "",
"messages_since": "",
"messages_until": "",
"type": ""
]
],
"clear_deleted_message_text": false,
"export_users": false,
"include_truncated_messages": false,
"version": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/export_channels")! 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
Get or create channel (type)
{{baseUrl}}/channels/:type/query
QUERY PARAMS
type
BODY json
{
"client_id": "",
"connection_id": "",
"data": {
"auto_translation_enabled": false,
"auto_translation_language": "",
"config_overrides": {
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"grants": {},
"max_message_length": "",
"quotes": false,
"reactions": false,
"replies": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
},
"created_by": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"disabled": false,
"frozen": false,
"members": [
{
"ban_expires": "",
"banned": false,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": false,
"is_moderator": false,
"role": "",
"shadow_banned": false,
"updated_at": "",
"user": {},
"user_id": ""
}
],
"own_capabilities": [],
"team": "",
"truncated_at": [],
"truncated_by": [],
"truncated_by_id": ""
},
"members": {
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
},
"messages": {
"created_at_after": "",
"created_at_after_or_equal": "",
"created_at_around": "",
"created_at_before": "",
"created_at_before_or_equal": "",
"id_around": "",
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
},
"presence": false,
"state": false,
"watch": false,
"watchers": {}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/channels/:type/query");
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 \"client_id\": \"\",\n \"connection_id\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"members\": {\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"messages\": {\n \"created_at_after\": \"\",\n \"created_at_after_or_equal\": \"\",\n \"created_at_around\": \"\",\n \"created_at_before\": \"\",\n \"created_at_before_or_equal\": \"\",\n \"id_around\": \"\",\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"presence\": false,\n \"state\": false,\n \"watch\": false,\n \"watchers\": {}\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/channels/:type/query" {:content-type :json
:form-params {:client_id ""
:connection_id ""
:data {:auto_translation_enabled false
:auto_translation_language ""
:config_overrides {:blocklist ""
:blocklist_behavior ""
:commands []
:grants {}
:max_message_length ""
:quotes false
:reactions false
:replies false
:typing_events false
:uploads false
:url_enrichment false}
:created_by {:ban_expires ""
:banned false
:id ""
:invisible false
:language ""
:push_notifications {:disabled false
:disabled_until ""}
:revoke_tokens_issued_before ""
:role ""
:teams []}
:disabled false
:frozen false
:members [{:ban_expires ""
:banned false
:channel_role ""
:created_at ""
:deleted_at ""
:invite_accepted_at ""
:invite_rejected_at ""
:invited false
:is_moderator false
:role ""
:shadow_banned false
:updated_at ""
:user {}
:user_id ""}]
:own_capabilities []
:team ""
:truncated_at []
:truncated_by []
:truncated_by_id ""}
:members {:id_gt ""
:id_gte ""
:id_lt ""
:id_lte ""
:limit ""
:offset ""}
:messages {:created_at_after ""
:created_at_after_or_equal ""
:created_at_around ""
:created_at_before ""
:created_at_before_or_equal ""
:id_around ""
:id_gt ""
:id_gte ""
:id_lt ""
:id_lte ""
:limit ""
:offset ""}
:presence false
:state false
:watch false
:watchers {}}})
require "http/client"
url = "{{baseUrl}}/channels/:type/query"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"members\": {\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"messages\": {\n \"created_at_after\": \"\",\n \"created_at_after_or_equal\": \"\",\n \"created_at_around\": \"\",\n \"created_at_before\": \"\",\n \"created_at_before_or_equal\": \"\",\n \"id_around\": \"\",\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"presence\": false,\n \"state\": false,\n \"watch\": false,\n \"watchers\": {}\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}}/channels/:type/query"),
Content = new StringContent("{\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"members\": {\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"messages\": {\n \"created_at_after\": \"\",\n \"created_at_after_or_equal\": \"\",\n \"created_at_around\": \"\",\n \"created_at_before\": \"\",\n \"created_at_before_or_equal\": \"\",\n \"id_around\": \"\",\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"presence\": false,\n \"state\": false,\n \"watch\": false,\n \"watchers\": {}\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}}/channels/:type/query");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"members\": {\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"messages\": {\n \"created_at_after\": \"\",\n \"created_at_after_or_equal\": \"\",\n \"created_at_around\": \"\",\n \"created_at_before\": \"\",\n \"created_at_before_or_equal\": \"\",\n \"id_around\": \"\",\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"presence\": false,\n \"state\": false,\n \"watch\": false,\n \"watchers\": {}\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/channels/:type/query"
payload := strings.NewReader("{\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"members\": {\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"messages\": {\n \"created_at_after\": \"\",\n \"created_at_after_or_equal\": \"\",\n \"created_at_around\": \"\",\n \"created_at_before\": \"\",\n \"created_at_before_or_equal\": \"\",\n \"id_around\": \"\",\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"presence\": false,\n \"state\": false,\n \"watch\": false,\n \"watchers\": {}\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/channels/:type/query HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 1852
{
"client_id": "",
"connection_id": "",
"data": {
"auto_translation_enabled": false,
"auto_translation_language": "",
"config_overrides": {
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"grants": {},
"max_message_length": "",
"quotes": false,
"reactions": false,
"replies": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
},
"created_by": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"disabled": false,
"frozen": false,
"members": [
{
"ban_expires": "",
"banned": false,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": false,
"is_moderator": false,
"role": "",
"shadow_banned": false,
"updated_at": "",
"user": {},
"user_id": ""
}
],
"own_capabilities": [],
"team": "",
"truncated_at": [],
"truncated_by": [],
"truncated_by_id": ""
},
"members": {
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
},
"messages": {
"created_at_after": "",
"created_at_after_or_equal": "",
"created_at_around": "",
"created_at_before": "",
"created_at_before_or_equal": "",
"id_around": "",
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
},
"presence": false,
"state": false,
"watch": false,
"watchers": {}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/channels/:type/query")
.setHeader("content-type", "application/json")
.setBody("{\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"members\": {\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"messages\": {\n \"created_at_after\": \"\",\n \"created_at_after_or_equal\": \"\",\n \"created_at_around\": \"\",\n \"created_at_before\": \"\",\n \"created_at_before_or_equal\": \"\",\n \"id_around\": \"\",\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"presence\": false,\n \"state\": false,\n \"watch\": false,\n \"watchers\": {}\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/channels/:type/query"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"members\": {\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"messages\": {\n \"created_at_after\": \"\",\n \"created_at_after_or_equal\": \"\",\n \"created_at_around\": \"\",\n \"created_at_before\": \"\",\n \"created_at_before_or_equal\": \"\",\n \"id_around\": \"\",\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"presence\": false,\n \"state\": false,\n \"watch\": false,\n \"watchers\": {}\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 \"client_id\": \"\",\n \"connection_id\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"members\": {\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"messages\": {\n \"created_at_after\": \"\",\n \"created_at_after_or_equal\": \"\",\n \"created_at_around\": \"\",\n \"created_at_before\": \"\",\n \"created_at_before_or_equal\": \"\",\n \"id_around\": \"\",\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"presence\": false,\n \"state\": false,\n \"watch\": false,\n \"watchers\": {}\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/channels/:type/query")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/channels/:type/query")
.header("content-type", "application/json")
.body("{\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"members\": {\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"messages\": {\n \"created_at_after\": \"\",\n \"created_at_after_or_equal\": \"\",\n \"created_at_around\": \"\",\n \"created_at_before\": \"\",\n \"created_at_before_or_equal\": \"\",\n \"id_around\": \"\",\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"presence\": false,\n \"state\": false,\n \"watch\": false,\n \"watchers\": {}\n}")
.asString();
const data = JSON.stringify({
client_id: '',
connection_id: '',
data: {
auto_translation_enabled: false,
auto_translation_language: '',
config_overrides: {
blocklist: '',
blocklist_behavior: '',
commands: [],
grants: {},
max_message_length: '',
quotes: false,
reactions: false,
replies: false,
typing_events: false,
uploads: false,
url_enrichment: false
},
created_by: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
disabled: false,
frozen: false,
members: [
{
ban_expires: '',
banned: false,
channel_role: '',
created_at: '',
deleted_at: '',
invite_accepted_at: '',
invite_rejected_at: '',
invited: false,
is_moderator: false,
role: '',
shadow_banned: false,
updated_at: '',
user: {},
user_id: ''
}
],
own_capabilities: [],
team: '',
truncated_at: [],
truncated_by: [],
truncated_by_id: ''
},
members: {
id_gt: '',
id_gte: '',
id_lt: '',
id_lte: '',
limit: '',
offset: ''
},
messages: {
created_at_after: '',
created_at_after_or_equal: '',
created_at_around: '',
created_at_before: '',
created_at_before_or_equal: '',
id_around: '',
id_gt: '',
id_gte: '',
id_lt: '',
id_lte: '',
limit: '',
offset: ''
},
presence: false,
state: false,
watch: false,
watchers: {}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/channels/:type/query');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:type/query',
headers: {'content-type': 'application/json'},
data: {
client_id: '',
connection_id: '',
data: {
auto_translation_enabled: false,
auto_translation_language: '',
config_overrides: {
blocklist: '',
blocklist_behavior: '',
commands: [],
grants: {},
max_message_length: '',
quotes: false,
reactions: false,
replies: false,
typing_events: false,
uploads: false,
url_enrichment: false
},
created_by: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
disabled: false,
frozen: false,
members: [
{
ban_expires: '',
banned: false,
channel_role: '',
created_at: '',
deleted_at: '',
invite_accepted_at: '',
invite_rejected_at: '',
invited: false,
is_moderator: false,
role: '',
shadow_banned: false,
updated_at: '',
user: {},
user_id: ''
}
],
own_capabilities: [],
team: '',
truncated_at: [],
truncated_by: [],
truncated_by_id: ''
},
members: {id_gt: '', id_gte: '', id_lt: '', id_lte: '', limit: '', offset: ''},
messages: {
created_at_after: '',
created_at_after_or_equal: '',
created_at_around: '',
created_at_before: '',
created_at_before_or_equal: '',
id_around: '',
id_gt: '',
id_gte: '',
id_lt: '',
id_lte: '',
limit: '',
offset: ''
},
presence: false,
state: false,
watch: false,
watchers: {}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/channels/:type/query';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"client_id":"","connection_id":"","data":{"auto_translation_enabled":false,"auto_translation_language":"","config_overrides":{"blocklist":"","blocklist_behavior":"","commands":[],"grants":{},"max_message_length":"","quotes":false,"reactions":false,"replies":false,"typing_events":false,"uploads":false,"url_enrichment":false},"created_by":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"disabled":false,"frozen":false,"members":[{"ban_expires":"","banned":false,"channel_role":"","created_at":"","deleted_at":"","invite_accepted_at":"","invite_rejected_at":"","invited":false,"is_moderator":false,"role":"","shadow_banned":false,"updated_at":"","user":{},"user_id":""}],"own_capabilities":[],"team":"","truncated_at":[],"truncated_by":[],"truncated_by_id":""},"members":{"id_gt":"","id_gte":"","id_lt":"","id_lte":"","limit":"","offset":""},"messages":{"created_at_after":"","created_at_after_or_equal":"","created_at_around":"","created_at_before":"","created_at_before_or_equal":"","id_around":"","id_gt":"","id_gte":"","id_lt":"","id_lte":"","limit":"","offset":""},"presence":false,"state":false,"watch":false,"watchers":{}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/channels/:type/query',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "client_id": "",\n "connection_id": "",\n "data": {\n "auto_translation_enabled": false,\n "auto_translation_language": "",\n "config_overrides": {\n "blocklist": "",\n "blocklist_behavior": "",\n "commands": [],\n "grants": {},\n "max_message_length": "",\n "quotes": false,\n "reactions": false,\n "replies": false,\n "typing_events": false,\n "uploads": false,\n "url_enrichment": false\n },\n "created_by": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "disabled": false,\n "frozen": false,\n "members": [\n {\n "ban_expires": "",\n "banned": false,\n "channel_role": "",\n "created_at": "",\n "deleted_at": "",\n "invite_accepted_at": "",\n "invite_rejected_at": "",\n "invited": false,\n "is_moderator": false,\n "role": "",\n "shadow_banned": false,\n "updated_at": "",\n "user": {},\n "user_id": ""\n }\n ],\n "own_capabilities": [],\n "team": "",\n "truncated_at": [],\n "truncated_by": [],\n "truncated_by_id": ""\n },\n "members": {\n "id_gt": "",\n "id_gte": "",\n "id_lt": "",\n "id_lte": "",\n "limit": "",\n "offset": ""\n },\n "messages": {\n "created_at_after": "",\n "created_at_after_or_equal": "",\n "created_at_around": "",\n "created_at_before": "",\n "created_at_before_or_equal": "",\n "id_around": "",\n "id_gt": "",\n "id_gte": "",\n "id_lt": "",\n "id_lte": "",\n "limit": "",\n "offset": ""\n },\n "presence": false,\n "state": false,\n "watch": false,\n "watchers": {}\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"members\": {\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"messages\": {\n \"created_at_after\": \"\",\n \"created_at_after_or_equal\": \"\",\n \"created_at_around\": \"\",\n \"created_at_before\": \"\",\n \"created_at_before_or_equal\": \"\",\n \"id_around\": \"\",\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"presence\": false,\n \"state\": false,\n \"watch\": false,\n \"watchers\": {}\n}")
val request = Request.Builder()
.url("{{baseUrl}}/channels/:type/query")
.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/channels/:type/query',
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({
client_id: '',
connection_id: '',
data: {
auto_translation_enabled: false,
auto_translation_language: '',
config_overrides: {
blocklist: '',
blocklist_behavior: '',
commands: [],
grants: {},
max_message_length: '',
quotes: false,
reactions: false,
replies: false,
typing_events: false,
uploads: false,
url_enrichment: false
},
created_by: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
disabled: false,
frozen: false,
members: [
{
ban_expires: '',
banned: false,
channel_role: '',
created_at: '',
deleted_at: '',
invite_accepted_at: '',
invite_rejected_at: '',
invited: false,
is_moderator: false,
role: '',
shadow_banned: false,
updated_at: '',
user: {},
user_id: ''
}
],
own_capabilities: [],
team: '',
truncated_at: [],
truncated_by: [],
truncated_by_id: ''
},
members: {id_gt: '', id_gte: '', id_lt: '', id_lte: '', limit: '', offset: ''},
messages: {
created_at_after: '',
created_at_after_or_equal: '',
created_at_around: '',
created_at_before: '',
created_at_before_or_equal: '',
id_around: '',
id_gt: '',
id_gte: '',
id_lt: '',
id_lte: '',
limit: '',
offset: ''
},
presence: false,
state: false,
watch: false,
watchers: {}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:type/query',
headers: {'content-type': 'application/json'},
body: {
client_id: '',
connection_id: '',
data: {
auto_translation_enabled: false,
auto_translation_language: '',
config_overrides: {
blocklist: '',
blocklist_behavior: '',
commands: [],
grants: {},
max_message_length: '',
quotes: false,
reactions: false,
replies: false,
typing_events: false,
uploads: false,
url_enrichment: false
},
created_by: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
disabled: false,
frozen: false,
members: [
{
ban_expires: '',
banned: false,
channel_role: '',
created_at: '',
deleted_at: '',
invite_accepted_at: '',
invite_rejected_at: '',
invited: false,
is_moderator: false,
role: '',
shadow_banned: false,
updated_at: '',
user: {},
user_id: ''
}
],
own_capabilities: [],
team: '',
truncated_at: [],
truncated_by: [],
truncated_by_id: ''
},
members: {id_gt: '', id_gte: '', id_lt: '', id_lte: '', limit: '', offset: ''},
messages: {
created_at_after: '',
created_at_after_or_equal: '',
created_at_around: '',
created_at_before: '',
created_at_before_or_equal: '',
id_around: '',
id_gt: '',
id_gte: '',
id_lt: '',
id_lte: '',
limit: '',
offset: ''
},
presence: false,
state: false,
watch: false,
watchers: {}
},
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}}/channels/:type/query');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
client_id: '',
connection_id: '',
data: {
auto_translation_enabled: false,
auto_translation_language: '',
config_overrides: {
blocklist: '',
blocklist_behavior: '',
commands: [],
grants: {},
max_message_length: '',
quotes: false,
reactions: false,
replies: false,
typing_events: false,
uploads: false,
url_enrichment: false
},
created_by: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
disabled: false,
frozen: false,
members: [
{
ban_expires: '',
banned: false,
channel_role: '',
created_at: '',
deleted_at: '',
invite_accepted_at: '',
invite_rejected_at: '',
invited: false,
is_moderator: false,
role: '',
shadow_banned: false,
updated_at: '',
user: {},
user_id: ''
}
],
own_capabilities: [],
team: '',
truncated_at: [],
truncated_by: [],
truncated_by_id: ''
},
members: {
id_gt: '',
id_gte: '',
id_lt: '',
id_lte: '',
limit: '',
offset: ''
},
messages: {
created_at_after: '',
created_at_after_or_equal: '',
created_at_around: '',
created_at_before: '',
created_at_before_or_equal: '',
id_around: '',
id_gt: '',
id_gte: '',
id_lt: '',
id_lte: '',
limit: '',
offset: ''
},
presence: false,
state: false,
watch: false,
watchers: {}
});
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}}/channels/:type/query',
headers: {'content-type': 'application/json'},
data: {
client_id: '',
connection_id: '',
data: {
auto_translation_enabled: false,
auto_translation_language: '',
config_overrides: {
blocklist: '',
blocklist_behavior: '',
commands: [],
grants: {},
max_message_length: '',
quotes: false,
reactions: false,
replies: false,
typing_events: false,
uploads: false,
url_enrichment: false
},
created_by: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
disabled: false,
frozen: false,
members: [
{
ban_expires: '',
banned: false,
channel_role: '',
created_at: '',
deleted_at: '',
invite_accepted_at: '',
invite_rejected_at: '',
invited: false,
is_moderator: false,
role: '',
shadow_banned: false,
updated_at: '',
user: {},
user_id: ''
}
],
own_capabilities: [],
team: '',
truncated_at: [],
truncated_by: [],
truncated_by_id: ''
},
members: {id_gt: '', id_gte: '', id_lt: '', id_lte: '', limit: '', offset: ''},
messages: {
created_at_after: '',
created_at_after_or_equal: '',
created_at_around: '',
created_at_before: '',
created_at_before_or_equal: '',
id_around: '',
id_gt: '',
id_gte: '',
id_lt: '',
id_lte: '',
limit: '',
offset: ''
},
presence: false,
state: false,
watch: false,
watchers: {}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/channels/:type/query';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"client_id":"","connection_id":"","data":{"auto_translation_enabled":false,"auto_translation_language":"","config_overrides":{"blocklist":"","blocklist_behavior":"","commands":[],"grants":{},"max_message_length":"","quotes":false,"reactions":false,"replies":false,"typing_events":false,"uploads":false,"url_enrichment":false},"created_by":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"disabled":false,"frozen":false,"members":[{"ban_expires":"","banned":false,"channel_role":"","created_at":"","deleted_at":"","invite_accepted_at":"","invite_rejected_at":"","invited":false,"is_moderator":false,"role":"","shadow_banned":false,"updated_at":"","user":{},"user_id":""}],"own_capabilities":[],"team":"","truncated_at":[],"truncated_by":[],"truncated_by_id":""},"members":{"id_gt":"","id_gte":"","id_lt":"","id_lte":"","limit":"","offset":""},"messages":{"created_at_after":"","created_at_after_or_equal":"","created_at_around":"","created_at_before":"","created_at_before_or_equal":"","id_around":"","id_gt":"","id_gte":"","id_lt":"","id_lte":"","limit":"","offset":""},"presence":false,"state":false,"watch":false,"watchers":{}}'
};
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 = @{ @"client_id": @"",
@"connection_id": @"",
@"data": @{ @"auto_translation_enabled": @NO, @"auto_translation_language": @"", @"config_overrides": @{ @"blocklist": @"", @"blocklist_behavior": @"", @"commands": @[ ], @"grants": @{ }, @"max_message_length": @"", @"quotes": @NO, @"reactions": @NO, @"replies": @NO, @"typing_events": @NO, @"uploads": @NO, @"url_enrichment": @NO }, @"created_by": @{ @"ban_expires": @"", @"banned": @NO, @"id": @"", @"invisible": @NO, @"language": @"", @"push_notifications": @{ @"disabled": @NO, @"disabled_until": @"" }, @"revoke_tokens_issued_before": @"", @"role": @"", @"teams": @[ ] }, @"disabled": @NO, @"frozen": @NO, @"members": @[ @{ @"ban_expires": @"", @"banned": @NO, @"channel_role": @"", @"created_at": @"", @"deleted_at": @"", @"invite_accepted_at": @"", @"invite_rejected_at": @"", @"invited": @NO, @"is_moderator": @NO, @"role": @"", @"shadow_banned": @NO, @"updated_at": @"", @"user": @{ }, @"user_id": @"" } ], @"own_capabilities": @[ ], @"team": @"", @"truncated_at": @[ ], @"truncated_by": @[ ], @"truncated_by_id": @"" },
@"members": @{ @"id_gt": @"", @"id_gte": @"", @"id_lt": @"", @"id_lte": @"", @"limit": @"", @"offset": @"" },
@"messages": @{ @"created_at_after": @"", @"created_at_after_or_equal": @"", @"created_at_around": @"", @"created_at_before": @"", @"created_at_before_or_equal": @"", @"id_around": @"", @"id_gt": @"", @"id_gte": @"", @"id_lt": @"", @"id_lte": @"", @"limit": @"", @"offset": @"" },
@"presence": @NO,
@"state": @NO,
@"watch": @NO,
@"watchers": @{ } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/channels/:type/query"]
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}}/channels/:type/query" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"members\": {\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"messages\": {\n \"created_at_after\": \"\",\n \"created_at_after_or_equal\": \"\",\n \"created_at_around\": \"\",\n \"created_at_before\": \"\",\n \"created_at_before_or_equal\": \"\",\n \"id_around\": \"\",\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"presence\": false,\n \"state\": false,\n \"watch\": false,\n \"watchers\": {}\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/channels/:type/query",
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([
'client_id' => '',
'connection_id' => '',
'data' => [
'auto_translation_enabled' => null,
'auto_translation_language' => '',
'config_overrides' => [
'blocklist' => '',
'blocklist_behavior' => '',
'commands' => [
],
'grants' => [
],
'max_message_length' => '',
'quotes' => null,
'reactions' => null,
'replies' => null,
'typing_events' => null,
'uploads' => null,
'url_enrichment' => null
],
'created_by' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'disabled' => null,
'frozen' => null,
'members' => [
[
'ban_expires' => '',
'banned' => null,
'channel_role' => '',
'created_at' => '',
'deleted_at' => '',
'invite_accepted_at' => '',
'invite_rejected_at' => '',
'invited' => null,
'is_moderator' => null,
'role' => '',
'shadow_banned' => null,
'updated_at' => '',
'user' => [
],
'user_id' => ''
]
],
'own_capabilities' => [
],
'team' => '',
'truncated_at' => [
],
'truncated_by' => [
],
'truncated_by_id' => ''
],
'members' => [
'id_gt' => '',
'id_gte' => '',
'id_lt' => '',
'id_lte' => '',
'limit' => '',
'offset' => ''
],
'messages' => [
'created_at_after' => '',
'created_at_after_or_equal' => '',
'created_at_around' => '',
'created_at_before' => '',
'created_at_before_or_equal' => '',
'id_around' => '',
'id_gt' => '',
'id_gte' => '',
'id_lt' => '',
'id_lte' => '',
'limit' => '',
'offset' => ''
],
'presence' => null,
'state' => null,
'watch' => null,
'watchers' => [
]
]),
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}}/channels/:type/query', [
'body' => '{
"client_id": "",
"connection_id": "",
"data": {
"auto_translation_enabled": false,
"auto_translation_language": "",
"config_overrides": {
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"grants": {},
"max_message_length": "",
"quotes": false,
"reactions": false,
"replies": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
},
"created_by": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"disabled": false,
"frozen": false,
"members": [
{
"ban_expires": "",
"banned": false,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": false,
"is_moderator": false,
"role": "",
"shadow_banned": false,
"updated_at": "",
"user": {},
"user_id": ""
}
],
"own_capabilities": [],
"team": "",
"truncated_at": [],
"truncated_by": [],
"truncated_by_id": ""
},
"members": {
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
},
"messages": {
"created_at_after": "",
"created_at_after_or_equal": "",
"created_at_around": "",
"created_at_before": "",
"created_at_before_or_equal": "",
"id_around": "",
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
},
"presence": false,
"state": false,
"watch": false,
"watchers": {}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/channels/:type/query');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'client_id' => '',
'connection_id' => '',
'data' => [
'auto_translation_enabled' => null,
'auto_translation_language' => '',
'config_overrides' => [
'blocklist' => '',
'blocklist_behavior' => '',
'commands' => [
],
'grants' => [
],
'max_message_length' => '',
'quotes' => null,
'reactions' => null,
'replies' => null,
'typing_events' => null,
'uploads' => null,
'url_enrichment' => null
],
'created_by' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'disabled' => null,
'frozen' => null,
'members' => [
[
'ban_expires' => '',
'banned' => null,
'channel_role' => '',
'created_at' => '',
'deleted_at' => '',
'invite_accepted_at' => '',
'invite_rejected_at' => '',
'invited' => null,
'is_moderator' => null,
'role' => '',
'shadow_banned' => null,
'updated_at' => '',
'user' => [
],
'user_id' => ''
]
],
'own_capabilities' => [
],
'team' => '',
'truncated_at' => [
],
'truncated_by' => [
],
'truncated_by_id' => ''
],
'members' => [
'id_gt' => '',
'id_gte' => '',
'id_lt' => '',
'id_lte' => '',
'limit' => '',
'offset' => ''
],
'messages' => [
'created_at_after' => '',
'created_at_after_or_equal' => '',
'created_at_around' => '',
'created_at_before' => '',
'created_at_before_or_equal' => '',
'id_around' => '',
'id_gt' => '',
'id_gte' => '',
'id_lt' => '',
'id_lte' => '',
'limit' => '',
'offset' => ''
],
'presence' => null,
'state' => null,
'watch' => null,
'watchers' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'client_id' => '',
'connection_id' => '',
'data' => [
'auto_translation_enabled' => null,
'auto_translation_language' => '',
'config_overrides' => [
'blocklist' => '',
'blocklist_behavior' => '',
'commands' => [
],
'grants' => [
],
'max_message_length' => '',
'quotes' => null,
'reactions' => null,
'replies' => null,
'typing_events' => null,
'uploads' => null,
'url_enrichment' => null
],
'created_by' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'disabled' => null,
'frozen' => null,
'members' => [
[
'ban_expires' => '',
'banned' => null,
'channel_role' => '',
'created_at' => '',
'deleted_at' => '',
'invite_accepted_at' => '',
'invite_rejected_at' => '',
'invited' => null,
'is_moderator' => null,
'role' => '',
'shadow_banned' => null,
'updated_at' => '',
'user' => [
],
'user_id' => ''
]
],
'own_capabilities' => [
],
'team' => '',
'truncated_at' => [
],
'truncated_by' => [
],
'truncated_by_id' => ''
],
'members' => [
'id_gt' => '',
'id_gte' => '',
'id_lt' => '',
'id_lte' => '',
'limit' => '',
'offset' => ''
],
'messages' => [
'created_at_after' => '',
'created_at_after_or_equal' => '',
'created_at_around' => '',
'created_at_before' => '',
'created_at_before_or_equal' => '',
'id_around' => '',
'id_gt' => '',
'id_gte' => '',
'id_lt' => '',
'id_lte' => '',
'limit' => '',
'offset' => ''
],
'presence' => null,
'state' => null,
'watch' => null,
'watchers' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/channels/:type/query');
$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}}/channels/:type/query' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"client_id": "",
"connection_id": "",
"data": {
"auto_translation_enabled": false,
"auto_translation_language": "",
"config_overrides": {
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"grants": {},
"max_message_length": "",
"quotes": false,
"reactions": false,
"replies": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
},
"created_by": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"disabled": false,
"frozen": false,
"members": [
{
"ban_expires": "",
"banned": false,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": false,
"is_moderator": false,
"role": "",
"shadow_banned": false,
"updated_at": "",
"user": {},
"user_id": ""
}
],
"own_capabilities": [],
"team": "",
"truncated_at": [],
"truncated_by": [],
"truncated_by_id": ""
},
"members": {
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
},
"messages": {
"created_at_after": "",
"created_at_after_or_equal": "",
"created_at_around": "",
"created_at_before": "",
"created_at_before_or_equal": "",
"id_around": "",
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
},
"presence": false,
"state": false,
"watch": false,
"watchers": {}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/channels/:type/query' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"client_id": "",
"connection_id": "",
"data": {
"auto_translation_enabled": false,
"auto_translation_language": "",
"config_overrides": {
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"grants": {},
"max_message_length": "",
"quotes": false,
"reactions": false,
"replies": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
},
"created_by": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"disabled": false,
"frozen": false,
"members": [
{
"ban_expires": "",
"banned": false,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": false,
"is_moderator": false,
"role": "",
"shadow_banned": false,
"updated_at": "",
"user": {},
"user_id": ""
}
],
"own_capabilities": [],
"team": "",
"truncated_at": [],
"truncated_by": [],
"truncated_by_id": ""
},
"members": {
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
},
"messages": {
"created_at_after": "",
"created_at_after_or_equal": "",
"created_at_around": "",
"created_at_before": "",
"created_at_before_or_equal": "",
"id_around": "",
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
},
"presence": false,
"state": false,
"watch": false,
"watchers": {}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"members\": {\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"messages\": {\n \"created_at_after\": \"\",\n \"created_at_after_or_equal\": \"\",\n \"created_at_around\": \"\",\n \"created_at_before\": \"\",\n \"created_at_before_or_equal\": \"\",\n \"id_around\": \"\",\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"presence\": false,\n \"state\": false,\n \"watch\": false,\n \"watchers\": {}\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/channels/:type/query", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/channels/:type/query"
payload = {
"client_id": "",
"connection_id": "",
"data": {
"auto_translation_enabled": False,
"auto_translation_language": "",
"config_overrides": {
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"grants": {},
"max_message_length": "",
"quotes": False,
"reactions": False,
"replies": False,
"typing_events": False,
"uploads": False,
"url_enrichment": False
},
"created_by": {
"ban_expires": "",
"banned": False,
"id": "",
"invisible": False,
"language": "",
"push_notifications": {
"disabled": False,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"disabled": False,
"frozen": False,
"members": [
{
"ban_expires": "",
"banned": False,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": False,
"is_moderator": False,
"role": "",
"shadow_banned": False,
"updated_at": "",
"user": {},
"user_id": ""
}
],
"own_capabilities": [],
"team": "",
"truncated_at": [],
"truncated_by": [],
"truncated_by_id": ""
},
"members": {
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
},
"messages": {
"created_at_after": "",
"created_at_after_or_equal": "",
"created_at_around": "",
"created_at_before": "",
"created_at_before_or_equal": "",
"id_around": "",
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
},
"presence": False,
"state": False,
"watch": False,
"watchers": {}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/channels/:type/query"
payload <- "{\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"members\": {\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"messages\": {\n \"created_at_after\": \"\",\n \"created_at_after_or_equal\": \"\",\n \"created_at_around\": \"\",\n \"created_at_before\": \"\",\n \"created_at_before_or_equal\": \"\",\n \"id_around\": \"\",\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"presence\": false,\n \"state\": false,\n \"watch\": false,\n \"watchers\": {}\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}}/channels/:type/query")
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 \"client_id\": \"\",\n \"connection_id\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"members\": {\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"messages\": {\n \"created_at_after\": \"\",\n \"created_at_after_or_equal\": \"\",\n \"created_at_around\": \"\",\n \"created_at_before\": \"\",\n \"created_at_before_or_equal\": \"\",\n \"id_around\": \"\",\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"presence\": false,\n \"state\": false,\n \"watch\": false,\n \"watchers\": {}\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/channels/:type/query') do |req|
req.body = "{\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"members\": {\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"messages\": {\n \"created_at_after\": \"\",\n \"created_at_after_or_equal\": \"\",\n \"created_at_around\": \"\",\n \"created_at_before\": \"\",\n \"created_at_before_or_equal\": \"\",\n \"id_around\": \"\",\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"presence\": false,\n \"state\": false,\n \"watch\": false,\n \"watchers\": {}\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/channels/:type/query";
let payload = json!({
"client_id": "",
"connection_id": "",
"data": json!({
"auto_translation_enabled": false,
"auto_translation_language": "",
"config_overrides": json!({
"blocklist": "",
"blocklist_behavior": "",
"commands": (),
"grants": json!({}),
"max_message_length": "",
"quotes": false,
"reactions": false,
"replies": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
}),
"created_by": json!({
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": json!({
"disabled": false,
"disabled_until": ""
}),
"revoke_tokens_issued_before": "",
"role": "",
"teams": ()
}),
"disabled": false,
"frozen": false,
"members": (
json!({
"ban_expires": "",
"banned": false,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": false,
"is_moderator": false,
"role": "",
"shadow_banned": false,
"updated_at": "",
"user": json!({}),
"user_id": ""
})
),
"own_capabilities": (),
"team": "",
"truncated_at": (),
"truncated_by": (),
"truncated_by_id": ""
}),
"members": json!({
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
}),
"messages": json!({
"created_at_after": "",
"created_at_after_or_equal": "",
"created_at_around": "",
"created_at_before": "",
"created_at_before_or_equal": "",
"id_around": "",
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
}),
"presence": false,
"state": false,
"watch": false,
"watchers": json!({})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/channels/:type/query \
--header 'content-type: application/json' \
--data '{
"client_id": "",
"connection_id": "",
"data": {
"auto_translation_enabled": false,
"auto_translation_language": "",
"config_overrides": {
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"grants": {},
"max_message_length": "",
"quotes": false,
"reactions": false,
"replies": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
},
"created_by": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"disabled": false,
"frozen": false,
"members": [
{
"ban_expires": "",
"banned": false,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": false,
"is_moderator": false,
"role": "",
"shadow_banned": false,
"updated_at": "",
"user": {},
"user_id": ""
}
],
"own_capabilities": [],
"team": "",
"truncated_at": [],
"truncated_by": [],
"truncated_by_id": ""
},
"members": {
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
},
"messages": {
"created_at_after": "",
"created_at_after_or_equal": "",
"created_at_around": "",
"created_at_before": "",
"created_at_before_or_equal": "",
"id_around": "",
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
},
"presence": false,
"state": false,
"watch": false,
"watchers": {}
}'
echo '{
"client_id": "",
"connection_id": "",
"data": {
"auto_translation_enabled": false,
"auto_translation_language": "",
"config_overrides": {
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"grants": {},
"max_message_length": "",
"quotes": false,
"reactions": false,
"replies": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
},
"created_by": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"disabled": false,
"frozen": false,
"members": [
{
"ban_expires": "",
"banned": false,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": false,
"is_moderator": false,
"role": "",
"shadow_banned": false,
"updated_at": "",
"user": {},
"user_id": ""
}
],
"own_capabilities": [],
"team": "",
"truncated_at": [],
"truncated_by": [],
"truncated_by_id": ""
},
"members": {
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
},
"messages": {
"created_at_after": "",
"created_at_after_or_equal": "",
"created_at_around": "",
"created_at_before": "",
"created_at_before_or_equal": "",
"id_around": "",
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
},
"presence": false,
"state": false,
"watch": false,
"watchers": {}
}' | \
http POST {{baseUrl}}/channels/:type/query \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "client_id": "",\n "connection_id": "",\n "data": {\n "auto_translation_enabled": false,\n "auto_translation_language": "",\n "config_overrides": {\n "blocklist": "",\n "blocklist_behavior": "",\n "commands": [],\n "grants": {},\n "max_message_length": "",\n "quotes": false,\n "reactions": false,\n "replies": false,\n "typing_events": false,\n "uploads": false,\n "url_enrichment": false\n },\n "created_by": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "disabled": false,\n "frozen": false,\n "members": [\n {\n "ban_expires": "",\n "banned": false,\n "channel_role": "",\n "created_at": "",\n "deleted_at": "",\n "invite_accepted_at": "",\n "invite_rejected_at": "",\n "invited": false,\n "is_moderator": false,\n "role": "",\n "shadow_banned": false,\n "updated_at": "",\n "user": {},\n "user_id": ""\n }\n ],\n "own_capabilities": [],\n "team": "",\n "truncated_at": [],\n "truncated_by": [],\n "truncated_by_id": ""\n },\n "members": {\n "id_gt": "",\n "id_gte": "",\n "id_lt": "",\n "id_lte": "",\n "limit": "",\n "offset": ""\n },\n "messages": {\n "created_at_after": "",\n "created_at_after_or_equal": "",\n "created_at_around": "",\n "created_at_before": "",\n "created_at_before_or_equal": "",\n "id_around": "",\n "id_gt": "",\n "id_gte": "",\n "id_lt": "",\n "id_lte": "",\n "limit": "",\n "offset": ""\n },\n "presence": false,\n "state": false,\n "watch": false,\n "watchers": {}\n}' \
--output-document \
- {{baseUrl}}/channels/:type/query
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"client_id": "",
"connection_id": "",
"data": [
"auto_translation_enabled": false,
"auto_translation_language": "",
"config_overrides": [
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"grants": [],
"max_message_length": "",
"quotes": false,
"reactions": false,
"replies": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
],
"created_by": [
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": [
"disabled": false,
"disabled_until": ""
],
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
],
"disabled": false,
"frozen": false,
"members": [
[
"ban_expires": "",
"banned": false,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": false,
"is_moderator": false,
"role": "",
"shadow_banned": false,
"updated_at": "",
"user": [],
"user_id": ""
]
],
"own_capabilities": [],
"team": "",
"truncated_at": [],
"truncated_by": [],
"truncated_by_id": ""
],
"members": [
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
],
"messages": [
"created_at_after": "",
"created_at_after_or_equal": "",
"created_at_around": "",
"created_at_before": "",
"created_at_before_or_equal": "",
"id_around": "",
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
],
"presence": false,
"state": false,
"watch": false,
"watchers": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/channels/:type/query")! 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
Get or create channel (type, id)
{{baseUrl}}/channels/:type/:id/query
QUERY PARAMS
type
id
BODY json
{
"client_id": "",
"connection_id": "",
"data": {
"auto_translation_enabled": false,
"auto_translation_language": "",
"config_overrides": {
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"grants": {},
"max_message_length": "",
"quotes": false,
"reactions": false,
"replies": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
},
"created_by": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"disabled": false,
"frozen": false,
"members": [
{
"ban_expires": "",
"banned": false,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": false,
"is_moderator": false,
"role": "",
"shadow_banned": false,
"updated_at": "",
"user": {},
"user_id": ""
}
],
"own_capabilities": [],
"team": "",
"truncated_at": [],
"truncated_by": [],
"truncated_by_id": ""
},
"members": {
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
},
"messages": {
"created_at_after": "",
"created_at_after_or_equal": "",
"created_at_around": "",
"created_at_before": "",
"created_at_before_or_equal": "",
"id_around": "",
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
},
"presence": false,
"state": false,
"watch": false,
"watchers": {}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/channels/:type/:id/query");
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 \"client_id\": \"\",\n \"connection_id\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"members\": {\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"messages\": {\n \"created_at_after\": \"\",\n \"created_at_after_or_equal\": \"\",\n \"created_at_around\": \"\",\n \"created_at_before\": \"\",\n \"created_at_before_or_equal\": \"\",\n \"id_around\": \"\",\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"presence\": false,\n \"state\": false,\n \"watch\": false,\n \"watchers\": {}\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/channels/:type/:id/query" {:content-type :json
:form-params {:client_id ""
:connection_id ""
:data {:auto_translation_enabled false
:auto_translation_language ""
:config_overrides {:blocklist ""
:blocklist_behavior ""
:commands []
:grants {}
:max_message_length ""
:quotes false
:reactions false
:replies false
:typing_events false
:uploads false
:url_enrichment false}
:created_by {:ban_expires ""
:banned false
:id ""
:invisible false
:language ""
:push_notifications {:disabled false
:disabled_until ""}
:revoke_tokens_issued_before ""
:role ""
:teams []}
:disabled false
:frozen false
:members [{:ban_expires ""
:banned false
:channel_role ""
:created_at ""
:deleted_at ""
:invite_accepted_at ""
:invite_rejected_at ""
:invited false
:is_moderator false
:role ""
:shadow_banned false
:updated_at ""
:user {}
:user_id ""}]
:own_capabilities []
:team ""
:truncated_at []
:truncated_by []
:truncated_by_id ""}
:members {:id_gt ""
:id_gte ""
:id_lt ""
:id_lte ""
:limit ""
:offset ""}
:messages {:created_at_after ""
:created_at_after_or_equal ""
:created_at_around ""
:created_at_before ""
:created_at_before_or_equal ""
:id_around ""
:id_gt ""
:id_gte ""
:id_lt ""
:id_lte ""
:limit ""
:offset ""}
:presence false
:state false
:watch false
:watchers {}}})
require "http/client"
url = "{{baseUrl}}/channels/:type/:id/query"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"members\": {\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"messages\": {\n \"created_at_after\": \"\",\n \"created_at_after_or_equal\": \"\",\n \"created_at_around\": \"\",\n \"created_at_before\": \"\",\n \"created_at_before_or_equal\": \"\",\n \"id_around\": \"\",\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"presence\": false,\n \"state\": false,\n \"watch\": false,\n \"watchers\": {}\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}}/channels/:type/:id/query"),
Content = new StringContent("{\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"members\": {\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"messages\": {\n \"created_at_after\": \"\",\n \"created_at_after_or_equal\": \"\",\n \"created_at_around\": \"\",\n \"created_at_before\": \"\",\n \"created_at_before_or_equal\": \"\",\n \"id_around\": \"\",\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"presence\": false,\n \"state\": false,\n \"watch\": false,\n \"watchers\": {}\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}}/channels/:type/:id/query");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"members\": {\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"messages\": {\n \"created_at_after\": \"\",\n \"created_at_after_or_equal\": \"\",\n \"created_at_around\": \"\",\n \"created_at_before\": \"\",\n \"created_at_before_or_equal\": \"\",\n \"id_around\": \"\",\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"presence\": false,\n \"state\": false,\n \"watch\": false,\n \"watchers\": {}\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/channels/:type/:id/query"
payload := strings.NewReader("{\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"members\": {\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"messages\": {\n \"created_at_after\": \"\",\n \"created_at_after_or_equal\": \"\",\n \"created_at_around\": \"\",\n \"created_at_before\": \"\",\n \"created_at_before_or_equal\": \"\",\n \"id_around\": \"\",\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"presence\": false,\n \"state\": false,\n \"watch\": false,\n \"watchers\": {}\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/channels/:type/:id/query HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 1852
{
"client_id": "",
"connection_id": "",
"data": {
"auto_translation_enabled": false,
"auto_translation_language": "",
"config_overrides": {
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"grants": {},
"max_message_length": "",
"quotes": false,
"reactions": false,
"replies": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
},
"created_by": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"disabled": false,
"frozen": false,
"members": [
{
"ban_expires": "",
"banned": false,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": false,
"is_moderator": false,
"role": "",
"shadow_banned": false,
"updated_at": "",
"user": {},
"user_id": ""
}
],
"own_capabilities": [],
"team": "",
"truncated_at": [],
"truncated_by": [],
"truncated_by_id": ""
},
"members": {
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
},
"messages": {
"created_at_after": "",
"created_at_after_or_equal": "",
"created_at_around": "",
"created_at_before": "",
"created_at_before_or_equal": "",
"id_around": "",
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
},
"presence": false,
"state": false,
"watch": false,
"watchers": {}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/channels/:type/:id/query")
.setHeader("content-type", "application/json")
.setBody("{\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"members\": {\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"messages\": {\n \"created_at_after\": \"\",\n \"created_at_after_or_equal\": \"\",\n \"created_at_around\": \"\",\n \"created_at_before\": \"\",\n \"created_at_before_or_equal\": \"\",\n \"id_around\": \"\",\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"presence\": false,\n \"state\": false,\n \"watch\": false,\n \"watchers\": {}\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/channels/:type/:id/query"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"members\": {\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"messages\": {\n \"created_at_after\": \"\",\n \"created_at_after_or_equal\": \"\",\n \"created_at_around\": \"\",\n \"created_at_before\": \"\",\n \"created_at_before_or_equal\": \"\",\n \"id_around\": \"\",\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"presence\": false,\n \"state\": false,\n \"watch\": false,\n \"watchers\": {}\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 \"client_id\": \"\",\n \"connection_id\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"members\": {\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"messages\": {\n \"created_at_after\": \"\",\n \"created_at_after_or_equal\": \"\",\n \"created_at_around\": \"\",\n \"created_at_before\": \"\",\n \"created_at_before_or_equal\": \"\",\n \"id_around\": \"\",\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"presence\": false,\n \"state\": false,\n \"watch\": false,\n \"watchers\": {}\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/channels/:type/:id/query")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/channels/:type/:id/query")
.header("content-type", "application/json")
.body("{\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"members\": {\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"messages\": {\n \"created_at_after\": \"\",\n \"created_at_after_or_equal\": \"\",\n \"created_at_around\": \"\",\n \"created_at_before\": \"\",\n \"created_at_before_or_equal\": \"\",\n \"id_around\": \"\",\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"presence\": false,\n \"state\": false,\n \"watch\": false,\n \"watchers\": {}\n}")
.asString();
const data = JSON.stringify({
client_id: '',
connection_id: '',
data: {
auto_translation_enabled: false,
auto_translation_language: '',
config_overrides: {
blocklist: '',
blocklist_behavior: '',
commands: [],
grants: {},
max_message_length: '',
quotes: false,
reactions: false,
replies: false,
typing_events: false,
uploads: false,
url_enrichment: false
},
created_by: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
disabled: false,
frozen: false,
members: [
{
ban_expires: '',
banned: false,
channel_role: '',
created_at: '',
deleted_at: '',
invite_accepted_at: '',
invite_rejected_at: '',
invited: false,
is_moderator: false,
role: '',
shadow_banned: false,
updated_at: '',
user: {},
user_id: ''
}
],
own_capabilities: [],
team: '',
truncated_at: [],
truncated_by: [],
truncated_by_id: ''
},
members: {
id_gt: '',
id_gte: '',
id_lt: '',
id_lte: '',
limit: '',
offset: ''
},
messages: {
created_at_after: '',
created_at_after_or_equal: '',
created_at_around: '',
created_at_before: '',
created_at_before_or_equal: '',
id_around: '',
id_gt: '',
id_gte: '',
id_lt: '',
id_lte: '',
limit: '',
offset: ''
},
presence: false,
state: false,
watch: false,
watchers: {}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/channels/:type/:id/query');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:type/:id/query',
headers: {'content-type': 'application/json'},
data: {
client_id: '',
connection_id: '',
data: {
auto_translation_enabled: false,
auto_translation_language: '',
config_overrides: {
blocklist: '',
blocklist_behavior: '',
commands: [],
grants: {},
max_message_length: '',
quotes: false,
reactions: false,
replies: false,
typing_events: false,
uploads: false,
url_enrichment: false
},
created_by: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
disabled: false,
frozen: false,
members: [
{
ban_expires: '',
banned: false,
channel_role: '',
created_at: '',
deleted_at: '',
invite_accepted_at: '',
invite_rejected_at: '',
invited: false,
is_moderator: false,
role: '',
shadow_banned: false,
updated_at: '',
user: {},
user_id: ''
}
],
own_capabilities: [],
team: '',
truncated_at: [],
truncated_by: [],
truncated_by_id: ''
},
members: {id_gt: '', id_gte: '', id_lt: '', id_lte: '', limit: '', offset: ''},
messages: {
created_at_after: '',
created_at_after_or_equal: '',
created_at_around: '',
created_at_before: '',
created_at_before_or_equal: '',
id_around: '',
id_gt: '',
id_gte: '',
id_lt: '',
id_lte: '',
limit: '',
offset: ''
},
presence: false,
state: false,
watch: false,
watchers: {}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/channels/:type/:id/query';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"client_id":"","connection_id":"","data":{"auto_translation_enabled":false,"auto_translation_language":"","config_overrides":{"blocklist":"","blocklist_behavior":"","commands":[],"grants":{},"max_message_length":"","quotes":false,"reactions":false,"replies":false,"typing_events":false,"uploads":false,"url_enrichment":false},"created_by":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"disabled":false,"frozen":false,"members":[{"ban_expires":"","banned":false,"channel_role":"","created_at":"","deleted_at":"","invite_accepted_at":"","invite_rejected_at":"","invited":false,"is_moderator":false,"role":"","shadow_banned":false,"updated_at":"","user":{},"user_id":""}],"own_capabilities":[],"team":"","truncated_at":[],"truncated_by":[],"truncated_by_id":""},"members":{"id_gt":"","id_gte":"","id_lt":"","id_lte":"","limit":"","offset":""},"messages":{"created_at_after":"","created_at_after_or_equal":"","created_at_around":"","created_at_before":"","created_at_before_or_equal":"","id_around":"","id_gt":"","id_gte":"","id_lt":"","id_lte":"","limit":"","offset":""},"presence":false,"state":false,"watch":false,"watchers":{}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/channels/:type/:id/query',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "client_id": "",\n "connection_id": "",\n "data": {\n "auto_translation_enabled": false,\n "auto_translation_language": "",\n "config_overrides": {\n "blocklist": "",\n "blocklist_behavior": "",\n "commands": [],\n "grants": {},\n "max_message_length": "",\n "quotes": false,\n "reactions": false,\n "replies": false,\n "typing_events": false,\n "uploads": false,\n "url_enrichment": false\n },\n "created_by": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "disabled": false,\n "frozen": false,\n "members": [\n {\n "ban_expires": "",\n "banned": false,\n "channel_role": "",\n "created_at": "",\n "deleted_at": "",\n "invite_accepted_at": "",\n "invite_rejected_at": "",\n "invited": false,\n "is_moderator": false,\n "role": "",\n "shadow_banned": false,\n "updated_at": "",\n "user": {},\n "user_id": ""\n }\n ],\n "own_capabilities": [],\n "team": "",\n "truncated_at": [],\n "truncated_by": [],\n "truncated_by_id": ""\n },\n "members": {\n "id_gt": "",\n "id_gte": "",\n "id_lt": "",\n "id_lte": "",\n "limit": "",\n "offset": ""\n },\n "messages": {\n "created_at_after": "",\n "created_at_after_or_equal": "",\n "created_at_around": "",\n "created_at_before": "",\n "created_at_before_or_equal": "",\n "id_around": "",\n "id_gt": "",\n "id_gte": "",\n "id_lt": "",\n "id_lte": "",\n "limit": "",\n "offset": ""\n },\n "presence": false,\n "state": false,\n "watch": false,\n "watchers": {}\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"members\": {\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"messages\": {\n \"created_at_after\": \"\",\n \"created_at_after_or_equal\": \"\",\n \"created_at_around\": \"\",\n \"created_at_before\": \"\",\n \"created_at_before_or_equal\": \"\",\n \"id_around\": \"\",\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"presence\": false,\n \"state\": false,\n \"watch\": false,\n \"watchers\": {}\n}")
val request = Request.Builder()
.url("{{baseUrl}}/channels/:type/:id/query")
.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/channels/:type/:id/query',
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({
client_id: '',
connection_id: '',
data: {
auto_translation_enabled: false,
auto_translation_language: '',
config_overrides: {
blocklist: '',
blocklist_behavior: '',
commands: [],
grants: {},
max_message_length: '',
quotes: false,
reactions: false,
replies: false,
typing_events: false,
uploads: false,
url_enrichment: false
},
created_by: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
disabled: false,
frozen: false,
members: [
{
ban_expires: '',
banned: false,
channel_role: '',
created_at: '',
deleted_at: '',
invite_accepted_at: '',
invite_rejected_at: '',
invited: false,
is_moderator: false,
role: '',
shadow_banned: false,
updated_at: '',
user: {},
user_id: ''
}
],
own_capabilities: [],
team: '',
truncated_at: [],
truncated_by: [],
truncated_by_id: ''
},
members: {id_gt: '', id_gte: '', id_lt: '', id_lte: '', limit: '', offset: ''},
messages: {
created_at_after: '',
created_at_after_or_equal: '',
created_at_around: '',
created_at_before: '',
created_at_before_or_equal: '',
id_around: '',
id_gt: '',
id_gte: '',
id_lt: '',
id_lte: '',
limit: '',
offset: ''
},
presence: false,
state: false,
watch: false,
watchers: {}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:type/:id/query',
headers: {'content-type': 'application/json'},
body: {
client_id: '',
connection_id: '',
data: {
auto_translation_enabled: false,
auto_translation_language: '',
config_overrides: {
blocklist: '',
blocklist_behavior: '',
commands: [],
grants: {},
max_message_length: '',
quotes: false,
reactions: false,
replies: false,
typing_events: false,
uploads: false,
url_enrichment: false
},
created_by: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
disabled: false,
frozen: false,
members: [
{
ban_expires: '',
banned: false,
channel_role: '',
created_at: '',
deleted_at: '',
invite_accepted_at: '',
invite_rejected_at: '',
invited: false,
is_moderator: false,
role: '',
shadow_banned: false,
updated_at: '',
user: {},
user_id: ''
}
],
own_capabilities: [],
team: '',
truncated_at: [],
truncated_by: [],
truncated_by_id: ''
},
members: {id_gt: '', id_gte: '', id_lt: '', id_lte: '', limit: '', offset: ''},
messages: {
created_at_after: '',
created_at_after_or_equal: '',
created_at_around: '',
created_at_before: '',
created_at_before_or_equal: '',
id_around: '',
id_gt: '',
id_gte: '',
id_lt: '',
id_lte: '',
limit: '',
offset: ''
},
presence: false,
state: false,
watch: false,
watchers: {}
},
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}}/channels/:type/:id/query');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
client_id: '',
connection_id: '',
data: {
auto_translation_enabled: false,
auto_translation_language: '',
config_overrides: {
blocklist: '',
blocklist_behavior: '',
commands: [],
grants: {},
max_message_length: '',
quotes: false,
reactions: false,
replies: false,
typing_events: false,
uploads: false,
url_enrichment: false
},
created_by: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
disabled: false,
frozen: false,
members: [
{
ban_expires: '',
banned: false,
channel_role: '',
created_at: '',
deleted_at: '',
invite_accepted_at: '',
invite_rejected_at: '',
invited: false,
is_moderator: false,
role: '',
shadow_banned: false,
updated_at: '',
user: {},
user_id: ''
}
],
own_capabilities: [],
team: '',
truncated_at: [],
truncated_by: [],
truncated_by_id: ''
},
members: {
id_gt: '',
id_gte: '',
id_lt: '',
id_lte: '',
limit: '',
offset: ''
},
messages: {
created_at_after: '',
created_at_after_or_equal: '',
created_at_around: '',
created_at_before: '',
created_at_before_or_equal: '',
id_around: '',
id_gt: '',
id_gte: '',
id_lt: '',
id_lte: '',
limit: '',
offset: ''
},
presence: false,
state: false,
watch: false,
watchers: {}
});
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}}/channels/:type/:id/query',
headers: {'content-type': 'application/json'},
data: {
client_id: '',
connection_id: '',
data: {
auto_translation_enabled: false,
auto_translation_language: '',
config_overrides: {
blocklist: '',
blocklist_behavior: '',
commands: [],
grants: {},
max_message_length: '',
quotes: false,
reactions: false,
replies: false,
typing_events: false,
uploads: false,
url_enrichment: false
},
created_by: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
disabled: false,
frozen: false,
members: [
{
ban_expires: '',
banned: false,
channel_role: '',
created_at: '',
deleted_at: '',
invite_accepted_at: '',
invite_rejected_at: '',
invited: false,
is_moderator: false,
role: '',
shadow_banned: false,
updated_at: '',
user: {},
user_id: ''
}
],
own_capabilities: [],
team: '',
truncated_at: [],
truncated_by: [],
truncated_by_id: ''
},
members: {id_gt: '', id_gte: '', id_lt: '', id_lte: '', limit: '', offset: ''},
messages: {
created_at_after: '',
created_at_after_or_equal: '',
created_at_around: '',
created_at_before: '',
created_at_before_or_equal: '',
id_around: '',
id_gt: '',
id_gte: '',
id_lt: '',
id_lte: '',
limit: '',
offset: ''
},
presence: false,
state: false,
watch: false,
watchers: {}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/channels/:type/:id/query';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"client_id":"","connection_id":"","data":{"auto_translation_enabled":false,"auto_translation_language":"","config_overrides":{"blocklist":"","blocklist_behavior":"","commands":[],"grants":{},"max_message_length":"","quotes":false,"reactions":false,"replies":false,"typing_events":false,"uploads":false,"url_enrichment":false},"created_by":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"disabled":false,"frozen":false,"members":[{"ban_expires":"","banned":false,"channel_role":"","created_at":"","deleted_at":"","invite_accepted_at":"","invite_rejected_at":"","invited":false,"is_moderator":false,"role":"","shadow_banned":false,"updated_at":"","user":{},"user_id":""}],"own_capabilities":[],"team":"","truncated_at":[],"truncated_by":[],"truncated_by_id":""},"members":{"id_gt":"","id_gte":"","id_lt":"","id_lte":"","limit":"","offset":""},"messages":{"created_at_after":"","created_at_after_or_equal":"","created_at_around":"","created_at_before":"","created_at_before_or_equal":"","id_around":"","id_gt":"","id_gte":"","id_lt":"","id_lte":"","limit":"","offset":""},"presence":false,"state":false,"watch":false,"watchers":{}}'
};
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 = @{ @"client_id": @"",
@"connection_id": @"",
@"data": @{ @"auto_translation_enabled": @NO, @"auto_translation_language": @"", @"config_overrides": @{ @"blocklist": @"", @"blocklist_behavior": @"", @"commands": @[ ], @"grants": @{ }, @"max_message_length": @"", @"quotes": @NO, @"reactions": @NO, @"replies": @NO, @"typing_events": @NO, @"uploads": @NO, @"url_enrichment": @NO }, @"created_by": @{ @"ban_expires": @"", @"banned": @NO, @"id": @"", @"invisible": @NO, @"language": @"", @"push_notifications": @{ @"disabled": @NO, @"disabled_until": @"" }, @"revoke_tokens_issued_before": @"", @"role": @"", @"teams": @[ ] }, @"disabled": @NO, @"frozen": @NO, @"members": @[ @{ @"ban_expires": @"", @"banned": @NO, @"channel_role": @"", @"created_at": @"", @"deleted_at": @"", @"invite_accepted_at": @"", @"invite_rejected_at": @"", @"invited": @NO, @"is_moderator": @NO, @"role": @"", @"shadow_banned": @NO, @"updated_at": @"", @"user": @{ }, @"user_id": @"" } ], @"own_capabilities": @[ ], @"team": @"", @"truncated_at": @[ ], @"truncated_by": @[ ], @"truncated_by_id": @"" },
@"members": @{ @"id_gt": @"", @"id_gte": @"", @"id_lt": @"", @"id_lte": @"", @"limit": @"", @"offset": @"" },
@"messages": @{ @"created_at_after": @"", @"created_at_after_or_equal": @"", @"created_at_around": @"", @"created_at_before": @"", @"created_at_before_or_equal": @"", @"id_around": @"", @"id_gt": @"", @"id_gte": @"", @"id_lt": @"", @"id_lte": @"", @"limit": @"", @"offset": @"" },
@"presence": @NO,
@"state": @NO,
@"watch": @NO,
@"watchers": @{ } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/channels/:type/:id/query"]
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}}/channels/:type/:id/query" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"members\": {\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"messages\": {\n \"created_at_after\": \"\",\n \"created_at_after_or_equal\": \"\",\n \"created_at_around\": \"\",\n \"created_at_before\": \"\",\n \"created_at_before_or_equal\": \"\",\n \"id_around\": \"\",\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"presence\": false,\n \"state\": false,\n \"watch\": false,\n \"watchers\": {}\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/channels/:type/:id/query",
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([
'client_id' => '',
'connection_id' => '',
'data' => [
'auto_translation_enabled' => null,
'auto_translation_language' => '',
'config_overrides' => [
'blocklist' => '',
'blocklist_behavior' => '',
'commands' => [
],
'grants' => [
],
'max_message_length' => '',
'quotes' => null,
'reactions' => null,
'replies' => null,
'typing_events' => null,
'uploads' => null,
'url_enrichment' => null
],
'created_by' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'disabled' => null,
'frozen' => null,
'members' => [
[
'ban_expires' => '',
'banned' => null,
'channel_role' => '',
'created_at' => '',
'deleted_at' => '',
'invite_accepted_at' => '',
'invite_rejected_at' => '',
'invited' => null,
'is_moderator' => null,
'role' => '',
'shadow_banned' => null,
'updated_at' => '',
'user' => [
],
'user_id' => ''
]
],
'own_capabilities' => [
],
'team' => '',
'truncated_at' => [
],
'truncated_by' => [
],
'truncated_by_id' => ''
],
'members' => [
'id_gt' => '',
'id_gte' => '',
'id_lt' => '',
'id_lte' => '',
'limit' => '',
'offset' => ''
],
'messages' => [
'created_at_after' => '',
'created_at_after_or_equal' => '',
'created_at_around' => '',
'created_at_before' => '',
'created_at_before_or_equal' => '',
'id_around' => '',
'id_gt' => '',
'id_gte' => '',
'id_lt' => '',
'id_lte' => '',
'limit' => '',
'offset' => ''
],
'presence' => null,
'state' => null,
'watch' => null,
'watchers' => [
]
]),
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}}/channels/:type/:id/query', [
'body' => '{
"client_id": "",
"connection_id": "",
"data": {
"auto_translation_enabled": false,
"auto_translation_language": "",
"config_overrides": {
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"grants": {},
"max_message_length": "",
"quotes": false,
"reactions": false,
"replies": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
},
"created_by": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"disabled": false,
"frozen": false,
"members": [
{
"ban_expires": "",
"banned": false,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": false,
"is_moderator": false,
"role": "",
"shadow_banned": false,
"updated_at": "",
"user": {},
"user_id": ""
}
],
"own_capabilities": [],
"team": "",
"truncated_at": [],
"truncated_by": [],
"truncated_by_id": ""
},
"members": {
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
},
"messages": {
"created_at_after": "",
"created_at_after_or_equal": "",
"created_at_around": "",
"created_at_before": "",
"created_at_before_or_equal": "",
"id_around": "",
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
},
"presence": false,
"state": false,
"watch": false,
"watchers": {}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/channels/:type/:id/query');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'client_id' => '',
'connection_id' => '',
'data' => [
'auto_translation_enabled' => null,
'auto_translation_language' => '',
'config_overrides' => [
'blocklist' => '',
'blocklist_behavior' => '',
'commands' => [
],
'grants' => [
],
'max_message_length' => '',
'quotes' => null,
'reactions' => null,
'replies' => null,
'typing_events' => null,
'uploads' => null,
'url_enrichment' => null
],
'created_by' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'disabled' => null,
'frozen' => null,
'members' => [
[
'ban_expires' => '',
'banned' => null,
'channel_role' => '',
'created_at' => '',
'deleted_at' => '',
'invite_accepted_at' => '',
'invite_rejected_at' => '',
'invited' => null,
'is_moderator' => null,
'role' => '',
'shadow_banned' => null,
'updated_at' => '',
'user' => [
],
'user_id' => ''
]
],
'own_capabilities' => [
],
'team' => '',
'truncated_at' => [
],
'truncated_by' => [
],
'truncated_by_id' => ''
],
'members' => [
'id_gt' => '',
'id_gte' => '',
'id_lt' => '',
'id_lte' => '',
'limit' => '',
'offset' => ''
],
'messages' => [
'created_at_after' => '',
'created_at_after_or_equal' => '',
'created_at_around' => '',
'created_at_before' => '',
'created_at_before_or_equal' => '',
'id_around' => '',
'id_gt' => '',
'id_gte' => '',
'id_lt' => '',
'id_lte' => '',
'limit' => '',
'offset' => ''
],
'presence' => null,
'state' => null,
'watch' => null,
'watchers' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'client_id' => '',
'connection_id' => '',
'data' => [
'auto_translation_enabled' => null,
'auto_translation_language' => '',
'config_overrides' => [
'blocklist' => '',
'blocklist_behavior' => '',
'commands' => [
],
'grants' => [
],
'max_message_length' => '',
'quotes' => null,
'reactions' => null,
'replies' => null,
'typing_events' => null,
'uploads' => null,
'url_enrichment' => null
],
'created_by' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'disabled' => null,
'frozen' => null,
'members' => [
[
'ban_expires' => '',
'banned' => null,
'channel_role' => '',
'created_at' => '',
'deleted_at' => '',
'invite_accepted_at' => '',
'invite_rejected_at' => '',
'invited' => null,
'is_moderator' => null,
'role' => '',
'shadow_banned' => null,
'updated_at' => '',
'user' => [
],
'user_id' => ''
]
],
'own_capabilities' => [
],
'team' => '',
'truncated_at' => [
],
'truncated_by' => [
],
'truncated_by_id' => ''
],
'members' => [
'id_gt' => '',
'id_gte' => '',
'id_lt' => '',
'id_lte' => '',
'limit' => '',
'offset' => ''
],
'messages' => [
'created_at_after' => '',
'created_at_after_or_equal' => '',
'created_at_around' => '',
'created_at_before' => '',
'created_at_before_or_equal' => '',
'id_around' => '',
'id_gt' => '',
'id_gte' => '',
'id_lt' => '',
'id_lte' => '',
'limit' => '',
'offset' => ''
],
'presence' => null,
'state' => null,
'watch' => null,
'watchers' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/channels/:type/:id/query');
$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}}/channels/:type/:id/query' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"client_id": "",
"connection_id": "",
"data": {
"auto_translation_enabled": false,
"auto_translation_language": "",
"config_overrides": {
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"grants": {},
"max_message_length": "",
"quotes": false,
"reactions": false,
"replies": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
},
"created_by": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"disabled": false,
"frozen": false,
"members": [
{
"ban_expires": "",
"banned": false,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": false,
"is_moderator": false,
"role": "",
"shadow_banned": false,
"updated_at": "",
"user": {},
"user_id": ""
}
],
"own_capabilities": [],
"team": "",
"truncated_at": [],
"truncated_by": [],
"truncated_by_id": ""
},
"members": {
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
},
"messages": {
"created_at_after": "",
"created_at_after_or_equal": "",
"created_at_around": "",
"created_at_before": "",
"created_at_before_or_equal": "",
"id_around": "",
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
},
"presence": false,
"state": false,
"watch": false,
"watchers": {}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/channels/:type/:id/query' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"client_id": "",
"connection_id": "",
"data": {
"auto_translation_enabled": false,
"auto_translation_language": "",
"config_overrides": {
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"grants": {},
"max_message_length": "",
"quotes": false,
"reactions": false,
"replies": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
},
"created_by": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"disabled": false,
"frozen": false,
"members": [
{
"ban_expires": "",
"banned": false,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": false,
"is_moderator": false,
"role": "",
"shadow_banned": false,
"updated_at": "",
"user": {},
"user_id": ""
}
],
"own_capabilities": [],
"team": "",
"truncated_at": [],
"truncated_by": [],
"truncated_by_id": ""
},
"members": {
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
},
"messages": {
"created_at_after": "",
"created_at_after_or_equal": "",
"created_at_around": "",
"created_at_before": "",
"created_at_before_or_equal": "",
"id_around": "",
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
},
"presence": false,
"state": false,
"watch": false,
"watchers": {}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"members\": {\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"messages\": {\n \"created_at_after\": \"\",\n \"created_at_after_or_equal\": \"\",\n \"created_at_around\": \"\",\n \"created_at_before\": \"\",\n \"created_at_before_or_equal\": \"\",\n \"id_around\": \"\",\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"presence\": false,\n \"state\": false,\n \"watch\": false,\n \"watchers\": {}\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/channels/:type/:id/query", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/channels/:type/:id/query"
payload = {
"client_id": "",
"connection_id": "",
"data": {
"auto_translation_enabled": False,
"auto_translation_language": "",
"config_overrides": {
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"grants": {},
"max_message_length": "",
"quotes": False,
"reactions": False,
"replies": False,
"typing_events": False,
"uploads": False,
"url_enrichment": False
},
"created_by": {
"ban_expires": "",
"banned": False,
"id": "",
"invisible": False,
"language": "",
"push_notifications": {
"disabled": False,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"disabled": False,
"frozen": False,
"members": [
{
"ban_expires": "",
"banned": False,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": False,
"is_moderator": False,
"role": "",
"shadow_banned": False,
"updated_at": "",
"user": {},
"user_id": ""
}
],
"own_capabilities": [],
"team": "",
"truncated_at": [],
"truncated_by": [],
"truncated_by_id": ""
},
"members": {
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
},
"messages": {
"created_at_after": "",
"created_at_after_or_equal": "",
"created_at_around": "",
"created_at_before": "",
"created_at_before_or_equal": "",
"id_around": "",
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
},
"presence": False,
"state": False,
"watch": False,
"watchers": {}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/channels/:type/:id/query"
payload <- "{\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"members\": {\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"messages\": {\n \"created_at_after\": \"\",\n \"created_at_after_or_equal\": \"\",\n \"created_at_around\": \"\",\n \"created_at_before\": \"\",\n \"created_at_before_or_equal\": \"\",\n \"id_around\": \"\",\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"presence\": false,\n \"state\": false,\n \"watch\": false,\n \"watchers\": {}\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}}/channels/:type/:id/query")
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 \"client_id\": \"\",\n \"connection_id\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"members\": {\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"messages\": {\n \"created_at_after\": \"\",\n \"created_at_after_or_equal\": \"\",\n \"created_at_around\": \"\",\n \"created_at_before\": \"\",\n \"created_at_before_or_equal\": \"\",\n \"id_around\": \"\",\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"presence\": false,\n \"state\": false,\n \"watch\": false,\n \"watchers\": {}\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/channels/:type/:id/query') do |req|
req.body = "{\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"members\": {\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"messages\": {\n \"created_at_after\": \"\",\n \"created_at_after_or_equal\": \"\",\n \"created_at_around\": \"\",\n \"created_at_before\": \"\",\n \"created_at_before_or_equal\": \"\",\n \"id_around\": \"\",\n \"id_gt\": \"\",\n \"id_gte\": \"\",\n \"id_lt\": \"\",\n \"id_lte\": \"\",\n \"limit\": \"\",\n \"offset\": \"\"\n },\n \"presence\": false,\n \"state\": false,\n \"watch\": false,\n \"watchers\": {}\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/channels/:type/:id/query";
let payload = json!({
"client_id": "",
"connection_id": "",
"data": json!({
"auto_translation_enabled": false,
"auto_translation_language": "",
"config_overrides": json!({
"blocklist": "",
"blocklist_behavior": "",
"commands": (),
"grants": json!({}),
"max_message_length": "",
"quotes": false,
"reactions": false,
"replies": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
}),
"created_by": json!({
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": json!({
"disabled": false,
"disabled_until": ""
}),
"revoke_tokens_issued_before": "",
"role": "",
"teams": ()
}),
"disabled": false,
"frozen": false,
"members": (
json!({
"ban_expires": "",
"banned": false,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": false,
"is_moderator": false,
"role": "",
"shadow_banned": false,
"updated_at": "",
"user": json!({}),
"user_id": ""
})
),
"own_capabilities": (),
"team": "",
"truncated_at": (),
"truncated_by": (),
"truncated_by_id": ""
}),
"members": json!({
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
}),
"messages": json!({
"created_at_after": "",
"created_at_after_or_equal": "",
"created_at_around": "",
"created_at_before": "",
"created_at_before_or_equal": "",
"id_around": "",
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
}),
"presence": false,
"state": false,
"watch": false,
"watchers": json!({})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/channels/:type/:id/query \
--header 'content-type: application/json' \
--data '{
"client_id": "",
"connection_id": "",
"data": {
"auto_translation_enabled": false,
"auto_translation_language": "",
"config_overrides": {
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"grants": {},
"max_message_length": "",
"quotes": false,
"reactions": false,
"replies": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
},
"created_by": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"disabled": false,
"frozen": false,
"members": [
{
"ban_expires": "",
"banned": false,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": false,
"is_moderator": false,
"role": "",
"shadow_banned": false,
"updated_at": "",
"user": {},
"user_id": ""
}
],
"own_capabilities": [],
"team": "",
"truncated_at": [],
"truncated_by": [],
"truncated_by_id": ""
},
"members": {
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
},
"messages": {
"created_at_after": "",
"created_at_after_or_equal": "",
"created_at_around": "",
"created_at_before": "",
"created_at_before_or_equal": "",
"id_around": "",
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
},
"presence": false,
"state": false,
"watch": false,
"watchers": {}
}'
echo '{
"client_id": "",
"connection_id": "",
"data": {
"auto_translation_enabled": false,
"auto_translation_language": "",
"config_overrides": {
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"grants": {},
"max_message_length": "",
"quotes": false,
"reactions": false,
"replies": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
},
"created_by": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"disabled": false,
"frozen": false,
"members": [
{
"ban_expires": "",
"banned": false,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": false,
"is_moderator": false,
"role": "",
"shadow_banned": false,
"updated_at": "",
"user": {},
"user_id": ""
}
],
"own_capabilities": [],
"team": "",
"truncated_at": [],
"truncated_by": [],
"truncated_by_id": ""
},
"members": {
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
},
"messages": {
"created_at_after": "",
"created_at_after_or_equal": "",
"created_at_around": "",
"created_at_before": "",
"created_at_before_or_equal": "",
"id_around": "",
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
},
"presence": false,
"state": false,
"watch": false,
"watchers": {}
}' | \
http POST {{baseUrl}}/channels/:type/:id/query \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "client_id": "",\n "connection_id": "",\n "data": {\n "auto_translation_enabled": false,\n "auto_translation_language": "",\n "config_overrides": {\n "blocklist": "",\n "blocklist_behavior": "",\n "commands": [],\n "grants": {},\n "max_message_length": "",\n "quotes": false,\n "reactions": false,\n "replies": false,\n "typing_events": false,\n "uploads": false,\n "url_enrichment": false\n },\n "created_by": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "disabled": false,\n "frozen": false,\n "members": [\n {\n "ban_expires": "",\n "banned": false,\n "channel_role": "",\n "created_at": "",\n "deleted_at": "",\n "invite_accepted_at": "",\n "invite_rejected_at": "",\n "invited": false,\n "is_moderator": false,\n "role": "",\n "shadow_banned": false,\n "updated_at": "",\n "user": {},\n "user_id": ""\n }\n ],\n "own_capabilities": [],\n "team": "",\n "truncated_at": [],\n "truncated_by": [],\n "truncated_by_id": ""\n },\n "members": {\n "id_gt": "",\n "id_gte": "",\n "id_lt": "",\n "id_lte": "",\n "limit": "",\n "offset": ""\n },\n "messages": {\n "created_at_after": "",\n "created_at_after_or_equal": "",\n "created_at_around": "",\n "created_at_before": "",\n "created_at_before_or_equal": "",\n "id_around": "",\n "id_gt": "",\n "id_gte": "",\n "id_lt": "",\n "id_lte": "",\n "limit": "",\n "offset": ""\n },\n "presence": false,\n "state": false,\n "watch": false,\n "watchers": {}\n}' \
--output-document \
- {{baseUrl}}/channels/:type/:id/query
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"client_id": "",
"connection_id": "",
"data": [
"auto_translation_enabled": false,
"auto_translation_language": "",
"config_overrides": [
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"grants": [],
"max_message_length": "",
"quotes": false,
"reactions": false,
"replies": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
],
"created_by": [
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": [
"disabled": false,
"disabled_until": ""
],
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
],
"disabled": false,
"frozen": false,
"members": [
[
"ban_expires": "",
"banned": false,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": false,
"is_moderator": false,
"role": "",
"shadow_banned": false,
"updated_at": "",
"user": [],
"user_id": ""
]
],
"own_capabilities": [],
"team": "",
"truncated_at": [],
"truncated_by": [],
"truncated_by_id": ""
],
"members": [
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
],
"messages": [
"created_at_after": "",
"created_at_after_or_equal": "",
"created_at_around": "",
"created_at_before": "",
"created_at_before_or_equal": "",
"id_around": "",
"id_gt": "",
"id_gte": "",
"id_lt": "",
"id_lte": "",
"limit": "",
"offset": ""
],
"presence": false,
"state": false,
"watch": false,
"watchers": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/channels/:type/:id/query")! 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
Hide channel
{{baseUrl}}/channels/:type/:id/hide
QUERY PARAMS
type
id
BODY json
{
"clear_history": false,
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/channels/:type/:id/hide");
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 \"clear_history\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/channels/:type/:id/hide" {:content-type :json
:form-params {:clear_history false
:user {:ban_expires ""
:banned false
:id ""
:invisible false
:language ""
:push_notifications {:disabled false
:disabled_until ""}
:revoke_tokens_issued_before ""
:role ""
:teams []}
:user_id ""}})
require "http/client"
url = "{{baseUrl}}/channels/:type/:id/hide"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"clear_history\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/channels/:type/:id/hide"),
Content = new StringContent("{\n \"clear_history\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/channels/:type/:id/hide");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"clear_history\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/channels/:type/:id/hide"
payload := strings.NewReader("{\n \"clear_history\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/channels/:type/:id/hide HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 322
{
"clear_history": false,
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/channels/:type/:id/hide")
.setHeader("content-type", "application/json")
.setBody("{\n \"clear_history\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/channels/:type/:id/hide"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"clear_history\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"clear_history\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/channels/:type/:id/hide")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/channels/:type/:id/hide")
.header("content-type", "application/json")
.body("{\n \"clear_history\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
.asString();
const data = JSON.stringify({
clear_history: false,
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/channels/:type/:id/hide');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:type/:id/hide',
headers: {'content-type': 'application/json'},
data: {
clear_history: false,
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/channels/:type/:id/hide';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"clear_history":false,"user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/channels/:type/:id/hide',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "clear_history": false,\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"clear_history\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/channels/:type/:id/hide")
.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/channels/:type/:id/hide',
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({
clear_history: false,
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:type/:id/hide',
headers: {'content-type': 'application/json'},
body: {
clear_history: false,
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/channels/:type/:id/hide');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
clear_history: false,
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:type/:id/hide',
headers: {'content-type': 'application/json'},
data: {
clear_history: false,
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/channels/:type/:id/hide';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"clear_history":false,"user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"clear_history": @NO,
@"user": @{ @"ban_expires": @"", @"banned": @NO, @"id": @"", @"invisible": @NO, @"language": @"", @"push_notifications": @{ @"disabled": @NO, @"disabled_until": @"" }, @"revoke_tokens_issued_before": @"", @"role": @"", @"teams": @[ ] },
@"user_id": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/channels/:type/:id/hide"]
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}}/channels/:type/:id/hide" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"clear_history\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/channels/:type/:id/hide",
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([
'clear_history' => null,
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/channels/:type/:id/hide', [
'body' => '{
"clear_history": false,
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/channels/:type/:id/hide');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'clear_history' => null,
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'clear_history' => null,
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]));
$request->setRequestUrl('{{baseUrl}}/channels/:type/:id/hide');
$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}}/channels/:type/:id/hide' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"clear_history": false,
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/channels/:type/:id/hide' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"clear_history": false,
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"clear_history\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/channels/:type/:id/hide", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/channels/:type/:id/hide"
payload = {
"clear_history": False,
"user": {
"ban_expires": "",
"banned": False,
"id": "",
"invisible": False,
"language": "",
"push_notifications": {
"disabled": False,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/channels/:type/:id/hide"
payload <- "{\n \"clear_history\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/channels/:type/:id/hide")
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 \"clear_history\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/channels/:type/:id/hide') do |req|
req.body = "{\n \"clear_history\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/channels/:type/:id/hide";
let payload = json!({
"clear_history": false,
"user": json!({
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": json!({
"disabled": false,
"disabled_until": ""
}),
"revoke_tokens_issued_before": "",
"role": "",
"teams": ()
}),
"user_id": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/channels/:type/:id/hide \
--header 'content-type: application/json' \
--data '{
"clear_history": false,
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
echo '{
"clear_history": false,
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}' | \
http POST {{baseUrl}}/channels/:type/:id/hide \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "clear_history": false,\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n}' \
--output-document \
- {{baseUrl}}/channels/:type/:id/hide
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"clear_history": false,
"user": [
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": [
"disabled": false,
"disabled_until": ""
],
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
],
"user_id": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/channels/:type/:id/hide")! 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
Mark channels as read
{{baseUrl}}/channels/read
BODY json
{
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/channels/read");
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 \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/channels/read" {:content-type :json
:form-params {:user {:ban_expires ""
:banned false
:id ""
:invisible false
:language ""
:push_notifications {:disabled false
:disabled_until ""}
:revoke_tokens_issued_before ""
:role ""
:teams []}
:user_id ""}})
require "http/client"
url = "{{baseUrl}}/channels/read"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/channels/read"),
Content = new StringContent("{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/channels/read");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/channels/read"
payload := strings.NewReader("{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/channels/read HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 296
{
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/channels/read")
.setHeader("content-type", "application/json")
.setBody("{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/channels/read"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/channels/read")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/channels/read")
.header("content-type", "application/json")
.body("{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
.asString();
const data = JSON.stringify({
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/channels/read');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/read',
headers: {'content-type': 'application/json'},
data: {
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/channels/read';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/channels/read',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/channels/read")
.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/channels/read',
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({
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/read',
headers: {'content-type': 'application/json'},
body: {
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/channels/read');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/read',
headers: {'content-type': 'application/json'},
data: {
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/channels/read';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"user": @{ @"ban_expires": @"", @"banned": @NO, @"id": @"", @"invisible": @NO, @"language": @"", @"push_notifications": @{ @"disabled": @NO, @"disabled_until": @"" }, @"revoke_tokens_issued_before": @"", @"role": @"", @"teams": @[ ] },
@"user_id": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/channels/read"]
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}}/channels/read" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/channels/read",
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([
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/channels/read', [
'body' => '{
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/channels/read');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]));
$request->setRequestUrl('{{baseUrl}}/channels/read');
$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}}/channels/read' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/channels/read' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/channels/read", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/channels/read"
payload = {
"user": {
"ban_expires": "",
"banned": False,
"id": "",
"invisible": False,
"language": "",
"push_notifications": {
"disabled": False,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/channels/read"
payload <- "{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/channels/read")
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 \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/channels/read') do |req|
req.body = "{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/channels/read";
let payload = json!({
"user": json!({
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": json!({
"disabled": false,
"disabled_until": ""
}),
"revoke_tokens_issued_before": "",
"role": "",
"teams": ()
}),
"user_id": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/channels/read \
--header 'content-type: application/json' \
--data '{
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
echo '{
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}' | \
http POST {{baseUrl}}/channels/read \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n}' \
--output-document \
- {{baseUrl}}/channels/read
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"user": [
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": [
"disabled": false,
"disabled_until": ""
],
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
],
"user_id": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/channels/read")! 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
Mark read
{{baseUrl}}/channels/:type/:id/read
QUERY PARAMS
type
id
BODY json
{
"message_id": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/channels/:type/:id/read");
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 \"message_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/channels/:type/:id/read" {:content-type :json
:form-params {:message_id ""
:user {:ban_expires ""
:banned false
:id ""
:invisible false
:language ""
:push_notifications {:disabled false
:disabled_until ""}
:revoke_tokens_issued_before ""
:role ""
:teams []}
:user_id ""}})
require "http/client"
url = "{{baseUrl}}/channels/:type/:id/read"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"message_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/channels/:type/:id/read"),
Content = new StringContent("{\n \"message_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/channels/:type/:id/read");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"message_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/channels/:type/:id/read"
payload := strings.NewReader("{\n \"message_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/channels/:type/:id/read HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 316
{
"message_id": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/channels/:type/:id/read")
.setHeader("content-type", "application/json")
.setBody("{\n \"message_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/channels/:type/:id/read"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"message_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"message_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/channels/:type/:id/read")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/channels/:type/:id/read")
.header("content-type", "application/json")
.body("{\n \"message_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
.asString();
const data = JSON.stringify({
message_id: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/channels/:type/:id/read');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:type/:id/read',
headers: {'content-type': 'application/json'},
data: {
message_id: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/channels/:type/:id/read';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"message_id":"","user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/channels/:type/:id/read',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "message_id": "",\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"message_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/channels/:type/:id/read")
.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/channels/:type/:id/read',
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({
message_id: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:type/:id/read',
headers: {'content-type': 'application/json'},
body: {
message_id: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/channels/:type/:id/read');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
message_id: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:type/:id/read',
headers: {'content-type': 'application/json'},
data: {
message_id: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/channels/:type/:id/read';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"message_id":"","user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"message_id": @"",
@"user": @{ @"ban_expires": @"", @"banned": @NO, @"id": @"", @"invisible": @NO, @"language": @"", @"push_notifications": @{ @"disabled": @NO, @"disabled_until": @"" }, @"revoke_tokens_issued_before": @"", @"role": @"", @"teams": @[ ] },
@"user_id": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/channels/:type/:id/read"]
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}}/channels/:type/:id/read" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"message_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/channels/:type/:id/read",
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([
'message_id' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/channels/:type/:id/read', [
'body' => '{
"message_id": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/channels/:type/:id/read');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'message_id' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'message_id' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]));
$request->setRequestUrl('{{baseUrl}}/channels/:type/:id/read');
$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}}/channels/:type/:id/read' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"message_id": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/channels/:type/:id/read' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"message_id": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"message_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/channels/:type/:id/read", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/channels/:type/:id/read"
payload = {
"message_id": "",
"user": {
"ban_expires": "",
"banned": False,
"id": "",
"invisible": False,
"language": "",
"push_notifications": {
"disabled": False,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/channels/:type/:id/read"
payload <- "{\n \"message_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/channels/:type/:id/read")
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 \"message_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/channels/:type/:id/read') do |req|
req.body = "{\n \"message_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/channels/:type/:id/read";
let payload = json!({
"message_id": "",
"user": json!({
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": json!({
"disabled": false,
"disabled_until": ""
}),
"revoke_tokens_issued_before": "",
"role": "",
"teams": ()
}),
"user_id": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/channels/:type/:id/read \
--header 'content-type: application/json' \
--data '{
"message_id": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
echo '{
"message_id": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}' | \
http POST {{baseUrl}}/channels/:type/:id/read \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "message_id": "",\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n}' \
--output-document \
- {{baseUrl}}/channels/:type/:id/read
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"message_id": "",
"user": [
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": [
"disabled": false,
"disabled_until": ""
],
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
],
"user_id": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/channels/:type/:id/read")! 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
Mark unread
{{baseUrl}}/channels/:type/:id/unread
QUERY PARAMS
type
id
BODY json
{
"message_id": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/channels/:type/:id/unread");
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 \"message_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/channels/:type/:id/unread" {:content-type :json
:form-params {:message_id ""
:user {:ban_expires ""
:banned false
:id ""
:invisible false
:language ""
:push_notifications {:disabled false
:disabled_until ""}
:revoke_tokens_issued_before ""
:role ""
:teams []}
:user_id ""}})
require "http/client"
url = "{{baseUrl}}/channels/:type/:id/unread"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"message_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/channels/:type/:id/unread"),
Content = new StringContent("{\n \"message_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/channels/:type/:id/unread");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"message_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/channels/:type/:id/unread"
payload := strings.NewReader("{\n \"message_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/channels/:type/:id/unread HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 316
{
"message_id": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/channels/:type/:id/unread")
.setHeader("content-type", "application/json")
.setBody("{\n \"message_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/channels/:type/:id/unread"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"message_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"message_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/channels/:type/:id/unread")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/channels/:type/:id/unread")
.header("content-type", "application/json")
.body("{\n \"message_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
.asString();
const data = JSON.stringify({
message_id: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/channels/:type/:id/unread');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:type/:id/unread',
headers: {'content-type': 'application/json'},
data: {
message_id: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/channels/:type/:id/unread';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"message_id":"","user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/channels/:type/:id/unread',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "message_id": "",\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"message_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/channels/:type/:id/unread")
.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/channels/:type/:id/unread',
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({
message_id: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:type/:id/unread',
headers: {'content-type': 'application/json'},
body: {
message_id: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/channels/:type/:id/unread');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
message_id: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:type/:id/unread',
headers: {'content-type': 'application/json'},
data: {
message_id: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/channels/:type/:id/unread';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"message_id":"","user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"message_id": @"",
@"user": @{ @"ban_expires": @"", @"banned": @NO, @"id": @"", @"invisible": @NO, @"language": @"", @"push_notifications": @{ @"disabled": @NO, @"disabled_until": @"" }, @"revoke_tokens_issued_before": @"", @"role": @"", @"teams": @[ ] },
@"user_id": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/channels/:type/:id/unread"]
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}}/channels/:type/:id/unread" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"message_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/channels/:type/:id/unread",
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([
'message_id' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/channels/:type/:id/unread', [
'body' => '{
"message_id": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/channels/:type/:id/unread');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'message_id' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'message_id' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]));
$request->setRequestUrl('{{baseUrl}}/channels/:type/:id/unread');
$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}}/channels/:type/:id/unread' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"message_id": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/channels/:type/:id/unread' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"message_id": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"message_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/channels/:type/:id/unread", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/channels/:type/:id/unread"
payload = {
"message_id": "",
"user": {
"ban_expires": "",
"banned": False,
"id": "",
"invisible": False,
"language": "",
"push_notifications": {
"disabled": False,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/channels/:type/:id/unread"
payload <- "{\n \"message_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/channels/:type/:id/unread")
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 \"message_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/channels/:type/:id/unread') do |req|
req.body = "{\n \"message_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/channels/:type/:id/unread";
let payload = json!({
"message_id": "",
"user": json!({
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": json!({
"disabled": false,
"disabled_until": ""
}),
"revoke_tokens_issued_before": "",
"role": "",
"teams": ()
}),
"user_id": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/channels/:type/:id/unread \
--header 'content-type: application/json' \
--data '{
"message_id": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
echo '{
"message_id": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}' | \
http POST {{baseUrl}}/channels/:type/:id/unread \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "message_id": "",\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n}' \
--output-document \
- {{baseUrl}}/channels/:type/:id/unread
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"message_id": "",
"user": [
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": [
"disabled": false,
"disabled_until": ""
],
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
],
"user_id": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/channels/:type/:id/unread")! 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
Mute channel
{{baseUrl}}/moderation/mute/channel
BODY json
{
"channel_cids": [],
"expiration": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/moderation/mute/channel");
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 \"channel_cids\": [],\n \"expiration\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/moderation/mute/channel" {:content-type :json
:form-params {:channel_cids []
:expiration ""
:user {:ban_expires ""
:banned false
:id ""
:invisible false
:language ""
:push_notifications {:disabled false
:disabled_until ""}
:revoke_tokens_issued_before ""
:role ""
:teams []}
:user_id ""}})
require "http/client"
url = "{{baseUrl}}/moderation/mute/channel"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"channel_cids\": [],\n \"expiration\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/moderation/mute/channel"),
Content = new StringContent("{\n \"channel_cids\": [],\n \"expiration\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/moderation/mute/channel");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"channel_cids\": [],\n \"expiration\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/moderation/mute/channel"
payload := strings.NewReader("{\n \"channel_cids\": [],\n \"expiration\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/moderation/mute/channel HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 338
{
"channel_cids": [],
"expiration": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/moderation/mute/channel")
.setHeader("content-type", "application/json")
.setBody("{\n \"channel_cids\": [],\n \"expiration\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/moderation/mute/channel"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"channel_cids\": [],\n \"expiration\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"channel_cids\": [],\n \"expiration\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/moderation/mute/channel")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/moderation/mute/channel")
.header("content-type", "application/json")
.body("{\n \"channel_cids\": [],\n \"expiration\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
.asString();
const data = JSON.stringify({
channel_cids: [],
expiration: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/moderation/mute/channel');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/moderation/mute/channel',
headers: {'content-type': 'application/json'},
data: {
channel_cids: [],
expiration: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/moderation/mute/channel';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"channel_cids":[],"expiration":"","user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/moderation/mute/channel',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "channel_cids": [],\n "expiration": "",\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"channel_cids\": [],\n \"expiration\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/moderation/mute/channel")
.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/moderation/mute/channel',
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({
channel_cids: [],
expiration: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/moderation/mute/channel',
headers: {'content-type': 'application/json'},
body: {
channel_cids: [],
expiration: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/moderation/mute/channel');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
channel_cids: [],
expiration: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/moderation/mute/channel',
headers: {'content-type': 'application/json'},
data: {
channel_cids: [],
expiration: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/moderation/mute/channel';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"channel_cids":[],"expiration":"","user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"channel_cids": @[ ],
@"expiration": @"",
@"user": @{ @"ban_expires": @"", @"banned": @NO, @"id": @"", @"invisible": @NO, @"language": @"", @"push_notifications": @{ @"disabled": @NO, @"disabled_until": @"" }, @"revoke_tokens_issued_before": @"", @"role": @"", @"teams": @[ ] },
@"user_id": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/moderation/mute/channel"]
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}}/moderation/mute/channel" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"channel_cids\": [],\n \"expiration\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/moderation/mute/channel",
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([
'channel_cids' => [
],
'expiration' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/moderation/mute/channel', [
'body' => '{
"channel_cids": [],
"expiration": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/moderation/mute/channel');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'channel_cids' => [
],
'expiration' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'channel_cids' => [
],
'expiration' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]));
$request->setRequestUrl('{{baseUrl}}/moderation/mute/channel');
$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}}/moderation/mute/channel' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"channel_cids": [],
"expiration": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/moderation/mute/channel' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"channel_cids": [],
"expiration": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"channel_cids\": [],\n \"expiration\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/moderation/mute/channel", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/moderation/mute/channel"
payload = {
"channel_cids": [],
"expiration": "",
"user": {
"ban_expires": "",
"banned": False,
"id": "",
"invisible": False,
"language": "",
"push_notifications": {
"disabled": False,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/moderation/mute/channel"
payload <- "{\n \"channel_cids\": [],\n \"expiration\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/moderation/mute/channel")
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 \"channel_cids\": [],\n \"expiration\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/moderation/mute/channel') do |req|
req.body = "{\n \"channel_cids\": [],\n \"expiration\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/moderation/mute/channel";
let payload = json!({
"channel_cids": (),
"expiration": "",
"user": json!({
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": json!({
"disabled": false,
"disabled_until": ""
}),
"revoke_tokens_issued_before": "",
"role": "",
"teams": ()
}),
"user_id": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/moderation/mute/channel \
--header 'content-type: application/json' \
--data '{
"channel_cids": [],
"expiration": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
echo '{
"channel_cids": [],
"expiration": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}' | \
http POST {{baseUrl}}/moderation/mute/channel \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "channel_cids": [],\n "expiration": "",\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n}' \
--output-document \
- {{baseUrl}}/moderation/mute/channel
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"channel_cids": [],
"expiration": "",
"user": [
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": [
"disabled": false,
"disabled_until": ""
],
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
],
"user_id": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/moderation/mute/channel")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
Partially update channel
{{baseUrl}}/channels/:type/:id
QUERY PARAMS
type
id
BODY json
{
"set": {},
"unset": [],
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/channels/:type/: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 \"set\": {},\n \"unset\": [],\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/channels/:type/:id" {:content-type :json
:form-params {:set {}
:unset []
:user {:ban_expires ""
:banned false
:id ""
:invisible false
:language ""
:push_notifications {:disabled false
:disabled_until ""}
:revoke_tokens_issued_before ""
:role ""
:teams []}
:user_id ""}})
require "http/client"
url = "{{baseUrl}}/channels/:type/:id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"set\": {},\n \"unset\": [],\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
response = HTTP::Client.patch url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Patch,
RequestUri = new Uri("{{baseUrl}}/channels/:type/:id"),
Content = new StringContent("{\n \"set\": {},\n \"unset\": [],\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/channels/:type/:id");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"set\": {},\n \"unset\": [],\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/channels/:type/:id"
payload := strings.NewReader("{\n \"set\": {},\n \"unset\": [],\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PATCH /baseUrl/channels/:type/:id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 324
{
"set": {},
"unset": [],
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/channels/:type/:id")
.setHeader("content-type", "application/json")
.setBody("{\n \"set\": {},\n \"unset\": [],\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/channels/:type/:id"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"set\": {},\n \"unset\": [],\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"set\": {},\n \"unset\": [],\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/channels/:type/:id")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/channels/:type/:id")
.header("content-type", "application/json")
.body("{\n \"set\": {},\n \"unset\": [],\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
.asString();
const data = JSON.stringify({
set: {},
unset: [],
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/channels/:type/:id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/channels/:type/:id',
headers: {'content-type': 'application/json'},
data: {
set: {},
unset: [],
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/channels/:type/:id';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"set":{},"unset":[],"user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/channels/:type/:id',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "set": {},\n "unset": [],\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"set\": {},\n \"unset\": [],\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/channels/:type/:id")
.patch(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PATCH',
hostname: 'example.com',
port: null,
path: '/baseUrl/channels/:type/: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({
set: {},
unset: [],
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/channels/:type/:id',
headers: {'content-type': 'application/json'},
body: {
set: {},
unset: [],
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/channels/:type/:id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
set: {},
unset: [],
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/channels/:type/:id',
headers: {'content-type': 'application/json'},
data: {
set: {},
unset: [],
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/channels/:type/:id';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"set":{},"unset":[],"user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"set": @{ },
@"unset": @[ ],
@"user": @{ @"ban_expires": @"", @"banned": @NO, @"id": @"", @"invisible": @NO, @"language": @"", @"push_notifications": @{ @"disabled": @NO, @"disabled_until": @"" }, @"revoke_tokens_issued_before": @"", @"role": @"", @"teams": @[ ] },
@"user_id": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/channels/:type/:id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PATCH"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/channels/:type/:id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"set\": {},\n \"unset\": [],\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/channels/:type/:id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'set' => [
],
'unset' => [
],
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/channels/:type/:id', [
'body' => '{
"set": {},
"unset": [],
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/channels/:type/:id');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'set' => [
],
'unset' => [
],
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'set' => [
],
'unset' => [
],
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]));
$request->setRequestUrl('{{baseUrl}}/channels/:type/:id');
$request->setRequestMethod('PATCH');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/channels/:type/:id' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"set": {},
"unset": [],
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/channels/:type/:id' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"set": {},
"unset": [],
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"set\": {},\n \"unset\": [],\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/channels/:type/:id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/channels/:type/:id"
payload = {
"set": {},
"unset": [],
"user": {
"ban_expires": "",
"banned": False,
"id": "",
"invisible": False,
"language": "",
"push_notifications": {
"disabled": False,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/channels/:type/:id"
payload <- "{\n \"set\": {},\n \"unset\": [],\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
encode <- "json"
response <- VERB("PATCH", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/channels/:type/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"set\": {},\n \"unset\": [],\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/channels/:type/:id') do |req|
req.body = "{\n \"set\": {},\n \"unset\": [],\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/channels/:type/:id";
let payload = json!({
"set": json!({}),
"unset": (),
"user": json!({
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": json!({
"disabled": false,
"disabled_until": ""
}),
"revoke_tokens_issued_before": "",
"role": "",
"teams": ()
}),
"user_id": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/channels/:type/:id \
--header 'content-type: application/json' \
--data '{
"set": {},
"unset": [],
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
echo '{
"set": {},
"unset": [],
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}' | \
http PATCH {{baseUrl}}/channels/:type/:id \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "set": {},\n "unset": [],\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n}' \
--output-document \
- {{baseUrl}}/channels/:type/:id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"set": [],
"unset": [],
"user": [
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": [
"disabled": false,
"disabled_until": ""
],
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
],
"user_id": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/channels/:type/:id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Query channels
{{baseUrl}}/channels
BODY json
{
"client_id": "",
"connection_id": "",
"filter_conditions": {},
"limit": "",
"member_limit": "",
"message_limit": "",
"offset": "",
"presence": false,
"sort": [
{
"direction": "",
"field": ""
}
],
"state": false,
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": "",
"watch": false
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/channels");
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 \"client_id\": \"\",\n \"connection_id\": \"\",\n \"filter_conditions\": {},\n \"limit\": \"\",\n \"member_limit\": \"\",\n \"message_limit\": \"\",\n \"offset\": \"\",\n \"presence\": false,\n \"sort\": [\n {\n \"direction\": \"\",\n \"field\": \"\"\n }\n ],\n \"state\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\",\n \"watch\": false\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/channels" {:content-type :json
:form-params {:client_id ""
:connection_id ""
:filter_conditions {}
:limit ""
:member_limit ""
:message_limit ""
:offset ""
:presence false
:sort [{:direction ""
:field ""}]
:state false
:user {:ban_expires ""
:banned false
:id ""
:invisible false
:language ""
:push_notifications {:disabled false
:disabled_until ""}
:revoke_tokens_issued_before ""
:role ""
:teams []}
:user_id ""
:watch false}})
require "http/client"
url = "{{baseUrl}}/channels"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"filter_conditions\": {},\n \"limit\": \"\",\n \"member_limit\": \"\",\n \"message_limit\": \"\",\n \"offset\": \"\",\n \"presence\": false,\n \"sort\": [\n {\n \"direction\": \"\",\n \"field\": \"\"\n }\n ],\n \"state\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\",\n \"watch\": false\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/channels"),
Content = new StringContent("{\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"filter_conditions\": {},\n \"limit\": \"\",\n \"member_limit\": \"\",\n \"message_limit\": \"\",\n \"offset\": \"\",\n \"presence\": false,\n \"sort\": [\n {\n \"direction\": \"\",\n \"field\": \"\"\n }\n ],\n \"state\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\",\n \"watch\": false\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/channels");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"filter_conditions\": {},\n \"limit\": \"\",\n \"member_limit\": \"\",\n \"message_limit\": \"\",\n \"offset\": \"\",\n \"presence\": false,\n \"sort\": [\n {\n \"direction\": \"\",\n \"field\": \"\"\n }\n ],\n \"state\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\",\n \"watch\": false\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/channels"
payload := strings.NewReader("{\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"filter_conditions\": {},\n \"limit\": \"\",\n \"member_limit\": \"\",\n \"message_limit\": \"\",\n \"offset\": \"\",\n \"presence\": false,\n \"sort\": [\n {\n \"direction\": \"\",\n \"field\": \"\"\n }\n ],\n \"state\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\",\n \"watch\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/channels HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 568
{
"client_id": "",
"connection_id": "",
"filter_conditions": {},
"limit": "",
"member_limit": "",
"message_limit": "",
"offset": "",
"presence": false,
"sort": [
{
"direction": "",
"field": ""
}
],
"state": false,
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": "",
"watch": false
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/channels")
.setHeader("content-type", "application/json")
.setBody("{\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"filter_conditions\": {},\n \"limit\": \"\",\n \"member_limit\": \"\",\n \"message_limit\": \"\",\n \"offset\": \"\",\n \"presence\": false,\n \"sort\": [\n {\n \"direction\": \"\",\n \"field\": \"\"\n }\n ],\n \"state\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\",\n \"watch\": false\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/channels"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"filter_conditions\": {},\n \"limit\": \"\",\n \"member_limit\": \"\",\n \"message_limit\": \"\",\n \"offset\": \"\",\n \"presence\": false,\n \"sort\": [\n {\n \"direction\": \"\",\n \"field\": \"\"\n }\n ],\n \"state\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\",\n \"watch\": false\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"filter_conditions\": {},\n \"limit\": \"\",\n \"member_limit\": \"\",\n \"message_limit\": \"\",\n \"offset\": \"\",\n \"presence\": false,\n \"sort\": [\n {\n \"direction\": \"\",\n \"field\": \"\"\n }\n ],\n \"state\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\",\n \"watch\": false\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/channels")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/channels")
.header("content-type", "application/json")
.body("{\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"filter_conditions\": {},\n \"limit\": \"\",\n \"member_limit\": \"\",\n \"message_limit\": \"\",\n \"offset\": \"\",\n \"presence\": false,\n \"sort\": [\n {\n \"direction\": \"\",\n \"field\": \"\"\n }\n ],\n \"state\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\",\n \"watch\": false\n}")
.asString();
const data = JSON.stringify({
client_id: '',
connection_id: '',
filter_conditions: {},
limit: '',
member_limit: '',
message_limit: '',
offset: '',
presence: false,
sort: [
{
direction: '',
field: ''
}
],
state: false,
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: '',
watch: false
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/channels');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/channels',
headers: {'content-type': 'application/json'},
data: {
client_id: '',
connection_id: '',
filter_conditions: {},
limit: '',
member_limit: '',
message_limit: '',
offset: '',
presence: false,
sort: [{direction: '', field: ''}],
state: false,
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: '',
watch: false
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/channels';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"client_id":"","connection_id":"","filter_conditions":{},"limit":"","member_limit":"","message_limit":"","offset":"","presence":false,"sort":[{"direction":"","field":""}],"state":false,"user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":"","watch":false}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/channels',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "client_id": "",\n "connection_id": "",\n "filter_conditions": {},\n "limit": "",\n "member_limit": "",\n "message_limit": "",\n "offset": "",\n "presence": false,\n "sort": [\n {\n "direction": "",\n "field": ""\n }\n ],\n "state": false,\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": "",\n "watch": false\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"filter_conditions\": {},\n \"limit\": \"\",\n \"member_limit\": \"\",\n \"message_limit\": \"\",\n \"offset\": \"\",\n \"presence\": false,\n \"sort\": [\n {\n \"direction\": \"\",\n \"field\": \"\"\n }\n ],\n \"state\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\",\n \"watch\": false\n}")
val request = Request.Builder()
.url("{{baseUrl}}/channels")
.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/channels',
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({
client_id: '',
connection_id: '',
filter_conditions: {},
limit: '',
member_limit: '',
message_limit: '',
offset: '',
presence: false,
sort: [{direction: '', field: ''}],
state: false,
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: '',
watch: false
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/channels',
headers: {'content-type': 'application/json'},
body: {
client_id: '',
connection_id: '',
filter_conditions: {},
limit: '',
member_limit: '',
message_limit: '',
offset: '',
presence: false,
sort: [{direction: '', field: ''}],
state: false,
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: '',
watch: false
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/channels');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
client_id: '',
connection_id: '',
filter_conditions: {},
limit: '',
member_limit: '',
message_limit: '',
offset: '',
presence: false,
sort: [
{
direction: '',
field: ''
}
],
state: false,
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: '',
watch: false
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/channels',
headers: {'content-type': 'application/json'},
data: {
client_id: '',
connection_id: '',
filter_conditions: {},
limit: '',
member_limit: '',
message_limit: '',
offset: '',
presence: false,
sort: [{direction: '', field: ''}],
state: false,
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: '',
watch: false
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/channels';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"client_id":"","connection_id":"","filter_conditions":{},"limit":"","member_limit":"","message_limit":"","offset":"","presence":false,"sort":[{"direction":"","field":""}],"state":false,"user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":"","watch":false}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"client_id": @"",
@"connection_id": @"",
@"filter_conditions": @{ },
@"limit": @"",
@"member_limit": @"",
@"message_limit": @"",
@"offset": @"",
@"presence": @NO,
@"sort": @[ @{ @"direction": @"", @"field": @"" } ],
@"state": @NO,
@"user": @{ @"ban_expires": @"", @"banned": @NO, @"id": @"", @"invisible": @NO, @"language": @"", @"push_notifications": @{ @"disabled": @NO, @"disabled_until": @"" }, @"revoke_tokens_issued_before": @"", @"role": @"", @"teams": @[ ] },
@"user_id": @"",
@"watch": @NO };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/channels"]
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}}/channels" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"filter_conditions\": {},\n \"limit\": \"\",\n \"member_limit\": \"\",\n \"message_limit\": \"\",\n \"offset\": \"\",\n \"presence\": false,\n \"sort\": [\n {\n \"direction\": \"\",\n \"field\": \"\"\n }\n ],\n \"state\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\",\n \"watch\": false\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/channels",
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([
'client_id' => '',
'connection_id' => '',
'filter_conditions' => [
],
'limit' => '',
'member_limit' => '',
'message_limit' => '',
'offset' => '',
'presence' => null,
'sort' => [
[
'direction' => '',
'field' => ''
]
],
'state' => null,
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => '',
'watch' => null
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/channels', [
'body' => '{
"client_id": "",
"connection_id": "",
"filter_conditions": {},
"limit": "",
"member_limit": "",
"message_limit": "",
"offset": "",
"presence": false,
"sort": [
{
"direction": "",
"field": ""
}
],
"state": false,
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": "",
"watch": false
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/channels');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'client_id' => '',
'connection_id' => '',
'filter_conditions' => [
],
'limit' => '',
'member_limit' => '',
'message_limit' => '',
'offset' => '',
'presence' => null,
'sort' => [
[
'direction' => '',
'field' => ''
]
],
'state' => null,
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => '',
'watch' => null
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'client_id' => '',
'connection_id' => '',
'filter_conditions' => [
],
'limit' => '',
'member_limit' => '',
'message_limit' => '',
'offset' => '',
'presence' => null,
'sort' => [
[
'direction' => '',
'field' => ''
]
],
'state' => null,
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => '',
'watch' => null
]));
$request->setRequestUrl('{{baseUrl}}/channels');
$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}}/channels' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"client_id": "",
"connection_id": "",
"filter_conditions": {},
"limit": "",
"member_limit": "",
"message_limit": "",
"offset": "",
"presence": false,
"sort": [
{
"direction": "",
"field": ""
}
],
"state": false,
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": "",
"watch": false
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/channels' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"client_id": "",
"connection_id": "",
"filter_conditions": {},
"limit": "",
"member_limit": "",
"message_limit": "",
"offset": "",
"presence": false,
"sort": [
{
"direction": "",
"field": ""
}
],
"state": false,
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": "",
"watch": false
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"filter_conditions\": {},\n \"limit\": \"\",\n \"member_limit\": \"\",\n \"message_limit\": \"\",\n \"offset\": \"\",\n \"presence\": false,\n \"sort\": [\n {\n \"direction\": \"\",\n \"field\": \"\"\n }\n ],\n \"state\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\",\n \"watch\": false\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/channels", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/channels"
payload = {
"client_id": "",
"connection_id": "",
"filter_conditions": {},
"limit": "",
"member_limit": "",
"message_limit": "",
"offset": "",
"presence": False,
"sort": [
{
"direction": "",
"field": ""
}
],
"state": False,
"user": {
"ban_expires": "",
"banned": False,
"id": "",
"invisible": False,
"language": "",
"push_notifications": {
"disabled": False,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": "",
"watch": False
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/channels"
payload <- "{\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"filter_conditions\": {},\n \"limit\": \"\",\n \"member_limit\": \"\",\n \"message_limit\": \"\",\n \"offset\": \"\",\n \"presence\": false,\n \"sort\": [\n {\n \"direction\": \"\",\n \"field\": \"\"\n }\n ],\n \"state\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\",\n \"watch\": false\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/channels")
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 \"client_id\": \"\",\n \"connection_id\": \"\",\n \"filter_conditions\": {},\n \"limit\": \"\",\n \"member_limit\": \"\",\n \"message_limit\": \"\",\n \"offset\": \"\",\n \"presence\": false,\n \"sort\": [\n {\n \"direction\": \"\",\n \"field\": \"\"\n }\n ],\n \"state\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\",\n \"watch\": false\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/channels') do |req|
req.body = "{\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"filter_conditions\": {},\n \"limit\": \"\",\n \"member_limit\": \"\",\n \"message_limit\": \"\",\n \"offset\": \"\",\n \"presence\": false,\n \"sort\": [\n {\n \"direction\": \"\",\n \"field\": \"\"\n }\n ],\n \"state\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\",\n \"watch\": false\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/channels";
let payload = json!({
"client_id": "",
"connection_id": "",
"filter_conditions": json!({}),
"limit": "",
"member_limit": "",
"message_limit": "",
"offset": "",
"presence": false,
"sort": (
json!({
"direction": "",
"field": ""
})
),
"state": false,
"user": json!({
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": json!({
"disabled": false,
"disabled_until": ""
}),
"revoke_tokens_issued_before": "",
"role": "",
"teams": ()
}),
"user_id": "",
"watch": false
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/channels \
--header 'content-type: application/json' \
--data '{
"client_id": "",
"connection_id": "",
"filter_conditions": {},
"limit": "",
"member_limit": "",
"message_limit": "",
"offset": "",
"presence": false,
"sort": [
{
"direction": "",
"field": ""
}
],
"state": false,
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": "",
"watch": false
}'
echo '{
"client_id": "",
"connection_id": "",
"filter_conditions": {},
"limit": "",
"member_limit": "",
"message_limit": "",
"offset": "",
"presence": false,
"sort": [
{
"direction": "",
"field": ""
}
],
"state": false,
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": "",
"watch": false
}' | \
http POST {{baseUrl}}/channels \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "client_id": "",\n "connection_id": "",\n "filter_conditions": {},\n "limit": "",\n "member_limit": "",\n "message_limit": "",\n "offset": "",\n "presence": false,\n "sort": [\n {\n "direction": "",\n "field": ""\n }\n ],\n "state": false,\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": "",\n "watch": false\n}' \
--output-document \
- {{baseUrl}}/channels
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"client_id": "",
"connection_id": "",
"filter_conditions": [],
"limit": "",
"member_limit": "",
"message_limit": "",
"offset": "",
"presence": false,
"sort": [
[
"direction": "",
"field": ""
]
],
"state": false,
"user": [
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": [
"disabled": false,
"disabled_until": ""
],
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
],
"user_id": "",
"watch": false
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/channels")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Query members
{{baseUrl}}/members
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/members");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/members")
require "http/client"
url = "{{baseUrl}}/members"
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}}/members"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/members");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/members"
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/members HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/members")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/members"))
.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}}/members")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/members")
.asString();
const 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}}/members');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/members'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/members';
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}}/members',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/members")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/members',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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}}/members'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/members');
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}}/members'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/members';
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}}/members"]
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}}/members" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/members",
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}}/members');
echo $response->getBody();
setUrl('{{baseUrl}}/members');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/members');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/members' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/members' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/members")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/members"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/members"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/members")
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/members') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/members";
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}}/members
http GET {{baseUrl}}/members
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/members
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/members")! 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
Search messages
{{baseUrl}}/search
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/search");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/search")
require "http/client"
url = "{{baseUrl}}/search"
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}}/search"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/search");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/search"
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/search HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/search")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/search"))
.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}}/search")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/search")
.asString();
const 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}}/search');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/search'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/search';
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}}/search',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/search")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/search',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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}}/search'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/search');
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}}/search'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/search';
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}}/search"]
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}}/search" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/search",
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}}/search');
echo $response->getBody();
setUrl('{{baseUrl}}/search');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/search');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/search' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/search' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/search")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/search"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/search"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/search")
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/search') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/search";
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}}/search
http GET {{baseUrl}}/search
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/search
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/search")! 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
Show channel
{{baseUrl}}/channels/:type/:id/show
QUERY PARAMS
type
id
BODY json
{
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/channels/:type/:id/show");
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 \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/channels/:type/:id/show" {:content-type :json
:form-params {:user {:ban_expires ""
:banned false
:id ""
:invisible false
:language ""
:push_notifications {:disabled false
:disabled_until ""}
:revoke_tokens_issued_before ""
:role ""
:teams []}
:user_id ""}})
require "http/client"
url = "{{baseUrl}}/channels/:type/:id/show"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/channels/:type/:id/show"),
Content = new StringContent("{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/channels/:type/:id/show");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/channels/:type/:id/show"
payload := strings.NewReader("{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/channels/:type/:id/show HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 296
{
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/channels/:type/:id/show")
.setHeader("content-type", "application/json")
.setBody("{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/channels/:type/:id/show"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/channels/:type/:id/show")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/channels/:type/:id/show")
.header("content-type", "application/json")
.body("{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
.asString();
const data = JSON.stringify({
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/channels/:type/:id/show');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:type/:id/show',
headers: {'content-type': 'application/json'},
data: {
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/channels/:type/:id/show';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/channels/:type/:id/show',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/channels/:type/:id/show")
.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/channels/:type/:id/show',
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({
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:type/:id/show',
headers: {'content-type': 'application/json'},
body: {
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/channels/:type/:id/show');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:type/:id/show',
headers: {'content-type': 'application/json'},
data: {
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/channels/:type/:id/show';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"user": @{ @"ban_expires": @"", @"banned": @NO, @"id": @"", @"invisible": @NO, @"language": @"", @"push_notifications": @{ @"disabled": @NO, @"disabled_until": @"" }, @"revoke_tokens_issued_before": @"", @"role": @"", @"teams": @[ ] },
@"user_id": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/channels/:type/:id/show"]
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}}/channels/:type/:id/show" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/channels/:type/:id/show",
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([
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/channels/:type/:id/show', [
'body' => '{
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/channels/:type/:id/show');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]));
$request->setRequestUrl('{{baseUrl}}/channels/:type/:id/show');
$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}}/channels/:type/:id/show' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/channels/:type/:id/show' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/channels/:type/:id/show", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/channels/:type/:id/show"
payload = {
"user": {
"ban_expires": "",
"banned": False,
"id": "",
"invisible": False,
"language": "",
"push_notifications": {
"disabled": False,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/channels/:type/:id/show"
payload <- "{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/channels/:type/:id/show")
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 \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/channels/:type/:id/show') do |req|
req.body = "{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/channels/:type/:id/show";
let payload = json!({
"user": json!({
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": json!({
"disabled": false,
"disabled_until": ""
}),
"revoke_tokens_issued_before": "",
"role": "",
"teams": ()
}),
"user_id": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/channels/:type/:id/show \
--header 'content-type: application/json' \
--data '{
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
echo '{
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}' | \
http POST {{baseUrl}}/channels/:type/:id/show \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n}' \
--output-document \
- {{baseUrl}}/channels/:type/:id/show
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"user": [
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": [
"disabled": false,
"disabled_until": ""
],
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
],
"user_id": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/channels/:type/:id/show")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Stop watching channel
{{baseUrl}}/channels/:type/:id/stop-watching
QUERY PARAMS
type
id
BODY json
{
"client_id": "",
"connection_id": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/channels/:type/:id/stop-watching");
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 \"client_id\": \"\",\n \"connection_id\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/channels/:type/:id/stop-watching" {:content-type :json
:form-params {:client_id ""
:connection_id ""}})
require "http/client"
url = "{{baseUrl}}/channels/:type/:id/stop-watching"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"client_id\": \"\",\n \"connection_id\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/channels/:type/:id/stop-watching"),
Content = new StringContent("{\n \"client_id\": \"\",\n \"connection_id\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/channels/:type/:id/stop-watching");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"client_id\": \"\",\n \"connection_id\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/channels/:type/:id/stop-watching"
payload := strings.NewReader("{\n \"client_id\": \"\",\n \"connection_id\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/channels/:type/:id/stop-watching HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 44
{
"client_id": "",
"connection_id": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/channels/:type/:id/stop-watching")
.setHeader("content-type", "application/json")
.setBody("{\n \"client_id\": \"\",\n \"connection_id\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/channels/:type/:id/stop-watching"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"client_id\": \"\",\n \"connection_id\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"client_id\": \"\",\n \"connection_id\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/channels/:type/:id/stop-watching")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/channels/:type/:id/stop-watching")
.header("content-type", "application/json")
.body("{\n \"client_id\": \"\",\n \"connection_id\": \"\"\n}")
.asString();
const data = JSON.stringify({
client_id: '',
connection_id: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/channels/:type/:id/stop-watching');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:type/:id/stop-watching',
headers: {'content-type': 'application/json'},
data: {client_id: '', connection_id: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/channels/:type/:id/stop-watching';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"client_id":"","connection_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/channels/:type/:id/stop-watching',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "client_id": "",\n "connection_id": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"client_id\": \"\",\n \"connection_id\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/channels/:type/:id/stop-watching")
.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/channels/:type/:id/stop-watching',
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({client_id: '', connection_id: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:type/:id/stop-watching',
headers: {'content-type': 'application/json'},
body: {client_id: '', connection_id: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/channels/:type/:id/stop-watching');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
client_id: '',
connection_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:type/:id/stop-watching',
headers: {'content-type': 'application/json'},
data: {client_id: '', connection_id: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/channels/:type/:id/stop-watching';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"client_id":"","connection_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"client_id": @"",
@"connection_id": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/channels/:type/:id/stop-watching"]
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}}/channels/:type/:id/stop-watching" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"client_id\": \"\",\n \"connection_id\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/channels/:type/:id/stop-watching",
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([
'client_id' => '',
'connection_id' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/channels/:type/:id/stop-watching', [
'body' => '{
"client_id": "",
"connection_id": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/channels/:type/:id/stop-watching');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'client_id' => '',
'connection_id' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'client_id' => '',
'connection_id' => ''
]));
$request->setRequestUrl('{{baseUrl}}/channels/:type/:id/stop-watching');
$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}}/channels/:type/:id/stop-watching' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"client_id": "",
"connection_id": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/channels/:type/:id/stop-watching' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"client_id": "",
"connection_id": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"client_id\": \"\",\n \"connection_id\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/channels/:type/:id/stop-watching", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/channels/:type/:id/stop-watching"
payload = {
"client_id": "",
"connection_id": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/channels/:type/:id/stop-watching"
payload <- "{\n \"client_id\": \"\",\n \"connection_id\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/channels/:type/:id/stop-watching")
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 \"client_id\": \"\",\n \"connection_id\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/channels/:type/:id/stop-watching') do |req|
req.body = "{\n \"client_id\": \"\",\n \"connection_id\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/channels/:type/:id/stop-watching";
let payload = json!({
"client_id": "",
"connection_id": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/channels/:type/:id/stop-watching \
--header 'content-type: application/json' \
--data '{
"client_id": "",
"connection_id": ""
}'
echo '{
"client_id": "",
"connection_id": ""
}' | \
http POST {{baseUrl}}/channels/:type/:id/stop-watching \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "client_id": "",\n "connection_id": ""\n}' \
--output-document \
- {{baseUrl}}/channels/:type/:id/stop-watching
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"client_id": "",
"connection_id": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/channels/:type/:id/stop-watching")! 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
Sync
{{baseUrl}}/sync
BODY json
{
"channel_cids": [],
"client_id": "",
"connection_id": "",
"last_sync_at": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": "",
"watch": false,
"with_inaccessible_cids": false
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/sync");
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 \"channel_cids\": [],\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"last_sync_at\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\",\n \"watch\": false,\n \"with_inaccessible_cids\": false\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/sync" {:content-type :json
:form-params {:channel_cids []
:client_id ""
:connection_id ""
:last_sync_at ""
:user {:ban_expires ""
:banned false
:id ""
:invisible false
:language ""
:push_notifications {:disabled false
:disabled_until ""}
:revoke_tokens_issued_before ""
:role ""
:teams []}
:user_id ""
:watch false
:with_inaccessible_cids false}})
require "http/client"
url = "{{baseUrl}}/sync"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"channel_cids\": [],\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"last_sync_at\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\",\n \"watch\": false,\n \"with_inaccessible_cids\": false\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/sync"),
Content = new StringContent("{\n \"channel_cids\": [],\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"last_sync_at\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\",\n \"watch\": false,\n \"with_inaccessible_cids\": false\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/sync");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"channel_cids\": [],\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"last_sync_at\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\",\n \"watch\": false,\n \"with_inaccessible_cids\": false\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/sync"
payload := strings.NewReader("{\n \"channel_cids\": [],\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"last_sync_at\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\",\n \"watch\": false,\n \"with_inaccessible_cids\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/sync HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 435
{
"channel_cids": [],
"client_id": "",
"connection_id": "",
"last_sync_at": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": "",
"watch": false,
"with_inaccessible_cids": false
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/sync")
.setHeader("content-type", "application/json")
.setBody("{\n \"channel_cids\": [],\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"last_sync_at\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\",\n \"watch\": false,\n \"with_inaccessible_cids\": false\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/sync"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"channel_cids\": [],\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"last_sync_at\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\",\n \"watch\": false,\n \"with_inaccessible_cids\": false\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"channel_cids\": [],\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"last_sync_at\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\",\n \"watch\": false,\n \"with_inaccessible_cids\": false\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/sync")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/sync")
.header("content-type", "application/json")
.body("{\n \"channel_cids\": [],\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"last_sync_at\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\",\n \"watch\": false,\n \"with_inaccessible_cids\": false\n}")
.asString();
const data = JSON.stringify({
channel_cids: [],
client_id: '',
connection_id: '',
last_sync_at: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: '',
watch: false,
with_inaccessible_cids: false
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/sync');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/sync',
headers: {'content-type': 'application/json'},
data: {
channel_cids: [],
client_id: '',
connection_id: '',
last_sync_at: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: '',
watch: false,
with_inaccessible_cids: false
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/sync';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"channel_cids":[],"client_id":"","connection_id":"","last_sync_at":"","user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":"","watch":false,"with_inaccessible_cids":false}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/sync',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "channel_cids": [],\n "client_id": "",\n "connection_id": "",\n "last_sync_at": "",\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": "",\n "watch": false,\n "with_inaccessible_cids": false\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"channel_cids\": [],\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"last_sync_at\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\",\n \"watch\": false,\n \"with_inaccessible_cids\": false\n}")
val request = Request.Builder()
.url("{{baseUrl}}/sync")
.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/sync',
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({
channel_cids: [],
client_id: '',
connection_id: '',
last_sync_at: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: '',
watch: false,
with_inaccessible_cids: false
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/sync',
headers: {'content-type': 'application/json'},
body: {
channel_cids: [],
client_id: '',
connection_id: '',
last_sync_at: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: '',
watch: false,
with_inaccessible_cids: false
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/sync');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
channel_cids: [],
client_id: '',
connection_id: '',
last_sync_at: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: '',
watch: false,
with_inaccessible_cids: false
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/sync',
headers: {'content-type': 'application/json'},
data: {
channel_cids: [],
client_id: '',
connection_id: '',
last_sync_at: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: '',
watch: false,
with_inaccessible_cids: false
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/sync';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"channel_cids":[],"client_id":"","connection_id":"","last_sync_at":"","user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":"","watch":false,"with_inaccessible_cids":false}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"channel_cids": @[ ],
@"client_id": @"",
@"connection_id": @"",
@"last_sync_at": @"",
@"user": @{ @"ban_expires": @"", @"banned": @NO, @"id": @"", @"invisible": @NO, @"language": @"", @"push_notifications": @{ @"disabled": @NO, @"disabled_until": @"" }, @"revoke_tokens_issued_before": @"", @"role": @"", @"teams": @[ ] },
@"user_id": @"",
@"watch": @NO,
@"with_inaccessible_cids": @NO };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/sync"]
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}}/sync" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"channel_cids\": [],\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"last_sync_at\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\",\n \"watch\": false,\n \"with_inaccessible_cids\": false\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/sync",
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([
'channel_cids' => [
],
'client_id' => '',
'connection_id' => '',
'last_sync_at' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => '',
'watch' => null,
'with_inaccessible_cids' => null
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/sync', [
'body' => '{
"channel_cids": [],
"client_id": "",
"connection_id": "",
"last_sync_at": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": "",
"watch": false,
"with_inaccessible_cids": false
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/sync');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'channel_cids' => [
],
'client_id' => '',
'connection_id' => '',
'last_sync_at' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => '',
'watch' => null,
'with_inaccessible_cids' => null
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'channel_cids' => [
],
'client_id' => '',
'connection_id' => '',
'last_sync_at' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => '',
'watch' => null,
'with_inaccessible_cids' => null
]));
$request->setRequestUrl('{{baseUrl}}/sync');
$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}}/sync' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"channel_cids": [],
"client_id": "",
"connection_id": "",
"last_sync_at": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": "",
"watch": false,
"with_inaccessible_cids": false
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/sync' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"channel_cids": [],
"client_id": "",
"connection_id": "",
"last_sync_at": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": "",
"watch": false,
"with_inaccessible_cids": false
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"channel_cids\": [],\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"last_sync_at\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\",\n \"watch\": false,\n \"with_inaccessible_cids\": false\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/sync", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/sync"
payload = {
"channel_cids": [],
"client_id": "",
"connection_id": "",
"last_sync_at": "",
"user": {
"ban_expires": "",
"banned": False,
"id": "",
"invisible": False,
"language": "",
"push_notifications": {
"disabled": False,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": "",
"watch": False,
"with_inaccessible_cids": False
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/sync"
payload <- "{\n \"channel_cids\": [],\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"last_sync_at\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\",\n \"watch\": false,\n \"with_inaccessible_cids\": false\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/sync")
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 \"channel_cids\": [],\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"last_sync_at\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\",\n \"watch\": false,\n \"with_inaccessible_cids\": false\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/sync') do |req|
req.body = "{\n \"channel_cids\": [],\n \"client_id\": \"\",\n \"connection_id\": \"\",\n \"last_sync_at\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\",\n \"watch\": false,\n \"with_inaccessible_cids\": false\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/sync";
let payload = json!({
"channel_cids": (),
"client_id": "",
"connection_id": "",
"last_sync_at": "",
"user": json!({
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": json!({
"disabled": false,
"disabled_until": ""
}),
"revoke_tokens_issued_before": "",
"role": "",
"teams": ()
}),
"user_id": "",
"watch": false,
"with_inaccessible_cids": false
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/sync \
--header 'content-type: application/json' \
--data '{
"channel_cids": [],
"client_id": "",
"connection_id": "",
"last_sync_at": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": "",
"watch": false,
"with_inaccessible_cids": false
}'
echo '{
"channel_cids": [],
"client_id": "",
"connection_id": "",
"last_sync_at": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": "",
"watch": false,
"with_inaccessible_cids": false
}' | \
http POST {{baseUrl}}/sync \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "channel_cids": [],\n "client_id": "",\n "connection_id": "",\n "last_sync_at": "",\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": "",\n "watch": false,\n "with_inaccessible_cids": false\n}' \
--output-document \
- {{baseUrl}}/sync
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"channel_cids": [],
"client_id": "",
"connection_id": "",
"last_sync_at": "",
"user": [
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": [
"disabled": false,
"disabled_until": ""
],
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
],
"user_id": "",
"watch": false,
"with_inaccessible_cids": false
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/sync")! 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
Truncate channel
{{baseUrl}}/channels/:type/:id/truncate
QUERY PARAMS
type
id
BODY json
{
"hard_delete": false,
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"cid": [],
"html": "",
"id": "",
"mentioned_users": [],
"mml": "",
"parent": [],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": [],
"quoted_message_id": "",
"reaction_scores": [],
"show_in_channel": false,
"silent": false,
"text": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
},
"skip_push": false,
"truncated_at": "",
"user": {},
"user_id": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/channels/:type/:id/truncate");
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 \"hard_delete\": false,\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"skip_push\": false,\n \"truncated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/channels/:type/:id/truncate" {:content-type :json
:form-params {:hard_delete false
:message {:attachments [{:actions [{:name ""
:style ""
:text ""
:type ""
:value ""}]
:asset_url ""
:author_icon ""
:author_link ""
:author_name ""
:color ""
:fallback ""
:fields [{:short false
:title ""
:value ""}]
:footer ""
:footer_icon ""
:giphy {:fixed_height {:frames ""
:height ""
:size ""
:url ""
:width ""}
:fixed_height_downsampled {}
:fixed_height_still {}
:fixed_width {}
:fixed_width_downsampled {}
:fixed_width_still {}
:original {}}
:image_url ""
:og_scrape_url ""
:original_height ""
:original_width ""
:pretext ""
:text ""
:thumb_url ""
:title ""
:title_link ""
:type ""}]
:cid []
:html ""
:id ""
:mentioned_users []
:mml ""
:parent []
:parent_id ""
:pin_expires ""
:pinned false
:pinned_at ""
:pinned_by []
:quoted_message_id ""
:reaction_scores []
:show_in_channel false
:silent false
:text ""
:user {:ban_expires ""
:banned false
:id ""
:invisible false
:language ""
:push_notifications {:disabled false
:disabled_until ""}
:revoke_tokens_issued_before ""
:role ""
:teams []}
:user_id ""}
:skip_push false
:truncated_at ""
:user {}
:user_id ""}})
require "http/client"
url = "{{baseUrl}}/channels/:type/:id/truncate"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"hard_delete\": false,\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"skip_push\": false,\n \"truncated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/channels/:type/:id/truncate"),
Content = new StringContent("{\n \"hard_delete\": false,\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"skip_push\": false,\n \"truncated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/channels/:type/:id/truncate");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"hard_delete\": false,\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"skip_push\": false,\n \"truncated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/channels/:type/:id/truncate"
payload := strings.NewReader("{\n \"hard_delete\": false,\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"skip_push\": false,\n \"truncated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/channels/:type/:id/truncate HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 1983
{
"hard_delete": false,
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"cid": [],
"html": "",
"id": "",
"mentioned_users": [],
"mml": "",
"parent": [],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": [],
"quoted_message_id": "",
"reaction_scores": [],
"show_in_channel": false,
"silent": false,
"text": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
},
"skip_push": false,
"truncated_at": "",
"user": {},
"user_id": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/channels/:type/:id/truncate")
.setHeader("content-type", "application/json")
.setBody("{\n \"hard_delete\": false,\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"skip_push\": false,\n \"truncated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/channels/:type/:id/truncate"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"hard_delete\": false,\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"skip_push\": false,\n \"truncated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"hard_delete\": false,\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"skip_push\": false,\n \"truncated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/channels/:type/:id/truncate")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/channels/:type/:id/truncate")
.header("content-type", "application/json")
.body("{\n \"hard_delete\": false,\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"skip_push\": false,\n \"truncated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n}")
.asString();
const data = JSON.stringify({
hard_delete: false,
message: {
attachments: [
{
actions: [
{
name: '',
style: '',
text: '',
type: '',
value: ''
}
],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [
{
short: false,
title: '',
value: ''
}
],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {
frames: '',
height: '',
size: '',
url: '',
width: ''
},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
cid: [],
html: '',
id: '',
mentioned_users: [],
mml: '',
parent: [],
parent_id: '',
pin_expires: '',
pinned: false,
pinned_at: '',
pinned_by: [],
quoted_message_id: '',
reaction_scores: [],
show_in_channel: false,
silent: false,
text: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
skip_push: false,
truncated_at: '',
user: {},
user_id: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/channels/:type/:id/truncate');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:type/:id/truncate',
headers: {'content-type': 'application/json'},
data: {
hard_delete: false,
message: {
attachments: [
{
actions: [{name: '', style: '', text: '', type: '', value: ''}],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [{short: false, title: '', value: ''}],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {frames: '', height: '', size: '', url: '', width: ''},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
cid: [],
html: '',
id: '',
mentioned_users: [],
mml: '',
parent: [],
parent_id: '',
pin_expires: '',
pinned: false,
pinned_at: '',
pinned_by: [],
quoted_message_id: '',
reaction_scores: [],
show_in_channel: false,
silent: false,
text: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
skip_push: false,
truncated_at: '',
user: {},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/channels/:type/:id/truncate';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"hard_delete":false,"message":{"attachments":[{"actions":[{"name":"","style":"","text":"","type":"","value":""}],"asset_url":"","author_icon":"","author_link":"","author_name":"","color":"","fallback":"","fields":[{"short":false,"title":"","value":""}],"footer":"","footer_icon":"","giphy":{"fixed_height":{"frames":"","height":"","size":"","url":"","width":""},"fixed_height_downsampled":{},"fixed_height_still":{},"fixed_width":{},"fixed_width_downsampled":{},"fixed_width_still":{},"original":{}},"image_url":"","og_scrape_url":"","original_height":"","original_width":"","pretext":"","text":"","thumb_url":"","title":"","title_link":"","type":""}],"cid":[],"html":"","id":"","mentioned_users":[],"mml":"","parent":[],"parent_id":"","pin_expires":"","pinned":false,"pinned_at":"","pinned_by":[],"quoted_message_id":"","reaction_scores":[],"show_in_channel":false,"silent":false,"text":"","user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""},"skip_push":false,"truncated_at":"","user":{},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/channels/:type/:id/truncate',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "hard_delete": false,\n "message": {\n "attachments": [\n {\n "actions": [\n {\n "name": "",\n "style": "",\n "text": "",\n "type": "",\n "value": ""\n }\n ],\n "asset_url": "",\n "author_icon": "",\n "author_link": "",\n "author_name": "",\n "color": "",\n "fallback": "",\n "fields": [\n {\n "short": false,\n "title": "",\n "value": ""\n }\n ],\n "footer": "",\n "footer_icon": "",\n "giphy": {\n "fixed_height": {\n "frames": "",\n "height": "",\n "size": "",\n "url": "",\n "width": ""\n },\n "fixed_height_downsampled": {},\n "fixed_height_still": {},\n "fixed_width": {},\n "fixed_width_downsampled": {},\n "fixed_width_still": {},\n "original": {}\n },\n "image_url": "",\n "og_scrape_url": "",\n "original_height": "",\n "original_width": "",\n "pretext": "",\n "text": "",\n "thumb_url": "",\n "title": "",\n "title_link": "",\n "type": ""\n }\n ],\n "cid": [],\n "html": "",\n "id": "",\n "mentioned_users": [],\n "mml": "",\n "parent": [],\n "parent_id": "",\n "pin_expires": "",\n "pinned": false,\n "pinned_at": "",\n "pinned_by": [],\n "quoted_message_id": "",\n "reaction_scores": [],\n "show_in_channel": false,\n "silent": false,\n "text": "",\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n },\n "skip_push": false,\n "truncated_at": "",\n "user": {},\n "user_id": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"hard_delete\": false,\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"skip_push\": false,\n \"truncated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/channels/:type/:id/truncate")
.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/channels/:type/:id/truncate',
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({
hard_delete: false,
message: {
attachments: [
{
actions: [{name: '', style: '', text: '', type: '', value: ''}],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [{short: false, title: '', value: ''}],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {frames: '', height: '', size: '', url: '', width: ''},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
cid: [],
html: '',
id: '',
mentioned_users: [],
mml: '',
parent: [],
parent_id: '',
pin_expires: '',
pinned: false,
pinned_at: '',
pinned_by: [],
quoted_message_id: '',
reaction_scores: [],
show_in_channel: false,
silent: false,
text: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
skip_push: false,
truncated_at: '',
user: {},
user_id: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:type/:id/truncate',
headers: {'content-type': 'application/json'},
body: {
hard_delete: false,
message: {
attachments: [
{
actions: [{name: '', style: '', text: '', type: '', value: ''}],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [{short: false, title: '', value: ''}],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {frames: '', height: '', size: '', url: '', width: ''},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
cid: [],
html: '',
id: '',
mentioned_users: [],
mml: '',
parent: [],
parent_id: '',
pin_expires: '',
pinned: false,
pinned_at: '',
pinned_by: [],
quoted_message_id: '',
reaction_scores: [],
show_in_channel: false,
silent: false,
text: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
skip_push: false,
truncated_at: '',
user: {},
user_id: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/channels/:type/:id/truncate');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
hard_delete: false,
message: {
attachments: [
{
actions: [
{
name: '',
style: '',
text: '',
type: '',
value: ''
}
],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [
{
short: false,
title: '',
value: ''
}
],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {
frames: '',
height: '',
size: '',
url: '',
width: ''
},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
cid: [],
html: '',
id: '',
mentioned_users: [],
mml: '',
parent: [],
parent_id: '',
pin_expires: '',
pinned: false,
pinned_at: '',
pinned_by: [],
quoted_message_id: '',
reaction_scores: [],
show_in_channel: false,
silent: false,
text: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
skip_push: false,
truncated_at: '',
user: {},
user_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:type/:id/truncate',
headers: {'content-type': 'application/json'},
data: {
hard_delete: false,
message: {
attachments: [
{
actions: [{name: '', style: '', text: '', type: '', value: ''}],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [{short: false, title: '', value: ''}],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {frames: '', height: '', size: '', url: '', width: ''},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
cid: [],
html: '',
id: '',
mentioned_users: [],
mml: '',
parent: [],
parent_id: '',
pin_expires: '',
pinned: false,
pinned_at: '',
pinned_by: [],
quoted_message_id: '',
reaction_scores: [],
show_in_channel: false,
silent: false,
text: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
skip_push: false,
truncated_at: '',
user: {},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/channels/:type/:id/truncate';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"hard_delete":false,"message":{"attachments":[{"actions":[{"name":"","style":"","text":"","type":"","value":""}],"asset_url":"","author_icon":"","author_link":"","author_name":"","color":"","fallback":"","fields":[{"short":false,"title":"","value":""}],"footer":"","footer_icon":"","giphy":{"fixed_height":{"frames":"","height":"","size":"","url":"","width":""},"fixed_height_downsampled":{},"fixed_height_still":{},"fixed_width":{},"fixed_width_downsampled":{},"fixed_width_still":{},"original":{}},"image_url":"","og_scrape_url":"","original_height":"","original_width":"","pretext":"","text":"","thumb_url":"","title":"","title_link":"","type":""}],"cid":[],"html":"","id":"","mentioned_users":[],"mml":"","parent":[],"parent_id":"","pin_expires":"","pinned":false,"pinned_at":"","pinned_by":[],"quoted_message_id":"","reaction_scores":[],"show_in_channel":false,"silent":false,"text":"","user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""},"skip_push":false,"truncated_at":"","user":{},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"hard_delete": @NO,
@"message": @{ @"attachments": @[ @{ @"actions": @[ @{ @"name": @"", @"style": @"", @"text": @"", @"type": @"", @"value": @"" } ], @"asset_url": @"", @"author_icon": @"", @"author_link": @"", @"author_name": @"", @"color": @"", @"fallback": @"", @"fields": @[ @{ @"short": @NO, @"title": @"", @"value": @"" } ], @"footer": @"", @"footer_icon": @"", @"giphy": @{ @"fixed_height": @{ @"frames": @"", @"height": @"", @"size": @"", @"url": @"", @"width": @"" }, @"fixed_height_downsampled": @{ }, @"fixed_height_still": @{ }, @"fixed_width": @{ }, @"fixed_width_downsampled": @{ }, @"fixed_width_still": @{ }, @"original": @{ } }, @"image_url": @"", @"og_scrape_url": @"", @"original_height": @"", @"original_width": @"", @"pretext": @"", @"text": @"", @"thumb_url": @"", @"title": @"", @"title_link": @"", @"type": @"" } ], @"cid": @[ ], @"html": @"", @"id": @"", @"mentioned_users": @[ ], @"mml": @"", @"parent": @[ ], @"parent_id": @"", @"pin_expires": @"", @"pinned": @NO, @"pinned_at": @"", @"pinned_by": @[ ], @"quoted_message_id": @"", @"reaction_scores": @[ ], @"show_in_channel": @NO, @"silent": @NO, @"text": @"", @"user": @{ @"ban_expires": @"", @"banned": @NO, @"id": @"", @"invisible": @NO, @"language": @"", @"push_notifications": @{ @"disabled": @NO, @"disabled_until": @"" }, @"revoke_tokens_issued_before": @"", @"role": @"", @"teams": @[ ] }, @"user_id": @"" },
@"skip_push": @NO,
@"truncated_at": @"",
@"user": @{ },
@"user_id": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/channels/:type/:id/truncate"]
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}}/channels/:type/:id/truncate" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"hard_delete\": false,\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"skip_push\": false,\n \"truncated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/channels/:type/:id/truncate",
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([
'hard_delete' => null,
'message' => [
'attachments' => [
[
'actions' => [
[
'name' => '',
'style' => '',
'text' => '',
'type' => '',
'value' => ''
]
],
'asset_url' => '',
'author_icon' => '',
'author_link' => '',
'author_name' => '',
'color' => '',
'fallback' => '',
'fields' => [
[
'short' => null,
'title' => '',
'value' => ''
]
],
'footer' => '',
'footer_icon' => '',
'giphy' => [
'fixed_height' => [
'frames' => '',
'height' => '',
'size' => '',
'url' => '',
'width' => ''
],
'fixed_height_downsampled' => [
],
'fixed_height_still' => [
],
'fixed_width' => [
],
'fixed_width_downsampled' => [
],
'fixed_width_still' => [
],
'original' => [
]
],
'image_url' => '',
'og_scrape_url' => '',
'original_height' => '',
'original_width' => '',
'pretext' => '',
'text' => '',
'thumb_url' => '',
'title' => '',
'title_link' => '',
'type' => ''
]
],
'cid' => [
],
'html' => '',
'id' => '',
'mentioned_users' => [
],
'mml' => '',
'parent' => [
],
'parent_id' => '',
'pin_expires' => '',
'pinned' => null,
'pinned_at' => '',
'pinned_by' => [
],
'quoted_message_id' => '',
'reaction_scores' => [
],
'show_in_channel' => null,
'silent' => null,
'text' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
],
'skip_push' => null,
'truncated_at' => '',
'user' => [
],
'user_id' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/channels/:type/:id/truncate', [
'body' => '{
"hard_delete": false,
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"cid": [],
"html": "",
"id": "",
"mentioned_users": [],
"mml": "",
"parent": [],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": [],
"quoted_message_id": "",
"reaction_scores": [],
"show_in_channel": false,
"silent": false,
"text": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
},
"skip_push": false,
"truncated_at": "",
"user": {},
"user_id": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/channels/:type/:id/truncate');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'hard_delete' => null,
'message' => [
'attachments' => [
[
'actions' => [
[
'name' => '',
'style' => '',
'text' => '',
'type' => '',
'value' => ''
]
],
'asset_url' => '',
'author_icon' => '',
'author_link' => '',
'author_name' => '',
'color' => '',
'fallback' => '',
'fields' => [
[
'short' => null,
'title' => '',
'value' => ''
]
],
'footer' => '',
'footer_icon' => '',
'giphy' => [
'fixed_height' => [
'frames' => '',
'height' => '',
'size' => '',
'url' => '',
'width' => ''
],
'fixed_height_downsampled' => [
],
'fixed_height_still' => [
],
'fixed_width' => [
],
'fixed_width_downsampled' => [
],
'fixed_width_still' => [
],
'original' => [
]
],
'image_url' => '',
'og_scrape_url' => '',
'original_height' => '',
'original_width' => '',
'pretext' => '',
'text' => '',
'thumb_url' => '',
'title' => '',
'title_link' => '',
'type' => ''
]
],
'cid' => [
],
'html' => '',
'id' => '',
'mentioned_users' => [
],
'mml' => '',
'parent' => [
],
'parent_id' => '',
'pin_expires' => '',
'pinned' => null,
'pinned_at' => '',
'pinned_by' => [
],
'quoted_message_id' => '',
'reaction_scores' => [
],
'show_in_channel' => null,
'silent' => null,
'text' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
],
'skip_push' => null,
'truncated_at' => '',
'user' => [
],
'user_id' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'hard_delete' => null,
'message' => [
'attachments' => [
[
'actions' => [
[
'name' => '',
'style' => '',
'text' => '',
'type' => '',
'value' => ''
]
],
'asset_url' => '',
'author_icon' => '',
'author_link' => '',
'author_name' => '',
'color' => '',
'fallback' => '',
'fields' => [
[
'short' => null,
'title' => '',
'value' => ''
]
],
'footer' => '',
'footer_icon' => '',
'giphy' => [
'fixed_height' => [
'frames' => '',
'height' => '',
'size' => '',
'url' => '',
'width' => ''
],
'fixed_height_downsampled' => [
],
'fixed_height_still' => [
],
'fixed_width' => [
],
'fixed_width_downsampled' => [
],
'fixed_width_still' => [
],
'original' => [
]
],
'image_url' => '',
'og_scrape_url' => '',
'original_height' => '',
'original_width' => '',
'pretext' => '',
'text' => '',
'thumb_url' => '',
'title' => '',
'title_link' => '',
'type' => ''
]
],
'cid' => [
],
'html' => '',
'id' => '',
'mentioned_users' => [
],
'mml' => '',
'parent' => [
],
'parent_id' => '',
'pin_expires' => '',
'pinned' => null,
'pinned_at' => '',
'pinned_by' => [
],
'quoted_message_id' => '',
'reaction_scores' => [
],
'show_in_channel' => null,
'silent' => null,
'text' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
],
'skip_push' => null,
'truncated_at' => '',
'user' => [
],
'user_id' => ''
]));
$request->setRequestUrl('{{baseUrl}}/channels/:type/:id/truncate');
$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}}/channels/:type/:id/truncate' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"hard_delete": false,
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"cid": [],
"html": "",
"id": "",
"mentioned_users": [],
"mml": "",
"parent": [],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": [],
"quoted_message_id": "",
"reaction_scores": [],
"show_in_channel": false,
"silent": false,
"text": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
},
"skip_push": false,
"truncated_at": "",
"user": {},
"user_id": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/channels/:type/:id/truncate' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"hard_delete": false,
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"cid": [],
"html": "",
"id": "",
"mentioned_users": [],
"mml": "",
"parent": [],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": [],
"quoted_message_id": "",
"reaction_scores": [],
"show_in_channel": false,
"silent": false,
"text": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
},
"skip_push": false,
"truncated_at": "",
"user": {},
"user_id": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"hard_delete\": false,\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"skip_push\": false,\n \"truncated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/channels/:type/:id/truncate", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/channels/:type/:id/truncate"
payload = {
"hard_delete": False,
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": False,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"cid": [],
"html": "",
"id": "",
"mentioned_users": [],
"mml": "",
"parent": [],
"parent_id": "",
"pin_expires": "",
"pinned": False,
"pinned_at": "",
"pinned_by": [],
"quoted_message_id": "",
"reaction_scores": [],
"show_in_channel": False,
"silent": False,
"text": "",
"user": {
"ban_expires": "",
"banned": False,
"id": "",
"invisible": False,
"language": "",
"push_notifications": {
"disabled": False,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
},
"skip_push": False,
"truncated_at": "",
"user": {},
"user_id": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/channels/:type/:id/truncate"
payload <- "{\n \"hard_delete\": false,\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"skip_push\": false,\n \"truncated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/channels/:type/:id/truncate")
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 \"hard_delete\": false,\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"skip_push\": false,\n \"truncated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/channels/:type/:id/truncate') do |req|
req.body = "{\n \"hard_delete\": false,\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"skip_push\": false,\n \"truncated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/channels/:type/:id/truncate";
let payload = json!({
"hard_delete": false,
"message": json!({
"attachments": (
json!({
"actions": (
json!({
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
})
),
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": (
json!({
"short": false,
"title": "",
"value": ""
})
),
"footer": "",
"footer_icon": "",
"giphy": json!({
"fixed_height": json!({
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
}),
"fixed_height_downsampled": json!({}),
"fixed_height_still": json!({}),
"fixed_width": json!({}),
"fixed_width_downsampled": json!({}),
"fixed_width_still": json!({}),
"original": json!({})
}),
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
})
),
"cid": (),
"html": "",
"id": "",
"mentioned_users": (),
"mml": "",
"parent": (),
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": (),
"quoted_message_id": "",
"reaction_scores": (),
"show_in_channel": false,
"silent": false,
"text": "",
"user": json!({
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": json!({
"disabled": false,
"disabled_until": ""
}),
"revoke_tokens_issued_before": "",
"role": "",
"teams": ()
}),
"user_id": ""
}),
"skip_push": false,
"truncated_at": "",
"user": json!({}),
"user_id": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/channels/:type/:id/truncate \
--header 'content-type: application/json' \
--data '{
"hard_delete": false,
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"cid": [],
"html": "",
"id": "",
"mentioned_users": [],
"mml": "",
"parent": [],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": [],
"quoted_message_id": "",
"reaction_scores": [],
"show_in_channel": false,
"silent": false,
"text": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
},
"skip_push": false,
"truncated_at": "",
"user": {},
"user_id": ""
}'
echo '{
"hard_delete": false,
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"cid": [],
"html": "",
"id": "",
"mentioned_users": [],
"mml": "",
"parent": [],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": [],
"quoted_message_id": "",
"reaction_scores": [],
"show_in_channel": false,
"silent": false,
"text": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
},
"skip_push": false,
"truncated_at": "",
"user": {},
"user_id": ""
}' | \
http POST {{baseUrl}}/channels/:type/:id/truncate \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "hard_delete": false,\n "message": {\n "attachments": [\n {\n "actions": [\n {\n "name": "",\n "style": "",\n "text": "",\n "type": "",\n "value": ""\n }\n ],\n "asset_url": "",\n "author_icon": "",\n "author_link": "",\n "author_name": "",\n "color": "",\n "fallback": "",\n "fields": [\n {\n "short": false,\n "title": "",\n "value": ""\n }\n ],\n "footer": "",\n "footer_icon": "",\n "giphy": {\n "fixed_height": {\n "frames": "",\n "height": "",\n "size": "",\n "url": "",\n "width": ""\n },\n "fixed_height_downsampled": {},\n "fixed_height_still": {},\n "fixed_width": {},\n "fixed_width_downsampled": {},\n "fixed_width_still": {},\n "original": {}\n },\n "image_url": "",\n "og_scrape_url": "",\n "original_height": "",\n "original_width": "",\n "pretext": "",\n "text": "",\n "thumb_url": "",\n "title": "",\n "title_link": "",\n "type": ""\n }\n ],\n "cid": [],\n "html": "",\n "id": "",\n "mentioned_users": [],\n "mml": "",\n "parent": [],\n "parent_id": "",\n "pin_expires": "",\n "pinned": false,\n "pinned_at": "",\n "pinned_by": [],\n "quoted_message_id": "",\n "reaction_scores": [],\n "show_in_channel": false,\n "silent": false,\n "text": "",\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n },\n "skip_push": false,\n "truncated_at": "",\n "user": {},\n "user_id": ""\n}' \
--output-document \
- {{baseUrl}}/channels/:type/:id/truncate
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"hard_delete": false,
"message": [
"attachments": [
[
"actions": [
[
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
]
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
[
"short": false,
"title": "",
"value": ""
]
],
"footer": "",
"footer_icon": "",
"giphy": [
"fixed_height": [
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
],
"fixed_height_downsampled": [],
"fixed_height_still": [],
"fixed_width": [],
"fixed_width_downsampled": [],
"fixed_width_still": [],
"original": []
],
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
]
],
"cid": [],
"html": "",
"id": "",
"mentioned_users": [],
"mml": "",
"parent": [],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": [],
"quoted_message_id": "",
"reaction_scores": [],
"show_in_channel": false,
"silent": false,
"text": "",
"user": [
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": [
"disabled": false,
"disabled_until": ""
],
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
],
"user_id": ""
],
"skip_push": false,
"truncated_at": "",
"user": [],
"user_id": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/channels/:type/:id/truncate")! 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
Unmute channel
{{baseUrl}}/moderation/unmute/channel
BODY json
{
"channel_cid": "",
"channel_cids": [],
"expiration": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/moderation/unmute/channel");
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 \"channel_cid\": \"\",\n \"channel_cids\": [],\n \"expiration\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/moderation/unmute/channel" {:content-type :json
:form-params {:channel_cid ""
:channel_cids []
:expiration ""
:user {:ban_expires ""
:banned false
:id ""
:invisible false
:language ""
:push_notifications {:disabled false
:disabled_until ""}
:revoke_tokens_issued_before ""
:role ""
:teams []}
:user_id ""}})
require "http/client"
url = "{{baseUrl}}/moderation/unmute/channel"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"channel_cid\": \"\",\n \"channel_cids\": [],\n \"expiration\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/moderation/unmute/channel"),
Content = new StringContent("{\n \"channel_cid\": \"\",\n \"channel_cids\": [],\n \"expiration\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/moderation/unmute/channel");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"channel_cid\": \"\",\n \"channel_cids\": [],\n \"expiration\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/moderation/unmute/channel"
payload := strings.NewReader("{\n \"channel_cid\": \"\",\n \"channel_cids\": [],\n \"expiration\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/moderation/unmute/channel HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 359
{
"channel_cid": "",
"channel_cids": [],
"expiration": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/moderation/unmute/channel")
.setHeader("content-type", "application/json")
.setBody("{\n \"channel_cid\": \"\",\n \"channel_cids\": [],\n \"expiration\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/moderation/unmute/channel"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"channel_cid\": \"\",\n \"channel_cids\": [],\n \"expiration\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"channel_cid\": \"\",\n \"channel_cids\": [],\n \"expiration\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/moderation/unmute/channel")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/moderation/unmute/channel")
.header("content-type", "application/json")
.body("{\n \"channel_cid\": \"\",\n \"channel_cids\": [],\n \"expiration\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
.asString();
const data = JSON.stringify({
channel_cid: '',
channel_cids: [],
expiration: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/moderation/unmute/channel');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/moderation/unmute/channel',
headers: {'content-type': 'application/json'},
data: {
channel_cid: '',
channel_cids: [],
expiration: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/moderation/unmute/channel';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"channel_cid":"","channel_cids":[],"expiration":"","user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/moderation/unmute/channel',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "channel_cid": "",\n "channel_cids": [],\n "expiration": "",\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"channel_cid\": \"\",\n \"channel_cids\": [],\n \"expiration\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/moderation/unmute/channel")
.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/moderation/unmute/channel',
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({
channel_cid: '',
channel_cids: [],
expiration: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/moderation/unmute/channel',
headers: {'content-type': 'application/json'},
body: {
channel_cid: '',
channel_cids: [],
expiration: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/moderation/unmute/channel');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
channel_cid: '',
channel_cids: [],
expiration: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/moderation/unmute/channel',
headers: {'content-type': 'application/json'},
data: {
channel_cid: '',
channel_cids: [],
expiration: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/moderation/unmute/channel';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"channel_cid":"","channel_cids":[],"expiration":"","user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"channel_cid": @"",
@"channel_cids": @[ ],
@"expiration": @"",
@"user": @{ @"ban_expires": @"", @"banned": @NO, @"id": @"", @"invisible": @NO, @"language": @"", @"push_notifications": @{ @"disabled": @NO, @"disabled_until": @"" }, @"revoke_tokens_issued_before": @"", @"role": @"", @"teams": @[ ] },
@"user_id": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/moderation/unmute/channel"]
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}}/moderation/unmute/channel" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"channel_cid\": \"\",\n \"channel_cids\": [],\n \"expiration\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/moderation/unmute/channel",
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([
'channel_cid' => '',
'channel_cids' => [
],
'expiration' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/moderation/unmute/channel', [
'body' => '{
"channel_cid": "",
"channel_cids": [],
"expiration": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/moderation/unmute/channel');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'channel_cid' => '',
'channel_cids' => [
],
'expiration' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'channel_cid' => '',
'channel_cids' => [
],
'expiration' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]));
$request->setRequestUrl('{{baseUrl}}/moderation/unmute/channel');
$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}}/moderation/unmute/channel' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"channel_cid": "",
"channel_cids": [],
"expiration": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/moderation/unmute/channel' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"channel_cid": "",
"channel_cids": [],
"expiration": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"channel_cid\": \"\",\n \"channel_cids\": [],\n \"expiration\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/moderation/unmute/channel", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/moderation/unmute/channel"
payload = {
"channel_cid": "",
"channel_cids": [],
"expiration": "",
"user": {
"ban_expires": "",
"banned": False,
"id": "",
"invisible": False,
"language": "",
"push_notifications": {
"disabled": False,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/moderation/unmute/channel"
payload <- "{\n \"channel_cid\": \"\",\n \"channel_cids\": [],\n \"expiration\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/moderation/unmute/channel")
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 \"channel_cid\": \"\",\n \"channel_cids\": [],\n \"expiration\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/moderation/unmute/channel') do |req|
req.body = "{\n \"channel_cid\": \"\",\n \"channel_cids\": [],\n \"expiration\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/moderation/unmute/channel";
let payload = json!({
"channel_cid": "",
"channel_cids": (),
"expiration": "",
"user": json!({
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": json!({
"disabled": false,
"disabled_until": ""
}),
"revoke_tokens_issued_before": "",
"role": "",
"teams": ()
}),
"user_id": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/moderation/unmute/channel \
--header 'content-type: application/json' \
--data '{
"channel_cid": "",
"channel_cids": [],
"expiration": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
echo '{
"channel_cid": "",
"channel_cids": [],
"expiration": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}' | \
http POST {{baseUrl}}/moderation/unmute/channel \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "channel_cid": "",\n "channel_cids": [],\n "expiration": "",\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n}' \
--output-document \
- {{baseUrl}}/moderation/unmute/channel
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"channel_cid": "",
"channel_cids": [],
"expiration": "",
"user": [
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": [
"disabled": false,
"disabled_until": ""
],
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
],
"user_id": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/moderation/unmute/channel")! 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
Update channel
{{baseUrl}}/channels/:type/:id
QUERY PARAMS
type
id
BODY json
{
"accept_invite": false,
"add_members": [
{
"ban_expires": "",
"banned": false,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": false,
"is_moderator": false,
"role": "",
"shadow_banned": false,
"updated_at": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
],
"add_moderators": [],
"assign_roles": [
{}
],
"cooldown": "",
"data": {
"auto_translation_enabled": false,
"auto_translation_language": "",
"config_overrides": {
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"grants": {},
"max_message_length": "",
"quotes": false,
"reactions": false,
"replies": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
},
"created_by": {},
"disabled": false,
"frozen": false,
"members": [
{}
],
"own_capabilities": [],
"team": "",
"truncated_at": [],
"truncated_by": [],
"truncated_by_id": ""
},
"demote_moderators": [],
"hide_history": false,
"invites": [
{}
],
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"cid": [],
"html": "",
"id": "",
"mentioned_users": [],
"mml": "",
"parent": [],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": [],
"quoted_message_id": "",
"reaction_scores": [],
"show_in_channel": false,
"silent": false,
"text": "",
"user": {},
"user_id": ""
},
"reject_invite": false,
"remove_members": [],
"skip_push": false,
"user": {},
"user_id": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/channels/:type/: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 \"accept_invite\": false,\n \"add_members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n }\n ],\n \"add_moderators\": [],\n \"assign_roles\": [\n {}\n ],\n \"cooldown\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {},\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {}\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"demote_moderators\": [],\n \"hide_history\": false,\n \"invites\": [\n {}\n ],\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n },\n \"reject_invite\": false,\n \"remove_members\": [],\n \"skip_push\": false,\n \"user\": {},\n \"user_id\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/channels/:type/:id" {:content-type :json
:form-params {:accept_invite false
:add_members [{:ban_expires ""
:banned false
:channel_role ""
:created_at ""
:deleted_at ""
:invite_accepted_at ""
:invite_rejected_at ""
:invited false
:is_moderator false
:role ""
:shadow_banned false
:updated_at ""
:user {:ban_expires ""
:banned false
:id ""
:invisible false
:language ""
:push_notifications {:disabled false
:disabled_until ""}
:revoke_tokens_issued_before ""
:role ""
:teams []}
:user_id ""}]
:add_moderators []
:assign_roles [{}]
:cooldown ""
:data {:auto_translation_enabled false
:auto_translation_language ""
:config_overrides {:blocklist ""
:blocklist_behavior ""
:commands []
:grants {}
:max_message_length ""
:quotes false
:reactions false
:replies false
:typing_events false
:uploads false
:url_enrichment false}
:created_by {}
:disabled false
:frozen false
:members [{}]
:own_capabilities []
:team ""
:truncated_at []
:truncated_by []
:truncated_by_id ""}
:demote_moderators []
:hide_history false
:invites [{}]
:message {:attachments [{:actions [{:name ""
:style ""
:text ""
:type ""
:value ""}]
:asset_url ""
:author_icon ""
:author_link ""
:author_name ""
:color ""
:fallback ""
:fields [{:short false
:title ""
:value ""}]
:footer ""
:footer_icon ""
:giphy {:fixed_height {:frames ""
:height ""
:size ""
:url ""
:width ""}
:fixed_height_downsampled {}
:fixed_height_still {}
:fixed_width {}
:fixed_width_downsampled {}
:fixed_width_still {}
:original {}}
:image_url ""
:og_scrape_url ""
:original_height ""
:original_width ""
:pretext ""
:text ""
:thumb_url ""
:title ""
:title_link ""
:type ""}]
:cid []
:html ""
:id ""
:mentioned_users []
:mml ""
:parent []
:parent_id ""
:pin_expires ""
:pinned false
:pinned_at ""
:pinned_by []
:quoted_message_id ""
:reaction_scores []
:show_in_channel false
:silent false
:text ""
:user {}
:user_id ""}
:reject_invite false
:remove_members []
:skip_push false
:user {}
:user_id ""}})
require "http/client"
url = "{{baseUrl}}/channels/:type/:id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"accept_invite\": false,\n \"add_members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n }\n ],\n \"add_moderators\": [],\n \"assign_roles\": [\n {}\n ],\n \"cooldown\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {},\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {}\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"demote_moderators\": [],\n \"hide_history\": false,\n \"invites\": [\n {}\n ],\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n },\n \"reject_invite\": false,\n \"remove_members\": [],\n \"skip_push\": false,\n \"user\": {},\n \"user_id\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/channels/:type/:id"),
Content = new StringContent("{\n \"accept_invite\": false,\n \"add_members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n }\n ],\n \"add_moderators\": [],\n \"assign_roles\": [\n {}\n ],\n \"cooldown\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {},\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {}\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"demote_moderators\": [],\n \"hide_history\": false,\n \"invites\": [\n {}\n ],\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n },\n \"reject_invite\": false,\n \"remove_members\": [],\n \"skip_push\": false,\n \"user\": {},\n \"user_id\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/channels/:type/:id");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"accept_invite\": false,\n \"add_members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n }\n ],\n \"add_moderators\": [],\n \"assign_roles\": [\n {}\n ],\n \"cooldown\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {},\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {}\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"demote_moderators\": [],\n \"hide_history\": false,\n \"invites\": [\n {}\n ],\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n },\n \"reject_invite\": false,\n \"remove_members\": [],\n \"skip_push\": false,\n \"user\": {},\n \"user_id\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/channels/:type/:id"
payload := strings.NewReader("{\n \"accept_invite\": false,\n \"add_members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n }\n ],\n \"add_moderators\": [],\n \"assign_roles\": [\n {}\n ],\n \"cooldown\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {},\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {}\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"demote_moderators\": [],\n \"hide_history\": false,\n \"invites\": [\n {}\n ],\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n },\n \"reject_invite\": false,\n \"remove_members\": [],\n \"skip_push\": false,\n \"user\": {},\n \"user_id\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/channels/:type/:id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 3206
{
"accept_invite": false,
"add_members": [
{
"ban_expires": "",
"banned": false,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": false,
"is_moderator": false,
"role": "",
"shadow_banned": false,
"updated_at": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
],
"add_moderators": [],
"assign_roles": [
{}
],
"cooldown": "",
"data": {
"auto_translation_enabled": false,
"auto_translation_language": "",
"config_overrides": {
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"grants": {},
"max_message_length": "",
"quotes": false,
"reactions": false,
"replies": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
},
"created_by": {},
"disabled": false,
"frozen": false,
"members": [
{}
],
"own_capabilities": [],
"team": "",
"truncated_at": [],
"truncated_by": [],
"truncated_by_id": ""
},
"demote_moderators": [],
"hide_history": false,
"invites": [
{}
],
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"cid": [],
"html": "",
"id": "",
"mentioned_users": [],
"mml": "",
"parent": [],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": [],
"quoted_message_id": "",
"reaction_scores": [],
"show_in_channel": false,
"silent": false,
"text": "",
"user": {},
"user_id": ""
},
"reject_invite": false,
"remove_members": [],
"skip_push": false,
"user": {},
"user_id": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/channels/:type/:id")
.setHeader("content-type", "application/json")
.setBody("{\n \"accept_invite\": false,\n \"add_members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n }\n ],\n \"add_moderators\": [],\n \"assign_roles\": [\n {}\n ],\n \"cooldown\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {},\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {}\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"demote_moderators\": [],\n \"hide_history\": false,\n \"invites\": [\n {}\n ],\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n },\n \"reject_invite\": false,\n \"remove_members\": [],\n \"skip_push\": false,\n \"user\": {},\n \"user_id\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/channels/:type/:id"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"accept_invite\": false,\n \"add_members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n }\n ],\n \"add_moderators\": [],\n \"assign_roles\": [\n {}\n ],\n \"cooldown\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {},\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {}\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"demote_moderators\": [],\n \"hide_history\": false,\n \"invites\": [\n {}\n ],\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n },\n \"reject_invite\": false,\n \"remove_members\": [],\n \"skip_push\": false,\n \"user\": {},\n \"user_id\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"accept_invite\": false,\n \"add_members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n }\n ],\n \"add_moderators\": [],\n \"assign_roles\": [\n {}\n ],\n \"cooldown\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {},\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {}\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"demote_moderators\": [],\n \"hide_history\": false,\n \"invites\": [\n {}\n ],\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n },\n \"reject_invite\": false,\n \"remove_members\": [],\n \"skip_push\": false,\n \"user\": {},\n \"user_id\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/channels/:type/:id")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/channels/:type/:id")
.header("content-type", "application/json")
.body("{\n \"accept_invite\": false,\n \"add_members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n }\n ],\n \"add_moderators\": [],\n \"assign_roles\": [\n {}\n ],\n \"cooldown\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {},\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {}\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"demote_moderators\": [],\n \"hide_history\": false,\n \"invites\": [\n {}\n ],\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n },\n \"reject_invite\": false,\n \"remove_members\": [],\n \"skip_push\": false,\n \"user\": {},\n \"user_id\": \"\"\n}")
.asString();
const data = JSON.stringify({
accept_invite: false,
add_members: [
{
ban_expires: '',
banned: false,
channel_role: '',
created_at: '',
deleted_at: '',
invite_accepted_at: '',
invite_rejected_at: '',
invited: false,
is_moderator: false,
role: '',
shadow_banned: false,
updated_at: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
],
add_moderators: [],
assign_roles: [
{}
],
cooldown: '',
data: {
auto_translation_enabled: false,
auto_translation_language: '',
config_overrides: {
blocklist: '',
blocklist_behavior: '',
commands: [],
grants: {},
max_message_length: '',
quotes: false,
reactions: false,
replies: false,
typing_events: false,
uploads: false,
url_enrichment: false
},
created_by: {},
disabled: false,
frozen: false,
members: [
{}
],
own_capabilities: [],
team: '',
truncated_at: [],
truncated_by: [],
truncated_by_id: ''
},
demote_moderators: [],
hide_history: false,
invites: [
{}
],
message: {
attachments: [
{
actions: [
{
name: '',
style: '',
text: '',
type: '',
value: ''
}
],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [
{
short: false,
title: '',
value: ''
}
],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {
frames: '',
height: '',
size: '',
url: '',
width: ''
},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
cid: [],
html: '',
id: '',
mentioned_users: [],
mml: '',
parent: [],
parent_id: '',
pin_expires: '',
pinned: false,
pinned_at: '',
pinned_by: [],
quoted_message_id: '',
reaction_scores: [],
show_in_channel: false,
silent: false,
text: '',
user: {},
user_id: ''
},
reject_invite: false,
remove_members: [],
skip_push: false,
user: {},
user_id: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/channels/:type/:id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:type/:id',
headers: {'content-type': 'application/json'},
data: {
accept_invite: false,
add_members: [
{
ban_expires: '',
banned: false,
channel_role: '',
created_at: '',
deleted_at: '',
invite_accepted_at: '',
invite_rejected_at: '',
invited: false,
is_moderator: false,
role: '',
shadow_banned: false,
updated_at: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
],
add_moderators: [],
assign_roles: [{}],
cooldown: '',
data: {
auto_translation_enabled: false,
auto_translation_language: '',
config_overrides: {
blocklist: '',
blocklist_behavior: '',
commands: [],
grants: {},
max_message_length: '',
quotes: false,
reactions: false,
replies: false,
typing_events: false,
uploads: false,
url_enrichment: false
},
created_by: {},
disabled: false,
frozen: false,
members: [{}],
own_capabilities: [],
team: '',
truncated_at: [],
truncated_by: [],
truncated_by_id: ''
},
demote_moderators: [],
hide_history: false,
invites: [{}],
message: {
attachments: [
{
actions: [{name: '', style: '', text: '', type: '', value: ''}],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [{short: false, title: '', value: ''}],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {frames: '', height: '', size: '', url: '', width: ''},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
cid: [],
html: '',
id: '',
mentioned_users: [],
mml: '',
parent: [],
parent_id: '',
pin_expires: '',
pinned: false,
pinned_at: '',
pinned_by: [],
quoted_message_id: '',
reaction_scores: [],
show_in_channel: false,
silent: false,
text: '',
user: {},
user_id: ''
},
reject_invite: false,
remove_members: [],
skip_push: false,
user: {},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/channels/:type/:id';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"accept_invite":false,"add_members":[{"ban_expires":"","banned":false,"channel_role":"","created_at":"","deleted_at":"","invite_accepted_at":"","invite_rejected_at":"","invited":false,"is_moderator":false,"role":"","shadow_banned":false,"updated_at":"","user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}],"add_moderators":[],"assign_roles":[{}],"cooldown":"","data":{"auto_translation_enabled":false,"auto_translation_language":"","config_overrides":{"blocklist":"","blocklist_behavior":"","commands":[],"grants":{},"max_message_length":"","quotes":false,"reactions":false,"replies":false,"typing_events":false,"uploads":false,"url_enrichment":false},"created_by":{},"disabled":false,"frozen":false,"members":[{}],"own_capabilities":[],"team":"","truncated_at":[],"truncated_by":[],"truncated_by_id":""},"demote_moderators":[],"hide_history":false,"invites":[{}],"message":{"attachments":[{"actions":[{"name":"","style":"","text":"","type":"","value":""}],"asset_url":"","author_icon":"","author_link":"","author_name":"","color":"","fallback":"","fields":[{"short":false,"title":"","value":""}],"footer":"","footer_icon":"","giphy":{"fixed_height":{"frames":"","height":"","size":"","url":"","width":""},"fixed_height_downsampled":{},"fixed_height_still":{},"fixed_width":{},"fixed_width_downsampled":{},"fixed_width_still":{},"original":{}},"image_url":"","og_scrape_url":"","original_height":"","original_width":"","pretext":"","text":"","thumb_url":"","title":"","title_link":"","type":""}],"cid":[],"html":"","id":"","mentioned_users":[],"mml":"","parent":[],"parent_id":"","pin_expires":"","pinned":false,"pinned_at":"","pinned_by":[],"quoted_message_id":"","reaction_scores":[],"show_in_channel":false,"silent":false,"text":"","user":{},"user_id":""},"reject_invite":false,"remove_members":[],"skip_push":false,"user":{},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/channels/:type/:id',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "accept_invite": false,\n "add_members": [\n {\n "ban_expires": "",\n "banned": false,\n "channel_role": "",\n "created_at": "",\n "deleted_at": "",\n "invite_accepted_at": "",\n "invite_rejected_at": "",\n "invited": false,\n "is_moderator": false,\n "role": "",\n "shadow_banned": false,\n "updated_at": "",\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n }\n ],\n "add_moderators": [],\n "assign_roles": [\n {}\n ],\n "cooldown": "",\n "data": {\n "auto_translation_enabled": false,\n "auto_translation_language": "",\n "config_overrides": {\n "blocklist": "",\n "blocklist_behavior": "",\n "commands": [],\n "grants": {},\n "max_message_length": "",\n "quotes": false,\n "reactions": false,\n "replies": false,\n "typing_events": false,\n "uploads": false,\n "url_enrichment": false\n },\n "created_by": {},\n "disabled": false,\n "frozen": false,\n "members": [\n {}\n ],\n "own_capabilities": [],\n "team": "",\n "truncated_at": [],\n "truncated_by": [],\n "truncated_by_id": ""\n },\n "demote_moderators": [],\n "hide_history": false,\n "invites": [\n {}\n ],\n "message": {\n "attachments": [\n {\n "actions": [\n {\n "name": "",\n "style": "",\n "text": "",\n "type": "",\n "value": ""\n }\n ],\n "asset_url": "",\n "author_icon": "",\n "author_link": "",\n "author_name": "",\n "color": "",\n "fallback": "",\n "fields": [\n {\n "short": false,\n "title": "",\n "value": ""\n }\n ],\n "footer": "",\n "footer_icon": "",\n "giphy": {\n "fixed_height": {\n "frames": "",\n "height": "",\n "size": "",\n "url": "",\n "width": ""\n },\n "fixed_height_downsampled": {},\n "fixed_height_still": {},\n "fixed_width": {},\n "fixed_width_downsampled": {},\n "fixed_width_still": {},\n "original": {}\n },\n "image_url": "",\n "og_scrape_url": "",\n "original_height": "",\n "original_width": "",\n "pretext": "",\n "text": "",\n "thumb_url": "",\n "title": "",\n "title_link": "",\n "type": ""\n }\n ],\n "cid": [],\n "html": "",\n "id": "",\n "mentioned_users": [],\n "mml": "",\n "parent": [],\n "parent_id": "",\n "pin_expires": "",\n "pinned": false,\n "pinned_at": "",\n "pinned_by": [],\n "quoted_message_id": "",\n "reaction_scores": [],\n "show_in_channel": false,\n "silent": false,\n "text": "",\n "user": {},\n "user_id": ""\n },\n "reject_invite": false,\n "remove_members": [],\n "skip_push": false,\n "user": {},\n "user_id": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"accept_invite\": false,\n \"add_members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n }\n ],\n \"add_moderators\": [],\n \"assign_roles\": [\n {}\n ],\n \"cooldown\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {},\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {}\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"demote_moderators\": [],\n \"hide_history\": false,\n \"invites\": [\n {}\n ],\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n },\n \"reject_invite\": false,\n \"remove_members\": [],\n \"skip_push\": false,\n \"user\": {},\n \"user_id\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/channels/:type/:id")
.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/channels/:type/: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({
accept_invite: false,
add_members: [
{
ban_expires: '',
banned: false,
channel_role: '',
created_at: '',
deleted_at: '',
invite_accepted_at: '',
invite_rejected_at: '',
invited: false,
is_moderator: false,
role: '',
shadow_banned: false,
updated_at: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
],
add_moderators: [],
assign_roles: [{}],
cooldown: '',
data: {
auto_translation_enabled: false,
auto_translation_language: '',
config_overrides: {
blocklist: '',
blocklist_behavior: '',
commands: [],
grants: {},
max_message_length: '',
quotes: false,
reactions: false,
replies: false,
typing_events: false,
uploads: false,
url_enrichment: false
},
created_by: {},
disabled: false,
frozen: false,
members: [{}],
own_capabilities: [],
team: '',
truncated_at: [],
truncated_by: [],
truncated_by_id: ''
},
demote_moderators: [],
hide_history: false,
invites: [{}],
message: {
attachments: [
{
actions: [{name: '', style: '', text: '', type: '', value: ''}],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [{short: false, title: '', value: ''}],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {frames: '', height: '', size: '', url: '', width: ''},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
cid: [],
html: '',
id: '',
mentioned_users: [],
mml: '',
parent: [],
parent_id: '',
pin_expires: '',
pinned: false,
pinned_at: '',
pinned_by: [],
quoted_message_id: '',
reaction_scores: [],
show_in_channel: false,
silent: false,
text: '',
user: {},
user_id: ''
},
reject_invite: false,
remove_members: [],
skip_push: false,
user: {},
user_id: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:type/:id',
headers: {'content-type': 'application/json'},
body: {
accept_invite: false,
add_members: [
{
ban_expires: '',
banned: false,
channel_role: '',
created_at: '',
deleted_at: '',
invite_accepted_at: '',
invite_rejected_at: '',
invited: false,
is_moderator: false,
role: '',
shadow_banned: false,
updated_at: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
],
add_moderators: [],
assign_roles: [{}],
cooldown: '',
data: {
auto_translation_enabled: false,
auto_translation_language: '',
config_overrides: {
blocklist: '',
blocklist_behavior: '',
commands: [],
grants: {},
max_message_length: '',
quotes: false,
reactions: false,
replies: false,
typing_events: false,
uploads: false,
url_enrichment: false
},
created_by: {},
disabled: false,
frozen: false,
members: [{}],
own_capabilities: [],
team: '',
truncated_at: [],
truncated_by: [],
truncated_by_id: ''
},
demote_moderators: [],
hide_history: false,
invites: [{}],
message: {
attachments: [
{
actions: [{name: '', style: '', text: '', type: '', value: ''}],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [{short: false, title: '', value: ''}],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {frames: '', height: '', size: '', url: '', width: ''},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
cid: [],
html: '',
id: '',
mentioned_users: [],
mml: '',
parent: [],
parent_id: '',
pin_expires: '',
pinned: false,
pinned_at: '',
pinned_by: [],
quoted_message_id: '',
reaction_scores: [],
show_in_channel: false,
silent: false,
text: '',
user: {},
user_id: ''
},
reject_invite: false,
remove_members: [],
skip_push: false,
user: {},
user_id: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/channels/:type/:id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
accept_invite: false,
add_members: [
{
ban_expires: '',
banned: false,
channel_role: '',
created_at: '',
deleted_at: '',
invite_accepted_at: '',
invite_rejected_at: '',
invited: false,
is_moderator: false,
role: '',
shadow_banned: false,
updated_at: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
],
add_moderators: [],
assign_roles: [
{}
],
cooldown: '',
data: {
auto_translation_enabled: false,
auto_translation_language: '',
config_overrides: {
blocklist: '',
blocklist_behavior: '',
commands: [],
grants: {},
max_message_length: '',
quotes: false,
reactions: false,
replies: false,
typing_events: false,
uploads: false,
url_enrichment: false
},
created_by: {},
disabled: false,
frozen: false,
members: [
{}
],
own_capabilities: [],
team: '',
truncated_at: [],
truncated_by: [],
truncated_by_id: ''
},
demote_moderators: [],
hide_history: false,
invites: [
{}
],
message: {
attachments: [
{
actions: [
{
name: '',
style: '',
text: '',
type: '',
value: ''
}
],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [
{
short: false,
title: '',
value: ''
}
],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {
frames: '',
height: '',
size: '',
url: '',
width: ''
},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
cid: [],
html: '',
id: '',
mentioned_users: [],
mml: '',
parent: [],
parent_id: '',
pin_expires: '',
pinned: false,
pinned_at: '',
pinned_by: [],
quoted_message_id: '',
reaction_scores: [],
show_in_channel: false,
silent: false,
text: '',
user: {},
user_id: ''
},
reject_invite: false,
remove_members: [],
skip_push: false,
user: {},
user_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:type/:id',
headers: {'content-type': 'application/json'},
data: {
accept_invite: false,
add_members: [
{
ban_expires: '',
banned: false,
channel_role: '',
created_at: '',
deleted_at: '',
invite_accepted_at: '',
invite_rejected_at: '',
invited: false,
is_moderator: false,
role: '',
shadow_banned: false,
updated_at: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
],
add_moderators: [],
assign_roles: [{}],
cooldown: '',
data: {
auto_translation_enabled: false,
auto_translation_language: '',
config_overrides: {
blocklist: '',
blocklist_behavior: '',
commands: [],
grants: {},
max_message_length: '',
quotes: false,
reactions: false,
replies: false,
typing_events: false,
uploads: false,
url_enrichment: false
},
created_by: {},
disabled: false,
frozen: false,
members: [{}],
own_capabilities: [],
team: '',
truncated_at: [],
truncated_by: [],
truncated_by_id: ''
},
demote_moderators: [],
hide_history: false,
invites: [{}],
message: {
attachments: [
{
actions: [{name: '', style: '', text: '', type: '', value: ''}],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [{short: false, title: '', value: ''}],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {frames: '', height: '', size: '', url: '', width: ''},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
cid: [],
html: '',
id: '',
mentioned_users: [],
mml: '',
parent: [],
parent_id: '',
pin_expires: '',
pinned: false,
pinned_at: '',
pinned_by: [],
quoted_message_id: '',
reaction_scores: [],
show_in_channel: false,
silent: false,
text: '',
user: {},
user_id: ''
},
reject_invite: false,
remove_members: [],
skip_push: false,
user: {},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/channels/:type/:id';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"accept_invite":false,"add_members":[{"ban_expires":"","banned":false,"channel_role":"","created_at":"","deleted_at":"","invite_accepted_at":"","invite_rejected_at":"","invited":false,"is_moderator":false,"role":"","shadow_banned":false,"updated_at":"","user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}],"add_moderators":[],"assign_roles":[{}],"cooldown":"","data":{"auto_translation_enabled":false,"auto_translation_language":"","config_overrides":{"blocklist":"","blocklist_behavior":"","commands":[],"grants":{},"max_message_length":"","quotes":false,"reactions":false,"replies":false,"typing_events":false,"uploads":false,"url_enrichment":false},"created_by":{},"disabled":false,"frozen":false,"members":[{}],"own_capabilities":[],"team":"","truncated_at":[],"truncated_by":[],"truncated_by_id":""},"demote_moderators":[],"hide_history":false,"invites":[{}],"message":{"attachments":[{"actions":[{"name":"","style":"","text":"","type":"","value":""}],"asset_url":"","author_icon":"","author_link":"","author_name":"","color":"","fallback":"","fields":[{"short":false,"title":"","value":""}],"footer":"","footer_icon":"","giphy":{"fixed_height":{"frames":"","height":"","size":"","url":"","width":""},"fixed_height_downsampled":{},"fixed_height_still":{},"fixed_width":{},"fixed_width_downsampled":{},"fixed_width_still":{},"original":{}},"image_url":"","og_scrape_url":"","original_height":"","original_width":"","pretext":"","text":"","thumb_url":"","title":"","title_link":"","type":""}],"cid":[],"html":"","id":"","mentioned_users":[],"mml":"","parent":[],"parent_id":"","pin_expires":"","pinned":false,"pinned_at":"","pinned_by":[],"quoted_message_id":"","reaction_scores":[],"show_in_channel":false,"silent":false,"text":"","user":{},"user_id":""},"reject_invite":false,"remove_members":[],"skip_push":false,"user":{},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"accept_invite": @NO,
@"add_members": @[ @{ @"ban_expires": @"", @"banned": @NO, @"channel_role": @"", @"created_at": @"", @"deleted_at": @"", @"invite_accepted_at": @"", @"invite_rejected_at": @"", @"invited": @NO, @"is_moderator": @NO, @"role": @"", @"shadow_banned": @NO, @"updated_at": @"", @"user": @{ @"ban_expires": @"", @"banned": @NO, @"id": @"", @"invisible": @NO, @"language": @"", @"push_notifications": @{ @"disabled": @NO, @"disabled_until": @"" }, @"revoke_tokens_issued_before": @"", @"role": @"", @"teams": @[ ] }, @"user_id": @"" } ],
@"add_moderators": @[ ],
@"assign_roles": @[ @{ } ],
@"cooldown": @"",
@"data": @{ @"auto_translation_enabled": @NO, @"auto_translation_language": @"", @"config_overrides": @{ @"blocklist": @"", @"blocklist_behavior": @"", @"commands": @[ ], @"grants": @{ }, @"max_message_length": @"", @"quotes": @NO, @"reactions": @NO, @"replies": @NO, @"typing_events": @NO, @"uploads": @NO, @"url_enrichment": @NO }, @"created_by": @{ }, @"disabled": @NO, @"frozen": @NO, @"members": @[ @{ } ], @"own_capabilities": @[ ], @"team": @"", @"truncated_at": @[ ], @"truncated_by": @[ ], @"truncated_by_id": @"" },
@"demote_moderators": @[ ],
@"hide_history": @NO,
@"invites": @[ @{ } ],
@"message": @{ @"attachments": @[ @{ @"actions": @[ @{ @"name": @"", @"style": @"", @"text": @"", @"type": @"", @"value": @"" } ], @"asset_url": @"", @"author_icon": @"", @"author_link": @"", @"author_name": @"", @"color": @"", @"fallback": @"", @"fields": @[ @{ @"short": @NO, @"title": @"", @"value": @"" } ], @"footer": @"", @"footer_icon": @"", @"giphy": @{ @"fixed_height": @{ @"frames": @"", @"height": @"", @"size": @"", @"url": @"", @"width": @"" }, @"fixed_height_downsampled": @{ }, @"fixed_height_still": @{ }, @"fixed_width": @{ }, @"fixed_width_downsampled": @{ }, @"fixed_width_still": @{ }, @"original": @{ } }, @"image_url": @"", @"og_scrape_url": @"", @"original_height": @"", @"original_width": @"", @"pretext": @"", @"text": @"", @"thumb_url": @"", @"title": @"", @"title_link": @"", @"type": @"" } ], @"cid": @[ ], @"html": @"", @"id": @"", @"mentioned_users": @[ ], @"mml": @"", @"parent": @[ ], @"parent_id": @"", @"pin_expires": @"", @"pinned": @NO, @"pinned_at": @"", @"pinned_by": @[ ], @"quoted_message_id": @"", @"reaction_scores": @[ ], @"show_in_channel": @NO, @"silent": @NO, @"text": @"", @"user": @{ }, @"user_id": @"" },
@"reject_invite": @NO,
@"remove_members": @[ ],
@"skip_push": @NO,
@"user": @{ },
@"user_id": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/channels/:type/:id"]
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}}/channels/:type/:id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"accept_invite\": false,\n \"add_members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n }\n ],\n \"add_moderators\": [],\n \"assign_roles\": [\n {}\n ],\n \"cooldown\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {},\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {}\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"demote_moderators\": [],\n \"hide_history\": false,\n \"invites\": [\n {}\n ],\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n },\n \"reject_invite\": false,\n \"remove_members\": [],\n \"skip_push\": false,\n \"user\": {},\n \"user_id\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/channels/:type/:id",
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([
'accept_invite' => null,
'add_members' => [
[
'ban_expires' => '',
'banned' => null,
'channel_role' => '',
'created_at' => '',
'deleted_at' => '',
'invite_accepted_at' => '',
'invite_rejected_at' => '',
'invited' => null,
'is_moderator' => null,
'role' => '',
'shadow_banned' => null,
'updated_at' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]
],
'add_moderators' => [
],
'assign_roles' => [
[
]
],
'cooldown' => '',
'data' => [
'auto_translation_enabled' => null,
'auto_translation_language' => '',
'config_overrides' => [
'blocklist' => '',
'blocklist_behavior' => '',
'commands' => [
],
'grants' => [
],
'max_message_length' => '',
'quotes' => null,
'reactions' => null,
'replies' => null,
'typing_events' => null,
'uploads' => null,
'url_enrichment' => null
],
'created_by' => [
],
'disabled' => null,
'frozen' => null,
'members' => [
[
]
],
'own_capabilities' => [
],
'team' => '',
'truncated_at' => [
],
'truncated_by' => [
],
'truncated_by_id' => ''
],
'demote_moderators' => [
],
'hide_history' => null,
'invites' => [
[
]
],
'message' => [
'attachments' => [
[
'actions' => [
[
'name' => '',
'style' => '',
'text' => '',
'type' => '',
'value' => ''
]
],
'asset_url' => '',
'author_icon' => '',
'author_link' => '',
'author_name' => '',
'color' => '',
'fallback' => '',
'fields' => [
[
'short' => null,
'title' => '',
'value' => ''
]
],
'footer' => '',
'footer_icon' => '',
'giphy' => [
'fixed_height' => [
'frames' => '',
'height' => '',
'size' => '',
'url' => '',
'width' => ''
],
'fixed_height_downsampled' => [
],
'fixed_height_still' => [
],
'fixed_width' => [
],
'fixed_width_downsampled' => [
],
'fixed_width_still' => [
],
'original' => [
]
],
'image_url' => '',
'og_scrape_url' => '',
'original_height' => '',
'original_width' => '',
'pretext' => '',
'text' => '',
'thumb_url' => '',
'title' => '',
'title_link' => '',
'type' => ''
]
],
'cid' => [
],
'html' => '',
'id' => '',
'mentioned_users' => [
],
'mml' => '',
'parent' => [
],
'parent_id' => '',
'pin_expires' => '',
'pinned' => null,
'pinned_at' => '',
'pinned_by' => [
],
'quoted_message_id' => '',
'reaction_scores' => [
],
'show_in_channel' => null,
'silent' => null,
'text' => '',
'user' => [
],
'user_id' => ''
],
'reject_invite' => null,
'remove_members' => [
],
'skip_push' => null,
'user' => [
],
'user_id' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/channels/:type/:id', [
'body' => '{
"accept_invite": false,
"add_members": [
{
"ban_expires": "",
"banned": false,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": false,
"is_moderator": false,
"role": "",
"shadow_banned": false,
"updated_at": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
],
"add_moderators": [],
"assign_roles": [
{}
],
"cooldown": "",
"data": {
"auto_translation_enabled": false,
"auto_translation_language": "",
"config_overrides": {
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"grants": {},
"max_message_length": "",
"quotes": false,
"reactions": false,
"replies": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
},
"created_by": {},
"disabled": false,
"frozen": false,
"members": [
{}
],
"own_capabilities": [],
"team": "",
"truncated_at": [],
"truncated_by": [],
"truncated_by_id": ""
},
"demote_moderators": [],
"hide_history": false,
"invites": [
{}
],
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"cid": [],
"html": "",
"id": "",
"mentioned_users": [],
"mml": "",
"parent": [],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": [],
"quoted_message_id": "",
"reaction_scores": [],
"show_in_channel": false,
"silent": false,
"text": "",
"user": {},
"user_id": ""
},
"reject_invite": false,
"remove_members": [],
"skip_push": false,
"user": {},
"user_id": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/channels/:type/:id');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'accept_invite' => null,
'add_members' => [
[
'ban_expires' => '',
'banned' => null,
'channel_role' => '',
'created_at' => '',
'deleted_at' => '',
'invite_accepted_at' => '',
'invite_rejected_at' => '',
'invited' => null,
'is_moderator' => null,
'role' => '',
'shadow_banned' => null,
'updated_at' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]
],
'add_moderators' => [
],
'assign_roles' => [
[
]
],
'cooldown' => '',
'data' => [
'auto_translation_enabled' => null,
'auto_translation_language' => '',
'config_overrides' => [
'blocklist' => '',
'blocklist_behavior' => '',
'commands' => [
],
'grants' => [
],
'max_message_length' => '',
'quotes' => null,
'reactions' => null,
'replies' => null,
'typing_events' => null,
'uploads' => null,
'url_enrichment' => null
],
'created_by' => [
],
'disabled' => null,
'frozen' => null,
'members' => [
[
]
],
'own_capabilities' => [
],
'team' => '',
'truncated_at' => [
],
'truncated_by' => [
],
'truncated_by_id' => ''
],
'demote_moderators' => [
],
'hide_history' => null,
'invites' => [
[
]
],
'message' => [
'attachments' => [
[
'actions' => [
[
'name' => '',
'style' => '',
'text' => '',
'type' => '',
'value' => ''
]
],
'asset_url' => '',
'author_icon' => '',
'author_link' => '',
'author_name' => '',
'color' => '',
'fallback' => '',
'fields' => [
[
'short' => null,
'title' => '',
'value' => ''
]
],
'footer' => '',
'footer_icon' => '',
'giphy' => [
'fixed_height' => [
'frames' => '',
'height' => '',
'size' => '',
'url' => '',
'width' => ''
],
'fixed_height_downsampled' => [
],
'fixed_height_still' => [
],
'fixed_width' => [
],
'fixed_width_downsampled' => [
],
'fixed_width_still' => [
],
'original' => [
]
],
'image_url' => '',
'og_scrape_url' => '',
'original_height' => '',
'original_width' => '',
'pretext' => '',
'text' => '',
'thumb_url' => '',
'title' => '',
'title_link' => '',
'type' => ''
]
],
'cid' => [
],
'html' => '',
'id' => '',
'mentioned_users' => [
],
'mml' => '',
'parent' => [
],
'parent_id' => '',
'pin_expires' => '',
'pinned' => null,
'pinned_at' => '',
'pinned_by' => [
],
'quoted_message_id' => '',
'reaction_scores' => [
],
'show_in_channel' => null,
'silent' => null,
'text' => '',
'user' => [
],
'user_id' => ''
],
'reject_invite' => null,
'remove_members' => [
],
'skip_push' => null,
'user' => [
],
'user_id' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'accept_invite' => null,
'add_members' => [
[
'ban_expires' => '',
'banned' => null,
'channel_role' => '',
'created_at' => '',
'deleted_at' => '',
'invite_accepted_at' => '',
'invite_rejected_at' => '',
'invited' => null,
'is_moderator' => null,
'role' => '',
'shadow_banned' => null,
'updated_at' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]
],
'add_moderators' => [
],
'assign_roles' => [
[
]
],
'cooldown' => '',
'data' => [
'auto_translation_enabled' => null,
'auto_translation_language' => '',
'config_overrides' => [
'blocklist' => '',
'blocklist_behavior' => '',
'commands' => [
],
'grants' => [
],
'max_message_length' => '',
'quotes' => null,
'reactions' => null,
'replies' => null,
'typing_events' => null,
'uploads' => null,
'url_enrichment' => null
],
'created_by' => [
],
'disabled' => null,
'frozen' => null,
'members' => [
[
]
],
'own_capabilities' => [
],
'team' => '',
'truncated_at' => [
],
'truncated_by' => [
],
'truncated_by_id' => ''
],
'demote_moderators' => [
],
'hide_history' => null,
'invites' => [
[
]
],
'message' => [
'attachments' => [
[
'actions' => [
[
'name' => '',
'style' => '',
'text' => '',
'type' => '',
'value' => ''
]
],
'asset_url' => '',
'author_icon' => '',
'author_link' => '',
'author_name' => '',
'color' => '',
'fallback' => '',
'fields' => [
[
'short' => null,
'title' => '',
'value' => ''
]
],
'footer' => '',
'footer_icon' => '',
'giphy' => [
'fixed_height' => [
'frames' => '',
'height' => '',
'size' => '',
'url' => '',
'width' => ''
],
'fixed_height_downsampled' => [
],
'fixed_height_still' => [
],
'fixed_width' => [
],
'fixed_width_downsampled' => [
],
'fixed_width_still' => [
],
'original' => [
]
],
'image_url' => '',
'og_scrape_url' => '',
'original_height' => '',
'original_width' => '',
'pretext' => '',
'text' => '',
'thumb_url' => '',
'title' => '',
'title_link' => '',
'type' => ''
]
],
'cid' => [
],
'html' => '',
'id' => '',
'mentioned_users' => [
],
'mml' => '',
'parent' => [
],
'parent_id' => '',
'pin_expires' => '',
'pinned' => null,
'pinned_at' => '',
'pinned_by' => [
],
'quoted_message_id' => '',
'reaction_scores' => [
],
'show_in_channel' => null,
'silent' => null,
'text' => '',
'user' => [
],
'user_id' => ''
],
'reject_invite' => null,
'remove_members' => [
],
'skip_push' => null,
'user' => [
],
'user_id' => ''
]));
$request->setRequestUrl('{{baseUrl}}/channels/:type/:id');
$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}}/channels/:type/:id' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"accept_invite": false,
"add_members": [
{
"ban_expires": "",
"banned": false,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": false,
"is_moderator": false,
"role": "",
"shadow_banned": false,
"updated_at": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
],
"add_moderators": [],
"assign_roles": [
{}
],
"cooldown": "",
"data": {
"auto_translation_enabled": false,
"auto_translation_language": "",
"config_overrides": {
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"grants": {},
"max_message_length": "",
"quotes": false,
"reactions": false,
"replies": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
},
"created_by": {},
"disabled": false,
"frozen": false,
"members": [
{}
],
"own_capabilities": [],
"team": "",
"truncated_at": [],
"truncated_by": [],
"truncated_by_id": ""
},
"demote_moderators": [],
"hide_history": false,
"invites": [
{}
],
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"cid": [],
"html": "",
"id": "",
"mentioned_users": [],
"mml": "",
"parent": [],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": [],
"quoted_message_id": "",
"reaction_scores": [],
"show_in_channel": false,
"silent": false,
"text": "",
"user": {},
"user_id": ""
},
"reject_invite": false,
"remove_members": [],
"skip_push": false,
"user": {},
"user_id": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/channels/:type/:id' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"accept_invite": false,
"add_members": [
{
"ban_expires": "",
"banned": false,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": false,
"is_moderator": false,
"role": "",
"shadow_banned": false,
"updated_at": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
],
"add_moderators": [],
"assign_roles": [
{}
],
"cooldown": "",
"data": {
"auto_translation_enabled": false,
"auto_translation_language": "",
"config_overrides": {
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"grants": {},
"max_message_length": "",
"quotes": false,
"reactions": false,
"replies": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
},
"created_by": {},
"disabled": false,
"frozen": false,
"members": [
{}
],
"own_capabilities": [],
"team": "",
"truncated_at": [],
"truncated_by": [],
"truncated_by_id": ""
},
"demote_moderators": [],
"hide_history": false,
"invites": [
{}
],
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"cid": [],
"html": "",
"id": "",
"mentioned_users": [],
"mml": "",
"parent": [],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": [],
"quoted_message_id": "",
"reaction_scores": [],
"show_in_channel": false,
"silent": false,
"text": "",
"user": {},
"user_id": ""
},
"reject_invite": false,
"remove_members": [],
"skip_push": false,
"user": {},
"user_id": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"accept_invite\": false,\n \"add_members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n }\n ],\n \"add_moderators\": [],\n \"assign_roles\": [\n {}\n ],\n \"cooldown\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {},\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {}\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"demote_moderators\": [],\n \"hide_history\": false,\n \"invites\": [\n {}\n ],\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n },\n \"reject_invite\": false,\n \"remove_members\": [],\n \"skip_push\": false,\n \"user\": {},\n \"user_id\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/channels/:type/:id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/channels/:type/:id"
payload = {
"accept_invite": False,
"add_members": [
{
"ban_expires": "",
"banned": False,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": False,
"is_moderator": False,
"role": "",
"shadow_banned": False,
"updated_at": "",
"user": {
"ban_expires": "",
"banned": False,
"id": "",
"invisible": False,
"language": "",
"push_notifications": {
"disabled": False,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
],
"add_moderators": [],
"assign_roles": [{}],
"cooldown": "",
"data": {
"auto_translation_enabled": False,
"auto_translation_language": "",
"config_overrides": {
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"grants": {},
"max_message_length": "",
"quotes": False,
"reactions": False,
"replies": False,
"typing_events": False,
"uploads": False,
"url_enrichment": False
},
"created_by": {},
"disabled": False,
"frozen": False,
"members": [{}],
"own_capabilities": [],
"team": "",
"truncated_at": [],
"truncated_by": [],
"truncated_by_id": ""
},
"demote_moderators": [],
"hide_history": False,
"invites": [{}],
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": False,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"cid": [],
"html": "",
"id": "",
"mentioned_users": [],
"mml": "",
"parent": [],
"parent_id": "",
"pin_expires": "",
"pinned": False,
"pinned_at": "",
"pinned_by": [],
"quoted_message_id": "",
"reaction_scores": [],
"show_in_channel": False,
"silent": False,
"text": "",
"user": {},
"user_id": ""
},
"reject_invite": False,
"remove_members": [],
"skip_push": False,
"user": {},
"user_id": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/channels/:type/:id"
payload <- "{\n \"accept_invite\": false,\n \"add_members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n }\n ],\n \"add_moderators\": [],\n \"assign_roles\": [\n {}\n ],\n \"cooldown\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {},\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {}\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"demote_moderators\": [],\n \"hide_history\": false,\n \"invites\": [\n {}\n ],\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n },\n \"reject_invite\": false,\n \"remove_members\": [],\n \"skip_push\": false,\n \"user\": {},\n \"user_id\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/channels/:type/:id")
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 \"accept_invite\": false,\n \"add_members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n }\n ],\n \"add_moderators\": [],\n \"assign_roles\": [\n {}\n ],\n \"cooldown\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {},\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {}\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"demote_moderators\": [],\n \"hide_history\": false,\n \"invites\": [\n {}\n ],\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n },\n \"reject_invite\": false,\n \"remove_members\": [],\n \"skip_push\": false,\n \"user\": {},\n \"user_id\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/channels/:type/:id') do |req|
req.body = "{\n \"accept_invite\": false,\n \"add_members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n }\n ],\n \"add_moderators\": [],\n \"assign_roles\": [\n {}\n ],\n \"cooldown\": \"\",\n \"data\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"config_overrides\": {\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"grants\": {},\n \"max_message_length\": \"\",\n \"quotes\": false,\n \"reactions\": false,\n \"replies\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"created_by\": {},\n \"disabled\": false,\n \"frozen\": false,\n \"members\": [\n {}\n ],\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": [],\n \"truncated_by\": [],\n \"truncated_by_id\": \"\"\n },\n \"demote_moderators\": [],\n \"hide_history\": false,\n \"invites\": [\n {}\n ],\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n },\n \"reject_invite\": false,\n \"remove_members\": [],\n \"skip_push\": false,\n \"user\": {},\n \"user_id\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/channels/:type/:id";
let payload = json!({
"accept_invite": false,
"add_members": (
json!({
"ban_expires": "",
"banned": false,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": false,
"is_moderator": false,
"role": "",
"shadow_banned": false,
"updated_at": "",
"user": json!({
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": json!({
"disabled": false,
"disabled_until": ""
}),
"revoke_tokens_issued_before": "",
"role": "",
"teams": ()
}),
"user_id": ""
})
),
"add_moderators": (),
"assign_roles": (json!({})),
"cooldown": "",
"data": json!({
"auto_translation_enabled": false,
"auto_translation_language": "",
"config_overrides": json!({
"blocklist": "",
"blocklist_behavior": "",
"commands": (),
"grants": json!({}),
"max_message_length": "",
"quotes": false,
"reactions": false,
"replies": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
}),
"created_by": json!({}),
"disabled": false,
"frozen": false,
"members": (json!({})),
"own_capabilities": (),
"team": "",
"truncated_at": (),
"truncated_by": (),
"truncated_by_id": ""
}),
"demote_moderators": (),
"hide_history": false,
"invites": (json!({})),
"message": json!({
"attachments": (
json!({
"actions": (
json!({
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
})
),
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": (
json!({
"short": false,
"title": "",
"value": ""
})
),
"footer": "",
"footer_icon": "",
"giphy": json!({
"fixed_height": json!({
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
}),
"fixed_height_downsampled": json!({}),
"fixed_height_still": json!({}),
"fixed_width": json!({}),
"fixed_width_downsampled": json!({}),
"fixed_width_still": json!({}),
"original": json!({})
}),
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
})
),
"cid": (),
"html": "",
"id": "",
"mentioned_users": (),
"mml": "",
"parent": (),
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": (),
"quoted_message_id": "",
"reaction_scores": (),
"show_in_channel": false,
"silent": false,
"text": "",
"user": json!({}),
"user_id": ""
}),
"reject_invite": false,
"remove_members": (),
"skip_push": false,
"user": json!({}),
"user_id": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/channels/:type/:id \
--header 'content-type: application/json' \
--data '{
"accept_invite": false,
"add_members": [
{
"ban_expires": "",
"banned": false,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": false,
"is_moderator": false,
"role": "",
"shadow_banned": false,
"updated_at": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
],
"add_moderators": [],
"assign_roles": [
{}
],
"cooldown": "",
"data": {
"auto_translation_enabled": false,
"auto_translation_language": "",
"config_overrides": {
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"grants": {},
"max_message_length": "",
"quotes": false,
"reactions": false,
"replies": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
},
"created_by": {},
"disabled": false,
"frozen": false,
"members": [
{}
],
"own_capabilities": [],
"team": "",
"truncated_at": [],
"truncated_by": [],
"truncated_by_id": ""
},
"demote_moderators": [],
"hide_history": false,
"invites": [
{}
],
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"cid": [],
"html": "",
"id": "",
"mentioned_users": [],
"mml": "",
"parent": [],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": [],
"quoted_message_id": "",
"reaction_scores": [],
"show_in_channel": false,
"silent": false,
"text": "",
"user": {},
"user_id": ""
},
"reject_invite": false,
"remove_members": [],
"skip_push": false,
"user": {},
"user_id": ""
}'
echo '{
"accept_invite": false,
"add_members": [
{
"ban_expires": "",
"banned": false,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": false,
"is_moderator": false,
"role": "",
"shadow_banned": false,
"updated_at": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
],
"add_moderators": [],
"assign_roles": [
{}
],
"cooldown": "",
"data": {
"auto_translation_enabled": false,
"auto_translation_language": "",
"config_overrides": {
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"grants": {},
"max_message_length": "",
"quotes": false,
"reactions": false,
"replies": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
},
"created_by": {},
"disabled": false,
"frozen": false,
"members": [
{}
],
"own_capabilities": [],
"team": "",
"truncated_at": [],
"truncated_by": [],
"truncated_by_id": ""
},
"demote_moderators": [],
"hide_history": false,
"invites": [
{}
],
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"cid": [],
"html": "",
"id": "",
"mentioned_users": [],
"mml": "",
"parent": [],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": [],
"quoted_message_id": "",
"reaction_scores": [],
"show_in_channel": false,
"silent": false,
"text": "",
"user": {},
"user_id": ""
},
"reject_invite": false,
"remove_members": [],
"skip_push": false,
"user": {},
"user_id": ""
}' | \
http POST {{baseUrl}}/channels/:type/:id \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "accept_invite": false,\n "add_members": [\n {\n "ban_expires": "",\n "banned": false,\n "channel_role": "",\n "created_at": "",\n "deleted_at": "",\n "invite_accepted_at": "",\n "invite_rejected_at": "",\n "invited": false,\n "is_moderator": false,\n "role": "",\n "shadow_banned": false,\n "updated_at": "",\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n }\n ],\n "add_moderators": [],\n "assign_roles": [\n {}\n ],\n "cooldown": "",\n "data": {\n "auto_translation_enabled": false,\n "auto_translation_language": "",\n "config_overrides": {\n "blocklist": "",\n "blocklist_behavior": "",\n "commands": [],\n "grants": {},\n "max_message_length": "",\n "quotes": false,\n "reactions": false,\n "replies": false,\n "typing_events": false,\n "uploads": false,\n "url_enrichment": false\n },\n "created_by": {},\n "disabled": false,\n "frozen": false,\n "members": [\n {}\n ],\n "own_capabilities": [],\n "team": "",\n "truncated_at": [],\n "truncated_by": [],\n "truncated_by_id": ""\n },\n "demote_moderators": [],\n "hide_history": false,\n "invites": [\n {}\n ],\n "message": {\n "attachments": [\n {\n "actions": [\n {\n "name": "",\n "style": "",\n "text": "",\n "type": "",\n "value": ""\n }\n ],\n "asset_url": "",\n "author_icon": "",\n "author_link": "",\n "author_name": "",\n "color": "",\n "fallback": "",\n "fields": [\n {\n "short": false,\n "title": "",\n "value": ""\n }\n ],\n "footer": "",\n "footer_icon": "",\n "giphy": {\n "fixed_height": {\n "frames": "",\n "height": "",\n "size": "",\n "url": "",\n "width": ""\n },\n "fixed_height_downsampled": {},\n "fixed_height_still": {},\n "fixed_width": {},\n "fixed_width_downsampled": {},\n "fixed_width_still": {},\n "original": {}\n },\n "image_url": "",\n "og_scrape_url": "",\n "original_height": "",\n "original_width": "",\n "pretext": "",\n "text": "",\n "thumb_url": "",\n "title": "",\n "title_link": "",\n "type": ""\n }\n ],\n "cid": [],\n "html": "",\n "id": "",\n "mentioned_users": [],\n "mml": "",\n "parent": [],\n "parent_id": "",\n "pin_expires": "",\n "pinned": false,\n "pinned_at": "",\n "pinned_by": [],\n "quoted_message_id": "",\n "reaction_scores": [],\n "show_in_channel": false,\n "silent": false,\n "text": "",\n "user": {},\n "user_id": ""\n },\n "reject_invite": false,\n "remove_members": [],\n "skip_push": false,\n "user": {},\n "user_id": ""\n}' \
--output-document \
- {{baseUrl}}/channels/:type/:id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"accept_invite": false,
"add_members": [
[
"ban_expires": "",
"banned": false,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": false,
"is_moderator": false,
"role": "",
"shadow_banned": false,
"updated_at": "",
"user": [
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": [
"disabled": false,
"disabled_until": ""
],
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
],
"user_id": ""
]
],
"add_moderators": [],
"assign_roles": [[]],
"cooldown": "",
"data": [
"auto_translation_enabled": false,
"auto_translation_language": "",
"config_overrides": [
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"grants": [],
"max_message_length": "",
"quotes": false,
"reactions": false,
"replies": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
],
"created_by": [],
"disabled": false,
"frozen": false,
"members": [[]],
"own_capabilities": [],
"team": "",
"truncated_at": [],
"truncated_by": [],
"truncated_by_id": ""
],
"demote_moderators": [],
"hide_history": false,
"invites": [[]],
"message": [
"attachments": [
[
"actions": [
[
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
]
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
[
"short": false,
"title": "",
"value": ""
]
],
"footer": "",
"footer_icon": "",
"giphy": [
"fixed_height": [
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
],
"fixed_height_downsampled": [],
"fixed_height_still": [],
"fixed_width": [],
"fixed_width_downsampled": [],
"fixed_width_still": [],
"original": []
],
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
]
],
"cid": [],
"html": "",
"id": "",
"mentioned_users": [],
"mml": "",
"parent": [],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": [],
"quoted_message_id": "",
"reaction_scores": [],
"show_in_channel": false,
"silent": false,
"text": "",
"user": [],
"user_id": ""
],
"reject_invite": false,
"remove_members": [],
"skip_push": false,
"user": [],
"user_id": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/channels/:type/:id")! 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
Create command
{{baseUrl}}/commands
BODY json
{
"args": "",
"description": "",
"name": "",
"set": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/commands");
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 \"args\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"set\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/commands" {:content-type :json
:form-params {:args ""
:description ""
:name ""
:set ""}})
require "http/client"
url = "{{baseUrl}}/commands"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"args\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"set\": \"\"\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}}/commands"),
Content = new StringContent("{\n \"args\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"set\": \"\"\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}}/commands");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"args\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"set\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/commands"
payload := strings.NewReader("{\n \"args\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"set\": \"\"\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/commands HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 64
{
"args": "",
"description": "",
"name": "",
"set": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/commands")
.setHeader("content-type", "application/json")
.setBody("{\n \"args\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"set\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/commands"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"args\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"set\": \"\"\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 \"args\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"set\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/commands")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/commands")
.header("content-type", "application/json")
.body("{\n \"args\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"set\": \"\"\n}")
.asString();
const data = JSON.stringify({
args: '',
description: '',
name: '',
set: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/commands');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/commands',
headers: {'content-type': 'application/json'},
data: {args: '', description: '', name: '', set: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/commands';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"args":"","description":"","name":"","set":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/commands',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "args": "",\n "description": "",\n "name": "",\n "set": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"args\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"set\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/commands")
.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/commands',
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({args: '', description: '', name: '', set: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/commands',
headers: {'content-type': 'application/json'},
body: {args: '', description: '', name: '', set: ''},
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}}/commands');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
args: '',
description: '',
name: '',
set: ''
});
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}}/commands',
headers: {'content-type': 'application/json'},
data: {args: '', description: '', name: '', set: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/commands';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"args":"","description":"","name":"","set":""}'
};
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 = @{ @"args": @"",
@"description": @"",
@"name": @"",
@"set": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/commands"]
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}}/commands" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"args\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"set\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/commands",
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([
'args' => '',
'description' => '',
'name' => '',
'set' => ''
]),
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}}/commands', [
'body' => '{
"args": "",
"description": "",
"name": "",
"set": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/commands');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'args' => '',
'description' => '',
'name' => '',
'set' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'args' => '',
'description' => '',
'name' => '',
'set' => ''
]));
$request->setRequestUrl('{{baseUrl}}/commands');
$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}}/commands' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"args": "",
"description": "",
"name": "",
"set": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/commands' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"args": "",
"description": "",
"name": "",
"set": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"args\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"set\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/commands", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/commands"
payload = {
"args": "",
"description": "",
"name": "",
"set": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/commands"
payload <- "{\n \"args\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"set\": \"\"\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}}/commands")
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 \"args\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"set\": \"\"\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/commands') do |req|
req.body = "{\n \"args\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"set\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/commands";
let payload = json!({
"args": "",
"description": "",
"name": "",
"set": ""
});
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}}/commands \
--header 'content-type: application/json' \
--data '{
"args": "",
"description": "",
"name": "",
"set": ""
}'
echo '{
"args": "",
"description": "",
"name": "",
"set": ""
}' | \
http POST {{baseUrl}}/commands \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "args": "",\n "description": "",\n "name": "",\n "set": ""\n}' \
--output-document \
- {{baseUrl}}/commands
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"args": "",
"description": "",
"name": "",
"set": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/commands")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
Delete command
{{baseUrl}}/commands/:name
QUERY PARAMS
name
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/commands/:name");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/commands/:name")
require "http/client"
url = "{{baseUrl}}/commands/:name"
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}}/commands/:name"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/commands/:name");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/commands/:name"
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/commands/:name HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/commands/:name")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/commands/:name"))
.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}}/commands/:name")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/commands/:name")
.asString();
const 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}}/commands/:name');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/commands/:name'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/commands/:name';
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}}/commands/:name',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/commands/:name")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/commands/:name',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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}}/commands/:name'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/commands/:name');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/commands/:name'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/commands/:name';
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}}/commands/:name"]
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}}/commands/:name" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/commands/:name",
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}}/commands/:name');
echo $response->getBody();
setUrl('{{baseUrl}}/commands/:name');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/commands/:name');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/commands/:name' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/commands/:name' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/commands/:name")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/commands/:name"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/commands/:name"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/commands/:name")
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/commands/:name') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/commands/:name";
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}}/commands/:name
http DELETE {{baseUrl}}/commands/:name
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/commands/:name
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/commands/:name")! 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
Get command
{{baseUrl}}/commands/:name
QUERY PARAMS
name
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/commands/:name");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/commands/:name")
require "http/client"
url = "{{baseUrl}}/commands/:name"
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}}/commands/:name"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/commands/:name");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/commands/:name"
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/commands/:name HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/commands/:name")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/commands/:name"))
.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}}/commands/:name")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/commands/:name")
.asString();
const 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}}/commands/:name');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/commands/:name'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/commands/:name';
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}}/commands/:name',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/commands/:name")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/commands/:name',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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}}/commands/:name'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/commands/:name');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/commands/:name'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/commands/:name';
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}}/commands/:name"]
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}}/commands/:name" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/commands/:name",
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}}/commands/:name');
echo $response->getBody();
setUrl('{{baseUrl}}/commands/:name');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/commands/:name');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/commands/:name' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/commands/:name' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/commands/:name")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/commands/:name"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/commands/:name"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/commands/:name")
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/commands/:name') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/commands/:name";
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}}/commands/:name
http GET {{baseUrl}}/commands/:name
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/commands/:name
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/commands/:name")! 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
List commands
{{baseUrl}}/commands
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/commands");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/commands")
require "http/client"
url = "{{baseUrl}}/commands"
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}}/commands"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/commands");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/commands"
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/commands HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/commands")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/commands"))
.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}}/commands")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/commands")
.asString();
const 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}}/commands');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/commands'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/commands';
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}}/commands',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/commands")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/commands',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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}}/commands'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/commands');
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}}/commands'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/commands';
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}}/commands"]
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}}/commands" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/commands",
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}}/commands');
echo $response->getBody();
setUrl('{{baseUrl}}/commands');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/commands');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/commands' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/commands' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/commands")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/commands"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/commands"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/commands")
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/commands') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/commands";
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}}/commands
http GET {{baseUrl}}/commands
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/commands
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/commands")! 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
Update command
{{baseUrl}}/commands/:name
QUERY PARAMS
name
BODY json
{
"Name": "",
"args": "",
"description": "",
"set": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/commands/:name");
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 \"args\": \"\",\n \"description\": \"\",\n \"set\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/commands/:name" {:content-type :json
:form-params {:Name ""
:args ""
:description ""
:set ""}})
require "http/client"
url = "{{baseUrl}}/commands/:name"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"Name\": \"\",\n \"args\": \"\",\n \"description\": \"\",\n \"set\": \"\"\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}}/commands/:name"),
Content = new StringContent("{\n \"Name\": \"\",\n \"args\": \"\",\n \"description\": \"\",\n \"set\": \"\"\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}}/commands/:name");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"Name\": \"\",\n \"args\": \"\",\n \"description\": \"\",\n \"set\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/commands/:name"
payload := strings.NewReader("{\n \"Name\": \"\",\n \"args\": \"\",\n \"description\": \"\",\n \"set\": \"\"\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/commands/:name HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 64
{
"Name": "",
"args": "",
"description": "",
"set": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/commands/:name")
.setHeader("content-type", "application/json")
.setBody("{\n \"Name\": \"\",\n \"args\": \"\",\n \"description\": \"\",\n \"set\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/commands/:name"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"Name\": \"\",\n \"args\": \"\",\n \"description\": \"\",\n \"set\": \"\"\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 \"args\": \"\",\n \"description\": \"\",\n \"set\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/commands/:name")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/commands/:name")
.header("content-type", "application/json")
.body("{\n \"Name\": \"\",\n \"args\": \"\",\n \"description\": \"\",\n \"set\": \"\"\n}")
.asString();
const data = JSON.stringify({
Name: '',
args: '',
description: '',
set: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/commands/:name');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/commands/:name',
headers: {'content-type': 'application/json'},
data: {Name: '', args: '', description: '', set: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/commands/:name';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"Name":"","args":"","description":"","set":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/commands/:name',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "Name": "",\n "args": "",\n "description": "",\n "set": ""\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 \"args\": \"\",\n \"description\": \"\",\n \"set\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/commands/:name")
.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/commands/:name',
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: '', args: '', description: '', set: ''}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/commands/:name',
headers: {'content-type': 'application/json'},
body: {Name: '', args: '', description: '', set: ''},
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}}/commands/:name');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
Name: '',
args: '',
description: '',
set: ''
});
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}}/commands/:name',
headers: {'content-type': 'application/json'},
data: {Name: '', args: '', description: '', set: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/commands/:name';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"Name":"","args":"","description":"","set":""}'
};
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": @"",
@"args": @"",
@"description": @"",
@"set": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/commands/:name"]
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}}/commands/:name" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"Name\": \"\",\n \"args\": \"\",\n \"description\": \"\",\n \"set\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/commands/:name",
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' => '',
'args' => '',
'description' => '',
'set' => ''
]),
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}}/commands/:name', [
'body' => '{
"Name": "",
"args": "",
"description": "",
"set": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/commands/:name');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'Name' => '',
'args' => '',
'description' => '',
'set' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'Name' => '',
'args' => '',
'description' => '',
'set' => ''
]));
$request->setRequestUrl('{{baseUrl}}/commands/:name');
$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}}/commands/:name' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"Name": "",
"args": "",
"description": "",
"set": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/commands/:name' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"Name": "",
"args": "",
"description": "",
"set": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"Name\": \"\",\n \"args\": \"\",\n \"description\": \"\",\n \"set\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/commands/:name", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/commands/:name"
payload = {
"Name": "",
"args": "",
"description": "",
"set": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/commands/:name"
payload <- "{\n \"Name\": \"\",\n \"args\": \"\",\n \"description\": \"\",\n \"set\": \"\"\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}}/commands/:name")
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 \"args\": \"\",\n \"description\": \"\",\n \"set\": \"\"\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/commands/:name') do |req|
req.body = "{\n \"Name\": \"\",\n \"args\": \"\",\n \"description\": \"\",\n \"set\": \"\"\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}}/commands/:name";
let payload = json!({
"Name": "",
"args": "",
"description": "",
"set": ""
});
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}}/commands/:name \
--header 'content-type: application/json' \
--data '{
"Name": "",
"args": "",
"description": "",
"set": ""
}'
echo '{
"Name": "",
"args": "",
"description": "",
"set": ""
}' | \
http PUT {{baseUrl}}/commands/:name \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "Name": "",\n "args": "",\n "description": "",\n "set": ""\n}' \
--output-document \
- {{baseUrl}}/commands/:name
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"Name": "",
"args": "",
"description": "",
"set": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/commands/:name")! 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
Create device
{{baseUrl}}/devices
BODY json
{
"id": "",
"push_provider": "",
"push_provider_name": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/devices");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"id\": \"\",\n \"push_provider\": \"\",\n \"push_provider_name\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/devices" {:content-type :json
:form-params {:id ""
:push_provider ""
:push_provider_name ""
:user {:ban_expires ""
:banned false
:id ""
:invisible false
:language ""
:push_notifications {:disabled false
:disabled_until ""}
:revoke_tokens_issued_before ""
:role ""
:teams []}
:user_id ""}})
require "http/client"
url = "{{baseUrl}}/devices"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"id\": \"\",\n \"push_provider\": \"\",\n \"push_provider_name\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/devices"),
Content = new StringContent("{\n \"id\": \"\",\n \"push_provider\": \"\",\n \"push_provider_name\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/devices");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"id\": \"\",\n \"push_provider\": \"\",\n \"push_provider_name\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/devices"
payload := strings.NewReader("{\n \"id\": \"\",\n \"push_provider\": \"\",\n \"push_provider_name\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/devices HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 359
{
"id": "",
"push_provider": "",
"push_provider_name": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/devices")
.setHeader("content-type", "application/json")
.setBody("{\n \"id\": \"\",\n \"push_provider\": \"\",\n \"push_provider_name\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/devices"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"id\": \"\",\n \"push_provider\": \"\",\n \"push_provider_name\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"id\": \"\",\n \"push_provider\": \"\",\n \"push_provider_name\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/devices")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/devices")
.header("content-type", "application/json")
.body("{\n \"id\": \"\",\n \"push_provider\": \"\",\n \"push_provider_name\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
.asString();
const data = JSON.stringify({
id: '',
push_provider: '',
push_provider_name: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/devices');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/devices',
headers: {'content-type': 'application/json'},
data: {
id: '',
push_provider: '',
push_provider_name: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/devices';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"id":"","push_provider":"","push_provider_name":"","user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/devices',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "id": "",\n "push_provider": "",\n "push_provider_name": "",\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"id\": \"\",\n \"push_provider\": \"\",\n \"push_provider_name\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/devices")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/devices',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
id: '',
push_provider: '',
push_provider_name: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/devices',
headers: {'content-type': 'application/json'},
body: {
id: '',
push_provider: '',
push_provider_name: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/devices');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
id: '',
push_provider: '',
push_provider_name: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/devices',
headers: {'content-type': 'application/json'},
data: {
id: '',
push_provider: '',
push_provider_name: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/devices';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"id":"","push_provider":"","push_provider_name":"","user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"id": @"",
@"push_provider": @"",
@"push_provider_name": @"",
@"user": @{ @"ban_expires": @"", @"banned": @NO, @"id": @"", @"invisible": @NO, @"language": @"", @"push_notifications": @{ @"disabled": @NO, @"disabled_until": @"" }, @"revoke_tokens_issued_before": @"", @"role": @"", @"teams": @[ ] },
@"user_id": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/devices"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/devices" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"id\": \"\",\n \"push_provider\": \"\",\n \"push_provider_name\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/devices",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'id' => '',
'push_provider' => '',
'push_provider_name' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/devices', [
'body' => '{
"id": "",
"push_provider": "",
"push_provider_name": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/devices');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'id' => '',
'push_provider' => '',
'push_provider_name' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'id' => '',
'push_provider' => '',
'push_provider_name' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]));
$request->setRequestUrl('{{baseUrl}}/devices');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/devices' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"id": "",
"push_provider": "",
"push_provider_name": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/devices' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"id": "",
"push_provider": "",
"push_provider_name": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"id\": \"\",\n \"push_provider\": \"\",\n \"push_provider_name\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/devices", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/devices"
payload = {
"id": "",
"push_provider": "",
"push_provider_name": "",
"user": {
"ban_expires": "",
"banned": False,
"id": "",
"invisible": False,
"language": "",
"push_notifications": {
"disabled": False,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/devices"
payload <- "{\n \"id\": \"\",\n \"push_provider\": \"\",\n \"push_provider_name\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/devices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"id\": \"\",\n \"push_provider\": \"\",\n \"push_provider_name\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/devices') do |req|
req.body = "{\n \"id\": \"\",\n \"push_provider\": \"\",\n \"push_provider_name\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/devices";
let payload = json!({
"id": "",
"push_provider": "",
"push_provider_name": "",
"user": json!({
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": json!({
"disabled": false,
"disabled_until": ""
}),
"revoke_tokens_issued_before": "",
"role": "",
"teams": ()
}),
"user_id": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/devices \
--header 'content-type: application/json' \
--data '{
"id": "",
"push_provider": "",
"push_provider_name": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
echo '{
"id": "",
"push_provider": "",
"push_provider_name": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}' | \
http POST {{baseUrl}}/devices \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "id": "",\n "push_provider": "",\n "push_provider_name": "",\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n}' \
--output-document \
- {{baseUrl}}/devices
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"id": "",
"push_provider": "",
"push_provider_name": "",
"user": [
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": [
"disabled": false,
"disabled_until": ""
],
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
],
"user_id": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/devices")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
Delete device
{{baseUrl}}/devices
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/devices");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/devices")
require "http/client"
url = "{{baseUrl}}/devices"
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}}/devices"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/devices");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/devices"
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/devices HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/devices")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/devices"))
.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}}/devices")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/devices")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/devices');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/devices'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/devices';
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}}/devices',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/devices")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/devices',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/devices'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/devices');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/devices'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/devices';
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}}/devices"]
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}}/devices" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/devices",
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}}/devices');
echo $response->getBody();
setUrl('{{baseUrl}}/devices');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/devices');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/devices' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/devices' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/devices")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/devices"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/devices"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/devices")
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/devices') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/devices";
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}}/devices
http DELETE {{baseUrl}}/devices
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/devices
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/devices")! 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
List devices
{{baseUrl}}/devices
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/devices");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/devices")
require "http/client"
url = "{{baseUrl}}/devices"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/devices"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/devices");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/devices"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/devices HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/devices")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/devices"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/devices")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/devices")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/devices');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/devices'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/devices';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/devices',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/devices")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/devices',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/devices'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/devices');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/devices'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/devices';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/devices"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/devices" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/devices",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/devices');
echo $response->getBody();
setUrl('{{baseUrl}}/devices');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/devices');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/devices' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/devices' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/devices")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/devices"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/devices"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/devices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/devices') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/devices";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/devices
http GET {{baseUrl}}/devices
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/devices
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/devices")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Send event
{{baseUrl}}/channels/:type/:id/event
QUERY PARAMS
type
id
BODY json
{
"event": {
"automoderation": false,
"automoderation_scores": {
"action": "",
"explicit": "",
"spam": "",
"toxic": ""
},
"channel": {
"auto_translation_enabled": false,
"auto_translation_language": "",
"cid": "",
"config": {
"automod": "",
"automod_behavior": "",
"automod_thresholds": {
"explicit": {
"block": "",
"flag": ""
},
"spam": {},
"toxic": {}
},
"blocklist": "",
"blocklist_behavior": "",
"commands": [
{
"args": "",
"description": "",
"name": "",
"set": ""
}
],
"connect_events": false,
"created_at": "",
"custom_events": false,
"grants": {},
"max_message_length": "",
"message_retention": "",
"mutes": false,
"name": "",
"push_notifications": false,
"quotes": false,
"reactions": false,
"read_events": false,
"reminders": false,
"replies": false,
"search": false,
"typing_events": false,
"updated_at": "",
"uploads": false,
"url_enrichment": false
},
"cooldown": "",
"created_at": "",
"created_by": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"deleted_at": "",
"disabled": false,
"frozen": false,
"hidden": false,
"hide_messages_before": "",
"id": "",
"last_message_at": "",
"member_count": "",
"members": [
{
"ban_expires": "",
"banned": false,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": false,
"is_moderator": false,
"role": "",
"shadow_banned": false,
"updated_at": "",
"user": {},
"user_id": ""
}
],
"mute_expires_at": "",
"muted": false,
"own_capabilities": [],
"team": "",
"truncated_at": "",
"truncated_by": {},
"type": "",
"updated_at": ""
},
"channel_id": "",
"channel_type": "",
"cid": "",
"connection_id": "",
"created_at": "",
"created_by": {},
"me": {
"banned": false,
"channel_mutes": [
{
"channel": {},
"created_at": "",
"expires": "",
"updated_at": "",
"user": {}
}
],
"created_at": "",
"deactivated_at": "",
"deleted_at": "",
"devices": [
{
"created_at": "",
"disabled": false,
"disabled_reason": "",
"id": "",
"push_provider": "",
"push_provider_name": "",
"user_id": ""
}
],
"id": "",
"invisible": false,
"language": "",
"last_active": "",
"latest_hidden_channels": [],
"mutes": [
{
"created_at": "",
"expires": "",
"target": {},
"updated_at": "",
"user": {}
}
],
"online": false,
"push_notifications": {},
"role": "",
"teams": [],
"total_unread_count": "",
"unread_channels": "",
"unread_count": "",
"updated_at": ""
},
"member": {},
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"before_message_send_failed": false,
"cid": "",
"command": "",
"created_at": "",
"deleted_at": "",
"html": "",
"i18n": {},
"id": "",
"image_labels": {},
"latest_reactions": [
{
"message_id": "",
"score": "",
"type": "",
"user": {},
"user_id": ""
}
],
"mentioned_users": [
{}
],
"mml": "",
"own_reactions": [
{}
],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": {},
"quoted_message": "",
"quoted_message_id": "",
"reaction_counts": {},
"reaction_scores": {},
"reply_count": "",
"shadowed": false,
"show_in_channel": false,
"silent": false,
"text": "",
"thread_participants": [
{}
],
"type": "",
"updated_at": "",
"user": {}
},
"parent_id": "",
"reaction": {},
"reason": "",
"team": "",
"type": "",
"user": {},
"user_id": "",
"watcher_count": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/channels/:type/:id/event");
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 \"event\": {\n \"automoderation\": false,\n \"automoderation_scores\": {\n \"action\": \"\",\n \"explicit\": \"\",\n \"spam\": \"\",\n \"toxic\": \"\"\n },\n \"channel\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"cid\": \"\",\n \"config\": {\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"automod_thresholds\": {\n \"explicit\": {\n \"block\": \"\",\n \"flag\": \"\"\n },\n \"spam\": {},\n \"toxic\": {}\n },\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [\n {\n \"args\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"set\": \"\"\n }\n ],\n \"connect_events\": false,\n \"created_at\": \"\",\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"name\": \"\",\n \"push_notifications\": false,\n \"quotes\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"reminders\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"updated_at\": \"\",\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"cooldown\": \"\",\n \"created_at\": \"\",\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"deleted_at\": \"\",\n \"disabled\": false,\n \"frozen\": false,\n \"hidden\": false,\n \"hide_messages_before\": \"\",\n \"id\": \"\",\n \"last_message_at\": \"\",\n \"member_count\": \"\",\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"mute_expires_at\": \"\",\n \"muted\": false,\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": \"\",\n \"truncated_by\": {},\n \"type\": \"\",\n \"updated_at\": \"\"\n },\n \"channel_id\": \"\",\n \"channel_type\": \"\",\n \"cid\": \"\",\n \"connection_id\": \"\",\n \"created_at\": \"\",\n \"created_by\": {},\n \"me\": {\n \"banned\": false,\n \"channel_mutes\": [\n {\n \"channel\": {},\n \"created_at\": \"\",\n \"expires\": \"\",\n \"updated_at\": \"\",\n \"user\": {}\n }\n ],\n \"created_at\": \"\",\n \"deactivated_at\": \"\",\n \"deleted_at\": \"\",\n \"devices\": [\n {\n \"created_at\": \"\",\n \"disabled\": false,\n \"disabled_reason\": \"\",\n \"id\": \"\",\n \"push_provider\": \"\",\n \"push_provider_name\": \"\",\n \"user_id\": \"\"\n }\n ],\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"last_active\": \"\",\n \"latest_hidden_channels\": [],\n \"mutes\": [\n {\n \"created_at\": \"\",\n \"expires\": \"\",\n \"target\": {},\n \"updated_at\": \"\",\n \"user\": {}\n }\n ],\n \"online\": false,\n \"push_notifications\": {},\n \"role\": \"\",\n \"teams\": [],\n \"total_unread_count\": \"\",\n \"unread_channels\": \"\",\n \"unread_count\": \"\",\n \"updated_at\": \"\"\n },\n \"member\": {},\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"before_message_send_failed\": false,\n \"cid\": \"\",\n \"command\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"html\": \"\",\n \"i18n\": {},\n \"id\": \"\",\n \"image_labels\": {},\n \"latest_reactions\": [\n {\n \"message_id\": \"\",\n \"score\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"mentioned_users\": [\n {}\n ],\n \"mml\": \"\",\n \"own_reactions\": [\n {}\n ],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": {},\n \"quoted_message\": \"\",\n \"quoted_message_id\": \"\",\n \"reaction_counts\": {},\n \"reaction_scores\": {},\n \"reply_count\": \"\",\n \"shadowed\": false,\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"thread_participants\": [\n {}\n ],\n \"type\": \"\",\n \"updated_at\": \"\",\n \"user\": {}\n },\n \"parent_id\": \"\",\n \"reaction\": {},\n \"reason\": \"\",\n \"team\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\",\n \"watcher_count\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/channels/:type/:id/event" {:content-type :json
:form-params {:event {:automoderation false
:automoderation_scores {:action ""
:explicit ""
:spam ""
:toxic ""}
:channel {:auto_translation_enabled false
:auto_translation_language ""
:cid ""
:config {:automod ""
:automod_behavior ""
:automod_thresholds {:explicit {:block ""
:flag ""}
:spam {}
:toxic {}}
:blocklist ""
:blocklist_behavior ""
:commands [{:args ""
:description ""
:name ""
:set ""}]
:connect_events false
:created_at ""
:custom_events false
:grants {}
:max_message_length ""
:message_retention ""
:mutes false
:name ""
:push_notifications false
:quotes false
:reactions false
:read_events false
:reminders false
:replies false
:search false
:typing_events false
:updated_at ""
:uploads false
:url_enrichment false}
:cooldown ""
:created_at ""
:created_by {:ban_expires ""
:banned false
:id ""
:invisible false
:language ""
:push_notifications {:disabled false
:disabled_until ""}
:revoke_tokens_issued_before ""
:role ""
:teams []}
:deleted_at ""
:disabled false
:frozen false
:hidden false
:hide_messages_before ""
:id ""
:last_message_at ""
:member_count ""
:members [{:ban_expires ""
:banned false
:channel_role ""
:created_at ""
:deleted_at ""
:invite_accepted_at ""
:invite_rejected_at ""
:invited false
:is_moderator false
:role ""
:shadow_banned false
:updated_at ""
:user {}
:user_id ""}]
:mute_expires_at ""
:muted false
:own_capabilities []
:team ""
:truncated_at ""
:truncated_by {}
:type ""
:updated_at ""}
:channel_id ""
:channel_type ""
:cid ""
:connection_id ""
:created_at ""
:created_by {}
:me {:banned false
:channel_mutes [{:channel {}
:created_at ""
:expires ""
:updated_at ""
:user {}}]
:created_at ""
:deactivated_at ""
:deleted_at ""
:devices [{:created_at ""
:disabled false
:disabled_reason ""
:id ""
:push_provider ""
:push_provider_name ""
:user_id ""}]
:id ""
:invisible false
:language ""
:last_active ""
:latest_hidden_channels []
:mutes [{:created_at ""
:expires ""
:target {}
:updated_at ""
:user {}}]
:online false
:push_notifications {}
:role ""
:teams []
:total_unread_count ""
:unread_channels ""
:unread_count ""
:updated_at ""}
:member {}
:message {:attachments [{:actions [{:name ""
:style ""
:text ""
:type ""
:value ""}]
:asset_url ""
:author_icon ""
:author_link ""
:author_name ""
:color ""
:fallback ""
:fields [{:short false
:title ""
:value ""}]
:footer ""
:footer_icon ""
:giphy {:fixed_height {:frames ""
:height ""
:size ""
:url ""
:width ""}
:fixed_height_downsampled {}
:fixed_height_still {}
:fixed_width {}
:fixed_width_downsampled {}
:fixed_width_still {}
:original {}}
:image_url ""
:og_scrape_url ""
:original_height ""
:original_width ""
:pretext ""
:text ""
:thumb_url ""
:title ""
:title_link ""
:type ""}]
:before_message_send_failed false
:cid ""
:command ""
:created_at ""
:deleted_at ""
:html ""
:i18n {}
:id ""
:image_labels {}
:latest_reactions [{:message_id ""
:score ""
:type ""
:user {}
:user_id ""}]
:mentioned_users [{}]
:mml ""
:own_reactions [{}]
:parent_id ""
:pin_expires ""
:pinned false
:pinned_at ""
:pinned_by {}
:quoted_message ""
:quoted_message_id ""
:reaction_counts {}
:reaction_scores {}
:reply_count ""
:shadowed false
:show_in_channel false
:silent false
:text ""
:thread_participants [{}]
:type ""
:updated_at ""
:user {}}
:parent_id ""
:reaction {}
:reason ""
:team ""
:type ""
:user {}
:user_id ""
:watcher_count ""}}})
require "http/client"
url = "{{baseUrl}}/channels/:type/:id/event"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"event\": {\n \"automoderation\": false,\n \"automoderation_scores\": {\n \"action\": \"\",\n \"explicit\": \"\",\n \"spam\": \"\",\n \"toxic\": \"\"\n },\n \"channel\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"cid\": \"\",\n \"config\": {\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"automod_thresholds\": {\n \"explicit\": {\n \"block\": \"\",\n \"flag\": \"\"\n },\n \"spam\": {},\n \"toxic\": {}\n },\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [\n {\n \"args\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"set\": \"\"\n }\n ],\n \"connect_events\": false,\n \"created_at\": \"\",\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"name\": \"\",\n \"push_notifications\": false,\n \"quotes\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"reminders\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"updated_at\": \"\",\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"cooldown\": \"\",\n \"created_at\": \"\",\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"deleted_at\": \"\",\n \"disabled\": false,\n \"frozen\": false,\n \"hidden\": false,\n \"hide_messages_before\": \"\",\n \"id\": \"\",\n \"last_message_at\": \"\",\n \"member_count\": \"\",\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"mute_expires_at\": \"\",\n \"muted\": false,\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": \"\",\n \"truncated_by\": {},\n \"type\": \"\",\n \"updated_at\": \"\"\n },\n \"channel_id\": \"\",\n \"channel_type\": \"\",\n \"cid\": \"\",\n \"connection_id\": \"\",\n \"created_at\": \"\",\n \"created_by\": {},\n \"me\": {\n \"banned\": false,\n \"channel_mutes\": [\n {\n \"channel\": {},\n \"created_at\": \"\",\n \"expires\": \"\",\n \"updated_at\": \"\",\n \"user\": {}\n }\n ],\n \"created_at\": \"\",\n \"deactivated_at\": \"\",\n \"deleted_at\": \"\",\n \"devices\": [\n {\n \"created_at\": \"\",\n \"disabled\": false,\n \"disabled_reason\": \"\",\n \"id\": \"\",\n \"push_provider\": \"\",\n \"push_provider_name\": \"\",\n \"user_id\": \"\"\n }\n ],\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"last_active\": \"\",\n \"latest_hidden_channels\": [],\n \"mutes\": [\n {\n \"created_at\": \"\",\n \"expires\": \"\",\n \"target\": {},\n \"updated_at\": \"\",\n \"user\": {}\n }\n ],\n \"online\": false,\n \"push_notifications\": {},\n \"role\": \"\",\n \"teams\": [],\n \"total_unread_count\": \"\",\n \"unread_channels\": \"\",\n \"unread_count\": \"\",\n \"updated_at\": \"\"\n },\n \"member\": {},\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"before_message_send_failed\": false,\n \"cid\": \"\",\n \"command\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"html\": \"\",\n \"i18n\": {},\n \"id\": \"\",\n \"image_labels\": {},\n \"latest_reactions\": [\n {\n \"message_id\": \"\",\n \"score\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"mentioned_users\": [\n {}\n ],\n \"mml\": \"\",\n \"own_reactions\": [\n {}\n ],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": {},\n \"quoted_message\": \"\",\n \"quoted_message_id\": \"\",\n \"reaction_counts\": {},\n \"reaction_scores\": {},\n \"reply_count\": \"\",\n \"shadowed\": false,\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"thread_participants\": [\n {}\n ],\n \"type\": \"\",\n \"updated_at\": \"\",\n \"user\": {}\n },\n \"parent_id\": \"\",\n \"reaction\": {},\n \"reason\": \"\",\n \"team\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\",\n \"watcher_count\": \"\"\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/channels/:type/:id/event"),
Content = new StringContent("{\n \"event\": {\n \"automoderation\": false,\n \"automoderation_scores\": {\n \"action\": \"\",\n \"explicit\": \"\",\n \"spam\": \"\",\n \"toxic\": \"\"\n },\n \"channel\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"cid\": \"\",\n \"config\": {\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"automod_thresholds\": {\n \"explicit\": {\n \"block\": \"\",\n \"flag\": \"\"\n },\n \"spam\": {},\n \"toxic\": {}\n },\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [\n {\n \"args\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"set\": \"\"\n }\n ],\n \"connect_events\": false,\n \"created_at\": \"\",\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"name\": \"\",\n \"push_notifications\": false,\n \"quotes\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"reminders\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"updated_at\": \"\",\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"cooldown\": \"\",\n \"created_at\": \"\",\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"deleted_at\": \"\",\n \"disabled\": false,\n \"frozen\": false,\n \"hidden\": false,\n \"hide_messages_before\": \"\",\n \"id\": \"\",\n \"last_message_at\": \"\",\n \"member_count\": \"\",\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"mute_expires_at\": \"\",\n \"muted\": false,\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": \"\",\n \"truncated_by\": {},\n \"type\": \"\",\n \"updated_at\": \"\"\n },\n \"channel_id\": \"\",\n \"channel_type\": \"\",\n \"cid\": \"\",\n \"connection_id\": \"\",\n \"created_at\": \"\",\n \"created_by\": {},\n \"me\": {\n \"banned\": false,\n \"channel_mutes\": [\n {\n \"channel\": {},\n \"created_at\": \"\",\n \"expires\": \"\",\n \"updated_at\": \"\",\n \"user\": {}\n }\n ],\n \"created_at\": \"\",\n \"deactivated_at\": \"\",\n \"deleted_at\": \"\",\n \"devices\": [\n {\n \"created_at\": \"\",\n \"disabled\": false,\n \"disabled_reason\": \"\",\n \"id\": \"\",\n \"push_provider\": \"\",\n \"push_provider_name\": \"\",\n \"user_id\": \"\"\n }\n ],\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"last_active\": \"\",\n \"latest_hidden_channels\": [],\n \"mutes\": [\n {\n \"created_at\": \"\",\n \"expires\": \"\",\n \"target\": {},\n \"updated_at\": \"\",\n \"user\": {}\n }\n ],\n \"online\": false,\n \"push_notifications\": {},\n \"role\": \"\",\n \"teams\": [],\n \"total_unread_count\": \"\",\n \"unread_channels\": \"\",\n \"unread_count\": \"\",\n \"updated_at\": \"\"\n },\n \"member\": {},\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"before_message_send_failed\": false,\n \"cid\": \"\",\n \"command\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"html\": \"\",\n \"i18n\": {},\n \"id\": \"\",\n \"image_labels\": {},\n \"latest_reactions\": [\n {\n \"message_id\": \"\",\n \"score\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"mentioned_users\": [\n {}\n ],\n \"mml\": \"\",\n \"own_reactions\": [\n {}\n ],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": {},\n \"quoted_message\": \"\",\n \"quoted_message_id\": \"\",\n \"reaction_counts\": {},\n \"reaction_scores\": {},\n \"reply_count\": \"\",\n \"shadowed\": false,\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"thread_participants\": [\n {}\n ],\n \"type\": \"\",\n \"updated_at\": \"\",\n \"user\": {}\n },\n \"parent_id\": \"\",\n \"reaction\": {},\n \"reason\": \"\",\n \"team\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\",\n \"watcher_count\": \"\"\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}}/channels/:type/:id/event");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"event\": {\n \"automoderation\": false,\n \"automoderation_scores\": {\n \"action\": \"\",\n \"explicit\": \"\",\n \"spam\": \"\",\n \"toxic\": \"\"\n },\n \"channel\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"cid\": \"\",\n \"config\": {\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"automod_thresholds\": {\n \"explicit\": {\n \"block\": \"\",\n \"flag\": \"\"\n },\n \"spam\": {},\n \"toxic\": {}\n },\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [\n {\n \"args\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"set\": \"\"\n }\n ],\n \"connect_events\": false,\n \"created_at\": \"\",\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"name\": \"\",\n \"push_notifications\": false,\n \"quotes\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"reminders\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"updated_at\": \"\",\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"cooldown\": \"\",\n \"created_at\": \"\",\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"deleted_at\": \"\",\n \"disabled\": false,\n \"frozen\": false,\n \"hidden\": false,\n \"hide_messages_before\": \"\",\n \"id\": \"\",\n \"last_message_at\": \"\",\n \"member_count\": \"\",\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"mute_expires_at\": \"\",\n \"muted\": false,\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": \"\",\n \"truncated_by\": {},\n \"type\": \"\",\n \"updated_at\": \"\"\n },\n \"channel_id\": \"\",\n \"channel_type\": \"\",\n \"cid\": \"\",\n \"connection_id\": \"\",\n \"created_at\": \"\",\n \"created_by\": {},\n \"me\": {\n \"banned\": false,\n \"channel_mutes\": [\n {\n \"channel\": {},\n \"created_at\": \"\",\n \"expires\": \"\",\n \"updated_at\": \"\",\n \"user\": {}\n }\n ],\n \"created_at\": \"\",\n \"deactivated_at\": \"\",\n \"deleted_at\": \"\",\n \"devices\": [\n {\n \"created_at\": \"\",\n \"disabled\": false,\n \"disabled_reason\": \"\",\n \"id\": \"\",\n \"push_provider\": \"\",\n \"push_provider_name\": \"\",\n \"user_id\": \"\"\n }\n ],\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"last_active\": \"\",\n \"latest_hidden_channels\": [],\n \"mutes\": [\n {\n \"created_at\": \"\",\n \"expires\": \"\",\n \"target\": {},\n \"updated_at\": \"\",\n \"user\": {}\n }\n ],\n \"online\": false,\n \"push_notifications\": {},\n \"role\": \"\",\n \"teams\": [],\n \"total_unread_count\": \"\",\n \"unread_channels\": \"\",\n \"unread_count\": \"\",\n \"updated_at\": \"\"\n },\n \"member\": {},\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"before_message_send_failed\": false,\n \"cid\": \"\",\n \"command\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"html\": \"\",\n \"i18n\": {},\n \"id\": \"\",\n \"image_labels\": {},\n \"latest_reactions\": [\n {\n \"message_id\": \"\",\n \"score\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"mentioned_users\": [\n {}\n ],\n \"mml\": \"\",\n \"own_reactions\": [\n {}\n ],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": {},\n \"quoted_message\": \"\",\n \"quoted_message_id\": \"\",\n \"reaction_counts\": {},\n \"reaction_scores\": {},\n \"reply_count\": \"\",\n \"shadowed\": false,\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"thread_participants\": [\n {}\n ],\n \"type\": \"\",\n \"updated_at\": \"\",\n \"user\": {}\n },\n \"parent_id\": \"\",\n \"reaction\": {},\n \"reason\": \"\",\n \"team\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\",\n \"watcher_count\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/channels/:type/:id/event"
payload := strings.NewReader("{\n \"event\": {\n \"automoderation\": false,\n \"automoderation_scores\": {\n \"action\": \"\",\n \"explicit\": \"\",\n \"spam\": \"\",\n \"toxic\": \"\"\n },\n \"channel\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"cid\": \"\",\n \"config\": {\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"automod_thresholds\": {\n \"explicit\": {\n \"block\": \"\",\n \"flag\": \"\"\n },\n \"spam\": {},\n \"toxic\": {}\n },\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [\n {\n \"args\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"set\": \"\"\n }\n ],\n \"connect_events\": false,\n \"created_at\": \"\",\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"name\": \"\",\n \"push_notifications\": false,\n \"quotes\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"reminders\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"updated_at\": \"\",\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"cooldown\": \"\",\n \"created_at\": \"\",\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"deleted_at\": \"\",\n \"disabled\": false,\n \"frozen\": false,\n \"hidden\": false,\n \"hide_messages_before\": \"\",\n \"id\": \"\",\n \"last_message_at\": \"\",\n \"member_count\": \"\",\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"mute_expires_at\": \"\",\n \"muted\": false,\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": \"\",\n \"truncated_by\": {},\n \"type\": \"\",\n \"updated_at\": \"\"\n },\n \"channel_id\": \"\",\n \"channel_type\": \"\",\n \"cid\": \"\",\n \"connection_id\": \"\",\n \"created_at\": \"\",\n \"created_by\": {},\n \"me\": {\n \"banned\": false,\n \"channel_mutes\": [\n {\n \"channel\": {},\n \"created_at\": \"\",\n \"expires\": \"\",\n \"updated_at\": \"\",\n \"user\": {}\n }\n ],\n \"created_at\": \"\",\n \"deactivated_at\": \"\",\n \"deleted_at\": \"\",\n \"devices\": [\n {\n \"created_at\": \"\",\n \"disabled\": false,\n \"disabled_reason\": \"\",\n \"id\": \"\",\n \"push_provider\": \"\",\n \"push_provider_name\": \"\",\n \"user_id\": \"\"\n }\n ],\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"last_active\": \"\",\n \"latest_hidden_channels\": [],\n \"mutes\": [\n {\n \"created_at\": \"\",\n \"expires\": \"\",\n \"target\": {},\n \"updated_at\": \"\",\n \"user\": {}\n }\n ],\n \"online\": false,\n \"push_notifications\": {},\n \"role\": \"\",\n \"teams\": [],\n \"total_unread_count\": \"\",\n \"unread_channels\": \"\",\n \"unread_count\": \"\",\n \"updated_at\": \"\"\n },\n \"member\": {},\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"before_message_send_failed\": false,\n \"cid\": \"\",\n \"command\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"html\": \"\",\n \"i18n\": {},\n \"id\": \"\",\n \"image_labels\": {},\n \"latest_reactions\": [\n {\n \"message_id\": \"\",\n \"score\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"mentioned_users\": [\n {}\n ],\n \"mml\": \"\",\n \"own_reactions\": [\n {}\n ],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": {},\n \"quoted_message\": \"\",\n \"quoted_message_id\": \"\",\n \"reaction_counts\": {},\n \"reaction_scores\": {},\n \"reply_count\": \"\",\n \"shadowed\": false,\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"thread_participants\": [\n {}\n ],\n \"type\": \"\",\n \"updated_at\": \"\",\n \"user\": {}\n },\n \"parent_id\": \"\",\n \"reaction\": {},\n \"reason\": \"\",\n \"team\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\",\n \"watcher_count\": \"\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/channels/:type/:id/event HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 6164
{
"event": {
"automoderation": false,
"automoderation_scores": {
"action": "",
"explicit": "",
"spam": "",
"toxic": ""
},
"channel": {
"auto_translation_enabled": false,
"auto_translation_language": "",
"cid": "",
"config": {
"automod": "",
"automod_behavior": "",
"automod_thresholds": {
"explicit": {
"block": "",
"flag": ""
},
"spam": {},
"toxic": {}
},
"blocklist": "",
"blocklist_behavior": "",
"commands": [
{
"args": "",
"description": "",
"name": "",
"set": ""
}
],
"connect_events": false,
"created_at": "",
"custom_events": false,
"grants": {},
"max_message_length": "",
"message_retention": "",
"mutes": false,
"name": "",
"push_notifications": false,
"quotes": false,
"reactions": false,
"read_events": false,
"reminders": false,
"replies": false,
"search": false,
"typing_events": false,
"updated_at": "",
"uploads": false,
"url_enrichment": false
},
"cooldown": "",
"created_at": "",
"created_by": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"deleted_at": "",
"disabled": false,
"frozen": false,
"hidden": false,
"hide_messages_before": "",
"id": "",
"last_message_at": "",
"member_count": "",
"members": [
{
"ban_expires": "",
"banned": false,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": false,
"is_moderator": false,
"role": "",
"shadow_banned": false,
"updated_at": "",
"user": {},
"user_id": ""
}
],
"mute_expires_at": "",
"muted": false,
"own_capabilities": [],
"team": "",
"truncated_at": "",
"truncated_by": {},
"type": "",
"updated_at": ""
},
"channel_id": "",
"channel_type": "",
"cid": "",
"connection_id": "",
"created_at": "",
"created_by": {},
"me": {
"banned": false,
"channel_mutes": [
{
"channel": {},
"created_at": "",
"expires": "",
"updated_at": "",
"user": {}
}
],
"created_at": "",
"deactivated_at": "",
"deleted_at": "",
"devices": [
{
"created_at": "",
"disabled": false,
"disabled_reason": "",
"id": "",
"push_provider": "",
"push_provider_name": "",
"user_id": ""
}
],
"id": "",
"invisible": false,
"language": "",
"last_active": "",
"latest_hidden_channels": [],
"mutes": [
{
"created_at": "",
"expires": "",
"target": {},
"updated_at": "",
"user": {}
}
],
"online": false,
"push_notifications": {},
"role": "",
"teams": [],
"total_unread_count": "",
"unread_channels": "",
"unread_count": "",
"updated_at": ""
},
"member": {},
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"before_message_send_failed": false,
"cid": "",
"command": "",
"created_at": "",
"deleted_at": "",
"html": "",
"i18n": {},
"id": "",
"image_labels": {},
"latest_reactions": [
{
"message_id": "",
"score": "",
"type": "",
"user": {},
"user_id": ""
}
],
"mentioned_users": [
{}
],
"mml": "",
"own_reactions": [
{}
],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": {},
"quoted_message": "",
"quoted_message_id": "",
"reaction_counts": {},
"reaction_scores": {},
"reply_count": "",
"shadowed": false,
"show_in_channel": false,
"silent": false,
"text": "",
"thread_participants": [
{}
],
"type": "",
"updated_at": "",
"user": {}
},
"parent_id": "",
"reaction": {},
"reason": "",
"team": "",
"type": "",
"user": {},
"user_id": "",
"watcher_count": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/channels/:type/:id/event")
.setHeader("content-type", "application/json")
.setBody("{\n \"event\": {\n \"automoderation\": false,\n \"automoderation_scores\": {\n \"action\": \"\",\n \"explicit\": \"\",\n \"spam\": \"\",\n \"toxic\": \"\"\n },\n \"channel\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"cid\": \"\",\n \"config\": {\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"automod_thresholds\": {\n \"explicit\": {\n \"block\": \"\",\n \"flag\": \"\"\n },\n \"spam\": {},\n \"toxic\": {}\n },\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [\n {\n \"args\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"set\": \"\"\n }\n ],\n \"connect_events\": false,\n \"created_at\": \"\",\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"name\": \"\",\n \"push_notifications\": false,\n \"quotes\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"reminders\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"updated_at\": \"\",\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"cooldown\": \"\",\n \"created_at\": \"\",\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"deleted_at\": \"\",\n \"disabled\": false,\n \"frozen\": false,\n \"hidden\": false,\n \"hide_messages_before\": \"\",\n \"id\": \"\",\n \"last_message_at\": \"\",\n \"member_count\": \"\",\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"mute_expires_at\": \"\",\n \"muted\": false,\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": \"\",\n \"truncated_by\": {},\n \"type\": \"\",\n \"updated_at\": \"\"\n },\n \"channel_id\": \"\",\n \"channel_type\": \"\",\n \"cid\": \"\",\n \"connection_id\": \"\",\n \"created_at\": \"\",\n \"created_by\": {},\n \"me\": {\n \"banned\": false,\n \"channel_mutes\": [\n {\n \"channel\": {},\n \"created_at\": \"\",\n \"expires\": \"\",\n \"updated_at\": \"\",\n \"user\": {}\n }\n ],\n \"created_at\": \"\",\n \"deactivated_at\": \"\",\n \"deleted_at\": \"\",\n \"devices\": [\n {\n \"created_at\": \"\",\n \"disabled\": false,\n \"disabled_reason\": \"\",\n \"id\": \"\",\n \"push_provider\": \"\",\n \"push_provider_name\": \"\",\n \"user_id\": \"\"\n }\n ],\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"last_active\": \"\",\n \"latest_hidden_channels\": [],\n \"mutes\": [\n {\n \"created_at\": \"\",\n \"expires\": \"\",\n \"target\": {},\n \"updated_at\": \"\",\n \"user\": {}\n }\n ],\n \"online\": false,\n \"push_notifications\": {},\n \"role\": \"\",\n \"teams\": [],\n \"total_unread_count\": \"\",\n \"unread_channels\": \"\",\n \"unread_count\": \"\",\n \"updated_at\": \"\"\n },\n \"member\": {},\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"before_message_send_failed\": false,\n \"cid\": \"\",\n \"command\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"html\": \"\",\n \"i18n\": {},\n \"id\": \"\",\n \"image_labels\": {},\n \"latest_reactions\": [\n {\n \"message_id\": \"\",\n \"score\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"mentioned_users\": [\n {}\n ],\n \"mml\": \"\",\n \"own_reactions\": [\n {}\n ],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": {},\n \"quoted_message\": \"\",\n \"quoted_message_id\": \"\",\n \"reaction_counts\": {},\n \"reaction_scores\": {},\n \"reply_count\": \"\",\n \"shadowed\": false,\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"thread_participants\": [\n {}\n ],\n \"type\": \"\",\n \"updated_at\": \"\",\n \"user\": {}\n },\n \"parent_id\": \"\",\n \"reaction\": {},\n \"reason\": \"\",\n \"team\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\",\n \"watcher_count\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/channels/:type/:id/event"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"event\": {\n \"automoderation\": false,\n \"automoderation_scores\": {\n \"action\": \"\",\n \"explicit\": \"\",\n \"spam\": \"\",\n \"toxic\": \"\"\n },\n \"channel\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"cid\": \"\",\n \"config\": {\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"automod_thresholds\": {\n \"explicit\": {\n \"block\": \"\",\n \"flag\": \"\"\n },\n \"spam\": {},\n \"toxic\": {}\n },\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [\n {\n \"args\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"set\": \"\"\n }\n ],\n \"connect_events\": false,\n \"created_at\": \"\",\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"name\": \"\",\n \"push_notifications\": false,\n \"quotes\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"reminders\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"updated_at\": \"\",\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"cooldown\": \"\",\n \"created_at\": \"\",\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"deleted_at\": \"\",\n \"disabled\": false,\n \"frozen\": false,\n \"hidden\": false,\n \"hide_messages_before\": \"\",\n \"id\": \"\",\n \"last_message_at\": \"\",\n \"member_count\": \"\",\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"mute_expires_at\": \"\",\n \"muted\": false,\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": \"\",\n \"truncated_by\": {},\n \"type\": \"\",\n \"updated_at\": \"\"\n },\n \"channel_id\": \"\",\n \"channel_type\": \"\",\n \"cid\": \"\",\n \"connection_id\": \"\",\n \"created_at\": \"\",\n \"created_by\": {},\n \"me\": {\n \"banned\": false,\n \"channel_mutes\": [\n {\n \"channel\": {},\n \"created_at\": \"\",\n \"expires\": \"\",\n \"updated_at\": \"\",\n \"user\": {}\n }\n ],\n \"created_at\": \"\",\n \"deactivated_at\": \"\",\n \"deleted_at\": \"\",\n \"devices\": [\n {\n \"created_at\": \"\",\n \"disabled\": false,\n \"disabled_reason\": \"\",\n \"id\": \"\",\n \"push_provider\": \"\",\n \"push_provider_name\": \"\",\n \"user_id\": \"\"\n }\n ],\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"last_active\": \"\",\n \"latest_hidden_channels\": [],\n \"mutes\": [\n {\n \"created_at\": \"\",\n \"expires\": \"\",\n \"target\": {},\n \"updated_at\": \"\",\n \"user\": {}\n }\n ],\n \"online\": false,\n \"push_notifications\": {},\n \"role\": \"\",\n \"teams\": [],\n \"total_unread_count\": \"\",\n \"unread_channels\": \"\",\n \"unread_count\": \"\",\n \"updated_at\": \"\"\n },\n \"member\": {},\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"before_message_send_failed\": false,\n \"cid\": \"\",\n \"command\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"html\": \"\",\n \"i18n\": {},\n \"id\": \"\",\n \"image_labels\": {},\n \"latest_reactions\": [\n {\n \"message_id\": \"\",\n \"score\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"mentioned_users\": [\n {}\n ],\n \"mml\": \"\",\n \"own_reactions\": [\n {}\n ],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": {},\n \"quoted_message\": \"\",\n \"quoted_message_id\": \"\",\n \"reaction_counts\": {},\n \"reaction_scores\": {},\n \"reply_count\": \"\",\n \"shadowed\": false,\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"thread_participants\": [\n {}\n ],\n \"type\": \"\",\n \"updated_at\": \"\",\n \"user\": {}\n },\n \"parent_id\": \"\",\n \"reaction\": {},\n \"reason\": \"\",\n \"team\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\",\n \"watcher_count\": \"\"\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 \"event\": {\n \"automoderation\": false,\n \"automoderation_scores\": {\n \"action\": \"\",\n \"explicit\": \"\",\n \"spam\": \"\",\n \"toxic\": \"\"\n },\n \"channel\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"cid\": \"\",\n \"config\": {\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"automod_thresholds\": {\n \"explicit\": {\n \"block\": \"\",\n \"flag\": \"\"\n },\n \"spam\": {},\n \"toxic\": {}\n },\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [\n {\n \"args\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"set\": \"\"\n }\n ],\n \"connect_events\": false,\n \"created_at\": \"\",\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"name\": \"\",\n \"push_notifications\": false,\n \"quotes\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"reminders\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"updated_at\": \"\",\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"cooldown\": \"\",\n \"created_at\": \"\",\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"deleted_at\": \"\",\n \"disabled\": false,\n \"frozen\": false,\n \"hidden\": false,\n \"hide_messages_before\": \"\",\n \"id\": \"\",\n \"last_message_at\": \"\",\n \"member_count\": \"\",\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"mute_expires_at\": \"\",\n \"muted\": false,\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": \"\",\n \"truncated_by\": {},\n \"type\": \"\",\n \"updated_at\": \"\"\n },\n \"channel_id\": \"\",\n \"channel_type\": \"\",\n \"cid\": \"\",\n \"connection_id\": \"\",\n \"created_at\": \"\",\n \"created_by\": {},\n \"me\": {\n \"banned\": false,\n \"channel_mutes\": [\n {\n \"channel\": {},\n \"created_at\": \"\",\n \"expires\": \"\",\n \"updated_at\": \"\",\n \"user\": {}\n }\n ],\n \"created_at\": \"\",\n \"deactivated_at\": \"\",\n \"deleted_at\": \"\",\n \"devices\": [\n {\n \"created_at\": \"\",\n \"disabled\": false,\n \"disabled_reason\": \"\",\n \"id\": \"\",\n \"push_provider\": \"\",\n \"push_provider_name\": \"\",\n \"user_id\": \"\"\n }\n ],\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"last_active\": \"\",\n \"latest_hidden_channels\": [],\n \"mutes\": [\n {\n \"created_at\": \"\",\n \"expires\": \"\",\n \"target\": {},\n \"updated_at\": \"\",\n \"user\": {}\n }\n ],\n \"online\": false,\n \"push_notifications\": {},\n \"role\": \"\",\n \"teams\": [],\n \"total_unread_count\": \"\",\n \"unread_channels\": \"\",\n \"unread_count\": \"\",\n \"updated_at\": \"\"\n },\n \"member\": {},\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"before_message_send_failed\": false,\n \"cid\": \"\",\n \"command\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"html\": \"\",\n \"i18n\": {},\n \"id\": \"\",\n \"image_labels\": {},\n \"latest_reactions\": [\n {\n \"message_id\": \"\",\n \"score\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"mentioned_users\": [\n {}\n ],\n \"mml\": \"\",\n \"own_reactions\": [\n {}\n ],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": {},\n \"quoted_message\": \"\",\n \"quoted_message_id\": \"\",\n \"reaction_counts\": {},\n \"reaction_scores\": {},\n \"reply_count\": \"\",\n \"shadowed\": false,\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"thread_participants\": [\n {}\n ],\n \"type\": \"\",\n \"updated_at\": \"\",\n \"user\": {}\n },\n \"parent_id\": \"\",\n \"reaction\": {},\n \"reason\": \"\",\n \"team\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\",\n \"watcher_count\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/channels/:type/:id/event")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/channels/:type/:id/event")
.header("content-type", "application/json")
.body("{\n \"event\": {\n \"automoderation\": false,\n \"automoderation_scores\": {\n \"action\": \"\",\n \"explicit\": \"\",\n \"spam\": \"\",\n \"toxic\": \"\"\n },\n \"channel\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"cid\": \"\",\n \"config\": {\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"automod_thresholds\": {\n \"explicit\": {\n \"block\": \"\",\n \"flag\": \"\"\n },\n \"spam\": {},\n \"toxic\": {}\n },\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [\n {\n \"args\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"set\": \"\"\n }\n ],\n \"connect_events\": false,\n \"created_at\": \"\",\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"name\": \"\",\n \"push_notifications\": false,\n \"quotes\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"reminders\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"updated_at\": \"\",\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"cooldown\": \"\",\n \"created_at\": \"\",\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"deleted_at\": \"\",\n \"disabled\": false,\n \"frozen\": false,\n \"hidden\": false,\n \"hide_messages_before\": \"\",\n \"id\": \"\",\n \"last_message_at\": \"\",\n \"member_count\": \"\",\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"mute_expires_at\": \"\",\n \"muted\": false,\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": \"\",\n \"truncated_by\": {},\n \"type\": \"\",\n \"updated_at\": \"\"\n },\n \"channel_id\": \"\",\n \"channel_type\": \"\",\n \"cid\": \"\",\n \"connection_id\": \"\",\n \"created_at\": \"\",\n \"created_by\": {},\n \"me\": {\n \"banned\": false,\n \"channel_mutes\": [\n {\n \"channel\": {},\n \"created_at\": \"\",\n \"expires\": \"\",\n \"updated_at\": \"\",\n \"user\": {}\n }\n ],\n \"created_at\": \"\",\n \"deactivated_at\": \"\",\n \"deleted_at\": \"\",\n \"devices\": [\n {\n \"created_at\": \"\",\n \"disabled\": false,\n \"disabled_reason\": \"\",\n \"id\": \"\",\n \"push_provider\": \"\",\n \"push_provider_name\": \"\",\n \"user_id\": \"\"\n }\n ],\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"last_active\": \"\",\n \"latest_hidden_channels\": [],\n \"mutes\": [\n {\n \"created_at\": \"\",\n \"expires\": \"\",\n \"target\": {},\n \"updated_at\": \"\",\n \"user\": {}\n }\n ],\n \"online\": false,\n \"push_notifications\": {},\n \"role\": \"\",\n \"teams\": [],\n \"total_unread_count\": \"\",\n \"unread_channels\": \"\",\n \"unread_count\": \"\",\n \"updated_at\": \"\"\n },\n \"member\": {},\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"before_message_send_failed\": false,\n \"cid\": \"\",\n \"command\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"html\": \"\",\n \"i18n\": {},\n \"id\": \"\",\n \"image_labels\": {},\n \"latest_reactions\": [\n {\n \"message_id\": \"\",\n \"score\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"mentioned_users\": [\n {}\n ],\n \"mml\": \"\",\n \"own_reactions\": [\n {}\n ],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": {},\n \"quoted_message\": \"\",\n \"quoted_message_id\": \"\",\n \"reaction_counts\": {},\n \"reaction_scores\": {},\n \"reply_count\": \"\",\n \"shadowed\": false,\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"thread_participants\": [\n {}\n ],\n \"type\": \"\",\n \"updated_at\": \"\",\n \"user\": {}\n },\n \"parent_id\": \"\",\n \"reaction\": {},\n \"reason\": \"\",\n \"team\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\",\n \"watcher_count\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
event: {
automoderation: false,
automoderation_scores: {
action: '',
explicit: '',
spam: '',
toxic: ''
},
channel: {
auto_translation_enabled: false,
auto_translation_language: '',
cid: '',
config: {
automod: '',
automod_behavior: '',
automod_thresholds: {
explicit: {
block: '',
flag: ''
},
spam: {},
toxic: {}
},
blocklist: '',
blocklist_behavior: '',
commands: [
{
args: '',
description: '',
name: '',
set: ''
}
],
connect_events: false,
created_at: '',
custom_events: false,
grants: {},
max_message_length: '',
message_retention: '',
mutes: false,
name: '',
push_notifications: false,
quotes: false,
reactions: false,
read_events: false,
reminders: false,
replies: false,
search: false,
typing_events: false,
updated_at: '',
uploads: false,
url_enrichment: false
},
cooldown: '',
created_at: '',
created_by: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
deleted_at: '',
disabled: false,
frozen: false,
hidden: false,
hide_messages_before: '',
id: '',
last_message_at: '',
member_count: '',
members: [
{
ban_expires: '',
banned: false,
channel_role: '',
created_at: '',
deleted_at: '',
invite_accepted_at: '',
invite_rejected_at: '',
invited: false,
is_moderator: false,
role: '',
shadow_banned: false,
updated_at: '',
user: {},
user_id: ''
}
],
mute_expires_at: '',
muted: false,
own_capabilities: [],
team: '',
truncated_at: '',
truncated_by: {},
type: '',
updated_at: ''
},
channel_id: '',
channel_type: '',
cid: '',
connection_id: '',
created_at: '',
created_by: {},
me: {
banned: false,
channel_mutes: [
{
channel: {},
created_at: '',
expires: '',
updated_at: '',
user: {}
}
],
created_at: '',
deactivated_at: '',
deleted_at: '',
devices: [
{
created_at: '',
disabled: false,
disabled_reason: '',
id: '',
push_provider: '',
push_provider_name: '',
user_id: ''
}
],
id: '',
invisible: false,
language: '',
last_active: '',
latest_hidden_channels: [],
mutes: [
{
created_at: '',
expires: '',
target: {},
updated_at: '',
user: {}
}
],
online: false,
push_notifications: {},
role: '',
teams: [],
total_unread_count: '',
unread_channels: '',
unread_count: '',
updated_at: ''
},
member: {},
message: {
attachments: [
{
actions: [
{
name: '',
style: '',
text: '',
type: '',
value: ''
}
],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [
{
short: false,
title: '',
value: ''
}
],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {
frames: '',
height: '',
size: '',
url: '',
width: ''
},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
before_message_send_failed: false,
cid: '',
command: '',
created_at: '',
deleted_at: '',
html: '',
i18n: {},
id: '',
image_labels: {},
latest_reactions: [
{
message_id: '',
score: '',
type: '',
user: {},
user_id: ''
}
],
mentioned_users: [
{}
],
mml: '',
own_reactions: [
{}
],
parent_id: '',
pin_expires: '',
pinned: false,
pinned_at: '',
pinned_by: {},
quoted_message: '',
quoted_message_id: '',
reaction_counts: {},
reaction_scores: {},
reply_count: '',
shadowed: false,
show_in_channel: false,
silent: false,
text: '',
thread_participants: [
{}
],
type: '',
updated_at: '',
user: {}
},
parent_id: '',
reaction: {},
reason: '',
team: '',
type: '',
user: {},
user_id: '',
watcher_count: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/channels/:type/:id/event');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:type/:id/event',
headers: {'content-type': 'application/json'},
data: {
event: {
automoderation: false,
automoderation_scores: {action: '', explicit: '', spam: '', toxic: ''},
channel: {
auto_translation_enabled: false,
auto_translation_language: '',
cid: '',
config: {
automod: '',
automod_behavior: '',
automod_thresholds: {explicit: {block: '', flag: ''}, spam: {}, toxic: {}},
blocklist: '',
blocklist_behavior: '',
commands: [{args: '', description: '', name: '', set: ''}],
connect_events: false,
created_at: '',
custom_events: false,
grants: {},
max_message_length: '',
message_retention: '',
mutes: false,
name: '',
push_notifications: false,
quotes: false,
reactions: false,
read_events: false,
reminders: false,
replies: false,
search: false,
typing_events: false,
updated_at: '',
uploads: false,
url_enrichment: false
},
cooldown: '',
created_at: '',
created_by: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
deleted_at: '',
disabled: false,
frozen: false,
hidden: false,
hide_messages_before: '',
id: '',
last_message_at: '',
member_count: '',
members: [
{
ban_expires: '',
banned: false,
channel_role: '',
created_at: '',
deleted_at: '',
invite_accepted_at: '',
invite_rejected_at: '',
invited: false,
is_moderator: false,
role: '',
shadow_banned: false,
updated_at: '',
user: {},
user_id: ''
}
],
mute_expires_at: '',
muted: false,
own_capabilities: [],
team: '',
truncated_at: '',
truncated_by: {},
type: '',
updated_at: ''
},
channel_id: '',
channel_type: '',
cid: '',
connection_id: '',
created_at: '',
created_by: {},
me: {
banned: false,
channel_mutes: [{channel: {}, created_at: '', expires: '', updated_at: '', user: {}}],
created_at: '',
deactivated_at: '',
deleted_at: '',
devices: [
{
created_at: '',
disabled: false,
disabled_reason: '',
id: '',
push_provider: '',
push_provider_name: '',
user_id: ''
}
],
id: '',
invisible: false,
language: '',
last_active: '',
latest_hidden_channels: [],
mutes: [{created_at: '', expires: '', target: {}, updated_at: '', user: {}}],
online: false,
push_notifications: {},
role: '',
teams: [],
total_unread_count: '',
unread_channels: '',
unread_count: '',
updated_at: ''
},
member: {},
message: {
attachments: [
{
actions: [{name: '', style: '', text: '', type: '', value: ''}],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [{short: false, title: '', value: ''}],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {frames: '', height: '', size: '', url: '', width: ''},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
before_message_send_failed: false,
cid: '',
command: '',
created_at: '',
deleted_at: '',
html: '',
i18n: {},
id: '',
image_labels: {},
latest_reactions: [{message_id: '', score: '', type: '', user: {}, user_id: ''}],
mentioned_users: [{}],
mml: '',
own_reactions: [{}],
parent_id: '',
pin_expires: '',
pinned: false,
pinned_at: '',
pinned_by: {},
quoted_message: '',
quoted_message_id: '',
reaction_counts: {},
reaction_scores: {},
reply_count: '',
shadowed: false,
show_in_channel: false,
silent: false,
text: '',
thread_participants: [{}],
type: '',
updated_at: '',
user: {}
},
parent_id: '',
reaction: {},
reason: '',
team: '',
type: '',
user: {},
user_id: '',
watcher_count: ''
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/channels/:type/:id/event';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"event":{"automoderation":false,"automoderation_scores":{"action":"","explicit":"","spam":"","toxic":""},"channel":{"auto_translation_enabled":false,"auto_translation_language":"","cid":"","config":{"automod":"","automod_behavior":"","automod_thresholds":{"explicit":{"block":"","flag":""},"spam":{},"toxic":{}},"blocklist":"","blocklist_behavior":"","commands":[{"args":"","description":"","name":"","set":""}],"connect_events":false,"created_at":"","custom_events":false,"grants":{},"max_message_length":"","message_retention":"","mutes":false,"name":"","push_notifications":false,"quotes":false,"reactions":false,"read_events":false,"reminders":false,"replies":false,"search":false,"typing_events":false,"updated_at":"","uploads":false,"url_enrichment":false},"cooldown":"","created_at":"","created_by":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"deleted_at":"","disabled":false,"frozen":false,"hidden":false,"hide_messages_before":"","id":"","last_message_at":"","member_count":"","members":[{"ban_expires":"","banned":false,"channel_role":"","created_at":"","deleted_at":"","invite_accepted_at":"","invite_rejected_at":"","invited":false,"is_moderator":false,"role":"","shadow_banned":false,"updated_at":"","user":{},"user_id":""}],"mute_expires_at":"","muted":false,"own_capabilities":[],"team":"","truncated_at":"","truncated_by":{},"type":"","updated_at":""},"channel_id":"","channel_type":"","cid":"","connection_id":"","created_at":"","created_by":{},"me":{"banned":false,"channel_mutes":[{"channel":{},"created_at":"","expires":"","updated_at":"","user":{}}],"created_at":"","deactivated_at":"","deleted_at":"","devices":[{"created_at":"","disabled":false,"disabled_reason":"","id":"","push_provider":"","push_provider_name":"","user_id":""}],"id":"","invisible":false,"language":"","last_active":"","latest_hidden_channels":[],"mutes":[{"created_at":"","expires":"","target":{},"updated_at":"","user":{}}],"online":false,"push_notifications":{},"role":"","teams":[],"total_unread_count":"","unread_channels":"","unread_count":"","updated_at":""},"member":{},"message":{"attachments":[{"actions":[{"name":"","style":"","text":"","type":"","value":""}],"asset_url":"","author_icon":"","author_link":"","author_name":"","color":"","fallback":"","fields":[{"short":false,"title":"","value":""}],"footer":"","footer_icon":"","giphy":{"fixed_height":{"frames":"","height":"","size":"","url":"","width":""},"fixed_height_downsampled":{},"fixed_height_still":{},"fixed_width":{},"fixed_width_downsampled":{},"fixed_width_still":{},"original":{}},"image_url":"","og_scrape_url":"","original_height":"","original_width":"","pretext":"","text":"","thumb_url":"","title":"","title_link":"","type":""}],"before_message_send_failed":false,"cid":"","command":"","created_at":"","deleted_at":"","html":"","i18n":{},"id":"","image_labels":{},"latest_reactions":[{"message_id":"","score":"","type":"","user":{},"user_id":""}],"mentioned_users":[{}],"mml":"","own_reactions":[{}],"parent_id":"","pin_expires":"","pinned":false,"pinned_at":"","pinned_by":{},"quoted_message":"","quoted_message_id":"","reaction_counts":{},"reaction_scores":{},"reply_count":"","shadowed":false,"show_in_channel":false,"silent":false,"text":"","thread_participants":[{}],"type":"","updated_at":"","user":{}},"parent_id":"","reaction":{},"reason":"","team":"","type":"","user":{},"user_id":"","watcher_count":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/channels/:type/:id/event',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "event": {\n "automoderation": false,\n "automoderation_scores": {\n "action": "",\n "explicit": "",\n "spam": "",\n "toxic": ""\n },\n "channel": {\n "auto_translation_enabled": false,\n "auto_translation_language": "",\n "cid": "",\n "config": {\n "automod": "",\n "automod_behavior": "",\n "automod_thresholds": {\n "explicit": {\n "block": "",\n "flag": ""\n },\n "spam": {},\n "toxic": {}\n },\n "blocklist": "",\n "blocklist_behavior": "",\n "commands": [\n {\n "args": "",\n "description": "",\n "name": "",\n "set": ""\n }\n ],\n "connect_events": false,\n "created_at": "",\n "custom_events": false,\n "grants": {},\n "max_message_length": "",\n "message_retention": "",\n "mutes": false,\n "name": "",\n "push_notifications": false,\n "quotes": false,\n "reactions": false,\n "read_events": false,\n "reminders": false,\n "replies": false,\n "search": false,\n "typing_events": false,\n "updated_at": "",\n "uploads": false,\n "url_enrichment": false\n },\n "cooldown": "",\n "created_at": "",\n "created_by": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "deleted_at": "",\n "disabled": false,\n "frozen": false,\n "hidden": false,\n "hide_messages_before": "",\n "id": "",\n "last_message_at": "",\n "member_count": "",\n "members": [\n {\n "ban_expires": "",\n "banned": false,\n "channel_role": "",\n "created_at": "",\n "deleted_at": "",\n "invite_accepted_at": "",\n "invite_rejected_at": "",\n "invited": false,\n "is_moderator": false,\n "role": "",\n "shadow_banned": false,\n "updated_at": "",\n "user": {},\n "user_id": ""\n }\n ],\n "mute_expires_at": "",\n "muted": false,\n "own_capabilities": [],\n "team": "",\n "truncated_at": "",\n "truncated_by": {},\n "type": "",\n "updated_at": ""\n },\n "channel_id": "",\n "channel_type": "",\n "cid": "",\n "connection_id": "",\n "created_at": "",\n "created_by": {},\n "me": {\n "banned": false,\n "channel_mutes": [\n {\n "channel": {},\n "created_at": "",\n "expires": "",\n "updated_at": "",\n "user": {}\n }\n ],\n "created_at": "",\n "deactivated_at": "",\n "deleted_at": "",\n "devices": [\n {\n "created_at": "",\n "disabled": false,\n "disabled_reason": "",\n "id": "",\n "push_provider": "",\n "push_provider_name": "",\n "user_id": ""\n }\n ],\n "id": "",\n "invisible": false,\n "language": "",\n "last_active": "",\n "latest_hidden_channels": [],\n "mutes": [\n {\n "created_at": "",\n "expires": "",\n "target": {},\n "updated_at": "",\n "user": {}\n }\n ],\n "online": false,\n "push_notifications": {},\n "role": "",\n "teams": [],\n "total_unread_count": "",\n "unread_channels": "",\n "unread_count": "",\n "updated_at": ""\n },\n "member": {},\n "message": {\n "attachments": [\n {\n "actions": [\n {\n "name": "",\n "style": "",\n "text": "",\n "type": "",\n "value": ""\n }\n ],\n "asset_url": "",\n "author_icon": "",\n "author_link": "",\n "author_name": "",\n "color": "",\n "fallback": "",\n "fields": [\n {\n "short": false,\n "title": "",\n "value": ""\n }\n ],\n "footer": "",\n "footer_icon": "",\n "giphy": {\n "fixed_height": {\n "frames": "",\n "height": "",\n "size": "",\n "url": "",\n "width": ""\n },\n "fixed_height_downsampled": {},\n "fixed_height_still": {},\n "fixed_width": {},\n "fixed_width_downsampled": {},\n "fixed_width_still": {},\n "original": {}\n },\n "image_url": "",\n "og_scrape_url": "",\n "original_height": "",\n "original_width": "",\n "pretext": "",\n "text": "",\n "thumb_url": "",\n "title": "",\n "title_link": "",\n "type": ""\n }\n ],\n "before_message_send_failed": false,\n "cid": "",\n "command": "",\n "created_at": "",\n "deleted_at": "",\n "html": "",\n "i18n": {},\n "id": "",\n "image_labels": {},\n "latest_reactions": [\n {\n "message_id": "",\n "score": "",\n "type": "",\n "user": {},\n "user_id": ""\n }\n ],\n "mentioned_users": [\n {}\n ],\n "mml": "",\n "own_reactions": [\n {}\n ],\n "parent_id": "",\n "pin_expires": "",\n "pinned": false,\n "pinned_at": "",\n "pinned_by": {},\n "quoted_message": "",\n "quoted_message_id": "",\n "reaction_counts": {},\n "reaction_scores": {},\n "reply_count": "",\n "shadowed": false,\n "show_in_channel": false,\n "silent": false,\n "text": "",\n "thread_participants": [\n {}\n ],\n "type": "",\n "updated_at": "",\n "user": {}\n },\n "parent_id": "",\n "reaction": {},\n "reason": "",\n "team": "",\n "type": "",\n "user": {},\n "user_id": "",\n "watcher_count": ""\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 \"event\": {\n \"automoderation\": false,\n \"automoderation_scores\": {\n \"action\": \"\",\n \"explicit\": \"\",\n \"spam\": \"\",\n \"toxic\": \"\"\n },\n \"channel\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"cid\": \"\",\n \"config\": {\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"automod_thresholds\": {\n \"explicit\": {\n \"block\": \"\",\n \"flag\": \"\"\n },\n \"spam\": {},\n \"toxic\": {}\n },\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [\n {\n \"args\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"set\": \"\"\n }\n ],\n \"connect_events\": false,\n \"created_at\": \"\",\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"name\": \"\",\n \"push_notifications\": false,\n \"quotes\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"reminders\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"updated_at\": \"\",\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"cooldown\": \"\",\n \"created_at\": \"\",\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"deleted_at\": \"\",\n \"disabled\": false,\n \"frozen\": false,\n \"hidden\": false,\n \"hide_messages_before\": \"\",\n \"id\": \"\",\n \"last_message_at\": \"\",\n \"member_count\": \"\",\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"mute_expires_at\": \"\",\n \"muted\": false,\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": \"\",\n \"truncated_by\": {},\n \"type\": \"\",\n \"updated_at\": \"\"\n },\n \"channel_id\": \"\",\n \"channel_type\": \"\",\n \"cid\": \"\",\n \"connection_id\": \"\",\n \"created_at\": \"\",\n \"created_by\": {},\n \"me\": {\n \"banned\": false,\n \"channel_mutes\": [\n {\n \"channel\": {},\n \"created_at\": \"\",\n \"expires\": \"\",\n \"updated_at\": \"\",\n \"user\": {}\n }\n ],\n \"created_at\": \"\",\n \"deactivated_at\": \"\",\n \"deleted_at\": \"\",\n \"devices\": [\n {\n \"created_at\": \"\",\n \"disabled\": false,\n \"disabled_reason\": \"\",\n \"id\": \"\",\n \"push_provider\": \"\",\n \"push_provider_name\": \"\",\n \"user_id\": \"\"\n }\n ],\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"last_active\": \"\",\n \"latest_hidden_channels\": [],\n \"mutes\": [\n {\n \"created_at\": \"\",\n \"expires\": \"\",\n \"target\": {},\n \"updated_at\": \"\",\n \"user\": {}\n }\n ],\n \"online\": false,\n \"push_notifications\": {},\n \"role\": \"\",\n \"teams\": [],\n \"total_unread_count\": \"\",\n \"unread_channels\": \"\",\n \"unread_count\": \"\",\n \"updated_at\": \"\"\n },\n \"member\": {},\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"before_message_send_failed\": false,\n \"cid\": \"\",\n \"command\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"html\": \"\",\n \"i18n\": {},\n \"id\": \"\",\n \"image_labels\": {},\n \"latest_reactions\": [\n {\n \"message_id\": \"\",\n \"score\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"mentioned_users\": [\n {}\n ],\n \"mml\": \"\",\n \"own_reactions\": [\n {}\n ],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": {},\n \"quoted_message\": \"\",\n \"quoted_message_id\": \"\",\n \"reaction_counts\": {},\n \"reaction_scores\": {},\n \"reply_count\": \"\",\n \"shadowed\": false,\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"thread_participants\": [\n {}\n ],\n \"type\": \"\",\n \"updated_at\": \"\",\n \"user\": {}\n },\n \"parent_id\": \"\",\n \"reaction\": {},\n \"reason\": \"\",\n \"team\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\",\n \"watcher_count\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/channels/:type/:id/event")
.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/channels/:type/:id/event',
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({
event: {
automoderation: false,
automoderation_scores: {action: '', explicit: '', spam: '', toxic: ''},
channel: {
auto_translation_enabled: false,
auto_translation_language: '',
cid: '',
config: {
automod: '',
automod_behavior: '',
automod_thresholds: {explicit: {block: '', flag: ''}, spam: {}, toxic: {}},
blocklist: '',
blocklist_behavior: '',
commands: [{args: '', description: '', name: '', set: ''}],
connect_events: false,
created_at: '',
custom_events: false,
grants: {},
max_message_length: '',
message_retention: '',
mutes: false,
name: '',
push_notifications: false,
quotes: false,
reactions: false,
read_events: false,
reminders: false,
replies: false,
search: false,
typing_events: false,
updated_at: '',
uploads: false,
url_enrichment: false
},
cooldown: '',
created_at: '',
created_by: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
deleted_at: '',
disabled: false,
frozen: false,
hidden: false,
hide_messages_before: '',
id: '',
last_message_at: '',
member_count: '',
members: [
{
ban_expires: '',
banned: false,
channel_role: '',
created_at: '',
deleted_at: '',
invite_accepted_at: '',
invite_rejected_at: '',
invited: false,
is_moderator: false,
role: '',
shadow_banned: false,
updated_at: '',
user: {},
user_id: ''
}
],
mute_expires_at: '',
muted: false,
own_capabilities: [],
team: '',
truncated_at: '',
truncated_by: {},
type: '',
updated_at: ''
},
channel_id: '',
channel_type: '',
cid: '',
connection_id: '',
created_at: '',
created_by: {},
me: {
banned: false,
channel_mutes: [{channel: {}, created_at: '', expires: '', updated_at: '', user: {}}],
created_at: '',
deactivated_at: '',
deleted_at: '',
devices: [
{
created_at: '',
disabled: false,
disabled_reason: '',
id: '',
push_provider: '',
push_provider_name: '',
user_id: ''
}
],
id: '',
invisible: false,
language: '',
last_active: '',
latest_hidden_channels: [],
mutes: [{created_at: '', expires: '', target: {}, updated_at: '', user: {}}],
online: false,
push_notifications: {},
role: '',
teams: [],
total_unread_count: '',
unread_channels: '',
unread_count: '',
updated_at: ''
},
member: {},
message: {
attachments: [
{
actions: [{name: '', style: '', text: '', type: '', value: ''}],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [{short: false, title: '', value: ''}],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {frames: '', height: '', size: '', url: '', width: ''},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
before_message_send_failed: false,
cid: '',
command: '',
created_at: '',
deleted_at: '',
html: '',
i18n: {},
id: '',
image_labels: {},
latest_reactions: [{message_id: '', score: '', type: '', user: {}, user_id: ''}],
mentioned_users: [{}],
mml: '',
own_reactions: [{}],
parent_id: '',
pin_expires: '',
pinned: false,
pinned_at: '',
pinned_by: {},
quoted_message: '',
quoted_message_id: '',
reaction_counts: {},
reaction_scores: {},
reply_count: '',
shadowed: false,
show_in_channel: false,
silent: false,
text: '',
thread_participants: [{}],
type: '',
updated_at: '',
user: {}
},
parent_id: '',
reaction: {},
reason: '',
team: '',
type: '',
user: {},
user_id: '',
watcher_count: ''
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:type/:id/event',
headers: {'content-type': 'application/json'},
body: {
event: {
automoderation: false,
automoderation_scores: {action: '', explicit: '', spam: '', toxic: ''},
channel: {
auto_translation_enabled: false,
auto_translation_language: '',
cid: '',
config: {
automod: '',
automod_behavior: '',
automod_thresholds: {explicit: {block: '', flag: ''}, spam: {}, toxic: {}},
blocklist: '',
blocklist_behavior: '',
commands: [{args: '', description: '', name: '', set: ''}],
connect_events: false,
created_at: '',
custom_events: false,
grants: {},
max_message_length: '',
message_retention: '',
mutes: false,
name: '',
push_notifications: false,
quotes: false,
reactions: false,
read_events: false,
reminders: false,
replies: false,
search: false,
typing_events: false,
updated_at: '',
uploads: false,
url_enrichment: false
},
cooldown: '',
created_at: '',
created_by: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
deleted_at: '',
disabled: false,
frozen: false,
hidden: false,
hide_messages_before: '',
id: '',
last_message_at: '',
member_count: '',
members: [
{
ban_expires: '',
banned: false,
channel_role: '',
created_at: '',
deleted_at: '',
invite_accepted_at: '',
invite_rejected_at: '',
invited: false,
is_moderator: false,
role: '',
shadow_banned: false,
updated_at: '',
user: {},
user_id: ''
}
],
mute_expires_at: '',
muted: false,
own_capabilities: [],
team: '',
truncated_at: '',
truncated_by: {},
type: '',
updated_at: ''
},
channel_id: '',
channel_type: '',
cid: '',
connection_id: '',
created_at: '',
created_by: {},
me: {
banned: false,
channel_mutes: [{channel: {}, created_at: '', expires: '', updated_at: '', user: {}}],
created_at: '',
deactivated_at: '',
deleted_at: '',
devices: [
{
created_at: '',
disabled: false,
disabled_reason: '',
id: '',
push_provider: '',
push_provider_name: '',
user_id: ''
}
],
id: '',
invisible: false,
language: '',
last_active: '',
latest_hidden_channels: [],
mutes: [{created_at: '', expires: '', target: {}, updated_at: '', user: {}}],
online: false,
push_notifications: {},
role: '',
teams: [],
total_unread_count: '',
unread_channels: '',
unread_count: '',
updated_at: ''
},
member: {},
message: {
attachments: [
{
actions: [{name: '', style: '', text: '', type: '', value: ''}],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [{short: false, title: '', value: ''}],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {frames: '', height: '', size: '', url: '', width: ''},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
before_message_send_failed: false,
cid: '',
command: '',
created_at: '',
deleted_at: '',
html: '',
i18n: {},
id: '',
image_labels: {},
latest_reactions: [{message_id: '', score: '', type: '', user: {}, user_id: ''}],
mentioned_users: [{}],
mml: '',
own_reactions: [{}],
parent_id: '',
pin_expires: '',
pinned: false,
pinned_at: '',
pinned_by: {},
quoted_message: '',
quoted_message_id: '',
reaction_counts: {},
reaction_scores: {},
reply_count: '',
shadowed: false,
show_in_channel: false,
silent: false,
text: '',
thread_participants: [{}],
type: '',
updated_at: '',
user: {}
},
parent_id: '',
reaction: {},
reason: '',
team: '',
type: '',
user: {},
user_id: '',
watcher_count: ''
}
},
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}}/channels/:type/:id/event');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
event: {
automoderation: false,
automoderation_scores: {
action: '',
explicit: '',
spam: '',
toxic: ''
},
channel: {
auto_translation_enabled: false,
auto_translation_language: '',
cid: '',
config: {
automod: '',
automod_behavior: '',
automod_thresholds: {
explicit: {
block: '',
flag: ''
},
spam: {},
toxic: {}
},
blocklist: '',
blocklist_behavior: '',
commands: [
{
args: '',
description: '',
name: '',
set: ''
}
],
connect_events: false,
created_at: '',
custom_events: false,
grants: {},
max_message_length: '',
message_retention: '',
mutes: false,
name: '',
push_notifications: false,
quotes: false,
reactions: false,
read_events: false,
reminders: false,
replies: false,
search: false,
typing_events: false,
updated_at: '',
uploads: false,
url_enrichment: false
},
cooldown: '',
created_at: '',
created_by: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
deleted_at: '',
disabled: false,
frozen: false,
hidden: false,
hide_messages_before: '',
id: '',
last_message_at: '',
member_count: '',
members: [
{
ban_expires: '',
banned: false,
channel_role: '',
created_at: '',
deleted_at: '',
invite_accepted_at: '',
invite_rejected_at: '',
invited: false,
is_moderator: false,
role: '',
shadow_banned: false,
updated_at: '',
user: {},
user_id: ''
}
],
mute_expires_at: '',
muted: false,
own_capabilities: [],
team: '',
truncated_at: '',
truncated_by: {},
type: '',
updated_at: ''
},
channel_id: '',
channel_type: '',
cid: '',
connection_id: '',
created_at: '',
created_by: {},
me: {
banned: false,
channel_mutes: [
{
channel: {},
created_at: '',
expires: '',
updated_at: '',
user: {}
}
],
created_at: '',
deactivated_at: '',
deleted_at: '',
devices: [
{
created_at: '',
disabled: false,
disabled_reason: '',
id: '',
push_provider: '',
push_provider_name: '',
user_id: ''
}
],
id: '',
invisible: false,
language: '',
last_active: '',
latest_hidden_channels: [],
mutes: [
{
created_at: '',
expires: '',
target: {},
updated_at: '',
user: {}
}
],
online: false,
push_notifications: {},
role: '',
teams: [],
total_unread_count: '',
unread_channels: '',
unread_count: '',
updated_at: ''
},
member: {},
message: {
attachments: [
{
actions: [
{
name: '',
style: '',
text: '',
type: '',
value: ''
}
],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [
{
short: false,
title: '',
value: ''
}
],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {
frames: '',
height: '',
size: '',
url: '',
width: ''
},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
before_message_send_failed: false,
cid: '',
command: '',
created_at: '',
deleted_at: '',
html: '',
i18n: {},
id: '',
image_labels: {},
latest_reactions: [
{
message_id: '',
score: '',
type: '',
user: {},
user_id: ''
}
],
mentioned_users: [
{}
],
mml: '',
own_reactions: [
{}
],
parent_id: '',
pin_expires: '',
pinned: false,
pinned_at: '',
pinned_by: {},
quoted_message: '',
quoted_message_id: '',
reaction_counts: {},
reaction_scores: {},
reply_count: '',
shadowed: false,
show_in_channel: false,
silent: false,
text: '',
thread_participants: [
{}
],
type: '',
updated_at: '',
user: {}
},
parent_id: '',
reaction: {},
reason: '',
team: '',
type: '',
user: {},
user_id: '',
watcher_count: ''
}
});
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}}/channels/:type/:id/event',
headers: {'content-type': 'application/json'},
data: {
event: {
automoderation: false,
automoderation_scores: {action: '', explicit: '', spam: '', toxic: ''},
channel: {
auto_translation_enabled: false,
auto_translation_language: '',
cid: '',
config: {
automod: '',
automod_behavior: '',
automod_thresholds: {explicit: {block: '', flag: ''}, spam: {}, toxic: {}},
blocklist: '',
blocklist_behavior: '',
commands: [{args: '', description: '', name: '', set: ''}],
connect_events: false,
created_at: '',
custom_events: false,
grants: {},
max_message_length: '',
message_retention: '',
mutes: false,
name: '',
push_notifications: false,
quotes: false,
reactions: false,
read_events: false,
reminders: false,
replies: false,
search: false,
typing_events: false,
updated_at: '',
uploads: false,
url_enrichment: false
},
cooldown: '',
created_at: '',
created_by: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
deleted_at: '',
disabled: false,
frozen: false,
hidden: false,
hide_messages_before: '',
id: '',
last_message_at: '',
member_count: '',
members: [
{
ban_expires: '',
banned: false,
channel_role: '',
created_at: '',
deleted_at: '',
invite_accepted_at: '',
invite_rejected_at: '',
invited: false,
is_moderator: false,
role: '',
shadow_banned: false,
updated_at: '',
user: {},
user_id: ''
}
],
mute_expires_at: '',
muted: false,
own_capabilities: [],
team: '',
truncated_at: '',
truncated_by: {},
type: '',
updated_at: ''
},
channel_id: '',
channel_type: '',
cid: '',
connection_id: '',
created_at: '',
created_by: {},
me: {
banned: false,
channel_mutes: [{channel: {}, created_at: '', expires: '', updated_at: '', user: {}}],
created_at: '',
deactivated_at: '',
deleted_at: '',
devices: [
{
created_at: '',
disabled: false,
disabled_reason: '',
id: '',
push_provider: '',
push_provider_name: '',
user_id: ''
}
],
id: '',
invisible: false,
language: '',
last_active: '',
latest_hidden_channels: [],
mutes: [{created_at: '', expires: '', target: {}, updated_at: '', user: {}}],
online: false,
push_notifications: {},
role: '',
teams: [],
total_unread_count: '',
unread_channels: '',
unread_count: '',
updated_at: ''
},
member: {},
message: {
attachments: [
{
actions: [{name: '', style: '', text: '', type: '', value: ''}],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [{short: false, title: '', value: ''}],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {frames: '', height: '', size: '', url: '', width: ''},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
before_message_send_failed: false,
cid: '',
command: '',
created_at: '',
deleted_at: '',
html: '',
i18n: {},
id: '',
image_labels: {},
latest_reactions: [{message_id: '', score: '', type: '', user: {}, user_id: ''}],
mentioned_users: [{}],
mml: '',
own_reactions: [{}],
parent_id: '',
pin_expires: '',
pinned: false,
pinned_at: '',
pinned_by: {},
quoted_message: '',
quoted_message_id: '',
reaction_counts: {},
reaction_scores: {},
reply_count: '',
shadowed: false,
show_in_channel: false,
silent: false,
text: '',
thread_participants: [{}],
type: '',
updated_at: '',
user: {}
},
parent_id: '',
reaction: {},
reason: '',
team: '',
type: '',
user: {},
user_id: '',
watcher_count: ''
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/channels/:type/:id/event';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"event":{"automoderation":false,"automoderation_scores":{"action":"","explicit":"","spam":"","toxic":""},"channel":{"auto_translation_enabled":false,"auto_translation_language":"","cid":"","config":{"automod":"","automod_behavior":"","automod_thresholds":{"explicit":{"block":"","flag":""},"spam":{},"toxic":{}},"blocklist":"","blocklist_behavior":"","commands":[{"args":"","description":"","name":"","set":""}],"connect_events":false,"created_at":"","custom_events":false,"grants":{},"max_message_length":"","message_retention":"","mutes":false,"name":"","push_notifications":false,"quotes":false,"reactions":false,"read_events":false,"reminders":false,"replies":false,"search":false,"typing_events":false,"updated_at":"","uploads":false,"url_enrichment":false},"cooldown":"","created_at":"","created_by":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"deleted_at":"","disabled":false,"frozen":false,"hidden":false,"hide_messages_before":"","id":"","last_message_at":"","member_count":"","members":[{"ban_expires":"","banned":false,"channel_role":"","created_at":"","deleted_at":"","invite_accepted_at":"","invite_rejected_at":"","invited":false,"is_moderator":false,"role":"","shadow_banned":false,"updated_at":"","user":{},"user_id":""}],"mute_expires_at":"","muted":false,"own_capabilities":[],"team":"","truncated_at":"","truncated_by":{},"type":"","updated_at":""},"channel_id":"","channel_type":"","cid":"","connection_id":"","created_at":"","created_by":{},"me":{"banned":false,"channel_mutes":[{"channel":{},"created_at":"","expires":"","updated_at":"","user":{}}],"created_at":"","deactivated_at":"","deleted_at":"","devices":[{"created_at":"","disabled":false,"disabled_reason":"","id":"","push_provider":"","push_provider_name":"","user_id":""}],"id":"","invisible":false,"language":"","last_active":"","latest_hidden_channels":[],"mutes":[{"created_at":"","expires":"","target":{},"updated_at":"","user":{}}],"online":false,"push_notifications":{},"role":"","teams":[],"total_unread_count":"","unread_channels":"","unread_count":"","updated_at":""},"member":{},"message":{"attachments":[{"actions":[{"name":"","style":"","text":"","type":"","value":""}],"asset_url":"","author_icon":"","author_link":"","author_name":"","color":"","fallback":"","fields":[{"short":false,"title":"","value":""}],"footer":"","footer_icon":"","giphy":{"fixed_height":{"frames":"","height":"","size":"","url":"","width":""},"fixed_height_downsampled":{},"fixed_height_still":{},"fixed_width":{},"fixed_width_downsampled":{},"fixed_width_still":{},"original":{}},"image_url":"","og_scrape_url":"","original_height":"","original_width":"","pretext":"","text":"","thumb_url":"","title":"","title_link":"","type":""}],"before_message_send_failed":false,"cid":"","command":"","created_at":"","deleted_at":"","html":"","i18n":{},"id":"","image_labels":{},"latest_reactions":[{"message_id":"","score":"","type":"","user":{},"user_id":""}],"mentioned_users":[{}],"mml":"","own_reactions":[{}],"parent_id":"","pin_expires":"","pinned":false,"pinned_at":"","pinned_by":{},"quoted_message":"","quoted_message_id":"","reaction_counts":{},"reaction_scores":{},"reply_count":"","shadowed":false,"show_in_channel":false,"silent":false,"text":"","thread_participants":[{}],"type":"","updated_at":"","user":{}},"parent_id":"","reaction":{},"reason":"","team":"","type":"","user":{},"user_id":"","watcher_count":""}}'
};
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 = @{ @"event": @{ @"automoderation": @NO, @"automoderation_scores": @{ @"action": @"", @"explicit": @"", @"spam": @"", @"toxic": @"" }, @"channel": @{ @"auto_translation_enabled": @NO, @"auto_translation_language": @"", @"cid": @"", @"config": @{ @"automod": @"", @"automod_behavior": @"", @"automod_thresholds": @{ @"explicit": @{ @"block": @"", @"flag": @"" }, @"spam": @{ }, @"toxic": @{ } }, @"blocklist": @"", @"blocklist_behavior": @"", @"commands": @[ @{ @"args": @"", @"description": @"", @"name": @"", @"set": @"" } ], @"connect_events": @NO, @"created_at": @"", @"custom_events": @NO, @"grants": @{ }, @"max_message_length": @"", @"message_retention": @"", @"mutes": @NO, @"name": @"", @"push_notifications": @NO, @"quotes": @NO, @"reactions": @NO, @"read_events": @NO, @"reminders": @NO, @"replies": @NO, @"search": @NO, @"typing_events": @NO, @"updated_at": @"", @"uploads": @NO, @"url_enrichment": @NO }, @"cooldown": @"", @"created_at": @"", @"created_by": @{ @"ban_expires": @"", @"banned": @NO, @"id": @"", @"invisible": @NO, @"language": @"", @"push_notifications": @{ @"disabled": @NO, @"disabled_until": @"" }, @"revoke_tokens_issued_before": @"", @"role": @"", @"teams": @[ ] }, @"deleted_at": @"", @"disabled": @NO, @"frozen": @NO, @"hidden": @NO, @"hide_messages_before": @"", @"id": @"", @"last_message_at": @"", @"member_count": @"", @"members": @[ @{ @"ban_expires": @"", @"banned": @NO, @"channel_role": @"", @"created_at": @"", @"deleted_at": @"", @"invite_accepted_at": @"", @"invite_rejected_at": @"", @"invited": @NO, @"is_moderator": @NO, @"role": @"", @"shadow_banned": @NO, @"updated_at": @"", @"user": @{ }, @"user_id": @"" } ], @"mute_expires_at": @"", @"muted": @NO, @"own_capabilities": @[ ], @"team": @"", @"truncated_at": @"", @"truncated_by": @{ }, @"type": @"", @"updated_at": @"" }, @"channel_id": @"", @"channel_type": @"", @"cid": @"", @"connection_id": @"", @"created_at": @"", @"created_by": @{ }, @"me": @{ @"banned": @NO, @"channel_mutes": @[ @{ @"channel": @{ }, @"created_at": @"", @"expires": @"", @"updated_at": @"", @"user": @{ } } ], @"created_at": @"", @"deactivated_at": @"", @"deleted_at": @"", @"devices": @[ @{ @"created_at": @"", @"disabled": @NO, @"disabled_reason": @"", @"id": @"", @"push_provider": @"", @"push_provider_name": @"", @"user_id": @"" } ], @"id": @"", @"invisible": @NO, @"language": @"", @"last_active": @"", @"latest_hidden_channels": @[ ], @"mutes": @[ @{ @"created_at": @"", @"expires": @"", @"target": @{ }, @"updated_at": @"", @"user": @{ } } ], @"online": @NO, @"push_notifications": @{ }, @"role": @"", @"teams": @[ ], @"total_unread_count": @"", @"unread_channels": @"", @"unread_count": @"", @"updated_at": @"" }, @"member": @{ }, @"message": @{ @"attachments": @[ @{ @"actions": @[ @{ @"name": @"", @"style": @"", @"text": @"", @"type": @"", @"value": @"" } ], @"asset_url": @"", @"author_icon": @"", @"author_link": @"", @"author_name": @"", @"color": @"", @"fallback": @"", @"fields": @[ @{ @"short": @NO, @"title": @"", @"value": @"" } ], @"footer": @"", @"footer_icon": @"", @"giphy": @{ @"fixed_height": @{ @"frames": @"", @"height": @"", @"size": @"", @"url": @"", @"width": @"" }, @"fixed_height_downsampled": @{ }, @"fixed_height_still": @{ }, @"fixed_width": @{ }, @"fixed_width_downsampled": @{ }, @"fixed_width_still": @{ }, @"original": @{ } }, @"image_url": @"", @"og_scrape_url": @"", @"original_height": @"", @"original_width": @"", @"pretext": @"", @"text": @"", @"thumb_url": @"", @"title": @"", @"title_link": @"", @"type": @"" } ], @"before_message_send_failed": @NO, @"cid": @"", @"command": @"", @"created_at": @"", @"deleted_at": @"", @"html": @"", @"i18n": @{ }, @"id": @"", @"image_labels": @{ }, @"latest_reactions": @[ @{ @"message_id": @"", @"score": @"", @"type": @"", @"user": @{ }, @"user_id": @"" } ], @"mentioned_users": @[ @{ } ], @"mml": @"", @"own_reactions": @[ @{ } ], @"parent_id": @"", @"pin_expires": @"", @"pinned": @NO, @"pinned_at": @"", @"pinned_by": @{ }, @"quoted_message": @"", @"quoted_message_id": @"", @"reaction_counts": @{ }, @"reaction_scores": @{ }, @"reply_count": @"", @"shadowed": @NO, @"show_in_channel": @NO, @"silent": @NO, @"text": @"", @"thread_participants": @[ @{ } ], @"type": @"", @"updated_at": @"", @"user": @{ } }, @"parent_id": @"", @"reaction": @{ }, @"reason": @"", @"team": @"", @"type": @"", @"user": @{ }, @"user_id": @"", @"watcher_count": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/channels/:type/:id/event"]
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}}/channels/:type/:id/event" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"event\": {\n \"automoderation\": false,\n \"automoderation_scores\": {\n \"action\": \"\",\n \"explicit\": \"\",\n \"spam\": \"\",\n \"toxic\": \"\"\n },\n \"channel\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"cid\": \"\",\n \"config\": {\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"automod_thresholds\": {\n \"explicit\": {\n \"block\": \"\",\n \"flag\": \"\"\n },\n \"spam\": {},\n \"toxic\": {}\n },\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [\n {\n \"args\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"set\": \"\"\n }\n ],\n \"connect_events\": false,\n \"created_at\": \"\",\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"name\": \"\",\n \"push_notifications\": false,\n \"quotes\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"reminders\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"updated_at\": \"\",\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"cooldown\": \"\",\n \"created_at\": \"\",\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"deleted_at\": \"\",\n \"disabled\": false,\n \"frozen\": false,\n \"hidden\": false,\n \"hide_messages_before\": \"\",\n \"id\": \"\",\n \"last_message_at\": \"\",\n \"member_count\": \"\",\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"mute_expires_at\": \"\",\n \"muted\": false,\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": \"\",\n \"truncated_by\": {},\n \"type\": \"\",\n \"updated_at\": \"\"\n },\n \"channel_id\": \"\",\n \"channel_type\": \"\",\n \"cid\": \"\",\n \"connection_id\": \"\",\n \"created_at\": \"\",\n \"created_by\": {},\n \"me\": {\n \"banned\": false,\n \"channel_mutes\": [\n {\n \"channel\": {},\n \"created_at\": \"\",\n \"expires\": \"\",\n \"updated_at\": \"\",\n \"user\": {}\n }\n ],\n \"created_at\": \"\",\n \"deactivated_at\": \"\",\n \"deleted_at\": \"\",\n \"devices\": [\n {\n \"created_at\": \"\",\n \"disabled\": false,\n \"disabled_reason\": \"\",\n \"id\": \"\",\n \"push_provider\": \"\",\n \"push_provider_name\": \"\",\n \"user_id\": \"\"\n }\n ],\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"last_active\": \"\",\n \"latest_hidden_channels\": [],\n \"mutes\": [\n {\n \"created_at\": \"\",\n \"expires\": \"\",\n \"target\": {},\n \"updated_at\": \"\",\n \"user\": {}\n }\n ],\n \"online\": false,\n \"push_notifications\": {},\n \"role\": \"\",\n \"teams\": [],\n \"total_unread_count\": \"\",\n \"unread_channels\": \"\",\n \"unread_count\": \"\",\n \"updated_at\": \"\"\n },\n \"member\": {},\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"before_message_send_failed\": false,\n \"cid\": \"\",\n \"command\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"html\": \"\",\n \"i18n\": {},\n \"id\": \"\",\n \"image_labels\": {},\n \"latest_reactions\": [\n {\n \"message_id\": \"\",\n \"score\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"mentioned_users\": [\n {}\n ],\n \"mml\": \"\",\n \"own_reactions\": [\n {}\n ],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": {},\n \"quoted_message\": \"\",\n \"quoted_message_id\": \"\",\n \"reaction_counts\": {},\n \"reaction_scores\": {},\n \"reply_count\": \"\",\n \"shadowed\": false,\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"thread_participants\": [\n {}\n ],\n \"type\": \"\",\n \"updated_at\": \"\",\n \"user\": {}\n },\n \"parent_id\": \"\",\n \"reaction\": {},\n \"reason\": \"\",\n \"team\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\",\n \"watcher_count\": \"\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/channels/:type/:id/event",
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([
'event' => [
'automoderation' => null,
'automoderation_scores' => [
'action' => '',
'explicit' => '',
'spam' => '',
'toxic' => ''
],
'channel' => [
'auto_translation_enabled' => null,
'auto_translation_language' => '',
'cid' => '',
'config' => [
'automod' => '',
'automod_behavior' => '',
'automod_thresholds' => [
'explicit' => [
'block' => '',
'flag' => ''
],
'spam' => [
],
'toxic' => [
]
],
'blocklist' => '',
'blocklist_behavior' => '',
'commands' => [
[
'args' => '',
'description' => '',
'name' => '',
'set' => ''
]
],
'connect_events' => null,
'created_at' => '',
'custom_events' => null,
'grants' => [
],
'max_message_length' => '',
'message_retention' => '',
'mutes' => null,
'name' => '',
'push_notifications' => null,
'quotes' => null,
'reactions' => null,
'read_events' => null,
'reminders' => null,
'replies' => null,
'search' => null,
'typing_events' => null,
'updated_at' => '',
'uploads' => null,
'url_enrichment' => null
],
'cooldown' => '',
'created_at' => '',
'created_by' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'deleted_at' => '',
'disabled' => null,
'frozen' => null,
'hidden' => null,
'hide_messages_before' => '',
'id' => '',
'last_message_at' => '',
'member_count' => '',
'members' => [
[
'ban_expires' => '',
'banned' => null,
'channel_role' => '',
'created_at' => '',
'deleted_at' => '',
'invite_accepted_at' => '',
'invite_rejected_at' => '',
'invited' => null,
'is_moderator' => null,
'role' => '',
'shadow_banned' => null,
'updated_at' => '',
'user' => [
],
'user_id' => ''
]
],
'mute_expires_at' => '',
'muted' => null,
'own_capabilities' => [
],
'team' => '',
'truncated_at' => '',
'truncated_by' => [
],
'type' => '',
'updated_at' => ''
],
'channel_id' => '',
'channel_type' => '',
'cid' => '',
'connection_id' => '',
'created_at' => '',
'created_by' => [
],
'me' => [
'banned' => null,
'channel_mutes' => [
[
'channel' => [
],
'created_at' => '',
'expires' => '',
'updated_at' => '',
'user' => [
]
]
],
'created_at' => '',
'deactivated_at' => '',
'deleted_at' => '',
'devices' => [
[
'created_at' => '',
'disabled' => null,
'disabled_reason' => '',
'id' => '',
'push_provider' => '',
'push_provider_name' => '',
'user_id' => ''
]
],
'id' => '',
'invisible' => null,
'language' => '',
'last_active' => '',
'latest_hidden_channels' => [
],
'mutes' => [
[
'created_at' => '',
'expires' => '',
'target' => [
],
'updated_at' => '',
'user' => [
]
]
],
'online' => null,
'push_notifications' => [
],
'role' => '',
'teams' => [
],
'total_unread_count' => '',
'unread_channels' => '',
'unread_count' => '',
'updated_at' => ''
],
'member' => [
],
'message' => [
'attachments' => [
[
'actions' => [
[
'name' => '',
'style' => '',
'text' => '',
'type' => '',
'value' => ''
]
],
'asset_url' => '',
'author_icon' => '',
'author_link' => '',
'author_name' => '',
'color' => '',
'fallback' => '',
'fields' => [
[
'short' => null,
'title' => '',
'value' => ''
]
],
'footer' => '',
'footer_icon' => '',
'giphy' => [
'fixed_height' => [
'frames' => '',
'height' => '',
'size' => '',
'url' => '',
'width' => ''
],
'fixed_height_downsampled' => [
],
'fixed_height_still' => [
],
'fixed_width' => [
],
'fixed_width_downsampled' => [
],
'fixed_width_still' => [
],
'original' => [
]
],
'image_url' => '',
'og_scrape_url' => '',
'original_height' => '',
'original_width' => '',
'pretext' => '',
'text' => '',
'thumb_url' => '',
'title' => '',
'title_link' => '',
'type' => ''
]
],
'before_message_send_failed' => null,
'cid' => '',
'command' => '',
'created_at' => '',
'deleted_at' => '',
'html' => '',
'i18n' => [
],
'id' => '',
'image_labels' => [
],
'latest_reactions' => [
[
'message_id' => '',
'score' => '',
'type' => '',
'user' => [
],
'user_id' => ''
]
],
'mentioned_users' => [
[
]
],
'mml' => '',
'own_reactions' => [
[
]
],
'parent_id' => '',
'pin_expires' => '',
'pinned' => null,
'pinned_at' => '',
'pinned_by' => [
],
'quoted_message' => '',
'quoted_message_id' => '',
'reaction_counts' => [
],
'reaction_scores' => [
],
'reply_count' => '',
'shadowed' => null,
'show_in_channel' => null,
'silent' => null,
'text' => '',
'thread_participants' => [
[
]
],
'type' => '',
'updated_at' => '',
'user' => [
]
],
'parent_id' => '',
'reaction' => [
],
'reason' => '',
'team' => '',
'type' => '',
'user' => [
],
'user_id' => '',
'watcher_count' => ''
]
]),
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}}/channels/:type/:id/event', [
'body' => '{
"event": {
"automoderation": false,
"automoderation_scores": {
"action": "",
"explicit": "",
"spam": "",
"toxic": ""
},
"channel": {
"auto_translation_enabled": false,
"auto_translation_language": "",
"cid": "",
"config": {
"automod": "",
"automod_behavior": "",
"automod_thresholds": {
"explicit": {
"block": "",
"flag": ""
},
"spam": {},
"toxic": {}
},
"blocklist": "",
"blocklist_behavior": "",
"commands": [
{
"args": "",
"description": "",
"name": "",
"set": ""
}
],
"connect_events": false,
"created_at": "",
"custom_events": false,
"grants": {},
"max_message_length": "",
"message_retention": "",
"mutes": false,
"name": "",
"push_notifications": false,
"quotes": false,
"reactions": false,
"read_events": false,
"reminders": false,
"replies": false,
"search": false,
"typing_events": false,
"updated_at": "",
"uploads": false,
"url_enrichment": false
},
"cooldown": "",
"created_at": "",
"created_by": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"deleted_at": "",
"disabled": false,
"frozen": false,
"hidden": false,
"hide_messages_before": "",
"id": "",
"last_message_at": "",
"member_count": "",
"members": [
{
"ban_expires": "",
"banned": false,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": false,
"is_moderator": false,
"role": "",
"shadow_banned": false,
"updated_at": "",
"user": {},
"user_id": ""
}
],
"mute_expires_at": "",
"muted": false,
"own_capabilities": [],
"team": "",
"truncated_at": "",
"truncated_by": {},
"type": "",
"updated_at": ""
},
"channel_id": "",
"channel_type": "",
"cid": "",
"connection_id": "",
"created_at": "",
"created_by": {},
"me": {
"banned": false,
"channel_mutes": [
{
"channel": {},
"created_at": "",
"expires": "",
"updated_at": "",
"user": {}
}
],
"created_at": "",
"deactivated_at": "",
"deleted_at": "",
"devices": [
{
"created_at": "",
"disabled": false,
"disabled_reason": "",
"id": "",
"push_provider": "",
"push_provider_name": "",
"user_id": ""
}
],
"id": "",
"invisible": false,
"language": "",
"last_active": "",
"latest_hidden_channels": [],
"mutes": [
{
"created_at": "",
"expires": "",
"target": {},
"updated_at": "",
"user": {}
}
],
"online": false,
"push_notifications": {},
"role": "",
"teams": [],
"total_unread_count": "",
"unread_channels": "",
"unread_count": "",
"updated_at": ""
},
"member": {},
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"before_message_send_failed": false,
"cid": "",
"command": "",
"created_at": "",
"deleted_at": "",
"html": "",
"i18n": {},
"id": "",
"image_labels": {},
"latest_reactions": [
{
"message_id": "",
"score": "",
"type": "",
"user": {},
"user_id": ""
}
],
"mentioned_users": [
{}
],
"mml": "",
"own_reactions": [
{}
],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": {},
"quoted_message": "",
"quoted_message_id": "",
"reaction_counts": {},
"reaction_scores": {},
"reply_count": "",
"shadowed": false,
"show_in_channel": false,
"silent": false,
"text": "",
"thread_participants": [
{}
],
"type": "",
"updated_at": "",
"user": {}
},
"parent_id": "",
"reaction": {},
"reason": "",
"team": "",
"type": "",
"user": {},
"user_id": "",
"watcher_count": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/channels/:type/:id/event');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'event' => [
'automoderation' => null,
'automoderation_scores' => [
'action' => '',
'explicit' => '',
'spam' => '',
'toxic' => ''
],
'channel' => [
'auto_translation_enabled' => null,
'auto_translation_language' => '',
'cid' => '',
'config' => [
'automod' => '',
'automod_behavior' => '',
'automod_thresholds' => [
'explicit' => [
'block' => '',
'flag' => ''
],
'spam' => [
],
'toxic' => [
]
],
'blocklist' => '',
'blocklist_behavior' => '',
'commands' => [
[
'args' => '',
'description' => '',
'name' => '',
'set' => ''
]
],
'connect_events' => null,
'created_at' => '',
'custom_events' => null,
'grants' => [
],
'max_message_length' => '',
'message_retention' => '',
'mutes' => null,
'name' => '',
'push_notifications' => null,
'quotes' => null,
'reactions' => null,
'read_events' => null,
'reminders' => null,
'replies' => null,
'search' => null,
'typing_events' => null,
'updated_at' => '',
'uploads' => null,
'url_enrichment' => null
],
'cooldown' => '',
'created_at' => '',
'created_by' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'deleted_at' => '',
'disabled' => null,
'frozen' => null,
'hidden' => null,
'hide_messages_before' => '',
'id' => '',
'last_message_at' => '',
'member_count' => '',
'members' => [
[
'ban_expires' => '',
'banned' => null,
'channel_role' => '',
'created_at' => '',
'deleted_at' => '',
'invite_accepted_at' => '',
'invite_rejected_at' => '',
'invited' => null,
'is_moderator' => null,
'role' => '',
'shadow_banned' => null,
'updated_at' => '',
'user' => [
],
'user_id' => ''
]
],
'mute_expires_at' => '',
'muted' => null,
'own_capabilities' => [
],
'team' => '',
'truncated_at' => '',
'truncated_by' => [
],
'type' => '',
'updated_at' => ''
],
'channel_id' => '',
'channel_type' => '',
'cid' => '',
'connection_id' => '',
'created_at' => '',
'created_by' => [
],
'me' => [
'banned' => null,
'channel_mutes' => [
[
'channel' => [
],
'created_at' => '',
'expires' => '',
'updated_at' => '',
'user' => [
]
]
],
'created_at' => '',
'deactivated_at' => '',
'deleted_at' => '',
'devices' => [
[
'created_at' => '',
'disabled' => null,
'disabled_reason' => '',
'id' => '',
'push_provider' => '',
'push_provider_name' => '',
'user_id' => ''
]
],
'id' => '',
'invisible' => null,
'language' => '',
'last_active' => '',
'latest_hidden_channels' => [
],
'mutes' => [
[
'created_at' => '',
'expires' => '',
'target' => [
],
'updated_at' => '',
'user' => [
]
]
],
'online' => null,
'push_notifications' => [
],
'role' => '',
'teams' => [
],
'total_unread_count' => '',
'unread_channels' => '',
'unread_count' => '',
'updated_at' => ''
],
'member' => [
],
'message' => [
'attachments' => [
[
'actions' => [
[
'name' => '',
'style' => '',
'text' => '',
'type' => '',
'value' => ''
]
],
'asset_url' => '',
'author_icon' => '',
'author_link' => '',
'author_name' => '',
'color' => '',
'fallback' => '',
'fields' => [
[
'short' => null,
'title' => '',
'value' => ''
]
],
'footer' => '',
'footer_icon' => '',
'giphy' => [
'fixed_height' => [
'frames' => '',
'height' => '',
'size' => '',
'url' => '',
'width' => ''
],
'fixed_height_downsampled' => [
],
'fixed_height_still' => [
],
'fixed_width' => [
],
'fixed_width_downsampled' => [
],
'fixed_width_still' => [
],
'original' => [
]
],
'image_url' => '',
'og_scrape_url' => '',
'original_height' => '',
'original_width' => '',
'pretext' => '',
'text' => '',
'thumb_url' => '',
'title' => '',
'title_link' => '',
'type' => ''
]
],
'before_message_send_failed' => null,
'cid' => '',
'command' => '',
'created_at' => '',
'deleted_at' => '',
'html' => '',
'i18n' => [
],
'id' => '',
'image_labels' => [
],
'latest_reactions' => [
[
'message_id' => '',
'score' => '',
'type' => '',
'user' => [
],
'user_id' => ''
]
],
'mentioned_users' => [
[
]
],
'mml' => '',
'own_reactions' => [
[
]
],
'parent_id' => '',
'pin_expires' => '',
'pinned' => null,
'pinned_at' => '',
'pinned_by' => [
],
'quoted_message' => '',
'quoted_message_id' => '',
'reaction_counts' => [
],
'reaction_scores' => [
],
'reply_count' => '',
'shadowed' => null,
'show_in_channel' => null,
'silent' => null,
'text' => '',
'thread_participants' => [
[
]
],
'type' => '',
'updated_at' => '',
'user' => [
]
],
'parent_id' => '',
'reaction' => [
],
'reason' => '',
'team' => '',
'type' => '',
'user' => [
],
'user_id' => '',
'watcher_count' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'event' => [
'automoderation' => null,
'automoderation_scores' => [
'action' => '',
'explicit' => '',
'spam' => '',
'toxic' => ''
],
'channel' => [
'auto_translation_enabled' => null,
'auto_translation_language' => '',
'cid' => '',
'config' => [
'automod' => '',
'automod_behavior' => '',
'automod_thresholds' => [
'explicit' => [
'block' => '',
'flag' => ''
],
'spam' => [
],
'toxic' => [
]
],
'blocklist' => '',
'blocklist_behavior' => '',
'commands' => [
[
'args' => '',
'description' => '',
'name' => '',
'set' => ''
]
],
'connect_events' => null,
'created_at' => '',
'custom_events' => null,
'grants' => [
],
'max_message_length' => '',
'message_retention' => '',
'mutes' => null,
'name' => '',
'push_notifications' => null,
'quotes' => null,
'reactions' => null,
'read_events' => null,
'reminders' => null,
'replies' => null,
'search' => null,
'typing_events' => null,
'updated_at' => '',
'uploads' => null,
'url_enrichment' => null
],
'cooldown' => '',
'created_at' => '',
'created_by' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'deleted_at' => '',
'disabled' => null,
'frozen' => null,
'hidden' => null,
'hide_messages_before' => '',
'id' => '',
'last_message_at' => '',
'member_count' => '',
'members' => [
[
'ban_expires' => '',
'banned' => null,
'channel_role' => '',
'created_at' => '',
'deleted_at' => '',
'invite_accepted_at' => '',
'invite_rejected_at' => '',
'invited' => null,
'is_moderator' => null,
'role' => '',
'shadow_banned' => null,
'updated_at' => '',
'user' => [
],
'user_id' => ''
]
],
'mute_expires_at' => '',
'muted' => null,
'own_capabilities' => [
],
'team' => '',
'truncated_at' => '',
'truncated_by' => [
],
'type' => '',
'updated_at' => ''
],
'channel_id' => '',
'channel_type' => '',
'cid' => '',
'connection_id' => '',
'created_at' => '',
'created_by' => [
],
'me' => [
'banned' => null,
'channel_mutes' => [
[
'channel' => [
],
'created_at' => '',
'expires' => '',
'updated_at' => '',
'user' => [
]
]
],
'created_at' => '',
'deactivated_at' => '',
'deleted_at' => '',
'devices' => [
[
'created_at' => '',
'disabled' => null,
'disabled_reason' => '',
'id' => '',
'push_provider' => '',
'push_provider_name' => '',
'user_id' => ''
]
],
'id' => '',
'invisible' => null,
'language' => '',
'last_active' => '',
'latest_hidden_channels' => [
],
'mutes' => [
[
'created_at' => '',
'expires' => '',
'target' => [
],
'updated_at' => '',
'user' => [
]
]
],
'online' => null,
'push_notifications' => [
],
'role' => '',
'teams' => [
],
'total_unread_count' => '',
'unread_channels' => '',
'unread_count' => '',
'updated_at' => ''
],
'member' => [
],
'message' => [
'attachments' => [
[
'actions' => [
[
'name' => '',
'style' => '',
'text' => '',
'type' => '',
'value' => ''
]
],
'asset_url' => '',
'author_icon' => '',
'author_link' => '',
'author_name' => '',
'color' => '',
'fallback' => '',
'fields' => [
[
'short' => null,
'title' => '',
'value' => ''
]
],
'footer' => '',
'footer_icon' => '',
'giphy' => [
'fixed_height' => [
'frames' => '',
'height' => '',
'size' => '',
'url' => '',
'width' => ''
],
'fixed_height_downsampled' => [
],
'fixed_height_still' => [
],
'fixed_width' => [
],
'fixed_width_downsampled' => [
],
'fixed_width_still' => [
],
'original' => [
]
],
'image_url' => '',
'og_scrape_url' => '',
'original_height' => '',
'original_width' => '',
'pretext' => '',
'text' => '',
'thumb_url' => '',
'title' => '',
'title_link' => '',
'type' => ''
]
],
'before_message_send_failed' => null,
'cid' => '',
'command' => '',
'created_at' => '',
'deleted_at' => '',
'html' => '',
'i18n' => [
],
'id' => '',
'image_labels' => [
],
'latest_reactions' => [
[
'message_id' => '',
'score' => '',
'type' => '',
'user' => [
],
'user_id' => ''
]
],
'mentioned_users' => [
[
]
],
'mml' => '',
'own_reactions' => [
[
]
],
'parent_id' => '',
'pin_expires' => '',
'pinned' => null,
'pinned_at' => '',
'pinned_by' => [
],
'quoted_message' => '',
'quoted_message_id' => '',
'reaction_counts' => [
],
'reaction_scores' => [
],
'reply_count' => '',
'shadowed' => null,
'show_in_channel' => null,
'silent' => null,
'text' => '',
'thread_participants' => [
[
]
],
'type' => '',
'updated_at' => '',
'user' => [
]
],
'parent_id' => '',
'reaction' => [
],
'reason' => '',
'team' => '',
'type' => '',
'user' => [
],
'user_id' => '',
'watcher_count' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/channels/:type/:id/event');
$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}}/channels/:type/:id/event' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"event": {
"automoderation": false,
"automoderation_scores": {
"action": "",
"explicit": "",
"spam": "",
"toxic": ""
},
"channel": {
"auto_translation_enabled": false,
"auto_translation_language": "",
"cid": "",
"config": {
"automod": "",
"automod_behavior": "",
"automod_thresholds": {
"explicit": {
"block": "",
"flag": ""
},
"spam": {},
"toxic": {}
},
"blocklist": "",
"blocklist_behavior": "",
"commands": [
{
"args": "",
"description": "",
"name": "",
"set": ""
}
],
"connect_events": false,
"created_at": "",
"custom_events": false,
"grants": {},
"max_message_length": "",
"message_retention": "",
"mutes": false,
"name": "",
"push_notifications": false,
"quotes": false,
"reactions": false,
"read_events": false,
"reminders": false,
"replies": false,
"search": false,
"typing_events": false,
"updated_at": "",
"uploads": false,
"url_enrichment": false
},
"cooldown": "",
"created_at": "",
"created_by": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"deleted_at": "",
"disabled": false,
"frozen": false,
"hidden": false,
"hide_messages_before": "",
"id": "",
"last_message_at": "",
"member_count": "",
"members": [
{
"ban_expires": "",
"banned": false,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": false,
"is_moderator": false,
"role": "",
"shadow_banned": false,
"updated_at": "",
"user": {},
"user_id": ""
}
],
"mute_expires_at": "",
"muted": false,
"own_capabilities": [],
"team": "",
"truncated_at": "",
"truncated_by": {},
"type": "",
"updated_at": ""
},
"channel_id": "",
"channel_type": "",
"cid": "",
"connection_id": "",
"created_at": "",
"created_by": {},
"me": {
"banned": false,
"channel_mutes": [
{
"channel": {},
"created_at": "",
"expires": "",
"updated_at": "",
"user": {}
}
],
"created_at": "",
"deactivated_at": "",
"deleted_at": "",
"devices": [
{
"created_at": "",
"disabled": false,
"disabled_reason": "",
"id": "",
"push_provider": "",
"push_provider_name": "",
"user_id": ""
}
],
"id": "",
"invisible": false,
"language": "",
"last_active": "",
"latest_hidden_channels": [],
"mutes": [
{
"created_at": "",
"expires": "",
"target": {},
"updated_at": "",
"user": {}
}
],
"online": false,
"push_notifications": {},
"role": "",
"teams": [],
"total_unread_count": "",
"unread_channels": "",
"unread_count": "",
"updated_at": ""
},
"member": {},
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"before_message_send_failed": false,
"cid": "",
"command": "",
"created_at": "",
"deleted_at": "",
"html": "",
"i18n": {},
"id": "",
"image_labels": {},
"latest_reactions": [
{
"message_id": "",
"score": "",
"type": "",
"user": {},
"user_id": ""
}
],
"mentioned_users": [
{}
],
"mml": "",
"own_reactions": [
{}
],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": {},
"quoted_message": "",
"quoted_message_id": "",
"reaction_counts": {},
"reaction_scores": {},
"reply_count": "",
"shadowed": false,
"show_in_channel": false,
"silent": false,
"text": "",
"thread_participants": [
{}
],
"type": "",
"updated_at": "",
"user": {}
},
"parent_id": "",
"reaction": {},
"reason": "",
"team": "",
"type": "",
"user": {},
"user_id": "",
"watcher_count": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/channels/:type/:id/event' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"event": {
"automoderation": false,
"automoderation_scores": {
"action": "",
"explicit": "",
"spam": "",
"toxic": ""
},
"channel": {
"auto_translation_enabled": false,
"auto_translation_language": "",
"cid": "",
"config": {
"automod": "",
"automod_behavior": "",
"automod_thresholds": {
"explicit": {
"block": "",
"flag": ""
},
"spam": {},
"toxic": {}
},
"blocklist": "",
"blocklist_behavior": "",
"commands": [
{
"args": "",
"description": "",
"name": "",
"set": ""
}
],
"connect_events": false,
"created_at": "",
"custom_events": false,
"grants": {},
"max_message_length": "",
"message_retention": "",
"mutes": false,
"name": "",
"push_notifications": false,
"quotes": false,
"reactions": false,
"read_events": false,
"reminders": false,
"replies": false,
"search": false,
"typing_events": false,
"updated_at": "",
"uploads": false,
"url_enrichment": false
},
"cooldown": "",
"created_at": "",
"created_by": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"deleted_at": "",
"disabled": false,
"frozen": false,
"hidden": false,
"hide_messages_before": "",
"id": "",
"last_message_at": "",
"member_count": "",
"members": [
{
"ban_expires": "",
"banned": false,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": false,
"is_moderator": false,
"role": "",
"shadow_banned": false,
"updated_at": "",
"user": {},
"user_id": ""
}
],
"mute_expires_at": "",
"muted": false,
"own_capabilities": [],
"team": "",
"truncated_at": "",
"truncated_by": {},
"type": "",
"updated_at": ""
},
"channel_id": "",
"channel_type": "",
"cid": "",
"connection_id": "",
"created_at": "",
"created_by": {},
"me": {
"banned": false,
"channel_mutes": [
{
"channel": {},
"created_at": "",
"expires": "",
"updated_at": "",
"user": {}
}
],
"created_at": "",
"deactivated_at": "",
"deleted_at": "",
"devices": [
{
"created_at": "",
"disabled": false,
"disabled_reason": "",
"id": "",
"push_provider": "",
"push_provider_name": "",
"user_id": ""
}
],
"id": "",
"invisible": false,
"language": "",
"last_active": "",
"latest_hidden_channels": [],
"mutes": [
{
"created_at": "",
"expires": "",
"target": {},
"updated_at": "",
"user": {}
}
],
"online": false,
"push_notifications": {},
"role": "",
"teams": [],
"total_unread_count": "",
"unread_channels": "",
"unread_count": "",
"updated_at": ""
},
"member": {},
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"before_message_send_failed": false,
"cid": "",
"command": "",
"created_at": "",
"deleted_at": "",
"html": "",
"i18n": {},
"id": "",
"image_labels": {},
"latest_reactions": [
{
"message_id": "",
"score": "",
"type": "",
"user": {},
"user_id": ""
}
],
"mentioned_users": [
{}
],
"mml": "",
"own_reactions": [
{}
],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": {},
"quoted_message": "",
"quoted_message_id": "",
"reaction_counts": {},
"reaction_scores": {},
"reply_count": "",
"shadowed": false,
"show_in_channel": false,
"silent": false,
"text": "",
"thread_participants": [
{}
],
"type": "",
"updated_at": "",
"user": {}
},
"parent_id": "",
"reaction": {},
"reason": "",
"team": "",
"type": "",
"user": {},
"user_id": "",
"watcher_count": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"event\": {\n \"automoderation\": false,\n \"automoderation_scores\": {\n \"action\": \"\",\n \"explicit\": \"\",\n \"spam\": \"\",\n \"toxic\": \"\"\n },\n \"channel\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"cid\": \"\",\n \"config\": {\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"automod_thresholds\": {\n \"explicit\": {\n \"block\": \"\",\n \"flag\": \"\"\n },\n \"spam\": {},\n \"toxic\": {}\n },\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [\n {\n \"args\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"set\": \"\"\n }\n ],\n \"connect_events\": false,\n \"created_at\": \"\",\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"name\": \"\",\n \"push_notifications\": false,\n \"quotes\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"reminders\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"updated_at\": \"\",\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"cooldown\": \"\",\n \"created_at\": \"\",\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"deleted_at\": \"\",\n \"disabled\": false,\n \"frozen\": false,\n \"hidden\": false,\n \"hide_messages_before\": \"\",\n \"id\": \"\",\n \"last_message_at\": \"\",\n \"member_count\": \"\",\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"mute_expires_at\": \"\",\n \"muted\": false,\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": \"\",\n \"truncated_by\": {},\n \"type\": \"\",\n \"updated_at\": \"\"\n },\n \"channel_id\": \"\",\n \"channel_type\": \"\",\n \"cid\": \"\",\n \"connection_id\": \"\",\n \"created_at\": \"\",\n \"created_by\": {},\n \"me\": {\n \"banned\": false,\n \"channel_mutes\": [\n {\n \"channel\": {},\n \"created_at\": \"\",\n \"expires\": \"\",\n \"updated_at\": \"\",\n \"user\": {}\n }\n ],\n \"created_at\": \"\",\n \"deactivated_at\": \"\",\n \"deleted_at\": \"\",\n \"devices\": [\n {\n \"created_at\": \"\",\n \"disabled\": false,\n \"disabled_reason\": \"\",\n \"id\": \"\",\n \"push_provider\": \"\",\n \"push_provider_name\": \"\",\n \"user_id\": \"\"\n }\n ],\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"last_active\": \"\",\n \"latest_hidden_channels\": [],\n \"mutes\": [\n {\n \"created_at\": \"\",\n \"expires\": \"\",\n \"target\": {},\n \"updated_at\": \"\",\n \"user\": {}\n }\n ],\n \"online\": false,\n \"push_notifications\": {},\n \"role\": \"\",\n \"teams\": [],\n \"total_unread_count\": \"\",\n \"unread_channels\": \"\",\n \"unread_count\": \"\",\n \"updated_at\": \"\"\n },\n \"member\": {},\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"before_message_send_failed\": false,\n \"cid\": \"\",\n \"command\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"html\": \"\",\n \"i18n\": {},\n \"id\": \"\",\n \"image_labels\": {},\n \"latest_reactions\": [\n {\n \"message_id\": \"\",\n \"score\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"mentioned_users\": [\n {}\n ],\n \"mml\": \"\",\n \"own_reactions\": [\n {}\n ],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": {},\n \"quoted_message\": \"\",\n \"quoted_message_id\": \"\",\n \"reaction_counts\": {},\n \"reaction_scores\": {},\n \"reply_count\": \"\",\n \"shadowed\": false,\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"thread_participants\": [\n {}\n ],\n \"type\": \"\",\n \"updated_at\": \"\",\n \"user\": {}\n },\n \"parent_id\": \"\",\n \"reaction\": {},\n \"reason\": \"\",\n \"team\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\",\n \"watcher_count\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/channels/:type/:id/event", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/channels/:type/:id/event"
payload = { "event": {
"automoderation": False,
"automoderation_scores": {
"action": "",
"explicit": "",
"spam": "",
"toxic": ""
},
"channel": {
"auto_translation_enabled": False,
"auto_translation_language": "",
"cid": "",
"config": {
"automod": "",
"automod_behavior": "",
"automod_thresholds": {
"explicit": {
"block": "",
"flag": ""
},
"spam": {},
"toxic": {}
},
"blocklist": "",
"blocklist_behavior": "",
"commands": [
{
"args": "",
"description": "",
"name": "",
"set": ""
}
],
"connect_events": False,
"created_at": "",
"custom_events": False,
"grants": {},
"max_message_length": "",
"message_retention": "",
"mutes": False,
"name": "",
"push_notifications": False,
"quotes": False,
"reactions": False,
"read_events": False,
"reminders": False,
"replies": False,
"search": False,
"typing_events": False,
"updated_at": "",
"uploads": False,
"url_enrichment": False
},
"cooldown": "",
"created_at": "",
"created_by": {
"ban_expires": "",
"banned": False,
"id": "",
"invisible": False,
"language": "",
"push_notifications": {
"disabled": False,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"deleted_at": "",
"disabled": False,
"frozen": False,
"hidden": False,
"hide_messages_before": "",
"id": "",
"last_message_at": "",
"member_count": "",
"members": [
{
"ban_expires": "",
"banned": False,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": False,
"is_moderator": False,
"role": "",
"shadow_banned": False,
"updated_at": "",
"user": {},
"user_id": ""
}
],
"mute_expires_at": "",
"muted": False,
"own_capabilities": [],
"team": "",
"truncated_at": "",
"truncated_by": {},
"type": "",
"updated_at": ""
},
"channel_id": "",
"channel_type": "",
"cid": "",
"connection_id": "",
"created_at": "",
"created_by": {},
"me": {
"banned": False,
"channel_mutes": [
{
"channel": {},
"created_at": "",
"expires": "",
"updated_at": "",
"user": {}
}
],
"created_at": "",
"deactivated_at": "",
"deleted_at": "",
"devices": [
{
"created_at": "",
"disabled": False,
"disabled_reason": "",
"id": "",
"push_provider": "",
"push_provider_name": "",
"user_id": ""
}
],
"id": "",
"invisible": False,
"language": "",
"last_active": "",
"latest_hidden_channels": [],
"mutes": [
{
"created_at": "",
"expires": "",
"target": {},
"updated_at": "",
"user": {}
}
],
"online": False,
"push_notifications": {},
"role": "",
"teams": [],
"total_unread_count": "",
"unread_channels": "",
"unread_count": "",
"updated_at": ""
},
"member": {},
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": False,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"before_message_send_failed": False,
"cid": "",
"command": "",
"created_at": "",
"deleted_at": "",
"html": "",
"i18n": {},
"id": "",
"image_labels": {},
"latest_reactions": [
{
"message_id": "",
"score": "",
"type": "",
"user": {},
"user_id": ""
}
],
"mentioned_users": [{}],
"mml": "",
"own_reactions": [{}],
"parent_id": "",
"pin_expires": "",
"pinned": False,
"pinned_at": "",
"pinned_by": {},
"quoted_message": "",
"quoted_message_id": "",
"reaction_counts": {},
"reaction_scores": {},
"reply_count": "",
"shadowed": False,
"show_in_channel": False,
"silent": False,
"text": "",
"thread_participants": [{}],
"type": "",
"updated_at": "",
"user": {}
},
"parent_id": "",
"reaction": {},
"reason": "",
"team": "",
"type": "",
"user": {},
"user_id": "",
"watcher_count": ""
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/channels/:type/:id/event"
payload <- "{\n \"event\": {\n \"automoderation\": false,\n \"automoderation_scores\": {\n \"action\": \"\",\n \"explicit\": \"\",\n \"spam\": \"\",\n \"toxic\": \"\"\n },\n \"channel\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"cid\": \"\",\n \"config\": {\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"automod_thresholds\": {\n \"explicit\": {\n \"block\": \"\",\n \"flag\": \"\"\n },\n \"spam\": {},\n \"toxic\": {}\n },\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [\n {\n \"args\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"set\": \"\"\n }\n ],\n \"connect_events\": false,\n \"created_at\": \"\",\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"name\": \"\",\n \"push_notifications\": false,\n \"quotes\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"reminders\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"updated_at\": \"\",\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"cooldown\": \"\",\n \"created_at\": \"\",\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"deleted_at\": \"\",\n \"disabled\": false,\n \"frozen\": false,\n \"hidden\": false,\n \"hide_messages_before\": \"\",\n \"id\": \"\",\n \"last_message_at\": \"\",\n \"member_count\": \"\",\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"mute_expires_at\": \"\",\n \"muted\": false,\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": \"\",\n \"truncated_by\": {},\n \"type\": \"\",\n \"updated_at\": \"\"\n },\n \"channel_id\": \"\",\n \"channel_type\": \"\",\n \"cid\": \"\",\n \"connection_id\": \"\",\n \"created_at\": \"\",\n \"created_by\": {},\n \"me\": {\n \"banned\": false,\n \"channel_mutes\": [\n {\n \"channel\": {},\n \"created_at\": \"\",\n \"expires\": \"\",\n \"updated_at\": \"\",\n \"user\": {}\n }\n ],\n \"created_at\": \"\",\n \"deactivated_at\": \"\",\n \"deleted_at\": \"\",\n \"devices\": [\n {\n \"created_at\": \"\",\n \"disabled\": false,\n \"disabled_reason\": \"\",\n \"id\": \"\",\n \"push_provider\": \"\",\n \"push_provider_name\": \"\",\n \"user_id\": \"\"\n }\n ],\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"last_active\": \"\",\n \"latest_hidden_channels\": [],\n \"mutes\": [\n {\n \"created_at\": \"\",\n \"expires\": \"\",\n \"target\": {},\n \"updated_at\": \"\",\n \"user\": {}\n }\n ],\n \"online\": false,\n \"push_notifications\": {},\n \"role\": \"\",\n \"teams\": [],\n \"total_unread_count\": \"\",\n \"unread_channels\": \"\",\n \"unread_count\": \"\",\n \"updated_at\": \"\"\n },\n \"member\": {},\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"before_message_send_failed\": false,\n \"cid\": \"\",\n \"command\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"html\": \"\",\n \"i18n\": {},\n \"id\": \"\",\n \"image_labels\": {},\n \"latest_reactions\": [\n {\n \"message_id\": \"\",\n \"score\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"mentioned_users\": [\n {}\n ],\n \"mml\": \"\",\n \"own_reactions\": [\n {}\n ],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": {},\n \"quoted_message\": \"\",\n \"quoted_message_id\": \"\",\n \"reaction_counts\": {},\n \"reaction_scores\": {},\n \"reply_count\": \"\",\n \"shadowed\": false,\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"thread_participants\": [\n {}\n ],\n \"type\": \"\",\n \"updated_at\": \"\",\n \"user\": {}\n },\n \"parent_id\": \"\",\n \"reaction\": {},\n \"reason\": \"\",\n \"team\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\",\n \"watcher_count\": \"\"\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/channels/:type/:id/event")
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 \"event\": {\n \"automoderation\": false,\n \"automoderation_scores\": {\n \"action\": \"\",\n \"explicit\": \"\",\n \"spam\": \"\",\n \"toxic\": \"\"\n },\n \"channel\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"cid\": \"\",\n \"config\": {\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"automod_thresholds\": {\n \"explicit\": {\n \"block\": \"\",\n \"flag\": \"\"\n },\n \"spam\": {},\n \"toxic\": {}\n },\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [\n {\n \"args\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"set\": \"\"\n }\n ],\n \"connect_events\": false,\n \"created_at\": \"\",\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"name\": \"\",\n \"push_notifications\": false,\n \"quotes\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"reminders\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"updated_at\": \"\",\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"cooldown\": \"\",\n \"created_at\": \"\",\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"deleted_at\": \"\",\n \"disabled\": false,\n \"frozen\": false,\n \"hidden\": false,\n \"hide_messages_before\": \"\",\n \"id\": \"\",\n \"last_message_at\": \"\",\n \"member_count\": \"\",\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"mute_expires_at\": \"\",\n \"muted\": false,\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": \"\",\n \"truncated_by\": {},\n \"type\": \"\",\n \"updated_at\": \"\"\n },\n \"channel_id\": \"\",\n \"channel_type\": \"\",\n \"cid\": \"\",\n \"connection_id\": \"\",\n \"created_at\": \"\",\n \"created_by\": {},\n \"me\": {\n \"banned\": false,\n \"channel_mutes\": [\n {\n \"channel\": {},\n \"created_at\": \"\",\n \"expires\": \"\",\n \"updated_at\": \"\",\n \"user\": {}\n }\n ],\n \"created_at\": \"\",\n \"deactivated_at\": \"\",\n \"deleted_at\": \"\",\n \"devices\": [\n {\n \"created_at\": \"\",\n \"disabled\": false,\n \"disabled_reason\": \"\",\n \"id\": \"\",\n \"push_provider\": \"\",\n \"push_provider_name\": \"\",\n \"user_id\": \"\"\n }\n ],\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"last_active\": \"\",\n \"latest_hidden_channels\": [],\n \"mutes\": [\n {\n \"created_at\": \"\",\n \"expires\": \"\",\n \"target\": {},\n \"updated_at\": \"\",\n \"user\": {}\n }\n ],\n \"online\": false,\n \"push_notifications\": {},\n \"role\": \"\",\n \"teams\": [],\n \"total_unread_count\": \"\",\n \"unread_channels\": \"\",\n \"unread_count\": \"\",\n \"updated_at\": \"\"\n },\n \"member\": {},\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"before_message_send_failed\": false,\n \"cid\": \"\",\n \"command\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"html\": \"\",\n \"i18n\": {},\n \"id\": \"\",\n \"image_labels\": {},\n \"latest_reactions\": [\n {\n \"message_id\": \"\",\n \"score\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"mentioned_users\": [\n {}\n ],\n \"mml\": \"\",\n \"own_reactions\": [\n {}\n ],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": {},\n \"quoted_message\": \"\",\n \"quoted_message_id\": \"\",\n \"reaction_counts\": {},\n \"reaction_scores\": {},\n \"reply_count\": \"\",\n \"shadowed\": false,\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"thread_participants\": [\n {}\n ],\n \"type\": \"\",\n \"updated_at\": \"\",\n \"user\": {}\n },\n \"parent_id\": \"\",\n \"reaction\": {},\n \"reason\": \"\",\n \"team\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\",\n \"watcher_count\": \"\"\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/channels/:type/:id/event') do |req|
req.body = "{\n \"event\": {\n \"automoderation\": false,\n \"automoderation_scores\": {\n \"action\": \"\",\n \"explicit\": \"\",\n \"spam\": \"\",\n \"toxic\": \"\"\n },\n \"channel\": {\n \"auto_translation_enabled\": false,\n \"auto_translation_language\": \"\",\n \"cid\": \"\",\n \"config\": {\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"automod_thresholds\": {\n \"explicit\": {\n \"block\": \"\",\n \"flag\": \"\"\n },\n \"spam\": {},\n \"toxic\": {}\n },\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [\n {\n \"args\": \"\",\n \"description\": \"\",\n \"name\": \"\",\n \"set\": \"\"\n }\n ],\n \"connect_events\": false,\n \"created_at\": \"\",\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"name\": \"\",\n \"push_notifications\": false,\n \"quotes\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"reminders\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"updated_at\": \"\",\n \"uploads\": false,\n \"url_enrichment\": false\n },\n \"cooldown\": \"\",\n \"created_at\": \"\",\n \"created_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"deleted_at\": \"\",\n \"disabled\": false,\n \"frozen\": false,\n \"hidden\": false,\n \"hide_messages_before\": \"\",\n \"id\": \"\",\n \"last_message_at\": \"\",\n \"member_count\": \"\",\n \"members\": [\n {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"channel_role\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"invite_accepted_at\": \"\",\n \"invite_rejected_at\": \"\",\n \"invited\": false,\n \"is_moderator\": false,\n \"role\": \"\",\n \"shadow_banned\": false,\n \"updated_at\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"mute_expires_at\": \"\",\n \"muted\": false,\n \"own_capabilities\": [],\n \"team\": \"\",\n \"truncated_at\": \"\",\n \"truncated_by\": {},\n \"type\": \"\",\n \"updated_at\": \"\"\n },\n \"channel_id\": \"\",\n \"channel_type\": \"\",\n \"cid\": \"\",\n \"connection_id\": \"\",\n \"created_at\": \"\",\n \"created_by\": {},\n \"me\": {\n \"banned\": false,\n \"channel_mutes\": [\n {\n \"channel\": {},\n \"created_at\": \"\",\n \"expires\": \"\",\n \"updated_at\": \"\",\n \"user\": {}\n }\n ],\n \"created_at\": \"\",\n \"deactivated_at\": \"\",\n \"deleted_at\": \"\",\n \"devices\": [\n {\n \"created_at\": \"\",\n \"disabled\": false,\n \"disabled_reason\": \"\",\n \"id\": \"\",\n \"push_provider\": \"\",\n \"push_provider_name\": \"\",\n \"user_id\": \"\"\n }\n ],\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"last_active\": \"\",\n \"latest_hidden_channels\": [],\n \"mutes\": [\n {\n \"created_at\": \"\",\n \"expires\": \"\",\n \"target\": {},\n \"updated_at\": \"\",\n \"user\": {}\n }\n ],\n \"online\": false,\n \"push_notifications\": {},\n \"role\": \"\",\n \"teams\": [],\n \"total_unread_count\": \"\",\n \"unread_channels\": \"\",\n \"unread_count\": \"\",\n \"updated_at\": \"\"\n },\n \"member\": {},\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"before_message_send_failed\": false,\n \"cid\": \"\",\n \"command\": \"\",\n \"created_at\": \"\",\n \"deleted_at\": \"\",\n \"html\": \"\",\n \"i18n\": {},\n \"id\": \"\",\n \"image_labels\": {},\n \"latest_reactions\": [\n {\n \"message_id\": \"\",\n \"score\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n }\n ],\n \"mentioned_users\": [\n {}\n ],\n \"mml\": \"\",\n \"own_reactions\": [\n {}\n ],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": {},\n \"quoted_message\": \"\",\n \"quoted_message_id\": \"\",\n \"reaction_counts\": {},\n \"reaction_scores\": {},\n \"reply_count\": \"\",\n \"shadowed\": false,\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"thread_participants\": [\n {}\n ],\n \"type\": \"\",\n \"updated_at\": \"\",\n \"user\": {}\n },\n \"parent_id\": \"\",\n \"reaction\": {},\n \"reason\": \"\",\n \"team\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\",\n \"watcher_count\": \"\"\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/channels/:type/:id/event";
let payload = json!({"event": json!({
"automoderation": false,
"automoderation_scores": json!({
"action": "",
"explicit": "",
"spam": "",
"toxic": ""
}),
"channel": json!({
"auto_translation_enabled": false,
"auto_translation_language": "",
"cid": "",
"config": json!({
"automod": "",
"automod_behavior": "",
"automod_thresholds": json!({
"explicit": json!({
"block": "",
"flag": ""
}),
"spam": json!({}),
"toxic": json!({})
}),
"blocklist": "",
"blocklist_behavior": "",
"commands": (
json!({
"args": "",
"description": "",
"name": "",
"set": ""
})
),
"connect_events": false,
"created_at": "",
"custom_events": false,
"grants": json!({}),
"max_message_length": "",
"message_retention": "",
"mutes": false,
"name": "",
"push_notifications": false,
"quotes": false,
"reactions": false,
"read_events": false,
"reminders": false,
"replies": false,
"search": false,
"typing_events": false,
"updated_at": "",
"uploads": false,
"url_enrichment": false
}),
"cooldown": "",
"created_at": "",
"created_by": json!({
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": json!({
"disabled": false,
"disabled_until": ""
}),
"revoke_tokens_issued_before": "",
"role": "",
"teams": ()
}),
"deleted_at": "",
"disabled": false,
"frozen": false,
"hidden": false,
"hide_messages_before": "",
"id": "",
"last_message_at": "",
"member_count": "",
"members": (
json!({
"ban_expires": "",
"banned": false,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": false,
"is_moderator": false,
"role": "",
"shadow_banned": false,
"updated_at": "",
"user": json!({}),
"user_id": ""
})
),
"mute_expires_at": "",
"muted": false,
"own_capabilities": (),
"team": "",
"truncated_at": "",
"truncated_by": json!({}),
"type": "",
"updated_at": ""
}),
"channel_id": "",
"channel_type": "",
"cid": "",
"connection_id": "",
"created_at": "",
"created_by": json!({}),
"me": json!({
"banned": false,
"channel_mutes": (
json!({
"channel": json!({}),
"created_at": "",
"expires": "",
"updated_at": "",
"user": json!({})
})
),
"created_at": "",
"deactivated_at": "",
"deleted_at": "",
"devices": (
json!({
"created_at": "",
"disabled": false,
"disabled_reason": "",
"id": "",
"push_provider": "",
"push_provider_name": "",
"user_id": ""
})
),
"id": "",
"invisible": false,
"language": "",
"last_active": "",
"latest_hidden_channels": (),
"mutes": (
json!({
"created_at": "",
"expires": "",
"target": json!({}),
"updated_at": "",
"user": json!({})
})
),
"online": false,
"push_notifications": json!({}),
"role": "",
"teams": (),
"total_unread_count": "",
"unread_channels": "",
"unread_count": "",
"updated_at": ""
}),
"member": json!({}),
"message": json!({
"attachments": (
json!({
"actions": (
json!({
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
})
),
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": (
json!({
"short": false,
"title": "",
"value": ""
})
),
"footer": "",
"footer_icon": "",
"giphy": json!({
"fixed_height": json!({
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
}),
"fixed_height_downsampled": json!({}),
"fixed_height_still": json!({}),
"fixed_width": json!({}),
"fixed_width_downsampled": json!({}),
"fixed_width_still": json!({}),
"original": json!({})
}),
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
})
),
"before_message_send_failed": false,
"cid": "",
"command": "",
"created_at": "",
"deleted_at": "",
"html": "",
"i18n": json!({}),
"id": "",
"image_labels": json!({}),
"latest_reactions": (
json!({
"message_id": "",
"score": "",
"type": "",
"user": json!({}),
"user_id": ""
})
),
"mentioned_users": (json!({})),
"mml": "",
"own_reactions": (json!({})),
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": json!({}),
"quoted_message": "",
"quoted_message_id": "",
"reaction_counts": json!({}),
"reaction_scores": json!({}),
"reply_count": "",
"shadowed": false,
"show_in_channel": false,
"silent": false,
"text": "",
"thread_participants": (json!({})),
"type": "",
"updated_at": "",
"user": json!({})
}),
"parent_id": "",
"reaction": json!({}),
"reason": "",
"team": "",
"type": "",
"user": json!({}),
"user_id": "",
"watcher_count": ""
})});
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}}/channels/:type/:id/event \
--header 'content-type: application/json' \
--data '{
"event": {
"automoderation": false,
"automoderation_scores": {
"action": "",
"explicit": "",
"spam": "",
"toxic": ""
},
"channel": {
"auto_translation_enabled": false,
"auto_translation_language": "",
"cid": "",
"config": {
"automod": "",
"automod_behavior": "",
"automod_thresholds": {
"explicit": {
"block": "",
"flag": ""
},
"spam": {},
"toxic": {}
},
"blocklist": "",
"blocklist_behavior": "",
"commands": [
{
"args": "",
"description": "",
"name": "",
"set": ""
}
],
"connect_events": false,
"created_at": "",
"custom_events": false,
"grants": {},
"max_message_length": "",
"message_retention": "",
"mutes": false,
"name": "",
"push_notifications": false,
"quotes": false,
"reactions": false,
"read_events": false,
"reminders": false,
"replies": false,
"search": false,
"typing_events": false,
"updated_at": "",
"uploads": false,
"url_enrichment": false
},
"cooldown": "",
"created_at": "",
"created_by": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"deleted_at": "",
"disabled": false,
"frozen": false,
"hidden": false,
"hide_messages_before": "",
"id": "",
"last_message_at": "",
"member_count": "",
"members": [
{
"ban_expires": "",
"banned": false,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": false,
"is_moderator": false,
"role": "",
"shadow_banned": false,
"updated_at": "",
"user": {},
"user_id": ""
}
],
"mute_expires_at": "",
"muted": false,
"own_capabilities": [],
"team": "",
"truncated_at": "",
"truncated_by": {},
"type": "",
"updated_at": ""
},
"channel_id": "",
"channel_type": "",
"cid": "",
"connection_id": "",
"created_at": "",
"created_by": {},
"me": {
"banned": false,
"channel_mutes": [
{
"channel": {},
"created_at": "",
"expires": "",
"updated_at": "",
"user": {}
}
],
"created_at": "",
"deactivated_at": "",
"deleted_at": "",
"devices": [
{
"created_at": "",
"disabled": false,
"disabled_reason": "",
"id": "",
"push_provider": "",
"push_provider_name": "",
"user_id": ""
}
],
"id": "",
"invisible": false,
"language": "",
"last_active": "",
"latest_hidden_channels": [],
"mutes": [
{
"created_at": "",
"expires": "",
"target": {},
"updated_at": "",
"user": {}
}
],
"online": false,
"push_notifications": {},
"role": "",
"teams": [],
"total_unread_count": "",
"unread_channels": "",
"unread_count": "",
"updated_at": ""
},
"member": {},
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"before_message_send_failed": false,
"cid": "",
"command": "",
"created_at": "",
"deleted_at": "",
"html": "",
"i18n": {},
"id": "",
"image_labels": {},
"latest_reactions": [
{
"message_id": "",
"score": "",
"type": "",
"user": {},
"user_id": ""
}
],
"mentioned_users": [
{}
],
"mml": "",
"own_reactions": [
{}
],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": {},
"quoted_message": "",
"quoted_message_id": "",
"reaction_counts": {},
"reaction_scores": {},
"reply_count": "",
"shadowed": false,
"show_in_channel": false,
"silent": false,
"text": "",
"thread_participants": [
{}
],
"type": "",
"updated_at": "",
"user": {}
},
"parent_id": "",
"reaction": {},
"reason": "",
"team": "",
"type": "",
"user": {},
"user_id": "",
"watcher_count": ""
}
}'
echo '{
"event": {
"automoderation": false,
"automoderation_scores": {
"action": "",
"explicit": "",
"spam": "",
"toxic": ""
},
"channel": {
"auto_translation_enabled": false,
"auto_translation_language": "",
"cid": "",
"config": {
"automod": "",
"automod_behavior": "",
"automod_thresholds": {
"explicit": {
"block": "",
"flag": ""
},
"spam": {},
"toxic": {}
},
"blocklist": "",
"blocklist_behavior": "",
"commands": [
{
"args": "",
"description": "",
"name": "",
"set": ""
}
],
"connect_events": false,
"created_at": "",
"custom_events": false,
"grants": {},
"max_message_length": "",
"message_retention": "",
"mutes": false,
"name": "",
"push_notifications": false,
"quotes": false,
"reactions": false,
"read_events": false,
"reminders": false,
"replies": false,
"search": false,
"typing_events": false,
"updated_at": "",
"uploads": false,
"url_enrichment": false
},
"cooldown": "",
"created_at": "",
"created_by": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"deleted_at": "",
"disabled": false,
"frozen": false,
"hidden": false,
"hide_messages_before": "",
"id": "",
"last_message_at": "",
"member_count": "",
"members": [
{
"ban_expires": "",
"banned": false,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": false,
"is_moderator": false,
"role": "",
"shadow_banned": false,
"updated_at": "",
"user": {},
"user_id": ""
}
],
"mute_expires_at": "",
"muted": false,
"own_capabilities": [],
"team": "",
"truncated_at": "",
"truncated_by": {},
"type": "",
"updated_at": ""
},
"channel_id": "",
"channel_type": "",
"cid": "",
"connection_id": "",
"created_at": "",
"created_by": {},
"me": {
"banned": false,
"channel_mutes": [
{
"channel": {},
"created_at": "",
"expires": "",
"updated_at": "",
"user": {}
}
],
"created_at": "",
"deactivated_at": "",
"deleted_at": "",
"devices": [
{
"created_at": "",
"disabled": false,
"disabled_reason": "",
"id": "",
"push_provider": "",
"push_provider_name": "",
"user_id": ""
}
],
"id": "",
"invisible": false,
"language": "",
"last_active": "",
"latest_hidden_channels": [],
"mutes": [
{
"created_at": "",
"expires": "",
"target": {},
"updated_at": "",
"user": {}
}
],
"online": false,
"push_notifications": {},
"role": "",
"teams": [],
"total_unread_count": "",
"unread_channels": "",
"unread_count": "",
"updated_at": ""
},
"member": {},
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"before_message_send_failed": false,
"cid": "",
"command": "",
"created_at": "",
"deleted_at": "",
"html": "",
"i18n": {},
"id": "",
"image_labels": {},
"latest_reactions": [
{
"message_id": "",
"score": "",
"type": "",
"user": {},
"user_id": ""
}
],
"mentioned_users": [
{}
],
"mml": "",
"own_reactions": [
{}
],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": {},
"quoted_message": "",
"quoted_message_id": "",
"reaction_counts": {},
"reaction_scores": {},
"reply_count": "",
"shadowed": false,
"show_in_channel": false,
"silent": false,
"text": "",
"thread_participants": [
{}
],
"type": "",
"updated_at": "",
"user": {}
},
"parent_id": "",
"reaction": {},
"reason": "",
"team": "",
"type": "",
"user": {},
"user_id": "",
"watcher_count": ""
}
}' | \
http POST {{baseUrl}}/channels/:type/:id/event \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "event": {\n "automoderation": false,\n "automoderation_scores": {\n "action": "",\n "explicit": "",\n "spam": "",\n "toxic": ""\n },\n "channel": {\n "auto_translation_enabled": false,\n "auto_translation_language": "",\n "cid": "",\n "config": {\n "automod": "",\n "automod_behavior": "",\n "automod_thresholds": {\n "explicit": {\n "block": "",\n "flag": ""\n },\n "spam": {},\n "toxic": {}\n },\n "blocklist": "",\n "blocklist_behavior": "",\n "commands": [\n {\n "args": "",\n "description": "",\n "name": "",\n "set": ""\n }\n ],\n "connect_events": false,\n "created_at": "",\n "custom_events": false,\n "grants": {},\n "max_message_length": "",\n "message_retention": "",\n "mutes": false,\n "name": "",\n "push_notifications": false,\n "quotes": false,\n "reactions": false,\n "read_events": false,\n "reminders": false,\n "replies": false,\n "search": false,\n "typing_events": false,\n "updated_at": "",\n "uploads": false,\n "url_enrichment": false\n },\n "cooldown": "",\n "created_at": "",\n "created_by": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "deleted_at": "",\n "disabled": false,\n "frozen": false,\n "hidden": false,\n "hide_messages_before": "",\n "id": "",\n "last_message_at": "",\n "member_count": "",\n "members": [\n {\n "ban_expires": "",\n "banned": false,\n "channel_role": "",\n "created_at": "",\n "deleted_at": "",\n "invite_accepted_at": "",\n "invite_rejected_at": "",\n "invited": false,\n "is_moderator": false,\n "role": "",\n "shadow_banned": false,\n "updated_at": "",\n "user": {},\n "user_id": ""\n }\n ],\n "mute_expires_at": "",\n "muted": false,\n "own_capabilities": [],\n "team": "",\n "truncated_at": "",\n "truncated_by": {},\n "type": "",\n "updated_at": ""\n },\n "channel_id": "",\n "channel_type": "",\n "cid": "",\n "connection_id": "",\n "created_at": "",\n "created_by": {},\n "me": {\n "banned": false,\n "channel_mutes": [\n {\n "channel": {},\n "created_at": "",\n "expires": "",\n "updated_at": "",\n "user": {}\n }\n ],\n "created_at": "",\n "deactivated_at": "",\n "deleted_at": "",\n "devices": [\n {\n "created_at": "",\n "disabled": false,\n "disabled_reason": "",\n "id": "",\n "push_provider": "",\n "push_provider_name": "",\n "user_id": ""\n }\n ],\n "id": "",\n "invisible": false,\n "language": "",\n "last_active": "",\n "latest_hidden_channels": [],\n "mutes": [\n {\n "created_at": "",\n "expires": "",\n "target": {},\n "updated_at": "",\n "user": {}\n }\n ],\n "online": false,\n "push_notifications": {},\n "role": "",\n "teams": [],\n "total_unread_count": "",\n "unread_channels": "",\n "unread_count": "",\n "updated_at": ""\n },\n "member": {},\n "message": {\n "attachments": [\n {\n "actions": [\n {\n "name": "",\n "style": "",\n "text": "",\n "type": "",\n "value": ""\n }\n ],\n "asset_url": "",\n "author_icon": "",\n "author_link": "",\n "author_name": "",\n "color": "",\n "fallback": "",\n "fields": [\n {\n "short": false,\n "title": "",\n "value": ""\n }\n ],\n "footer": "",\n "footer_icon": "",\n "giphy": {\n "fixed_height": {\n "frames": "",\n "height": "",\n "size": "",\n "url": "",\n "width": ""\n },\n "fixed_height_downsampled": {},\n "fixed_height_still": {},\n "fixed_width": {},\n "fixed_width_downsampled": {},\n "fixed_width_still": {},\n "original": {}\n },\n "image_url": "",\n "og_scrape_url": "",\n "original_height": "",\n "original_width": "",\n "pretext": "",\n "text": "",\n "thumb_url": "",\n "title": "",\n "title_link": "",\n "type": ""\n }\n ],\n "before_message_send_failed": false,\n "cid": "",\n "command": "",\n "created_at": "",\n "deleted_at": "",\n "html": "",\n "i18n": {},\n "id": "",\n "image_labels": {},\n "latest_reactions": [\n {\n "message_id": "",\n "score": "",\n "type": "",\n "user": {},\n "user_id": ""\n }\n ],\n "mentioned_users": [\n {}\n ],\n "mml": "",\n "own_reactions": [\n {}\n ],\n "parent_id": "",\n "pin_expires": "",\n "pinned": false,\n "pinned_at": "",\n "pinned_by": {},\n "quoted_message": "",\n "quoted_message_id": "",\n "reaction_counts": {},\n "reaction_scores": {},\n "reply_count": "",\n "shadowed": false,\n "show_in_channel": false,\n "silent": false,\n "text": "",\n "thread_participants": [\n {}\n ],\n "type": "",\n "updated_at": "",\n "user": {}\n },\n "parent_id": "",\n "reaction": {},\n "reason": "",\n "team": "",\n "type": "",\n "user": {},\n "user_id": "",\n "watcher_count": ""\n }\n}' \
--output-document \
- {{baseUrl}}/channels/:type/:id/event
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["event": [
"automoderation": false,
"automoderation_scores": [
"action": "",
"explicit": "",
"spam": "",
"toxic": ""
],
"channel": [
"auto_translation_enabled": false,
"auto_translation_language": "",
"cid": "",
"config": [
"automod": "",
"automod_behavior": "",
"automod_thresholds": [
"explicit": [
"block": "",
"flag": ""
],
"spam": [],
"toxic": []
],
"blocklist": "",
"blocklist_behavior": "",
"commands": [
[
"args": "",
"description": "",
"name": "",
"set": ""
]
],
"connect_events": false,
"created_at": "",
"custom_events": false,
"grants": [],
"max_message_length": "",
"message_retention": "",
"mutes": false,
"name": "",
"push_notifications": false,
"quotes": false,
"reactions": false,
"read_events": false,
"reminders": false,
"replies": false,
"search": false,
"typing_events": false,
"updated_at": "",
"uploads": false,
"url_enrichment": false
],
"cooldown": "",
"created_at": "",
"created_by": [
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": [
"disabled": false,
"disabled_until": ""
],
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
],
"deleted_at": "",
"disabled": false,
"frozen": false,
"hidden": false,
"hide_messages_before": "",
"id": "",
"last_message_at": "",
"member_count": "",
"members": [
[
"ban_expires": "",
"banned": false,
"channel_role": "",
"created_at": "",
"deleted_at": "",
"invite_accepted_at": "",
"invite_rejected_at": "",
"invited": false,
"is_moderator": false,
"role": "",
"shadow_banned": false,
"updated_at": "",
"user": [],
"user_id": ""
]
],
"mute_expires_at": "",
"muted": false,
"own_capabilities": [],
"team": "",
"truncated_at": "",
"truncated_by": [],
"type": "",
"updated_at": ""
],
"channel_id": "",
"channel_type": "",
"cid": "",
"connection_id": "",
"created_at": "",
"created_by": [],
"me": [
"banned": false,
"channel_mutes": [
[
"channel": [],
"created_at": "",
"expires": "",
"updated_at": "",
"user": []
]
],
"created_at": "",
"deactivated_at": "",
"deleted_at": "",
"devices": [
[
"created_at": "",
"disabled": false,
"disabled_reason": "",
"id": "",
"push_provider": "",
"push_provider_name": "",
"user_id": ""
]
],
"id": "",
"invisible": false,
"language": "",
"last_active": "",
"latest_hidden_channels": [],
"mutes": [
[
"created_at": "",
"expires": "",
"target": [],
"updated_at": "",
"user": []
]
],
"online": false,
"push_notifications": [],
"role": "",
"teams": [],
"total_unread_count": "",
"unread_channels": "",
"unread_count": "",
"updated_at": ""
],
"member": [],
"message": [
"attachments": [
[
"actions": [
[
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
]
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
[
"short": false,
"title": "",
"value": ""
]
],
"footer": "",
"footer_icon": "",
"giphy": [
"fixed_height": [
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
],
"fixed_height_downsampled": [],
"fixed_height_still": [],
"fixed_width": [],
"fixed_width_downsampled": [],
"fixed_width_still": [],
"original": []
],
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
]
],
"before_message_send_failed": false,
"cid": "",
"command": "",
"created_at": "",
"deleted_at": "",
"html": "",
"i18n": [],
"id": "",
"image_labels": [],
"latest_reactions": [
[
"message_id": "",
"score": "",
"type": "",
"user": [],
"user_id": ""
]
],
"mentioned_users": [[]],
"mml": "",
"own_reactions": [[]],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": [],
"quoted_message": "",
"quoted_message_id": "",
"reaction_counts": [],
"reaction_scores": [],
"reply_count": "",
"shadowed": false,
"show_in_channel": false,
"silent": false,
"text": "",
"thread_participants": [[]],
"type": "",
"updated_at": "",
"user": []
],
"parent_id": "",
"reaction": [],
"reason": "",
"team": "",
"type": "",
"user": [],
"user_id": "",
"watcher_count": ""
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/channels/:type/:id/event")! 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
Send user event
{{baseUrl}}/users/:user_id/event
QUERY PARAMS
user_id
BODY json
{
"event": {
"created_at": "",
"type": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/users/:user_id/event");
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 \"event\": {\n \"created_at\": \"\",\n \"type\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/users/:user_id/event" {:content-type :json
:form-params {:event {:created_at ""
:type ""}}})
require "http/client"
url = "{{baseUrl}}/users/:user_id/event"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"event\": {\n \"created_at\": \"\",\n \"type\": \"\"\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/users/:user_id/event"),
Content = new StringContent("{\n \"event\": {\n \"created_at\": \"\",\n \"type\": \"\"\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/users/:user_id/event");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"event\": {\n \"created_at\": \"\",\n \"type\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/users/:user_id/event"
payload := strings.NewReader("{\n \"event\": {\n \"created_at\": \"\",\n \"type\": \"\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/users/:user_id/event HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 57
{
"event": {
"created_at": "",
"type": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/users/:user_id/event")
.setHeader("content-type", "application/json")
.setBody("{\n \"event\": {\n \"created_at\": \"\",\n \"type\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/users/:user_id/event"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"event\": {\n \"created_at\": \"\",\n \"type\": \"\"\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"event\": {\n \"created_at\": \"\",\n \"type\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/users/:user_id/event")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/users/:user_id/event")
.header("content-type", "application/json")
.body("{\n \"event\": {\n \"created_at\": \"\",\n \"type\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
event: {
created_at: '',
type: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/users/:user_id/event');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/users/:user_id/event',
headers: {'content-type': 'application/json'},
data: {event: {created_at: '', type: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/users/:user_id/event';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"event":{"created_at":"","type":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/users/:user_id/event',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "event": {\n "created_at": "",\n "type": ""\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"event\": {\n \"created_at\": \"\",\n \"type\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/users/:user_id/event")
.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/users/:user_id/event',
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({event: {created_at: '', type: ''}}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/users/:user_id/event',
headers: {'content-type': 'application/json'},
body: {event: {created_at: '', type: ''}},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/users/:user_id/event');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
event: {
created_at: '',
type: ''
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/users/:user_id/event',
headers: {'content-type': 'application/json'},
data: {event: {created_at: '', type: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/users/:user_id/event';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"event":{"created_at":"","type":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"event": @{ @"created_at": @"", @"type": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/users/:user_id/event"]
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}}/users/:user_id/event" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"event\": {\n \"created_at\": \"\",\n \"type\": \"\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/users/:user_id/event",
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([
'event' => [
'created_at' => '',
'type' => ''
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/users/:user_id/event', [
'body' => '{
"event": {
"created_at": "",
"type": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/users/:user_id/event');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'event' => [
'created_at' => '',
'type' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'event' => [
'created_at' => '',
'type' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/users/:user_id/event');
$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}}/users/:user_id/event' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"event": {
"created_at": "",
"type": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/users/:user_id/event' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"event": {
"created_at": "",
"type": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"event\": {\n \"created_at\": \"\",\n \"type\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/users/:user_id/event", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/users/:user_id/event"
payload = { "event": {
"created_at": "",
"type": ""
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/users/:user_id/event"
payload <- "{\n \"event\": {\n \"created_at\": \"\",\n \"type\": \"\"\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/users/:user_id/event")
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 \"event\": {\n \"created_at\": \"\",\n \"type\": \"\"\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/users/:user_id/event') do |req|
req.body = "{\n \"event\": {\n \"created_at\": \"\",\n \"type\": \"\"\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/users/:user_id/event";
let payload = json!({"event": json!({
"created_at": "",
"type": ""
})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/users/:user_id/event \
--header 'content-type: application/json' \
--data '{
"event": {
"created_at": "",
"type": ""
}
}'
echo '{
"event": {
"created_at": "",
"type": ""
}
}' | \
http POST {{baseUrl}}/users/:user_id/event \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "event": {\n "created_at": "",\n "type": ""\n }\n}' \
--output-document \
- {{baseUrl}}/users/:user_id/event
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["event": [
"created_at": "",
"type": ""
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/users/:user_id/event")! 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
Create import URL
{{baseUrl}}/import_urls
BODY json
{
"filename": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/import_urls");
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 \"filename\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/import_urls" {:content-type :json
:form-params {:filename ""}})
require "http/client"
url = "{{baseUrl}}/import_urls"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"filename\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/import_urls"),
Content = new StringContent("{\n \"filename\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/import_urls");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"filename\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/import_urls"
payload := strings.NewReader("{\n \"filename\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/import_urls HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 20
{
"filename": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/import_urls")
.setHeader("content-type", "application/json")
.setBody("{\n \"filename\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/import_urls"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"filename\": \"\"\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 \"filename\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/import_urls")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/import_urls")
.header("content-type", "application/json")
.body("{\n \"filename\": \"\"\n}")
.asString();
const data = JSON.stringify({
filename: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/import_urls');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/import_urls',
headers: {'content-type': 'application/json'},
data: {filename: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/import_urls';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"filename":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/import_urls',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "filename": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"filename\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/import_urls")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/import_urls',
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({filename: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/import_urls',
headers: {'content-type': 'application/json'},
body: {filename: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/import_urls');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
filename: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/import_urls',
headers: {'content-type': 'application/json'},
data: {filename: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/import_urls';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"filename":""}'
};
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 = @{ @"filename": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/import_urls"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/import_urls" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"filename\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/import_urls",
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([
'filename' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/import_urls', [
'body' => '{
"filename": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/import_urls');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'filename' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'filename' => ''
]));
$request->setRequestUrl('{{baseUrl}}/import_urls');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/import_urls' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"filename": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/import_urls' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"filename": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"filename\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/import_urls", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/import_urls"
payload = { "filename": "" }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/import_urls"
payload <- "{\n \"filename\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/import_urls")
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 \"filename\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/import_urls') do |req|
req.body = "{\n \"filename\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/import_urls";
let payload = json!({"filename": ""});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/import_urls \
--header 'content-type: application/json' \
--data '{
"filename": ""
}'
echo '{
"filename": ""
}' | \
http POST {{baseUrl}}/import_urls \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "filename": ""\n}' \
--output-document \
- {{baseUrl}}/import_urls
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["filename": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/import_urls")! 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
Create import
{{baseUrl}}/imports
BODY json
{
"mode": "",
"path": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/imports");
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 \"mode\": \"\",\n \"path\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/imports" {:content-type :json
:form-params {:mode ""
:path ""}})
require "http/client"
url = "{{baseUrl}}/imports"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"mode\": \"\",\n \"path\": \"\"\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}}/imports"),
Content = new StringContent("{\n \"mode\": \"\",\n \"path\": \"\"\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}}/imports");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"mode\": \"\",\n \"path\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/imports"
payload := strings.NewReader("{\n \"mode\": \"\",\n \"path\": \"\"\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/imports HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 30
{
"mode": "",
"path": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/imports")
.setHeader("content-type", "application/json")
.setBody("{\n \"mode\": \"\",\n \"path\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/imports"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"mode\": \"\",\n \"path\": \"\"\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 \"mode\": \"\",\n \"path\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/imports")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/imports")
.header("content-type", "application/json")
.body("{\n \"mode\": \"\",\n \"path\": \"\"\n}")
.asString();
const data = JSON.stringify({
mode: '',
path: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/imports');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/imports',
headers: {'content-type': 'application/json'},
data: {mode: '', path: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/imports';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"mode":"","path":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/imports',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "mode": "",\n "path": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"mode\": \"\",\n \"path\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/imports")
.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/imports',
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({mode: '', path: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/imports',
headers: {'content-type': 'application/json'},
body: {mode: '', path: ''},
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}}/imports');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
mode: '',
path: ''
});
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}}/imports',
headers: {'content-type': 'application/json'},
data: {mode: '', path: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/imports';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"mode":"","path":""}'
};
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 = @{ @"mode": @"",
@"path": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/imports"]
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}}/imports" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"mode\": \"\",\n \"path\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/imports",
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([
'mode' => '',
'path' => ''
]),
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}}/imports', [
'body' => '{
"mode": "",
"path": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/imports');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'mode' => '',
'path' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'mode' => '',
'path' => ''
]));
$request->setRequestUrl('{{baseUrl}}/imports');
$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}}/imports' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"mode": "",
"path": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/imports' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"mode": "",
"path": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"mode\": \"\",\n \"path\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/imports", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/imports"
payload = {
"mode": "",
"path": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/imports"
payload <- "{\n \"mode\": \"\",\n \"path\": \"\"\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}}/imports")
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 \"mode\": \"\",\n \"path\": \"\"\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/imports') do |req|
req.body = "{\n \"mode\": \"\",\n \"path\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/imports";
let payload = json!({
"mode": "",
"path": ""
});
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}}/imports \
--header 'content-type: application/json' \
--data '{
"mode": "",
"path": ""
}'
echo '{
"mode": "",
"path": ""
}' | \
http POST {{baseUrl}}/imports \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "mode": "",\n "path": ""\n}' \
--output-document \
- {{baseUrl}}/imports
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"mode": "",
"path": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/imports")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Get import (GET)
{{baseUrl}}/imports/: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}}/imports/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/imports/:id")
require "http/client"
url = "{{baseUrl}}/imports/: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}}/imports/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/imports/:id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/imports/: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/imports/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/imports/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/imports/: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}}/imports/:id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/imports/: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}}/imports/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/imports/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/imports/: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}}/imports/:id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/imports/:id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/imports/: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}}/imports/: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}}/imports/: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}}/imports/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/imports/: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}}/imports/: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}}/imports/:id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/imports/: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}}/imports/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/imports/:id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/imports/:id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/imports/:id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/imports/:id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/imports/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/imports/:id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/imports/:id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/imports/: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/imports/:id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/imports/: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}}/imports/:id
http GET {{baseUrl}}/imports/:id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/imports/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/imports/: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
Get import
{{baseUrl}}/imports
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/imports");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/imports")
require "http/client"
url = "{{baseUrl}}/imports"
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}}/imports"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/imports");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/imports"
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/imports HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/imports")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/imports"))
.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}}/imports")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/imports")
.asString();
const 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}}/imports');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/imports'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/imports';
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}}/imports',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/imports")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/imports',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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}}/imports'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/imports');
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}}/imports'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/imports';
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}}/imports"]
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}}/imports" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/imports",
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}}/imports');
echo $response->getBody();
setUrl('{{baseUrl}}/imports');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/imports');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/imports' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/imports' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/imports")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/imports"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/imports"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/imports")
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/imports') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/imports";
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}}/imports
http GET {{baseUrl}}/imports
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/imports
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/imports")! 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()
DELETE
Delete file
{{baseUrl}}/channels/:type/:id/file
QUERY PARAMS
type
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/channels/:type/:id/file");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/channels/:type/:id/file")
require "http/client"
url = "{{baseUrl}}/channels/:type/:id/file"
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}}/channels/:type/:id/file"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/channels/:type/:id/file");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/channels/:type/:id/file"
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/channels/:type/:id/file HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/channels/:type/:id/file")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/channels/:type/:id/file"))
.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}}/channels/:type/:id/file")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/channels/:type/:id/file")
.asString();
const 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}}/channels/:type/:id/file');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/channels/:type/:id/file'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/channels/:type/:id/file';
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}}/channels/:type/:id/file',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/channels/:type/:id/file")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/channels/:type/:id/file',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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}}/channels/:type/:id/file'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/channels/:type/:id/file');
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}}/channels/:type/:id/file'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/channels/:type/:id/file';
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}}/channels/:type/:id/file"]
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}}/channels/:type/:id/file" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/channels/:type/:id/file",
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}}/channels/:type/:id/file');
echo $response->getBody();
setUrl('{{baseUrl}}/channels/:type/:id/file');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/channels/:type/:id/file');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/channels/:type/:id/file' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/channels/:type/:id/file' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/channels/:type/:id/file")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/channels/:type/:id/file"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/channels/:type/:id/file"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/channels/:type/:id/file")
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/channels/:type/:id/file') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/channels/:type/:id/file";
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}}/channels/:type/:id/file
http DELETE {{baseUrl}}/channels/:type/:id/file
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/channels/:type/:id/file
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/channels/:type/:id/file")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
Delete image
{{baseUrl}}/channels/:type/:id/image
QUERY PARAMS
type
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/channels/:type/:id/image");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/channels/:type/:id/image")
require "http/client"
url = "{{baseUrl}}/channels/:type/:id/image"
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}}/channels/:type/:id/image"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/channels/:type/:id/image");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/channels/:type/:id/image"
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/channels/:type/:id/image HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/channels/:type/:id/image")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/channels/:type/:id/image"))
.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}}/channels/:type/:id/image")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/channels/:type/:id/image")
.asString();
const 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}}/channels/:type/:id/image');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/channels/:type/:id/image'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/channels/:type/:id/image';
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}}/channels/:type/:id/image',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/channels/:type/:id/image")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/channels/:type/:id/image',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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}}/channels/:type/:id/image'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/channels/:type/:id/image');
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}}/channels/:type/:id/image'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/channels/:type/:id/image';
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}}/channels/:type/:id/image"]
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}}/channels/:type/:id/image" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/channels/:type/:id/image",
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}}/channels/:type/:id/image');
echo $response->getBody();
setUrl('{{baseUrl}}/channels/:type/:id/image');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/channels/:type/:id/image');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/channels/:type/:id/image' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/channels/:type/:id/image' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/channels/:type/:id/image")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/channels/:type/:id/image"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/channels/:type/:id/image"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/channels/:type/:id/image")
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/channels/:type/:id/image') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/channels/:type/:id/image";
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}}/channels/:type/:id/image
http DELETE {{baseUrl}}/channels/:type/:id/image
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/channels/:type/:id/image
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/channels/:type/:id/image")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
Delete message
{{baseUrl}}/messages/: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}}/messages/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/messages/:id")
require "http/client"
url = "{{baseUrl}}/messages/: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}}/messages/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/messages/:id");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/messages/: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/messages/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/messages/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/messages/: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}}/messages/:id")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/messages/: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}}/messages/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/messages/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/messages/: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}}/messages/:id',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/messages/: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/messages/: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}}/messages/: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}}/messages/: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}}/messages/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/messages/: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}}/messages/: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}}/messages/:id" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/messages/: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}}/messages/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/messages/:id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/messages/:id');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/messages/:id' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/messages/:id' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/messages/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/messages/:id"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/messages/:id"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/messages/: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/messages/: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}}/messages/: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}}/messages/:id
http DELETE {{baseUrl}}/messages/:id
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/messages/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/messages/: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()
DELETE
Delete reaction
{{baseUrl}}/messages/:id/reaction/:type
QUERY PARAMS
id
type
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/messages/:id/reaction/:type");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/messages/:id/reaction/:type")
require "http/client"
url = "{{baseUrl}}/messages/:id/reaction/:type"
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}}/messages/:id/reaction/:type"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/messages/:id/reaction/:type");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/messages/:id/reaction/:type"
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/messages/:id/reaction/:type HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/messages/:id/reaction/:type")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/messages/:id/reaction/:type"))
.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}}/messages/:id/reaction/:type")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/messages/:id/reaction/:type")
.asString();
const 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}}/messages/:id/reaction/:type');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/messages/:id/reaction/:type'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/messages/:id/reaction/:type';
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}}/messages/:id/reaction/:type',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/messages/:id/reaction/:type")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/messages/:id/reaction/:type',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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}}/messages/:id/reaction/:type'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/messages/:id/reaction/:type');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/messages/:id/reaction/:type'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/messages/:id/reaction/:type';
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}}/messages/:id/reaction/:type"]
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}}/messages/:id/reaction/:type" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/messages/:id/reaction/:type",
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}}/messages/:id/reaction/:type');
echo $response->getBody();
setUrl('{{baseUrl}}/messages/:id/reaction/:type');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/messages/:id/reaction/:type');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/messages/:id/reaction/:type' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/messages/:id/reaction/:type' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/messages/:id/reaction/:type")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/messages/:id/reaction/:type"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/messages/:id/reaction/:type"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/messages/:id/reaction/:type")
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/messages/:id/reaction/:type') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/messages/:id/reaction/:type";
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}}/messages/:id/reaction/:type
http DELETE {{baseUrl}}/messages/:id/reaction/:type
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/messages/:id/reaction/:type
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/messages/:id/reaction/:type")! 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
Get OG
{{baseUrl}}/og
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/og");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/og")
require "http/client"
url = "{{baseUrl}}/og"
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}}/og"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/og");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/og"
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/og HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/og")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/og"))
.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}}/og")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/og")
.asString();
const 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}}/og');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/og'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/og';
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}}/og',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/og")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/og',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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}}/og'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/og');
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}}/og'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/og';
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}}/og"]
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}}/og" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/og",
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}}/og');
echo $response->getBody();
setUrl('{{baseUrl}}/og');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/og');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/og' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/og' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/og")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/og"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/og"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/og")
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/og') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/og";
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}}/og
http GET {{baseUrl}}/og
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/og
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/og")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Get many messages
{{baseUrl}}/channels/:type/:id/messages
QUERY PARAMS
type
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/channels/:type/:id/messages");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/channels/:type/:id/messages")
require "http/client"
url = "{{baseUrl}}/channels/:type/:id/messages"
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}}/channels/:type/:id/messages"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/channels/:type/:id/messages");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/channels/:type/:id/messages"
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/channels/:type/:id/messages HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/channels/:type/:id/messages")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/channels/:type/:id/messages"))
.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}}/channels/:type/:id/messages")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/channels/:type/:id/messages")
.asString();
const 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}}/channels/:type/:id/messages');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/channels/:type/:id/messages'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/channels/:type/:id/messages';
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}}/channels/:type/:id/messages',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/channels/:type/:id/messages")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/channels/:type/:id/messages',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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}}/channels/:type/:id/messages'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/channels/:type/:id/messages');
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}}/channels/:type/:id/messages'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/channels/:type/:id/messages';
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}}/channels/:type/:id/messages"]
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}}/channels/:type/:id/messages" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/channels/:type/:id/messages",
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}}/channels/:type/:id/messages');
echo $response->getBody();
setUrl('{{baseUrl}}/channels/:type/:id/messages');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/channels/:type/:id/messages');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/channels/:type/:id/messages' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/channels/:type/:id/messages' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/channels/:type/:id/messages")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/channels/:type/:id/messages"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/channels/:type/:id/messages"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/channels/:type/:id/messages")
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/channels/:type/:id/messages') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/channels/:type/:id/messages";
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}}/channels/:type/:id/messages
http GET {{baseUrl}}/channels/:type/:id/messages
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/channels/:type/:id/messages
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/channels/:type/:id/messages")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Get message
{{baseUrl}}/messages/: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}}/messages/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/messages/:id")
require "http/client"
url = "{{baseUrl}}/messages/: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}}/messages/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/messages/:id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/messages/: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/messages/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/messages/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/messages/: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}}/messages/:id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/messages/: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}}/messages/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/messages/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/messages/: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}}/messages/:id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/messages/:id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/messages/: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}}/messages/: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}}/messages/: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}}/messages/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/messages/: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}}/messages/: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}}/messages/:id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/messages/: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}}/messages/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/messages/:id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/messages/:id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/messages/:id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/messages/:id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/messages/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/messages/:id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/messages/:id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/messages/: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/messages/:id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/messages/: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}}/messages/:id
http GET {{baseUrl}}/messages/:id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/messages/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/messages/: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
Get reactions
{{baseUrl}}/messages/:id/reactions
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/messages/:id/reactions");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/messages/:id/reactions")
require "http/client"
url = "{{baseUrl}}/messages/:id/reactions"
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}}/messages/:id/reactions"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/messages/:id/reactions");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/messages/:id/reactions"
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/messages/:id/reactions HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/messages/:id/reactions")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/messages/:id/reactions"))
.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}}/messages/:id/reactions")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/messages/:id/reactions")
.asString();
const 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}}/messages/:id/reactions');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/messages/:id/reactions'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/messages/:id/reactions';
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}}/messages/:id/reactions',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/messages/:id/reactions")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/messages/:id/reactions',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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}}/messages/:id/reactions'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/messages/:id/reactions');
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}}/messages/:id/reactions'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/messages/:id/reactions';
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}}/messages/:id/reactions"]
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}}/messages/:id/reactions" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/messages/:id/reactions",
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}}/messages/:id/reactions');
echo $response->getBody();
setUrl('{{baseUrl}}/messages/:id/reactions');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/messages/:id/reactions');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/messages/:id/reactions' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/messages/:id/reactions' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/messages/:id/reactions")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/messages/:id/reactions"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/messages/:id/reactions"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/messages/:id/reactions")
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/messages/:id/reactions') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/messages/:id/reactions";
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}}/messages/:id/reactions
http GET {{baseUrl}}/messages/:id/reactions
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/messages/:id/reactions
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/messages/:id/reactions")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Get replies
{{baseUrl}}/messages/:parent_id/replies
QUERY PARAMS
parent_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/messages/:parent_id/replies");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/messages/:parent_id/replies")
require "http/client"
url = "{{baseUrl}}/messages/:parent_id/replies"
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}}/messages/:parent_id/replies"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/messages/:parent_id/replies");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/messages/:parent_id/replies"
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/messages/:parent_id/replies HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/messages/:parent_id/replies")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/messages/:parent_id/replies"))
.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}}/messages/:parent_id/replies")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/messages/:parent_id/replies")
.asString();
const 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}}/messages/:parent_id/replies');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/messages/:parent_id/replies'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/messages/:parent_id/replies';
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}}/messages/:parent_id/replies',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/messages/:parent_id/replies")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/messages/:parent_id/replies',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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}}/messages/:parent_id/replies'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/messages/:parent_id/replies');
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}}/messages/:parent_id/replies'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/messages/:parent_id/replies';
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}}/messages/:parent_id/replies"]
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}}/messages/:parent_id/replies" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/messages/:parent_id/replies",
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}}/messages/:parent_id/replies');
echo $response->getBody();
setUrl('{{baseUrl}}/messages/:parent_id/replies');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/messages/:parent_id/replies');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/messages/:parent_id/replies' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/messages/:parent_id/replies' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/messages/:parent_id/replies")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/messages/:parent_id/replies"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/messages/:parent_id/replies"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/messages/:parent_id/replies")
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/messages/:parent_id/replies') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/messages/:parent_id/replies";
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}}/messages/:parent_id/replies
http GET {{baseUrl}}/messages/:parent_id/replies
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/messages/:parent_id/replies
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/messages/:parent_id/replies")! 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
Partially message update
{{baseUrl}}/messages/:id
QUERY PARAMS
id
BODY json
{
"set": {},
"skip_enrich_url": false,
"unset": [],
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/messages/: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 \"set\": {},\n \"skip_enrich_url\": false,\n \"unset\": [],\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/messages/:id" {:content-type :json
:form-params {:set {}
:skip_enrich_url false
:unset []
:user {:ban_expires ""
:banned false
:id ""
:invisible false
:language ""
:push_notifications {:disabled false
:disabled_until ""}
:revoke_tokens_issued_before ""
:role ""
:teams []}
:user_id ""}})
require "http/client"
url = "{{baseUrl}}/messages/:id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"set\": {},\n \"skip_enrich_url\": false,\n \"unset\": [],\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/messages/:id"),
Content = new StringContent("{\n \"set\": {},\n \"skip_enrich_url\": false,\n \"unset\": [],\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/messages/:id");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"set\": {},\n \"skip_enrich_url\": false,\n \"unset\": [],\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/messages/:id"
payload := strings.NewReader("{\n \"set\": {},\n \"skip_enrich_url\": false,\n \"unset\": [],\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/messages/:id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 352
{
"set": {},
"skip_enrich_url": false,
"unset": [],
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/messages/:id")
.setHeader("content-type", "application/json")
.setBody("{\n \"set\": {},\n \"skip_enrich_url\": false,\n \"unset\": [],\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/messages/:id"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"set\": {},\n \"skip_enrich_url\": false,\n \"unset\": [],\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"set\": {},\n \"skip_enrich_url\": false,\n \"unset\": [],\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/messages/:id")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/messages/:id")
.header("content-type", "application/json")
.body("{\n \"set\": {},\n \"skip_enrich_url\": false,\n \"unset\": [],\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
.asString();
const data = JSON.stringify({
set: {},
skip_enrich_url: false,
unset: [],
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/messages/:id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/messages/:id',
headers: {'content-type': 'application/json'},
data: {
set: {},
skip_enrich_url: false,
unset: [],
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/messages/:id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"set":{},"skip_enrich_url":false,"unset":[],"user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/messages/:id',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "set": {},\n "skip_enrich_url": false,\n "unset": [],\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"set\": {},\n \"skip_enrich_url\": false,\n \"unset\": [],\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/messages/: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/messages/: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({
set: {},
skip_enrich_url: false,
unset: [],
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/messages/:id',
headers: {'content-type': 'application/json'},
body: {
set: {},
skip_enrich_url: false,
unset: [],
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/messages/:id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
set: {},
skip_enrich_url: false,
unset: [],
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/messages/:id',
headers: {'content-type': 'application/json'},
data: {
set: {},
skip_enrich_url: false,
unset: [],
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/messages/:id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"set":{},"skip_enrich_url":false,"unset":[],"user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"set": @{ },
@"skip_enrich_url": @NO,
@"unset": @[ ],
@"user": @{ @"ban_expires": @"", @"banned": @NO, @"id": @"", @"invisible": @NO, @"language": @"", @"push_notifications": @{ @"disabled": @NO, @"disabled_until": @"" }, @"revoke_tokens_issued_before": @"", @"role": @"", @"teams": @[ ] },
@"user_id": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/messages/: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}}/messages/:id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"set\": {},\n \"skip_enrich_url\": false,\n \"unset\": [],\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/messages/: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([
'set' => [
],
'skip_enrich_url' => null,
'unset' => [
],
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/messages/:id', [
'body' => '{
"set": {},
"skip_enrich_url": false,
"unset": [],
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/messages/:id');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'set' => [
],
'skip_enrich_url' => null,
'unset' => [
],
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'set' => [
],
'skip_enrich_url' => null,
'unset' => [
],
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]));
$request->setRequestUrl('{{baseUrl}}/messages/: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}}/messages/:id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"set": {},
"skip_enrich_url": false,
"unset": [],
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/messages/:id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"set": {},
"skip_enrich_url": false,
"unset": [],
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"set\": {},\n \"skip_enrich_url\": false,\n \"unset\": [],\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/messages/:id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/messages/:id"
payload = {
"set": {},
"skip_enrich_url": False,
"unset": [],
"user": {
"ban_expires": "",
"banned": False,
"id": "",
"invisible": False,
"language": "",
"push_notifications": {
"disabled": False,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/messages/:id"
payload <- "{\n \"set\": {},\n \"skip_enrich_url\": false,\n \"unset\": [],\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/messages/: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 \"set\": {},\n \"skip_enrich_url\": false,\n \"unset\": [],\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/messages/:id') do |req|
req.body = "{\n \"set\": {},\n \"skip_enrich_url\": false,\n \"unset\": [],\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/messages/:id";
let payload = json!({
"set": json!({}),
"skip_enrich_url": false,
"unset": (),
"user": json!({
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": json!({
"disabled": false,
"disabled_until": ""
}),
"revoke_tokens_issued_before": "",
"role": "",
"teams": ()
}),
"user_id": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/messages/:id \
--header 'content-type: application/json' \
--data '{
"set": {},
"skip_enrich_url": false,
"unset": [],
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
echo '{
"set": {},
"skip_enrich_url": false,
"unset": [],
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}' | \
http PUT {{baseUrl}}/messages/:id \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "set": {},\n "skip_enrich_url": false,\n "unset": [],\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n}' \
--output-document \
- {{baseUrl}}/messages/:id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"set": [],
"skip_enrich_url": false,
"unset": [],
"user": [
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": [
"disabled": false,
"disabled_until": ""
],
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
],
"user_id": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/messages/: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
Query Message Flags
{{baseUrl}}/moderation/flags/message
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/moderation/flags/message");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/moderation/flags/message")
require "http/client"
url = "{{baseUrl}}/moderation/flags/message"
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}}/moderation/flags/message"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/moderation/flags/message");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/moderation/flags/message"
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/moderation/flags/message HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/moderation/flags/message")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/moderation/flags/message"))
.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}}/moderation/flags/message")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/moderation/flags/message")
.asString();
const 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}}/moderation/flags/message');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/moderation/flags/message'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/moderation/flags/message';
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}}/moderation/flags/message',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/moderation/flags/message")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/moderation/flags/message',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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}}/moderation/flags/message'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/moderation/flags/message');
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}}/moderation/flags/message'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/moderation/flags/message';
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}}/moderation/flags/message"]
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}}/moderation/flags/message" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/moderation/flags/message",
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}}/moderation/flags/message');
echo $response->getBody();
setUrl('{{baseUrl}}/moderation/flags/message');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/moderation/flags/message');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/moderation/flags/message' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/moderation/flags/message' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/moderation/flags/message")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/moderation/flags/message"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/moderation/flags/message"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/moderation/flags/message")
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/moderation/flags/message') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/moderation/flags/message";
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}}/moderation/flags/message
http GET {{baseUrl}}/moderation/flags/message
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/moderation/flags/message
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/moderation/flags/message")! 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
Run message command action
{{baseUrl}}/messages/:id/action
QUERY PARAMS
id
BODY json
{
"ID": "",
"form_data": {},
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/messages/:id/action");
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 \"form_data\": {},\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/messages/:id/action" {:content-type :json
:form-params {:ID ""
:form_data {}
:user {:ban_expires ""
:banned false
:id ""
:invisible false
:language ""
:push_notifications {:disabled false
:disabled_until ""}
:revoke_tokens_issued_before ""
:role ""
:teams []}
:user_id ""}})
require "http/client"
url = "{{baseUrl}}/messages/:id/action"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"ID\": \"\",\n \"form_data\": {},\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/messages/:id/action"),
Content = new StringContent("{\n \"ID\": \"\",\n \"form_data\": {},\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/messages/:id/action");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"ID\": \"\",\n \"form_data\": {},\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/messages/:id/action"
payload := strings.NewReader("{\n \"ID\": \"\",\n \"form_data\": {},\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/messages/:id/action HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 327
{
"ID": "",
"form_data": {},
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/messages/:id/action")
.setHeader("content-type", "application/json")
.setBody("{\n \"ID\": \"\",\n \"form_data\": {},\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/messages/:id/action"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"ID\": \"\",\n \"form_data\": {},\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"ID\": \"\",\n \"form_data\": {},\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/messages/:id/action")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/messages/:id/action")
.header("content-type", "application/json")
.body("{\n \"ID\": \"\",\n \"form_data\": {},\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
.asString();
const data = JSON.stringify({
ID: '',
form_data: {},
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/messages/:id/action');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/messages/:id/action',
headers: {'content-type': 'application/json'},
data: {
ID: '',
form_data: {},
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/messages/:id/action';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"ID":"","form_data":{},"user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/messages/:id/action',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "ID": "",\n "form_data": {},\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"ID\": \"\",\n \"form_data\": {},\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/messages/:id/action")
.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/messages/:id/action',
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: '',
form_data: {},
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/messages/:id/action',
headers: {'content-type': 'application/json'},
body: {
ID: '',
form_data: {},
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/messages/:id/action');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
ID: '',
form_data: {},
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/messages/:id/action',
headers: {'content-type': 'application/json'},
data: {
ID: '',
form_data: {},
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/messages/:id/action';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"ID":"","form_data":{},"user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"ID": @"",
@"form_data": @{ },
@"user": @{ @"ban_expires": @"", @"banned": @NO, @"id": @"", @"invisible": @NO, @"language": @"", @"push_notifications": @{ @"disabled": @NO, @"disabled_until": @"" }, @"revoke_tokens_issued_before": @"", @"role": @"", @"teams": @[ ] },
@"user_id": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/messages/:id/action"]
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}}/messages/:id/action" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"ID\": \"\",\n \"form_data\": {},\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/messages/:id/action",
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' => '',
'form_data' => [
],
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/messages/:id/action', [
'body' => '{
"ID": "",
"form_data": {},
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/messages/:id/action');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'ID' => '',
'form_data' => [
],
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'ID' => '',
'form_data' => [
],
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]));
$request->setRequestUrl('{{baseUrl}}/messages/:id/action');
$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}}/messages/:id/action' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"ID": "",
"form_data": {},
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/messages/:id/action' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"ID": "",
"form_data": {},
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"ID\": \"\",\n \"form_data\": {},\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/messages/:id/action", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/messages/:id/action"
payload = {
"ID": "",
"form_data": {},
"user": {
"ban_expires": "",
"banned": False,
"id": "",
"invisible": False,
"language": "",
"push_notifications": {
"disabled": False,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/messages/:id/action"
payload <- "{\n \"ID\": \"\",\n \"form_data\": {},\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/messages/:id/action")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"ID\": \"\",\n \"form_data\": {},\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/messages/:id/action') do |req|
req.body = "{\n \"ID\": \"\",\n \"form_data\": {},\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/messages/:id/action";
let payload = json!({
"ID": "",
"form_data": json!({}),
"user": json!({
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": json!({
"disabled": false,
"disabled_until": ""
}),
"revoke_tokens_issued_before": "",
"role": "",
"teams": ()
}),
"user_id": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/messages/:id/action \
--header 'content-type: application/json' \
--data '{
"ID": "",
"form_data": {},
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
echo '{
"ID": "",
"form_data": {},
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}' | \
http POST {{baseUrl}}/messages/:id/action \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "ID": "",\n "form_data": {},\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n}' \
--output-document \
- {{baseUrl}}/messages/:id/action
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"ID": "",
"form_data": [],
"user": [
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": [
"disabled": false,
"disabled_until": ""
],
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
],
"user_id": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/messages/:id/action")! 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
Send new message
{{baseUrl}}/channels/:type/:id/message
QUERY PARAMS
type
id
BODY json
{
"force_moderation": false,
"is_pending_message": false,
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"cid": [],
"html": "",
"id": "",
"mentioned_users": [],
"mml": "",
"parent": [],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": [],
"quoted_message_id": "",
"reaction_scores": [],
"show_in_channel": false,
"silent": false,
"text": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
},
"pending_message_metadata": {},
"skip_enrich_url": false,
"skip_push": false
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/channels/:type/:id/message");
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 \"force_moderation\": false,\n \"is_pending_message\": false,\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"pending_message_metadata\": {},\n \"skip_enrich_url\": false,\n \"skip_push\": false\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/channels/:type/:id/message" {:content-type :json
:form-params {:force_moderation false
:is_pending_message false
:message {:attachments [{:actions [{:name ""
:style ""
:text ""
:type ""
:value ""}]
:asset_url ""
:author_icon ""
:author_link ""
:author_name ""
:color ""
:fallback ""
:fields [{:short false
:title ""
:value ""}]
:footer ""
:footer_icon ""
:giphy {:fixed_height {:frames ""
:height ""
:size ""
:url ""
:width ""}
:fixed_height_downsampled {}
:fixed_height_still {}
:fixed_width {}
:fixed_width_downsampled {}
:fixed_width_still {}
:original {}}
:image_url ""
:og_scrape_url ""
:original_height ""
:original_width ""
:pretext ""
:text ""
:thumb_url ""
:title ""
:title_link ""
:type ""}]
:cid []
:html ""
:id ""
:mentioned_users []
:mml ""
:parent []
:parent_id ""
:pin_expires ""
:pinned false
:pinned_at ""
:pinned_by []
:quoted_message_id ""
:reaction_scores []
:show_in_channel false
:silent false
:text ""
:user {:ban_expires ""
:banned false
:id ""
:invisible false
:language ""
:push_notifications {:disabled false
:disabled_until ""}
:revoke_tokens_issued_before ""
:role ""
:teams []}
:user_id ""}
:pending_message_metadata {}
:skip_enrich_url false
:skip_push false}})
require "http/client"
url = "{{baseUrl}}/channels/:type/:id/message"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"force_moderation\": false,\n \"is_pending_message\": false,\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"pending_message_metadata\": {},\n \"skip_enrich_url\": false,\n \"skip_push\": false\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/channels/:type/:id/message"),
Content = new StringContent("{\n \"force_moderation\": false,\n \"is_pending_message\": false,\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"pending_message_metadata\": {},\n \"skip_enrich_url\": false,\n \"skip_push\": false\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/channels/:type/:id/message");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"force_moderation\": false,\n \"is_pending_message\": false,\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"pending_message_metadata\": {},\n \"skip_enrich_url\": false,\n \"skip_push\": false\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/channels/:type/:id/message"
payload := strings.NewReader("{\n \"force_moderation\": false,\n \"is_pending_message\": false,\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"pending_message_metadata\": {},\n \"skip_enrich_url\": false,\n \"skip_push\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/channels/:type/:id/message HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 2028
{
"force_moderation": false,
"is_pending_message": false,
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"cid": [],
"html": "",
"id": "",
"mentioned_users": [],
"mml": "",
"parent": [],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": [],
"quoted_message_id": "",
"reaction_scores": [],
"show_in_channel": false,
"silent": false,
"text": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
},
"pending_message_metadata": {},
"skip_enrich_url": false,
"skip_push": false
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/channels/:type/:id/message")
.setHeader("content-type", "application/json")
.setBody("{\n \"force_moderation\": false,\n \"is_pending_message\": false,\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"pending_message_metadata\": {},\n \"skip_enrich_url\": false,\n \"skip_push\": false\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/channels/:type/:id/message"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"force_moderation\": false,\n \"is_pending_message\": false,\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"pending_message_metadata\": {},\n \"skip_enrich_url\": false,\n \"skip_push\": false\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"force_moderation\": false,\n \"is_pending_message\": false,\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"pending_message_metadata\": {},\n \"skip_enrich_url\": false,\n \"skip_push\": false\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/channels/:type/:id/message")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/channels/:type/:id/message")
.header("content-type", "application/json")
.body("{\n \"force_moderation\": false,\n \"is_pending_message\": false,\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"pending_message_metadata\": {},\n \"skip_enrich_url\": false,\n \"skip_push\": false\n}")
.asString();
const data = JSON.stringify({
force_moderation: false,
is_pending_message: false,
message: {
attachments: [
{
actions: [
{
name: '',
style: '',
text: '',
type: '',
value: ''
}
],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [
{
short: false,
title: '',
value: ''
}
],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {
frames: '',
height: '',
size: '',
url: '',
width: ''
},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
cid: [],
html: '',
id: '',
mentioned_users: [],
mml: '',
parent: [],
parent_id: '',
pin_expires: '',
pinned: false,
pinned_at: '',
pinned_by: [],
quoted_message_id: '',
reaction_scores: [],
show_in_channel: false,
silent: false,
text: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
pending_message_metadata: {},
skip_enrich_url: false,
skip_push: false
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/channels/:type/:id/message');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:type/:id/message',
headers: {'content-type': 'application/json'},
data: {
force_moderation: false,
is_pending_message: false,
message: {
attachments: [
{
actions: [{name: '', style: '', text: '', type: '', value: ''}],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [{short: false, title: '', value: ''}],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {frames: '', height: '', size: '', url: '', width: ''},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
cid: [],
html: '',
id: '',
mentioned_users: [],
mml: '',
parent: [],
parent_id: '',
pin_expires: '',
pinned: false,
pinned_at: '',
pinned_by: [],
quoted_message_id: '',
reaction_scores: [],
show_in_channel: false,
silent: false,
text: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
pending_message_metadata: {},
skip_enrich_url: false,
skip_push: false
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/channels/:type/:id/message';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"force_moderation":false,"is_pending_message":false,"message":{"attachments":[{"actions":[{"name":"","style":"","text":"","type":"","value":""}],"asset_url":"","author_icon":"","author_link":"","author_name":"","color":"","fallback":"","fields":[{"short":false,"title":"","value":""}],"footer":"","footer_icon":"","giphy":{"fixed_height":{"frames":"","height":"","size":"","url":"","width":""},"fixed_height_downsampled":{},"fixed_height_still":{},"fixed_width":{},"fixed_width_downsampled":{},"fixed_width_still":{},"original":{}},"image_url":"","og_scrape_url":"","original_height":"","original_width":"","pretext":"","text":"","thumb_url":"","title":"","title_link":"","type":""}],"cid":[],"html":"","id":"","mentioned_users":[],"mml":"","parent":[],"parent_id":"","pin_expires":"","pinned":false,"pinned_at":"","pinned_by":[],"quoted_message_id":"","reaction_scores":[],"show_in_channel":false,"silent":false,"text":"","user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""},"pending_message_metadata":{},"skip_enrich_url":false,"skip_push":false}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/channels/:type/:id/message',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "force_moderation": false,\n "is_pending_message": false,\n "message": {\n "attachments": [\n {\n "actions": [\n {\n "name": "",\n "style": "",\n "text": "",\n "type": "",\n "value": ""\n }\n ],\n "asset_url": "",\n "author_icon": "",\n "author_link": "",\n "author_name": "",\n "color": "",\n "fallback": "",\n "fields": [\n {\n "short": false,\n "title": "",\n "value": ""\n }\n ],\n "footer": "",\n "footer_icon": "",\n "giphy": {\n "fixed_height": {\n "frames": "",\n "height": "",\n "size": "",\n "url": "",\n "width": ""\n },\n "fixed_height_downsampled": {},\n "fixed_height_still": {},\n "fixed_width": {},\n "fixed_width_downsampled": {},\n "fixed_width_still": {},\n "original": {}\n },\n "image_url": "",\n "og_scrape_url": "",\n "original_height": "",\n "original_width": "",\n "pretext": "",\n "text": "",\n "thumb_url": "",\n "title": "",\n "title_link": "",\n "type": ""\n }\n ],\n "cid": [],\n "html": "",\n "id": "",\n "mentioned_users": [],\n "mml": "",\n "parent": [],\n "parent_id": "",\n "pin_expires": "",\n "pinned": false,\n "pinned_at": "",\n "pinned_by": [],\n "quoted_message_id": "",\n "reaction_scores": [],\n "show_in_channel": false,\n "silent": false,\n "text": "",\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n },\n "pending_message_metadata": {},\n "skip_enrich_url": false,\n "skip_push": false\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"force_moderation\": false,\n \"is_pending_message\": false,\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"pending_message_metadata\": {},\n \"skip_enrich_url\": false,\n \"skip_push\": false\n}")
val request = Request.Builder()
.url("{{baseUrl}}/channels/:type/:id/message")
.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/channels/:type/:id/message',
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({
force_moderation: false,
is_pending_message: false,
message: {
attachments: [
{
actions: [{name: '', style: '', text: '', type: '', value: ''}],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [{short: false, title: '', value: ''}],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {frames: '', height: '', size: '', url: '', width: ''},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
cid: [],
html: '',
id: '',
mentioned_users: [],
mml: '',
parent: [],
parent_id: '',
pin_expires: '',
pinned: false,
pinned_at: '',
pinned_by: [],
quoted_message_id: '',
reaction_scores: [],
show_in_channel: false,
silent: false,
text: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
pending_message_metadata: {},
skip_enrich_url: false,
skip_push: false
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:type/:id/message',
headers: {'content-type': 'application/json'},
body: {
force_moderation: false,
is_pending_message: false,
message: {
attachments: [
{
actions: [{name: '', style: '', text: '', type: '', value: ''}],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [{short: false, title: '', value: ''}],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {frames: '', height: '', size: '', url: '', width: ''},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
cid: [],
html: '',
id: '',
mentioned_users: [],
mml: '',
parent: [],
parent_id: '',
pin_expires: '',
pinned: false,
pinned_at: '',
pinned_by: [],
quoted_message_id: '',
reaction_scores: [],
show_in_channel: false,
silent: false,
text: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
pending_message_metadata: {},
skip_enrich_url: false,
skip_push: false
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/channels/:type/:id/message');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
force_moderation: false,
is_pending_message: false,
message: {
attachments: [
{
actions: [
{
name: '',
style: '',
text: '',
type: '',
value: ''
}
],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [
{
short: false,
title: '',
value: ''
}
],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {
frames: '',
height: '',
size: '',
url: '',
width: ''
},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
cid: [],
html: '',
id: '',
mentioned_users: [],
mml: '',
parent: [],
parent_id: '',
pin_expires: '',
pinned: false,
pinned_at: '',
pinned_by: [],
quoted_message_id: '',
reaction_scores: [],
show_in_channel: false,
silent: false,
text: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
pending_message_metadata: {},
skip_enrich_url: false,
skip_push: false
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:type/:id/message',
headers: {'content-type': 'application/json'},
data: {
force_moderation: false,
is_pending_message: false,
message: {
attachments: [
{
actions: [{name: '', style: '', text: '', type: '', value: ''}],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [{short: false, title: '', value: ''}],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {frames: '', height: '', size: '', url: '', width: ''},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
cid: [],
html: '',
id: '',
mentioned_users: [],
mml: '',
parent: [],
parent_id: '',
pin_expires: '',
pinned: false,
pinned_at: '',
pinned_by: [],
quoted_message_id: '',
reaction_scores: [],
show_in_channel: false,
silent: false,
text: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
pending_message_metadata: {},
skip_enrich_url: false,
skip_push: false
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/channels/:type/:id/message';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"force_moderation":false,"is_pending_message":false,"message":{"attachments":[{"actions":[{"name":"","style":"","text":"","type":"","value":""}],"asset_url":"","author_icon":"","author_link":"","author_name":"","color":"","fallback":"","fields":[{"short":false,"title":"","value":""}],"footer":"","footer_icon":"","giphy":{"fixed_height":{"frames":"","height":"","size":"","url":"","width":""},"fixed_height_downsampled":{},"fixed_height_still":{},"fixed_width":{},"fixed_width_downsampled":{},"fixed_width_still":{},"original":{}},"image_url":"","og_scrape_url":"","original_height":"","original_width":"","pretext":"","text":"","thumb_url":"","title":"","title_link":"","type":""}],"cid":[],"html":"","id":"","mentioned_users":[],"mml":"","parent":[],"parent_id":"","pin_expires":"","pinned":false,"pinned_at":"","pinned_by":[],"quoted_message_id":"","reaction_scores":[],"show_in_channel":false,"silent":false,"text":"","user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""},"pending_message_metadata":{},"skip_enrich_url":false,"skip_push":false}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"force_moderation": @NO,
@"is_pending_message": @NO,
@"message": @{ @"attachments": @[ @{ @"actions": @[ @{ @"name": @"", @"style": @"", @"text": @"", @"type": @"", @"value": @"" } ], @"asset_url": @"", @"author_icon": @"", @"author_link": @"", @"author_name": @"", @"color": @"", @"fallback": @"", @"fields": @[ @{ @"short": @NO, @"title": @"", @"value": @"" } ], @"footer": @"", @"footer_icon": @"", @"giphy": @{ @"fixed_height": @{ @"frames": @"", @"height": @"", @"size": @"", @"url": @"", @"width": @"" }, @"fixed_height_downsampled": @{ }, @"fixed_height_still": @{ }, @"fixed_width": @{ }, @"fixed_width_downsampled": @{ }, @"fixed_width_still": @{ }, @"original": @{ } }, @"image_url": @"", @"og_scrape_url": @"", @"original_height": @"", @"original_width": @"", @"pretext": @"", @"text": @"", @"thumb_url": @"", @"title": @"", @"title_link": @"", @"type": @"" } ], @"cid": @[ ], @"html": @"", @"id": @"", @"mentioned_users": @[ ], @"mml": @"", @"parent": @[ ], @"parent_id": @"", @"pin_expires": @"", @"pinned": @NO, @"pinned_at": @"", @"pinned_by": @[ ], @"quoted_message_id": @"", @"reaction_scores": @[ ], @"show_in_channel": @NO, @"silent": @NO, @"text": @"", @"user": @{ @"ban_expires": @"", @"banned": @NO, @"id": @"", @"invisible": @NO, @"language": @"", @"push_notifications": @{ @"disabled": @NO, @"disabled_until": @"" }, @"revoke_tokens_issued_before": @"", @"role": @"", @"teams": @[ ] }, @"user_id": @"" },
@"pending_message_metadata": @{ },
@"skip_enrich_url": @NO,
@"skip_push": @NO };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/channels/:type/:id/message"]
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}}/channels/:type/:id/message" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"force_moderation\": false,\n \"is_pending_message\": false,\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"pending_message_metadata\": {},\n \"skip_enrich_url\": false,\n \"skip_push\": false\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/channels/:type/:id/message",
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([
'force_moderation' => null,
'is_pending_message' => null,
'message' => [
'attachments' => [
[
'actions' => [
[
'name' => '',
'style' => '',
'text' => '',
'type' => '',
'value' => ''
]
],
'asset_url' => '',
'author_icon' => '',
'author_link' => '',
'author_name' => '',
'color' => '',
'fallback' => '',
'fields' => [
[
'short' => null,
'title' => '',
'value' => ''
]
],
'footer' => '',
'footer_icon' => '',
'giphy' => [
'fixed_height' => [
'frames' => '',
'height' => '',
'size' => '',
'url' => '',
'width' => ''
],
'fixed_height_downsampled' => [
],
'fixed_height_still' => [
],
'fixed_width' => [
],
'fixed_width_downsampled' => [
],
'fixed_width_still' => [
],
'original' => [
]
],
'image_url' => '',
'og_scrape_url' => '',
'original_height' => '',
'original_width' => '',
'pretext' => '',
'text' => '',
'thumb_url' => '',
'title' => '',
'title_link' => '',
'type' => ''
]
],
'cid' => [
],
'html' => '',
'id' => '',
'mentioned_users' => [
],
'mml' => '',
'parent' => [
],
'parent_id' => '',
'pin_expires' => '',
'pinned' => null,
'pinned_at' => '',
'pinned_by' => [
],
'quoted_message_id' => '',
'reaction_scores' => [
],
'show_in_channel' => null,
'silent' => null,
'text' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
],
'pending_message_metadata' => [
],
'skip_enrich_url' => null,
'skip_push' => null
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/channels/:type/:id/message', [
'body' => '{
"force_moderation": false,
"is_pending_message": false,
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"cid": [],
"html": "",
"id": "",
"mentioned_users": [],
"mml": "",
"parent": [],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": [],
"quoted_message_id": "",
"reaction_scores": [],
"show_in_channel": false,
"silent": false,
"text": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
},
"pending_message_metadata": {},
"skip_enrich_url": false,
"skip_push": false
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/channels/:type/:id/message');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'force_moderation' => null,
'is_pending_message' => null,
'message' => [
'attachments' => [
[
'actions' => [
[
'name' => '',
'style' => '',
'text' => '',
'type' => '',
'value' => ''
]
],
'asset_url' => '',
'author_icon' => '',
'author_link' => '',
'author_name' => '',
'color' => '',
'fallback' => '',
'fields' => [
[
'short' => null,
'title' => '',
'value' => ''
]
],
'footer' => '',
'footer_icon' => '',
'giphy' => [
'fixed_height' => [
'frames' => '',
'height' => '',
'size' => '',
'url' => '',
'width' => ''
],
'fixed_height_downsampled' => [
],
'fixed_height_still' => [
],
'fixed_width' => [
],
'fixed_width_downsampled' => [
],
'fixed_width_still' => [
],
'original' => [
]
],
'image_url' => '',
'og_scrape_url' => '',
'original_height' => '',
'original_width' => '',
'pretext' => '',
'text' => '',
'thumb_url' => '',
'title' => '',
'title_link' => '',
'type' => ''
]
],
'cid' => [
],
'html' => '',
'id' => '',
'mentioned_users' => [
],
'mml' => '',
'parent' => [
],
'parent_id' => '',
'pin_expires' => '',
'pinned' => null,
'pinned_at' => '',
'pinned_by' => [
],
'quoted_message_id' => '',
'reaction_scores' => [
],
'show_in_channel' => null,
'silent' => null,
'text' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
],
'pending_message_metadata' => [
],
'skip_enrich_url' => null,
'skip_push' => null
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'force_moderation' => null,
'is_pending_message' => null,
'message' => [
'attachments' => [
[
'actions' => [
[
'name' => '',
'style' => '',
'text' => '',
'type' => '',
'value' => ''
]
],
'asset_url' => '',
'author_icon' => '',
'author_link' => '',
'author_name' => '',
'color' => '',
'fallback' => '',
'fields' => [
[
'short' => null,
'title' => '',
'value' => ''
]
],
'footer' => '',
'footer_icon' => '',
'giphy' => [
'fixed_height' => [
'frames' => '',
'height' => '',
'size' => '',
'url' => '',
'width' => ''
],
'fixed_height_downsampled' => [
],
'fixed_height_still' => [
],
'fixed_width' => [
],
'fixed_width_downsampled' => [
],
'fixed_width_still' => [
],
'original' => [
]
],
'image_url' => '',
'og_scrape_url' => '',
'original_height' => '',
'original_width' => '',
'pretext' => '',
'text' => '',
'thumb_url' => '',
'title' => '',
'title_link' => '',
'type' => ''
]
],
'cid' => [
],
'html' => '',
'id' => '',
'mentioned_users' => [
],
'mml' => '',
'parent' => [
],
'parent_id' => '',
'pin_expires' => '',
'pinned' => null,
'pinned_at' => '',
'pinned_by' => [
],
'quoted_message_id' => '',
'reaction_scores' => [
],
'show_in_channel' => null,
'silent' => null,
'text' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
],
'pending_message_metadata' => [
],
'skip_enrich_url' => null,
'skip_push' => null
]));
$request->setRequestUrl('{{baseUrl}}/channels/:type/:id/message');
$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}}/channels/:type/:id/message' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"force_moderation": false,
"is_pending_message": false,
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"cid": [],
"html": "",
"id": "",
"mentioned_users": [],
"mml": "",
"parent": [],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": [],
"quoted_message_id": "",
"reaction_scores": [],
"show_in_channel": false,
"silent": false,
"text": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
},
"pending_message_metadata": {},
"skip_enrich_url": false,
"skip_push": false
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/channels/:type/:id/message' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"force_moderation": false,
"is_pending_message": false,
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"cid": [],
"html": "",
"id": "",
"mentioned_users": [],
"mml": "",
"parent": [],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": [],
"quoted_message_id": "",
"reaction_scores": [],
"show_in_channel": false,
"silent": false,
"text": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
},
"pending_message_metadata": {},
"skip_enrich_url": false,
"skip_push": false
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"force_moderation\": false,\n \"is_pending_message\": false,\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"pending_message_metadata\": {},\n \"skip_enrich_url\": false,\n \"skip_push\": false\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/channels/:type/:id/message", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/channels/:type/:id/message"
payload = {
"force_moderation": False,
"is_pending_message": False,
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": False,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"cid": [],
"html": "",
"id": "",
"mentioned_users": [],
"mml": "",
"parent": [],
"parent_id": "",
"pin_expires": "",
"pinned": False,
"pinned_at": "",
"pinned_by": [],
"quoted_message_id": "",
"reaction_scores": [],
"show_in_channel": False,
"silent": False,
"text": "",
"user": {
"ban_expires": "",
"banned": False,
"id": "",
"invisible": False,
"language": "",
"push_notifications": {
"disabled": False,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
},
"pending_message_metadata": {},
"skip_enrich_url": False,
"skip_push": False
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/channels/:type/:id/message"
payload <- "{\n \"force_moderation\": false,\n \"is_pending_message\": false,\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"pending_message_metadata\": {},\n \"skip_enrich_url\": false,\n \"skip_push\": false\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/channels/:type/:id/message")
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 \"force_moderation\": false,\n \"is_pending_message\": false,\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"pending_message_metadata\": {},\n \"skip_enrich_url\": false,\n \"skip_push\": false\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/channels/:type/:id/message') do |req|
req.body = "{\n \"force_moderation\": false,\n \"is_pending_message\": false,\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"pending_message_metadata\": {},\n \"skip_enrich_url\": false,\n \"skip_push\": false\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/channels/:type/:id/message";
let payload = json!({
"force_moderation": false,
"is_pending_message": false,
"message": json!({
"attachments": (
json!({
"actions": (
json!({
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
})
),
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": (
json!({
"short": false,
"title": "",
"value": ""
})
),
"footer": "",
"footer_icon": "",
"giphy": json!({
"fixed_height": json!({
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
}),
"fixed_height_downsampled": json!({}),
"fixed_height_still": json!({}),
"fixed_width": json!({}),
"fixed_width_downsampled": json!({}),
"fixed_width_still": json!({}),
"original": json!({})
}),
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
})
),
"cid": (),
"html": "",
"id": "",
"mentioned_users": (),
"mml": "",
"parent": (),
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": (),
"quoted_message_id": "",
"reaction_scores": (),
"show_in_channel": false,
"silent": false,
"text": "",
"user": json!({
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": json!({
"disabled": false,
"disabled_until": ""
}),
"revoke_tokens_issued_before": "",
"role": "",
"teams": ()
}),
"user_id": ""
}),
"pending_message_metadata": json!({}),
"skip_enrich_url": false,
"skip_push": false
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/channels/:type/:id/message \
--header 'content-type: application/json' \
--data '{
"force_moderation": false,
"is_pending_message": false,
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"cid": [],
"html": "",
"id": "",
"mentioned_users": [],
"mml": "",
"parent": [],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": [],
"quoted_message_id": "",
"reaction_scores": [],
"show_in_channel": false,
"silent": false,
"text": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
},
"pending_message_metadata": {},
"skip_enrich_url": false,
"skip_push": false
}'
echo '{
"force_moderation": false,
"is_pending_message": false,
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"cid": [],
"html": "",
"id": "",
"mentioned_users": [],
"mml": "",
"parent": [],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": [],
"quoted_message_id": "",
"reaction_scores": [],
"show_in_channel": false,
"silent": false,
"text": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
},
"pending_message_metadata": {},
"skip_enrich_url": false,
"skip_push": false
}' | \
http POST {{baseUrl}}/channels/:type/:id/message \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "force_moderation": false,\n "is_pending_message": false,\n "message": {\n "attachments": [\n {\n "actions": [\n {\n "name": "",\n "style": "",\n "text": "",\n "type": "",\n "value": ""\n }\n ],\n "asset_url": "",\n "author_icon": "",\n "author_link": "",\n "author_name": "",\n "color": "",\n "fallback": "",\n "fields": [\n {\n "short": false,\n "title": "",\n "value": ""\n }\n ],\n "footer": "",\n "footer_icon": "",\n "giphy": {\n "fixed_height": {\n "frames": "",\n "height": "",\n "size": "",\n "url": "",\n "width": ""\n },\n "fixed_height_downsampled": {},\n "fixed_height_still": {},\n "fixed_width": {},\n "fixed_width_downsampled": {},\n "fixed_width_still": {},\n "original": {}\n },\n "image_url": "",\n "og_scrape_url": "",\n "original_height": "",\n "original_width": "",\n "pretext": "",\n "text": "",\n "thumb_url": "",\n "title": "",\n "title_link": "",\n "type": ""\n }\n ],\n "cid": [],\n "html": "",\n "id": "",\n "mentioned_users": [],\n "mml": "",\n "parent": [],\n "parent_id": "",\n "pin_expires": "",\n "pinned": false,\n "pinned_at": "",\n "pinned_by": [],\n "quoted_message_id": "",\n "reaction_scores": [],\n "show_in_channel": false,\n "silent": false,\n "text": "",\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n },\n "pending_message_metadata": {},\n "skip_enrich_url": false,\n "skip_push": false\n}' \
--output-document \
- {{baseUrl}}/channels/:type/:id/message
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"force_moderation": false,
"is_pending_message": false,
"message": [
"attachments": [
[
"actions": [
[
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
]
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
[
"short": false,
"title": "",
"value": ""
]
],
"footer": "",
"footer_icon": "",
"giphy": [
"fixed_height": [
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
],
"fixed_height_downsampled": [],
"fixed_height_still": [],
"fixed_width": [],
"fixed_width_downsampled": [],
"fixed_width_still": [],
"original": []
],
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
]
],
"cid": [],
"html": "",
"id": "",
"mentioned_users": [],
"mml": "",
"parent": [],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": [],
"quoted_message_id": "",
"reaction_scores": [],
"show_in_channel": false,
"silent": false,
"text": "",
"user": [
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": [
"disabled": false,
"disabled_until": ""
],
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
],
"user_id": ""
],
"pending_message_metadata": [],
"skip_enrich_url": false,
"skip_push": false
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/channels/:type/:id/message")! 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
Send reaction
{{baseUrl}}/messages/:id/reaction
QUERY PARAMS
id
BODY json
{
"ID": "",
"enforce_unique": false,
"reaction": {
"message_id": "",
"score": "",
"type": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
},
"skip_push": false
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/messages/:id/reaction");
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 \"enforce_unique\": false,\n \"reaction\": {\n \"message_id\": \"\",\n \"score\": \"\",\n \"type\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"skip_push\": false\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/messages/:id/reaction" {:content-type :json
:form-params {:ID ""
:enforce_unique false
:reaction {:message_id ""
:score ""
:type ""
:user {:ban_expires ""
:banned false
:id ""
:invisible false
:language ""
:push_notifications {:disabled false
:disabled_until ""}
:revoke_tokens_issued_before ""
:role ""
:teams []}
:user_id ""}
:skip_push false}})
require "http/client"
url = "{{baseUrl}}/messages/:id/reaction"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"ID\": \"\",\n \"enforce_unique\": false,\n \"reaction\": {\n \"message_id\": \"\",\n \"score\": \"\",\n \"type\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"skip_push\": false\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/messages/:id/reaction"),
Content = new StringContent("{\n \"ID\": \"\",\n \"enforce_unique\": false,\n \"reaction\": {\n \"message_id\": \"\",\n \"score\": \"\",\n \"type\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"skip_push\": false\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/messages/:id/reaction");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"ID\": \"\",\n \"enforce_unique\": false,\n \"reaction\": {\n \"message_id\": \"\",\n \"score\": \"\",\n \"type\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"skip_push\": false\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/messages/:id/reaction"
payload := strings.NewReader("{\n \"ID\": \"\",\n \"enforce_unique\": false,\n \"reaction\": {\n \"message_id\": \"\",\n \"score\": \"\",\n \"type\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"skip_push\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/messages/:id/reaction HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 462
{
"ID": "",
"enforce_unique": false,
"reaction": {
"message_id": "",
"score": "",
"type": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
},
"skip_push": false
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/messages/:id/reaction")
.setHeader("content-type", "application/json")
.setBody("{\n \"ID\": \"\",\n \"enforce_unique\": false,\n \"reaction\": {\n \"message_id\": \"\",\n \"score\": \"\",\n \"type\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"skip_push\": false\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/messages/:id/reaction"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"ID\": \"\",\n \"enforce_unique\": false,\n \"reaction\": {\n \"message_id\": \"\",\n \"score\": \"\",\n \"type\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"skip_push\": false\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"ID\": \"\",\n \"enforce_unique\": false,\n \"reaction\": {\n \"message_id\": \"\",\n \"score\": \"\",\n \"type\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"skip_push\": false\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/messages/:id/reaction")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/messages/:id/reaction")
.header("content-type", "application/json")
.body("{\n \"ID\": \"\",\n \"enforce_unique\": false,\n \"reaction\": {\n \"message_id\": \"\",\n \"score\": \"\",\n \"type\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"skip_push\": false\n}")
.asString();
const data = JSON.stringify({
ID: '',
enforce_unique: false,
reaction: {
message_id: '',
score: '',
type: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
skip_push: false
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/messages/:id/reaction');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/messages/:id/reaction',
headers: {'content-type': 'application/json'},
data: {
ID: '',
enforce_unique: false,
reaction: {
message_id: '',
score: '',
type: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
skip_push: false
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/messages/:id/reaction';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"ID":"","enforce_unique":false,"reaction":{"message_id":"","score":"","type":"","user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""},"skip_push":false}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/messages/:id/reaction',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "ID": "",\n "enforce_unique": false,\n "reaction": {\n "message_id": "",\n "score": "",\n "type": "",\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n },\n "skip_push": false\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"ID\": \"\",\n \"enforce_unique\": false,\n \"reaction\": {\n \"message_id\": \"\",\n \"score\": \"\",\n \"type\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"skip_push\": false\n}")
val request = Request.Builder()
.url("{{baseUrl}}/messages/:id/reaction")
.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/messages/:id/reaction',
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: '',
enforce_unique: false,
reaction: {
message_id: '',
score: '',
type: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
skip_push: false
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/messages/:id/reaction',
headers: {'content-type': 'application/json'},
body: {
ID: '',
enforce_unique: false,
reaction: {
message_id: '',
score: '',
type: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
skip_push: false
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/messages/:id/reaction');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
ID: '',
enforce_unique: false,
reaction: {
message_id: '',
score: '',
type: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
skip_push: false
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/messages/:id/reaction',
headers: {'content-type': 'application/json'},
data: {
ID: '',
enforce_unique: false,
reaction: {
message_id: '',
score: '',
type: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
skip_push: false
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/messages/:id/reaction';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"ID":"","enforce_unique":false,"reaction":{"message_id":"","score":"","type":"","user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""},"skip_push":false}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"ID": @"",
@"enforce_unique": @NO,
@"reaction": @{ @"message_id": @"", @"score": @"", @"type": @"", @"user": @{ @"ban_expires": @"", @"banned": @NO, @"id": @"", @"invisible": @NO, @"language": @"", @"push_notifications": @{ @"disabled": @NO, @"disabled_until": @"" }, @"revoke_tokens_issued_before": @"", @"role": @"", @"teams": @[ ] }, @"user_id": @"" },
@"skip_push": @NO };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/messages/:id/reaction"]
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}}/messages/:id/reaction" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"ID\": \"\",\n \"enforce_unique\": false,\n \"reaction\": {\n \"message_id\": \"\",\n \"score\": \"\",\n \"type\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"skip_push\": false\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/messages/:id/reaction",
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' => '',
'enforce_unique' => null,
'reaction' => [
'message_id' => '',
'score' => '',
'type' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
],
'skip_push' => null
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/messages/:id/reaction', [
'body' => '{
"ID": "",
"enforce_unique": false,
"reaction": {
"message_id": "",
"score": "",
"type": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
},
"skip_push": false
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/messages/:id/reaction');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'ID' => '',
'enforce_unique' => null,
'reaction' => [
'message_id' => '',
'score' => '',
'type' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
],
'skip_push' => null
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'ID' => '',
'enforce_unique' => null,
'reaction' => [
'message_id' => '',
'score' => '',
'type' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
],
'skip_push' => null
]));
$request->setRequestUrl('{{baseUrl}}/messages/:id/reaction');
$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}}/messages/:id/reaction' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"ID": "",
"enforce_unique": false,
"reaction": {
"message_id": "",
"score": "",
"type": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
},
"skip_push": false
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/messages/:id/reaction' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"ID": "",
"enforce_unique": false,
"reaction": {
"message_id": "",
"score": "",
"type": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
},
"skip_push": false
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"ID\": \"\",\n \"enforce_unique\": false,\n \"reaction\": {\n \"message_id\": \"\",\n \"score\": \"\",\n \"type\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"skip_push\": false\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/messages/:id/reaction", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/messages/:id/reaction"
payload = {
"ID": "",
"enforce_unique": False,
"reaction": {
"message_id": "",
"score": "",
"type": "",
"user": {
"ban_expires": "",
"banned": False,
"id": "",
"invisible": False,
"language": "",
"push_notifications": {
"disabled": False,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
},
"skip_push": False
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/messages/:id/reaction"
payload <- "{\n \"ID\": \"\",\n \"enforce_unique\": false,\n \"reaction\": {\n \"message_id\": \"\",\n \"score\": \"\",\n \"type\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"skip_push\": false\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/messages/:id/reaction")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"ID\": \"\",\n \"enforce_unique\": false,\n \"reaction\": {\n \"message_id\": \"\",\n \"score\": \"\",\n \"type\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"skip_push\": false\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/messages/:id/reaction') do |req|
req.body = "{\n \"ID\": \"\",\n \"enforce_unique\": false,\n \"reaction\": {\n \"message_id\": \"\",\n \"score\": \"\",\n \"type\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"skip_push\": false\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/messages/:id/reaction";
let payload = json!({
"ID": "",
"enforce_unique": false,
"reaction": json!({
"message_id": "",
"score": "",
"type": "",
"user": json!({
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": json!({
"disabled": false,
"disabled_until": ""
}),
"revoke_tokens_issued_before": "",
"role": "",
"teams": ()
}),
"user_id": ""
}),
"skip_push": false
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/messages/:id/reaction \
--header 'content-type: application/json' \
--data '{
"ID": "",
"enforce_unique": false,
"reaction": {
"message_id": "",
"score": "",
"type": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
},
"skip_push": false
}'
echo '{
"ID": "",
"enforce_unique": false,
"reaction": {
"message_id": "",
"score": "",
"type": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
},
"skip_push": false
}' | \
http POST {{baseUrl}}/messages/:id/reaction \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "ID": "",\n "enforce_unique": false,\n "reaction": {\n "message_id": "",\n "score": "",\n "type": "",\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n },\n "skip_push": false\n}' \
--output-document \
- {{baseUrl}}/messages/:id/reaction
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"ID": "",
"enforce_unique": false,
"reaction": [
"message_id": "",
"score": "",
"type": "",
"user": [
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": [
"disabled": false,
"disabled_until": ""
],
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
],
"user_id": ""
],
"skip_push": false
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/messages/:id/reaction")! 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
Translate message
{{baseUrl}}/messages/:id/translate
QUERY PARAMS
id
BODY json
{
"language": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/messages/:id/translate");
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 \"language\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/messages/:id/translate" {:content-type :json
:form-params {:language ""}})
require "http/client"
url = "{{baseUrl}}/messages/:id/translate"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"language\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/messages/:id/translate"),
Content = new StringContent("{\n \"language\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/messages/:id/translate");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"language\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/messages/:id/translate"
payload := strings.NewReader("{\n \"language\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/messages/:id/translate HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 20
{
"language": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/messages/:id/translate")
.setHeader("content-type", "application/json")
.setBody("{\n \"language\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/messages/:id/translate"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"language\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"language\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/messages/:id/translate")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/messages/:id/translate")
.header("content-type", "application/json")
.body("{\n \"language\": \"\"\n}")
.asString();
const data = JSON.stringify({
language: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/messages/:id/translate');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/messages/:id/translate',
headers: {'content-type': 'application/json'},
data: {language: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/messages/:id/translate';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"language":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/messages/:id/translate',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "language": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"language\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/messages/:id/translate")
.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/messages/:id/translate',
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({language: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/messages/:id/translate',
headers: {'content-type': 'application/json'},
body: {language: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/messages/:id/translate');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
language: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/messages/:id/translate',
headers: {'content-type': 'application/json'},
data: {language: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/messages/:id/translate';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"language":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"language": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/messages/:id/translate"]
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}}/messages/:id/translate" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"language\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/messages/:id/translate",
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([
'language' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/messages/:id/translate', [
'body' => '{
"language": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/messages/:id/translate');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'language' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'language' => ''
]));
$request->setRequestUrl('{{baseUrl}}/messages/:id/translate');
$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}}/messages/:id/translate' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"language": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/messages/:id/translate' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"language": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"language\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/messages/:id/translate", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/messages/:id/translate"
payload = { "language": "" }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/messages/:id/translate"
payload <- "{\n \"language\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/messages/:id/translate")
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 \"language\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/messages/:id/translate') do |req|
req.body = "{\n \"language\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/messages/:id/translate";
let payload = json!({"language": ""});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/messages/:id/translate \
--header 'content-type: application/json' \
--data '{
"language": ""
}'
echo '{
"language": ""
}' | \
http POST {{baseUrl}}/messages/:id/translate \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "language": ""\n}' \
--output-document \
- {{baseUrl}}/messages/:id/translate
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["language": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/messages/:id/translate")! 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
Update message
{{baseUrl}}/messages/:id
QUERY PARAMS
id
BODY json
{
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"cid": [],
"html": "",
"id": "",
"mentioned_users": [],
"mml": "",
"parent": [],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": [],
"quoted_message_id": "",
"reaction_scores": [],
"show_in_channel": false,
"silent": false,
"text": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
},
"pending_message_metadata": {},
"skip_enrich_url": false
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/messages/: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 \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"pending_message_metadata\": {},\n \"skip_enrich_url\": false\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/messages/:id" {:content-type :json
:form-params {:message {:attachments [{:actions [{:name ""
:style ""
:text ""
:type ""
:value ""}]
:asset_url ""
:author_icon ""
:author_link ""
:author_name ""
:color ""
:fallback ""
:fields [{:short false
:title ""
:value ""}]
:footer ""
:footer_icon ""
:giphy {:fixed_height {:frames ""
:height ""
:size ""
:url ""
:width ""}
:fixed_height_downsampled {}
:fixed_height_still {}
:fixed_width {}
:fixed_width_downsampled {}
:fixed_width_still {}
:original {}}
:image_url ""
:og_scrape_url ""
:original_height ""
:original_width ""
:pretext ""
:text ""
:thumb_url ""
:title ""
:title_link ""
:type ""}]
:cid []
:html ""
:id ""
:mentioned_users []
:mml ""
:parent []
:parent_id ""
:pin_expires ""
:pinned false
:pinned_at ""
:pinned_by []
:quoted_message_id ""
:reaction_scores []
:show_in_channel false
:silent false
:text ""
:user {:ban_expires ""
:banned false
:id ""
:invisible false
:language ""
:push_notifications {:disabled false
:disabled_until ""}
:revoke_tokens_issued_before ""
:role ""
:teams []}
:user_id ""}
:pending_message_metadata {}
:skip_enrich_url false}})
require "http/client"
url = "{{baseUrl}}/messages/:id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"pending_message_metadata\": {},\n \"skip_enrich_url\": false\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/messages/:id"),
Content = new StringContent("{\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"pending_message_metadata\": {},\n \"skip_enrich_url\": false\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/messages/:id");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"pending_message_metadata\": {},\n \"skip_enrich_url\": false\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/messages/:id"
payload := strings.NewReader("{\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"pending_message_metadata\": {},\n \"skip_enrich_url\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/messages/:id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 1946
{
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"cid": [],
"html": "",
"id": "",
"mentioned_users": [],
"mml": "",
"parent": [],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": [],
"quoted_message_id": "",
"reaction_scores": [],
"show_in_channel": false,
"silent": false,
"text": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
},
"pending_message_metadata": {},
"skip_enrich_url": false
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/messages/:id")
.setHeader("content-type", "application/json")
.setBody("{\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"pending_message_metadata\": {},\n \"skip_enrich_url\": false\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/messages/:id"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"pending_message_metadata\": {},\n \"skip_enrich_url\": false\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"pending_message_metadata\": {},\n \"skip_enrich_url\": false\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/messages/:id")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/messages/:id")
.header("content-type", "application/json")
.body("{\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"pending_message_metadata\": {},\n \"skip_enrich_url\": false\n}")
.asString();
const data = JSON.stringify({
message: {
attachments: [
{
actions: [
{
name: '',
style: '',
text: '',
type: '',
value: ''
}
],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [
{
short: false,
title: '',
value: ''
}
],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {
frames: '',
height: '',
size: '',
url: '',
width: ''
},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
cid: [],
html: '',
id: '',
mentioned_users: [],
mml: '',
parent: [],
parent_id: '',
pin_expires: '',
pinned: false,
pinned_at: '',
pinned_by: [],
quoted_message_id: '',
reaction_scores: [],
show_in_channel: false,
silent: false,
text: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
pending_message_metadata: {},
skip_enrich_url: false
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/messages/:id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/messages/:id',
headers: {'content-type': 'application/json'},
data: {
message: {
attachments: [
{
actions: [{name: '', style: '', text: '', type: '', value: ''}],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [{short: false, title: '', value: ''}],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {frames: '', height: '', size: '', url: '', width: ''},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
cid: [],
html: '',
id: '',
mentioned_users: [],
mml: '',
parent: [],
parent_id: '',
pin_expires: '',
pinned: false,
pinned_at: '',
pinned_by: [],
quoted_message_id: '',
reaction_scores: [],
show_in_channel: false,
silent: false,
text: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
pending_message_metadata: {},
skip_enrich_url: false
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/messages/:id';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"message":{"attachments":[{"actions":[{"name":"","style":"","text":"","type":"","value":""}],"asset_url":"","author_icon":"","author_link":"","author_name":"","color":"","fallback":"","fields":[{"short":false,"title":"","value":""}],"footer":"","footer_icon":"","giphy":{"fixed_height":{"frames":"","height":"","size":"","url":"","width":""},"fixed_height_downsampled":{},"fixed_height_still":{},"fixed_width":{},"fixed_width_downsampled":{},"fixed_width_still":{},"original":{}},"image_url":"","og_scrape_url":"","original_height":"","original_width":"","pretext":"","text":"","thumb_url":"","title":"","title_link":"","type":""}],"cid":[],"html":"","id":"","mentioned_users":[],"mml":"","parent":[],"parent_id":"","pin_expires":"","pinned":false,"pinned_at":"","pinned_by":[],"quoted_message_id":"","reaction_scores":[],"show_in_channel":false,"silent":false,"text":"","user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""},"pending_message_metadata":{},"skip_enrich_url":false}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/messages/:id',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "message": {\n "attachments": [\n {\n "actions": [\n {\n "name": "",\n "style": "",\n "text": "",\n "type": "",\n "value": ""\n }\n ],\n "asset_url": "",\n "author_icon": "",\n "author_link": "",\n "author_name": "",\n "color": "",\n "fallback": "",\n "fields": [\n {\n "short": false,\n "title": "",\n "value": ""\n }\n ],\n "footer": "",\n "footer_icon": "",\n "giphy": {\n "fixed_height": {\n "frames": "",\n "height": "",\n "size": "",\n "url": "",\n "width": ""\n },\n "fixed_height_downsampled": {},\n "fixed_height_still": {},\n "fixed_width": {},\n "fixed_width_downsampled": {},\n "fixed_width_still": {},\n "original": {}\n },\n "image_url": "",\n "og_scrape_url": "",\n "original_height": "",\n "original_width": "",\n "pretext": "",\n "text": "",\n "thumb_url": "",\n "title": "",\n "title_link": "",\n "type": ""\n }\n ],\n "cid": [],\n "html": "",\n "id": "",\n "mentioned_users": [],\n "mml": "",\n "parent": [],\n "parent_id": "",\n "pin_expires": "",\n "pinned": false,\n "pinned_at": "",\n "pinned_by": [],\n "quoted_message_id": "",\n "reaction_scores": [],\n "show_in_channel": false,\n "silent": false,\n "text": "",\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n },\n "pending_message_metadata": {},\n "skip_enrich_url": false\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"pending_message_metadata\": {},\n \"skip_enrich_url\": false\n}")
val request = Request.Builder()
.url("{{baseUrl}}/messages/:id")
.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/messages/: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({
message: {
attachments: [
{
actions: [{name: '', style: '', text: '', type: '', value: ''}],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [{short: false, title: '', value: ''}],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {frames: '', height: '', size: '', url: '', width: ''},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
cid: [],
html: '',
id: '',
mentioned_users: [],
mml: '',
parent: [],
parent_id: '',
pin_expires: '',
pinned: false,
pinned_at: '',
pinned_by: [],
quoted_message_id: '',
reaction_scores: [],
show_in_channel: false,
silent: false,
text: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
pending_message_metadata: {},
skip_enrich_url: false
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/messages/:id',
headers: {'content-type': 'application/json'},
body: {
message: {
attachments: [
{
actions: [{name: '', style: '', text: '', type: '', value: ''}],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [{short: false, title: '', value: ''}],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {frames: '', height: '', size: '', url: '', width: ''},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
cid: [],
html: '',
id: '',
mentioned_users: [],
mml: '',
parent: [],
parent_id: '',
pin_expires: '',
pinned: false,
pinned_at: '',
pinned_by: [],
quoted_message_id: '',
reaction_scores: [],
show_in_channel: false,
silent: false,
text: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
pending_message_metadata: {},
skip_enrich_url: false
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/messages/:id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
message: {
attachments: [
{
actions: [
{
name: '',
style: '',
text: '',
type: '',
value: ''
}
],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [
{
short: false,
title: '',
value: ''
}
],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {
frames: '',
height: '',
size: '',
url: '',
width: ''
},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
cid: [],
html: '',
id: '',
mentioned_users: [],
mml: '',
parent: [],
parent_id: '',
pin_expires: '',
pinned: false,
pinned_at: '',
pinned_by: [],
quoted_message_id: '',
reaction_scores: [],
show_in_channel: false,
silent: false,
text: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
pending_message_metadata: {},
skip_enrich_url: false
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/messages/:id',
headers: {'content-type': 'application/json'},
data: {
message: {
attachments: [
{
actions: [{name: '', style: '', text: '', type: '', value: ''}],
asset_url: '',
author_icon: '',
author_link: '',
author_name: '',
color: '',
fallback: '',
fields: [{short: false, title: '', value: ''}],
footer: '',
footer_icon: '',
giphy: {
fixed_height: {frames: '', height: '', size: '', url: '', width: ''},
fixed_height_downsampled: {},
fixed_height_still: {},
fixed_width: {},
fixed_width_downsampled: {},
fixed_width_still: {},
original: {}
},
image_url: '',
og_scrape_url: '',
original_height: '',
original_width: '',
pretext: '',
text: '',
thumb_url: '',
title: '',
title_link: '',
type: ''
}
],
cid: [],
html: '',
id: '',
mentioned_users: [],
mml: '',
parent: [],
parent_id: '',
pin_expires: '',
pinned: false,
pinned_at: '',
pinned_by: [],
quoted_message_id: '',
reaction_scores: [],
show_in_channel: false,
silent: false,
text: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
pending_message_metadata: {},
skip_enrich_url: false
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/messages/:id';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"message":{"attachments":[{"actions":[{"name":"","style":"","text":"","type":"","value":""}],"asset_url":"","author_icon":"","author_link":"","author_name":"","color":"","fallback":"","fields":[{"short":false,"title":"","value":""}],"footer":"","footer_icon":"","giphy":{"fixed_height":{"frames":"","height":"","size":"","url":"","width":""},"fixed_height_downsampled":{},"fixed_height_still":{},"fixed_width":{},"fixed_width_downsampled":{},"fixed_width_still":{},"original":{}},"image_url":"","og_scrape_url":"","original_height":"","original_width":"","pretext":"","text":"","thumb_url":"","title":"","title_link":"","type":""}],"cid":[],"html":"","id":"","mentioned_users":[],"mml":"","parent":[],"parent_id":"","pin_expires":"","pinned":false,"pinned_at":"","pinned_by":[],"quoted_message_id":"","reaction_scores":[],"show_in_channel":false,"silent":false,"text":"","user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""},"pending_message_metadata":{},"skip_enrich_url":false}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"message": @{ @"attachments": @[ @{ @"actions": @[ @{ @"name": @"", @"style": @"", @"text": @"", @"type": @"", @"value": @"" } ], @"asset_url": @"", @"author_icon": @"", @"author_link": @"", @"author_name": @"", @"color": @"", @"fallback": @"", @"fields": @[ @{ @"short": @NO, @"title": @"", @"value": @"" } ], @"footer": @"", @"footer_icon": @"", @"giphy": @{ @"fixed_height": @{ @"frames": @"", @"height": @"", @"size": @"", @"url": @"", @"width": @"" }, @"fixed_height_downsampled": @{ }, @"fixed_height_still": @{ }, @"fixed_width": @{ }, @"fixed_width_downsampled": @{ }, @"fixed_width_still": @{ }, @"original": @{ } }, @"image_url": @"", @"og_scrape_url": @"", @"original_height": @"", @"original_width": @"", @"pretext": @"", @"text": @"", @"thumb_url": @"", @"title": @"", @"title_link": @"", @"type": @"" } ], @"cid": @[ ], @"html": @"", @"id": @"", @"mentioned_users": @[ ], @"mml": @"", @"parent": @[ ], @"parent_id": @"", @"pin_expires": @"", @"pinned": @NO, @"pinned_at": @"", @"pinned_by": @[ ], @"quoted_message_id": @"", @"reaction_scores": @[ ], @"show_in_channel": @NO, @"silent": @NO, @"text": @"", @"user": @{ @"ban_expires": @"", @"banned": @NO, @"id": @"", @"invisible": @NO, @"language": @"", @"push_notifications": @{ @"disabled": @NO, @"disabled_until": @"" }, @"revoke_tokens_issued_before": @"", @"role": @"", @"teams": @[ ] }, @"user_id": @"" },
@"pending_message_metadata": @{ },
@"skip_enrich_url": @NO };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/messages/:id"]
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}}/messages/:id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"pending_message_metadata\": {},\n \"skip_enrich_url\": false\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/messages/:id",
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([
'message' => [
'attachments' => [
[
'actions' => [
[
'name' => '',
'style' => '',
'text' => '',
'type' => '',
'value' => ''
]
],
'asset_url' => '',
'author_icon' => '',
'author_link' => '',
'author_name' => '',
'color' => '',
'fallback' => '',
'fields' => [
[
'short' => null,
'title' => '',
'value' => ''
]
],
'footer' => '',
'footer_icon' => '',
'giphy' => [
'fixed_height' => [
'frames' => '',
'height' => '',
'size' => '',
'url' => '',
'width' => ''
],
'fixed_height_downsampled' => [
],
'fixed_height_still' => [
],
'fixed_width' => [
],
'fixed_width_downsampled' => [
],
'fixed_width_still' => [
],
'original' => [
]
],
'image_url' => '',
'og_scrape_url' => '',
'original_height' => '',
'original_width' => '',
'pretext' => '',
'text' => '',
'thumb_url' => '',
'title' => '',
'title_link' => '',
'type' => ''
]
],
'cid' => [
],
'html' => '',
'id' => '',
'mentioned_users' => [
],
'mml' => '',
'parent' => [
],
'parent_id' => '',
'pin_expires' => '',
'pinned' => null,
'pinned_at' => '',
'pinned_by' => [
],
'quoted_message_id' => '',
'reaction_scores' => [
],
'show_in_channel' => null,
'silent' => null,
'text' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
],
'pending_message_metadata' => [
],
'skip_enrich_url' => null
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/messages/:id', [
'body' => '{
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"cid": [],
"html": "",
"id": "",
"mentioned_users": [],
"mml": "",
"parent": [],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": [],
"quoted_message_id": "",
"reaction_scores": [],
"show_in_channel": false,
"silent": false,
"text": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
},
"pending_message_metadata": {},
"skip_enrich_url": false
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/messages/:id');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'message' => [
'attachments' => [
[
'actions' => [
[
'name' => '',
'style' => '',
'text' => '',
'type' => '',
'value' => ''
]
],
'asset_url' => '',
'author_icon' => '',
'author_link' => '',
'author_name' => '',
'color' => '',
'fallback' => '',
'fields' => [
[
'short' => null,
'title' => '',
'value' => ''
]
],
'footer' => '',
'footer_icon' => '',
'giphy' => [
'fixed_height' => [
'frames' => '',
'height' => '',
'size' => '',
'url' => '',
'width' => ''
],
'fixed_height_downsampled' => [
],
'fixed_height_still' => [
],
'fixed_width' => [
],
'fixed_width_downsampled' => [
],
'fixed_width_still' => [
],
'original' => [
]
],
'image_url' => '',
'og_scrape_url' => '',
'original_height' => '',
'original_width' => '',
'pretext' => '',
'text' => '',
'thumb_url' => '',
'title' => '',
'title_link' => '',
'type' => ''
]
],
'cid' => [
],
'html' => '',
'id' => '',
'mentioned_users' => [
],
'mml' => '',
'parent' => [
],
'parent_id' => '',
'pin_expires' => '',
'pinned' => null,
'pinned_at' => '',
'pinned_by' => [
],
'quoted_message_id' => '',
'reaction_scores' => [
],
'show_in_channel' => null,
'silent' => null,
'text' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
],
'pending_message_metadata' => [
],
'skip_enrich_url' => null
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'message' => [
'attachments' => [
[
'actions' => [
[
'name' => '',
'style' => '',
'text' => '',
'type' => '',
'value' => ''
]
],
'asset_url' => '',
'author_icon' => '',
'author_link' => '',
'author_name' => '',
'color' => '',
'fallback' => '',
'fields' => [
[
'short' => null,
'title' => '',
'value' => ''
]
],
'footer' => '',
'footer_icon' => '',
'giphy' => [
'fixed_height' => [
'frames' => '',
'height' => '',
'size' => '',
'url' => '',
'width' => ''
],
'fixed_height_downsampled' => [
],
'fixed_height_still' => [
],
'fixed_width' => [
],
'fixed_width_downsampled' => [
],
'fixed_width_still' => [
],
'original' => [
]
],
'image_url' => '',
'og_scrape_url' => '',
'original_height' => '',
'original_width' => '',
'pretext' => '',
'text' => '',
'thumb_url' => '',
'title' => '',
'title_link' => '',
'type' => ''
]
],
'cid' => [
],
'html' => '',
'id' => '',
'mentioned_users' => [
],
'mml' => '',
'parent' => [
],
'parent_id' => '',
'pin_expires' => '',
'pinned' => null,
'pinned_at' => '',
'pinned_by' => [
],
'quoted_message_id' => '',
'reaction_scores' => [
],
'show_in_channel' => null,
'silent' => null,
'text' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
],
'pending_message_metadata' => [
],
'skip_enrich_url' => null
]));
$request->setRequestUrl('{{baseUrl}}/messages/:id');
$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}}/messages/:id' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"cid": [],
"html": "",
"id": "",
"mentioned_users": [],
"mml": "",
"parent": [],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": [],
"quoted_message_id": "",
"reaction_scores": [],
"show_in_channel": false,
"silent": false,
"text": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
},
"pending_message_metadata": {},
"skip_enrich_url": false
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/messages/:id' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"cid": [],
"html": "",
"id": "",
"mentioned_users": [],
"mml": "",
"parent": [],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": [],
"quoted_message_id": "",
"reaction_scores": [],
"show_in_channel": false,
"silent": false,
"text": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
},
"pending_message_metadata": {},
"skip_enrich_url": false
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"pending_message_metadata\": {},\n \"skip_enrich_url\": false\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/messages/:id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/messages/:id"
payload = {
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": False,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"cid": [],
"html": "",
"id": "",
"mentioned_users": [],
"mml": "",
"parent": [],
"parent_id": "",
"pin_expires": "",
"pinned": False,
"pinned_at": "",
"pinned_by": [],
"quoted_message_id": "",
"reaction_scores": [],
"show_in_channel": False,
"silent": False,
"text": "",
"user": {
"ban_expires": "",
"banned": False,
"id": "",
"invisible": False,
"language": "",
"push_notifications": {
"disabled": False,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
},
"pending_message_metadata": {},
"skip_enrich_url": False
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/messages/:id"
payload <- "{\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"pending_message_metadata\": {},\n \"skip_enrich_url\": false\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/messages/:id")
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 \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"pending_message_metadata\": {},\n \"skip_enrich_url\": false\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/messages/:id') do |req|
req.body = "{\n \"message\": {\n \"attachments\": [\n {\n \"actions\": [\n {\n \"name\": \"\",\n \"style\": \"\",\n \"text\": \"\",\n \"type\": \"\",\n \"value\": \"\"\n }\n ],\n \"asset_url\": \"\",\n \"author_icon\": \"\",\n \"author_link\": \"\",\n \"author_name\": \"\",\n \"color\": \"\",\n \"fallback\": \"\",\n \"fields\": [\n {\n \"short\": false,\n \"title\": \"\",\n \"value\": \"\"\n }\n ],\n \"footer\": \"\",\n \"footer_icon\": \"\",\n \"giphy\": {\n \"fixed_height\": {\n \"frames\": \"\",\n \"height\": \"\",\n \"size\": \"\",\n \"url\": \"\",\n \"width\": \"\"\n },\n \"fixed_height_downsampled\": {},\n \"fixed_height_still\": {},\n \"fixed_width\": {},\n \"fixed_width_downsampled\": {},\n \"fixed_width_still\": {},\n \"original\": {}\n },\n \"image_url\": \"\",\n \"og_scrape_url\": \"\",\n \"original_height\": \"\",\n \"original_width\": \"\",\n \"pretext\": \"\",\n \"text\": \"\",\n \"thumb_url\": \"\",\n \"title\": \"\",\n \"title_link\": \"\",\n \"type\": \"\"\n }\n ],\n \"cid\": [],\n \"html\": \"\",\n \"id\": \"\",\n \"mentioned_users\": [],\n \"mml\": \"\",\n \"parent\": [],\n \"parent_id\": \"\",\n \"pin_expires\": \"\",\n \"pinned\": false,\n \"pinned_at\": \"\",\n \"pinned_by\": [],\n \"quoted_message_id\": \"\",\n \"reaction_scores\": [],\n \"show_in_channel\": false,\n \"silent\": false,\n \"text\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n },\n \"pending_message_metadata\": {},\n \"skip_enrich_url\": false\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/messages/:id";
let payload = json!({
"message": json!({
"attachments": (
json!({
"actions": (
json!({
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
})
),
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": (
json!({
"short": false,
"title": "",
"value": ""
})
),
"footer": "",
"footer_icon": "",
"giphy": json!({
"fixed_height": json!({
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
}),
"fixed_height_downsampled": json!({}),
"fixed_height_still": json!({}),
"fixed_width": json!({}),
"fixed_width_downsampled": json!({}),
"fixed_width_still": json!({}),
"original": json!({})
}),
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
})
),
"cid": (),
"html": "",
"id": "",
"mentioned_users": (),
"mml": "",
"parent": (),
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": (),
"quoted_message_id": "",
"reaction_scores": (),
"show_in_channel": false,
"silent": false,
"text": "",
"user": json!({
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": json!({
"disabled": false,
"disabled_until": ""
}),
"revoke_tokens_issued_before": "",
"role": "",
"teams": ()
}),
"user_id": ""
}),
"pending_message_metadata": json!({}),
"skip_enrich_url": false
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/messages/:id \
--header 'content-type: application/json' \
--data '{
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"cid": [],
"html": "",
"id": "",
"mentioned_users": [],
"mml": "",
"parent": [],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": [],
"quoted_message_id": "",
"reaction_scores": [],
"show_in_channel": false,
"silent": false,
"text": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
},
"pending_message_metadata": {},
"skip_enrich_url": false
}'
echo '{
"message": {
"attachments": [
{
"actions": [
{
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
}
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
{
"short": false,
"title": "",
"value": ""
}
],
"footer": "",
"footer_icon": "",
"giphy": {
"fixed_height": {
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
},
"fixed_height_downsampled": {},
"fixed_height_still": {},
"fixed_width": {},
"fixed_width_downsampled": {},
"fixed_width_still": {},
"original": {}
},
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
}
],
"cid": [],
"html": "",
"id": "",
"mentioned_users": [],
"mml": "",
"parent": [],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": [],
"quoted_message_id": "",
"reaction_scores": [],
"show_in_channel": false,
"silent": false,
"text": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
},
"pending_message_metadata": {},
"skip_enrich_url": false
}' | \
http POST {{baseUrl}}/messages/:id \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "message": {\n "attachments": [\n {\n "actions": [\n {\n "name": "",\n "style": "",\n "text": "",\n "type": "",\n "value": ""\n }\n ],\n "asset_url": "",\n "author_icon": "",\n "author_link": "",\n "author_name": "",\n "color": "",\n "fallback": "",\n "fields": [\n {\n "short": false,\n "title": "",\n "value": ""\n }\n ],\n "footer": "",\n "footer_icon": "",\n "giphy": {\n "fixed_height": {\n "frames": "",\n "height": "",\n "size": "",\n "url": "",\n "width": ""\n },\n "fixed_height_downsampled": {},\n "fixed_height_still": {},\n "fixed_width": {},\n "fixed_width_downsampled": {},\n "fixed_width_still": {},\n "original": {}\n },\n "image_url": "",\n "og_scrape_url": "",\n "original_height": "",\n "original_width": "",\n "pretext": "",\n "text": "",\n "thumb_url": "",\n "title": "",\n "title_link": "",\n "type": ""\n }\n ],\n "cid": [],\n "html": "",\n "id": "",\n "mentioned_users": [],\n "mml": "",\n "parent": [],\n "parent_id": "",\n "pin_expires": "",\n "pinned": false,\n "pinned_at": "",\n "pinned_by": [],\n "quoted_message_id": "",\n "reaction_scores": [],\n "show_in_channel": false,\n "silent": false,\n "text": "",\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n },\n "pending_message_metadata": {},\n "skip_enrich_url": false\n}' \
--output-document \
- {{baseUrl}}/messages/:id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"message": [
"attachments": [
[
"actions": [
[
"name": "",
"style": "",
"text": "",
"type": "",
"value": ""
]
],
"asset_url": "",
"author_icon": "",
"author_link": "",
"author_name": "",
"color": "",
"fallback": "",
"fields": [
[
"short": false,
"title": "",
"value": ""
]
],
"footer": "",
"footer_icon": "",
"giphy": [
"fixed_height": [
"frames": "",
"height": "",
"size": "",
"url": "",
"width": ""
],
"fixed_height_downsampled": [],
"fixed_height_still": [],
"fixed_width": [],
"fixed_width_downsampled": [],
"fixed_width_still": [],
"original": []
],
"image_url": "",
"og_scrape_url": "",
"original_height": "",
"original_width": "",
"pretext": "",
"text": "",
"thumb_url": "",
"title": "",
"title_link": "",
"type": ""
]
],
"cid": [],
"html": "",
"id": "",
"mentioned_users": [],
"mml": "",
"parent": [],
"parent_id": "",
"pin_expires": "",
"pinned": false,
"pinned_at": "",
"pinned_by": [],
"quoted_message_id": "",
"reaction_scores": [],
"show_in_channel": false,
"silent": false,
"text": "",
"user": [
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": [
"disabled": false,
"disabled_until": ""
],
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
],
"user_id": ""
],
"pending_message_metadata": [],
"skip_enrich_url": false
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/messages/:id")! 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
Upload file
{{baseUrl}}/channels/:type/:id/file
QUERY PARAMS
type
id
BODY multipartForm
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/channels/:type/:id/file");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: multipart/form-data; boundary=---011000010111000001101001");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user\"\r\n\r\n\r\n-----011000010111000001101001--\r\n");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/channels/:type/:id/file" {:multipart [{:name "file"
:content ""} {:name "user"
:content ""}]})
require "http/client"
url = "{{baseUrl}}/channels/:type/:id/file"
headers = HTTP::Headers{
"content-type" => "multipart/form-data; boundary=---011000010111000001101001"
}
reqBody = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user\"\r\n\r\n\r\n-----011000010111000001101001--\r\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}}/channels/:type/:id/file"),
Content = new MultipartFormDataContent
{
new StringContent("")
{
Headers =
{
ContentDisposition = new ContentDispositionHeaderValue("form-data")
{
Name = "file",
}
}
},
new StringContent("")
{
Headers =
{
ContentDisposition = new ContentDispositionHeaderValue("form-data")
{
Name = "user",
}
}
},
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/channels/:type/:id/file");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001");
request.AddParameter("multipart/form-data; boundary=---011000010111000001101001", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user\"\r\n\r\n\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/channels/:type/:id/file"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/channels/:type/:id/file HTTP/1.1
Content-Type: multipart/form-data; boundary=---011000010111000001101001
Host: example.com
Content-Length: 193
-----011000010111000001101001
Content-Disposition: form-data; name="file"
-----011000010111000001101001
Content-Disposition: form-data; name="user"
-----011000010111000001101001--
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/channels/:type/:id/file")
.setHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.setBody("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/channels/:type/:id/file"))
.header("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.method("POST", HttpRequest.BodyPublishers.ofString("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001");
RequestBody body = RequestBody.create(mediaType, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user\"\r\n\r\n\r\n-----011000010111000001101001--\r\n");
Request request = new Request.Builder()
.url("{{baseUrl}}/channels/:type/:id/file")
.post(body)
.addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/channels/:type/:id/file")
.header("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
.asString();
const data = new FormData();
data.append('file', '');
data.append('user', '');
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/channels/:type/:id/file');
xhr.send(data);
import axios from 'axios';
const form = new FormData();
form.append('file', '');
form.append('user', '');
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:type/:id/file',
headers: {'content-type': 'multipart/form-data; boundary=---011000010111000001101001'},
data: '[form]'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/channels/:type/:id/file';
const form = new FormData();
form.append('file', '');
form.append('user', '');
const options = {method: 'POST'};
options.body = form;
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const form = new FormData();
form.append('file', '');
form.append('user', '');
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/channels/:type/:id/file',
method: 'POST',
headers: {},
processData: false,
contentType: false,
mimeType: 'multipart/form-data',
data: form
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001")
val body = RequestBody.create(mediaType, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
val request = Request.Builder()
.url("{{baseUrl}}/channels/:type/:id/file")
.post(body)
.addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/channels/:type/:id/file',
headers: {
'content-type': 'multipart/form-data; boundary=---011000010111000001101001'
}
};
const req = http.request(options, function (res) {
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('-----011000010111000001101001\r\nContent-Disposition: form-data; name="file"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name="user"\r\n\r\n\r\n-----011000010111000001101001--\r\n');
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:type/:id/file',
headers: {'content-type': 'multipart/form-data; boundary=---011000010111000001101001'},
formData: {file: '', user: ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/channels/:type/:id/file');
req.headers({
'content-type': 'multipart/form-data; boundary=---011000010111000001101001'
});
req.multipart([]);
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}}/channels/:type/:id/file',
headers: {'content-type': 'multipart/form-data; boundary=---011000010111000001101001'},
data: '-----011000010111000001101001\r\nContent-Disposition: form-data; name="file"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name="user"\r\n\r\n\r\n-----011000010111000001101001--\r\n'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const FormData = require('form-data');
const fetch = require('node-fetch');
const formData = new FormData();
formData.append('file', '');
formData.append('user', '');
const url = '{{baseUrl}}/channels/:type/:id/file';
const options = {method: 'POST'};
options.body = formData;
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": @"multipart/form-data; boundary=---011000010111000001101001" };
NSArray *parameters = @[ @{ @"name": @"file", @"value": @"" },
@{ @"name": @"user", @"value": @"" } ];
NSString *boundary = @"---011000010111000001101001";
NSError *error;
NSMutableString *body = [NSMutableString string];
for (NSDictionary *param in parameters) {
[body appendFormat:@"--%@\r\n", boundary];
if (param[@"fileName"]) {
[body appendFormat:@"Content-Disposition:form-data; name=\"%@\"; filename=\"%@\"\r\n", param[@"name"], param[@"fileName"]];
[body appendFormat:@"Content-Type: %@\r\n\r\n", param[@"contentType"]];
[body appendFormat:@"%@", [NSString stringWithContentsOfFile:param[@"fileName"] encoding:NSUTF8StringEncoding error:&error]];
if (error) {
NSLog(@"%@", error);
}
} else {
[body appendFormat:@"Content-Disposition:form-data; name=\"%@\"\r\n\r\n", param[@"name"]];
[body appendFormat:@"%@", param[@"value"]];
}
}
[body appendFormat:@"\r\n--%@--\r\n", boundary];
NSData *postData = [body dataUsingEncoding:NSUTF8StringEncoding];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/channels/:type/:id/file"]
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}}/channels/:type/:id/file" in
let headers = Header.add (Header.init ()) "content-type" "multipart/form-data; boundary=---011000010111000001101001" in
let body = Cohttp_lwt_body.of_string "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user\"\r\n\r\n\r\n-----011000010111000001101001--\r\n" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/channels/:type/:id/file",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user\"\r\n\r\n\r\n-----011000010111000001101001--\r\n",
CURLOPT_HTTPHEADER => [
"content-type: multipart/form-data; boundary=---011000010111000001101001"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/channels/:type/:id/file', [
'headers' => [
'content-type' => 'multipart/form-data; boundary=---011000010111000001101001',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/channels/:type/:id/file');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'multipart/form-data; boundary=---011000010111000001101001'
]);
$request->setBody('-----011000010111000001101001
Content-Disposition: form-data; name="file"
-----011000010111000001101001
Content-Disposition: form-data; name="user"
-----011000010111000001101001--
');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
addForm(null, null);
$request->setRequestUrl('{{baseUrl}}/channels/:type/:id/file');
$request->setRequestMethod('POST');
$request->setBody($body);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/channels/:type/:id/file' -Method POST -Headers $headers -ContentType 'multipart/form-data; boundary=---011000010111000001101001' -Body '-----011000010111000001101001
Content-Disposition: form-data; name="file"
-----011000010111000001101001
Content-Disposition: form-data; name="user"
-----011000010111000001101001--
'
$headers=@{}
$headers.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/channels/:type/:id/file' -Method POST -Headers $headers -ContentType 'multipart/form-data; boundary=---011000010111000001101001' -Body '-----011000010111000001101001
Content-Disposition: form-data; name="file"
-----011000010111000001101001
Content-Disposition: form-data; name="user"
-----011000010111000001101001--
'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
headers = { 'content-type': "multipart/form-data; boundary=---011000010111000001101001" }
conn.request("POST", "/baseUrl/channels/:type/:id/file", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/channels/:type/:id/file"
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
headers = {"content-type": "multipart/form-data; boundary=---011000010111000001101001"}
response = requests.post(url, data=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/channels/:type/:id/file"
payload <- "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
encode <- "multipart"
response <- VERB("POST", url, body = payload, content_type("multipart/form-data"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/channels/:type/:id/file")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'multipart/form-data; boundary=---011000010111000001101001'}
)
response = conn.post('/baseUrl/channels/:type/:id/file') do |req|
req.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/channels/:type/:id/file";
let form = reqwest::multipart::Form::new()
.text("file", "")
.text("user", "");
let mut headers = reqwest::header::HeaderMap::new();
let client = reqwest::Client::new();
let response = client.post(url)
.multipart(form)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/channels/:type/:id/file \
--header 'content-type: multipart/form-data' \
--form file= \
--form user=
echo '-----011000010111000001101001
Content-Disposition: form-data; name="file"
-----011000010111000001101001
Content-Disposition: form-data; name="user"
-----011000010111000001101001--
' | \
http POST {{baseUrl}}/channels/:type/:id/file \
content-type:'multipart/form-data; boundary=---011000010111000001101001'
wget --quiet \
--method POST \
--header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
--body-data '-----011000010111000001101001\r\nContent-Disposition: form-data; name="file"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name="user"\r\n\r\n\r\n-----011000010111000001101001--\r\n' \
--output-document \
- {{baseUrl}}/channels/:type/:id/file
import Foundation
let headers = ["content-type": "multipart/form-data; boundary=---011000010111000001101001"]
let parameters = [
[
"name": "file",
"value": ""
],
[
"name": "user",
"value": ""
]
]
let boundary = "---011000010111000001101001"
var body = ""
var error: NSError? = nil
for param in parameters {
let paramName = param["name"]!
body += "--\(boundary)\r\n"
body += "Content-Disposition:form-data; name=\"\(paramName)\""
if let filename = param["fileName"] {
let contentType = param["content-type"]!
let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)
if (error != nil) {
print(error as Any)
}
body += "; filename=\"\(filename)\"\r\n"
body += "Content-Type: \(contentType)\r\n\r\n"
body += fileContent
} else if let paramValue = param["value"] {
body += "\r\n\r\n\(paramValue)"
}
}
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/channels/:type/:id/file")! 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
Upload image
{{baseUrl}}/channels/:type/:id/image
QUERY PARAMS
type
id
BODY multipartForm
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/channels/:type/:id/image");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: multipart/form-data; boundary=---011000010111000001101001");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"upload_sizes\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user\"\r\n\r\n\r\n-----011000010111000001101001--\r\n");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/channels/:type/:id/image" {:multipart [{:name "file"
:content ""} {:name "upload_sizes"
:content ""} {:name "user"
:content ""}]})
require "http/client"
url = "{{baseUrl}}/channels/:type/:id/image"
headers = HTTP::Headers{
"content-type" => "multipart/form-data; boundary=---011000010111000001101001"
}
reqBody = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"upload_sizes\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user\"\r\n\r\n\r\n-----011000010111000001101001--\r\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}}/channels/:type/:id/image"),
Content = new MultipartFormDataContent
{
new StringContent("")
{
Headers =
{
ContentDisposition = new ContentDispositionHeaderValue("form-data")
{
Name = "file",
}
}
},
new StringContent("")
{
Headers =
{
ContentDisposition = new ContentDispositionHeaderValue("form-data")
{
Name = "upload_sizes",
}
}
},
new StringContent("")
{
Headers =
{
ContentDisposition = new ContentDispositionHeaderValue("form-data")
{
Name = "user",
}
}
},
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/channels/:type/:id/image");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001");
request.AddParameter("multipart/form-data; boundary=---011000010111000001101001", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"upload_sizes\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user\"\r\n\r\n\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/channels/:type/:id/image"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"upload_sizes\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/channels/:type/:id/image HTTP/1.1
Content-Type: multipart/form-data; boundary=---011000010111000001101001
Host: example.com
Content-Length: 281
-----011000010111000001101001
Content-Disposition: form-data; name="file"
-----011000010111000001101001
Content-Disposition: form-data; name="upload_sizes"
-----011000010111000001101001
Content-Disposition: form-data; name="user"
-----011000010111000001101001--
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/channels/:type/:id/image")
.setHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.setBody("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"upload_sizes\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/channels/:type/:id/image"))
.header("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.method("POST", HttpRequest.BodyPublishers.ofString("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"upload_sizes\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001");
RequestBody body = RequestBody.create(mediaType, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"upload_sizes\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user\"\r\n\r\n\r\n-----011000010111000001101001--\r\n");
Request request = new Request.Builder()
.url("{{baseUrl}}/channels/:type/:id/image")
.post(body)
.addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/channels/:type/:id/image")
.header("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"upload_sizes\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
.asString();
const data = new FormData();
data.append('file', '');
data.append('upload_sizes', '');
data.append('user', '');
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/channels/:type/:id/image');
xhr.send(data);
import axios from 'axios';
const form = new FormData();
form.append('file', '');
form.append('upload_sizes', '');
form.append('user', '');
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:type/:id/image',
headers: {'content-type': 'multipart/form-data; boundary=---011000010111000001101001'},
data: '[form]'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/channels/:type/:id/image';
const form = new FormData();
form.append('file', '');
form.append('upload_sizes', '');
form.append('user', '');
const options = {method: 'POST'};
options.body = form;
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const form = new FormData();
form.append('file', '');
form.append('upload_sizes', '');
form.append('user', '');
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/channels/:type/:id/image',
method: 'POST',
headers: {},
processData: false,
contentType: false,
mimeType: 'multipart/form-data',
data: form
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001")
val body = RequestBody.create(mediaType, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"upload_sizes\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
val request = Request.Builder()
.url("{{baseUrl}}/channels/:type/:id/image")
.post(body)
.addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/channels/:type/:id/image',
headers: {
'content-type': 'multipart/form-data; boundary=---011000010111000001101001'
}
};
const req = http.request(options, function (res) {
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('-----011000010111000001101001\r\nContent-Disposition: form-data; name="file"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name="upload_sizes"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name="user"\r\n\r\n\r\n-----011000010111000001101001--\r\n');
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:type/:id/image',
headers: {'content-type': 'multipart/form-data; boundary=---011000010111000001101001'},
formData: {file: '', upload_sizes: '', user: ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/channels/:type/:id/image');
req.headers({
'content-type': 'multipart/form-data; boundary=---011000010111000001101001'
});
req.multipart([]);
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}}/channels/:type/:id/image',
headers: {'content-type': 'multipart/form-data; boundary=---011000010111000001101001'},
data: '-----011000010111000001101001\r\nContent-Disposition: form-data; name="file"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name="upload_sizes"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name="user"\r\n\r\n\r\n-----011000010111000001101001--\r\n'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const FormData = require('form-data');
const fetch = require('node-fetch');
const formData = new FormData();
formData.append('file', '');
formData.append('upload_sizes', '');
formData.append('user', '');
const url = '{{baseUrl}}/channels/:type/:id/image';
const options = {method: 'POST'};
options.body = formData;
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": @"multipart/form-data; boundary=---011000010111000001101001" };
NSArray *parameters = @[ @{ @"name": @"file", @"value": @"" },
@{ @"name": @"upload_sizes", @"value": @"" },
@{ @"name": @"user", @"value": @"" } ];
NSString *boundary = @"---011000010111000001101001";
NSError *error;
NSMutableString *body = [NSMutableString string];
for (NSDictionary *param in parameters) {
[body appendFormat:@"--%@\r\n", boundary];
if (param[@"fileName"]) {
[body appendFormat:@"Content-Disposition:form-data; name=\"%@\"; filename=\"%@\"\r\n", param[@"name"], param[@"fileName"]];
[body appendFormat:@"Content-Type: %@\r\n\r\n", param[@"contentType"]];
[body appendFormat:@"%@", [NSString stringWithContentsOfFile:param[@"fileName"] encoding:NSUTF8StringEncoding error:&error]];
if (error) {
NSLog(@"%@", error);
}
} else {
[body appendFormat:@"Content-Disposition:form-data; name=\"%@\"\r\n\r\n", param[@"name"]];
[body appendFormat:@"%@", param[@"value"]];
}
}
[body appendFormat:@"\r\n--%@--\r\n", boundary];
NSData *postData = [body dataUsingEncoding:NSUTF8StringEncoding];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/channels/:type/:id/image"]
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}}/channels/:type/:id/image" in
let headers = Header.add (Header.init ()) "content-type" "multipart/form-data; boundary=---011000010111000001101001" in
let body = Cohttp_lwt_body.of_string "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"upload_sizes\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user\"\r\n\r\n\r\n-----011000010111000001101001--\r\n" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/channels/:type/:id/image",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"upload_sizes\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user\"\r\n\r\n\r\n-----011000010111000001101001--\r\n",
CURLOPT_HTTPHEADER => [
"content-type: multipart/form-data; boundary=---011000010111000001101001"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/channels/:type/:id/image', [
'headers' => [
'content-type' => 'multipart/form-data; boundary=---011000010111000001101001',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/channels/:type/:id/image');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'multipart/form-data; boundary=---011000010111000001101001'
]);
$request->setBody('-----011000010111000001101001
Content-Disposition: form-data; name="file"
-----011000010111000001101001
Content-Disposition: form-data; name="upload_sizes"
-----011000010111000001101001
Content-Disposition: form-data; name="user"
-----011000010111000001101001--
');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
addForm(null, null);
$request->setRequestUrl('{{baseUrl}}/channels/:type/:id/image');
$request->setRequestMethod('POST');
$request->setBody($body);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/channels/:type/:id/image' -Method POST -Headers $headers -ContentType 'multipart/form-data; boundary=---011000010111000001101001' -Body '-----011000010111000001101001
Content-Disposition: form-data; name="file"
-----011000010111000001101001
Content-Disposition: form-data; name="upload_sizes"
-----011000010111000001101001
Content-Disposition: form-data; name="user"
-----011000010111000001101001--
'
$headers=@{}
$headers.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/channels/:type/:id/image' -Method POST -Headers $headers -ContentType 'multipart/form-data; boundary=---011000010111000001101001' -Body '-----011000010111000001101001
Content-Disposition: form-data; name="file"
-----011000010111000001101001
Content-Disposition: form-data; name="upload_sizes"
-----011000010111000001101001
Content-Disposition: form-data; name="user"
-----011000010111000001101001--
'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"upload_sizes\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
headers = { 'content-type': "multipart/form-data; boundary=---011000010111000001101001" }
conn.request("POST", "/baseUrl/channels/:type/:id/image", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/channels/:type/:id/image"
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"upload_sizes\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
headers = {"content-type": "multipart/form-data; boundary=---011000010111000001101001"}
response = requests.post(url, data=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/channels/:type/:id/image"
payload <- "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"upload_sizes\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
encode <- "multipart"
response <- VERB("POST", url, body = payload, content_type("multipart/form-data"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/channels/:type/:id/image")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"upload_sizes\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'multipart/form-data; boundary=---011000010111000001101001'}
)
response = conn.post('/baseUrl/channels/:type/:id/image') do |req|
req.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"upload_sizes\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/channels/:type/:id/image";
let form = reqwest::multipart::Form::new()
.text("file", "")
.text("upload_sizes", "")
.text("user", "");
let mut headers = reqwest::header::HeaderMap::new();
let client = reqwest::Client::new();
let response = client.post(url)
.multipart(form)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/channels/:type/:id/image \
--header 'content-type: multipart/form-data' \
--form file= \
--form upload_sizes= \
--form user=
echo '-----011000010111000001101001
Content-Disposition: form-data; name="file"
-----011000010111000001101001
Content-Disposition: form-data; name="upload_sizes"
-----011000010111000001101001
Content-Disposition: form-data; name="user"
-----011000010111000001101001--
' | \
http POST {{baseUrl}}/channels/:type/:id/image \
content-type:'multipart/form-data; boundary=---011000010111000001101001'
wget --quiet \
--method POST \
--header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
--body-data '-----011000010111000001101001\r\nContent-Disposition: form-data; name="file"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name="upload_sizes"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name="user"\r\n\r\n\r\n-----011000010111000001101001--\r\n' \
--output-document \
- {{baseUrl}}/channels/:type/:id/image
import Foundation
let headers = ["content-type": "multipart/form-data; boundary=---011000010111000001101001"]
let parameters = [
[
"name": "file",
"value": ""
],
[
"name": "upload_sizes",
"value": ""
],
[
"name": "user",
"value": ""
]
]
let boundary = "---011000010111000001101001"
var body = ""
var error: NSError? = nil
for param in parameters {
let paramName = param["name"]!
body += "--\(boundary)\r\n"
body += "Content-Disposition:form-data; name=\"\(paramName)\""
if let filename = param["fileName"] {
let contentType = param["content-type"]!
let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)
if (error != nil) {
print(error as Any)
}
body += "; filename=\"\(filename)\"\r\n"
body += "Content-Type: \(contentType)\r\n\r\n"
body += fileContent
} else if let paramValue = param["value"] {
body += "\r\n\r\n\(paramValue)"
}
}
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/channels/:type/:id/image")! 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
Flag
{{baseUrl}}/moderation/flag
BODY json
{
"target_message_id": "",
"target_user_id": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/moderation/flag");
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 \"target_message_id\": \"\",\n \"target_user_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/moderation/flag" {:content-type :json
:form-params {:target_message_id ""
:target_user_id ""
:user {:ban_expires ""
:banned false
:id ""
:invisible false
:language ""
:push_notifications {:disabled false
:disabled_until ""}
:revoke_tokens_issued_before ""
:role ""
:teams []}
:user_id ""}})
require "http/client"
url = "{{baseUrl}}/moderation/flag"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"target_message_id\": \"\",\n \"target_user_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/moderation/flag"),
Content = new StringContent("{\n \"target_message_id\": \"\",\n \"target_user_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/moderation/flag");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"target_message_id\": \"\",\n \"target_user_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/moderation/flag"
payload := strings.NewReader("{\n \"target_message_id\": \"\",\n \"target_user_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/moderation/flag HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 347
{
"target_message_id": "",
"target_user_id": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/moderation/flag")
.setHeader("content-type", "application/json")
.setBody("{\n \"target_message_id\": \"\",\n \"target_user_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/moderation/flag"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"target_message_id\": \"\",\n \"target_user_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"target_message_id\": \"\",\n \"target_user_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/moderation/flag")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/moderation/flag")
.header("content-type", "application/json")
.body("{\n \"target_message_id\": \"\",\n \"target_user_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
.asString();
const data = JSON.stringify({
target_message_id: '',
target_user_id: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/moderation/flag');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/moderation/flag',
headers: {'content-type': 'application/json'},
data: {
target_message_id: '',
target_user_id: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/moderation/flag';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"target_message_id":"","target_user_id":"","user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/moderation/flag',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "target_message_id": "",\n "target_user_id": "",\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"target_message_id\": \"\",\n \"target_user_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/moderation/flag")
.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/moderation/flag',
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({
target_message_id: '',
target_user_id: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/moderation/flag',
headers: {'content-type': 'application/json'},
body: {
target_message_id: '',
target_user_id: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/moderation/flag');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
target_message_id: '',
target_user_id: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/moderation/flag',
headers: {'content-type': 'application/json'},
data: {
target_message_id: '',
target_user_id: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/moderation/flag';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"target_message_id":"","target_user_id":"","user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"target_message_id": @"",
@"target_user_id": @"",
@"user": @{ @"ban_expires": @"", @"banned": @NO, @"id": @"", @"invisible": @NO, @"language": @"", @"push_notifications": @{ @"disabled": @NO, @"disabled_until": @"" }, @"revoke_tokens_issued_before": @"", @"role": @"", @"teams": @[ ] },
@"user_id": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/moderation/flag"]
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}}/moderation/flag" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"target_message_id\": \"\",\n \"target_user_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/moderation/flag",
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([
'target_message_id' => '',
'target_user_id' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/moderation/flag', [
'body' => '{
"target_message_id": "",
"target_user_id": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/moderation/flag');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'target_message_id' => '',
'target_user_id' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'target_message_id' => '',
'target_user_id' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]));
$request->setRequestUrl('{{baseUrl}}/moderation/flag');
$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}}/moderation/flag' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"target_message_id": "",
"target_user_id": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/moderation/flag' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"target_message_id": "",
"target_user_id": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"target_message_id\": \"\",\n \"target_user_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/moderation/flag", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/moderation/flag"
payload = {
"target_message_id": "",
"target_user_id": "",
"user": {
"ban_expires": "",
"banned": False,
"id": "",
"invisible": False,
"language": "",
"push_notifications": {
"disabled": False,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/moderation/flag"
payload <- "{\n \"target_message_id\": \"\",\n \"target_user_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/moderation/flag")
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 \"target_message_id\": \"\",\n \"target_user_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/moderation/flag') do |req|
req.body = "{\n \"target_message_id\": \"\",\n \"target_user_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/moderation/flag";
let payload = json!({
"target_message_id": "",
"target_user_id": "",
"user": json!({
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": json!({
"disabled": false,
"disabled_until": ""
}),
"revoke_tokens_issued_before": "",
"role": "",
"teams": ()
}),
"user_id": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/moderation/flag \
--header 'content-type: application/json' \
--data '{
"target_message_id": "",
"target_user_id": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
echo '{
"target_message_id": "",
"target_user_id": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}' | \
http POST {{baseUrl}}/moderation/flag \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "target_message_id": "",\n "target_user_id": "",\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n}' \
--output-document \
- {{baseUrl}}/moderation/flag
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"target_message_id": "",
"target_user_id": "",
"user": [
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": [
"disabled": false,
"disabled_until": ""
],
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
],
"user_id": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/moderation/flag")! 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
Unflag
{{baseUrl}}/moderation/unflag
BODY json
{
"target_message_id": "",
"target_user_id": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/moderation/unflag");
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 \"target_message_id\": \"\",\n \"target_user_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/moderation/unflag" {:content-type :json
:form-params {:target_message_id ""
:target_user_id ""
:user {:ban_expires ""
:banned false
:id ""
:invisible false
:language ""
:push_notifications {:disabled false
:disabled_until ""}
:revoke_tokens_issued_before ""
:role ""
:teams []}
:user_id ""}})
require "http/client"
url = "{{baseUrl}}/moderation/unflag"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"target_message_id\": \"\",\n \"target_user_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/moderation/unflag"),
Content = new StringContent("{\n \"target_message_id\": \"\",\n \"target_user_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/moderation/unflag");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"target_message_id\": \"\",\n \"target_user_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/moderation/unflag"
payload := strings.NewReader("{\n \"target_message_id\": \"\",\n \"target_user_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/moderation/unflag HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 347
{
"target_message_id": "",
"target_user_id": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/moderation/unflag")
.setHeader("content-type", "application/json")
.setBody("{\n \"target_message_id\": \"\",\n \"target_user_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/moderation/unflag"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"target_message_id\": \"\",\n \"target_user_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"target_message_id\": \"\",\n \"target_user_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/moderation/unflag")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/moderation/unflag")
.header("content-type", "application/json")
.body("{\n \"target_message_id\": \"\",\n \"target_user_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
.asString();
const data = JSON.stringify({
target_message_id: '',
target_user_id: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/moderation/unflag');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/moderation/unflag',
headers: {'content-type': 'application/json'},
data: {
target_message_id: '',
target_user_id: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/moderation/unflag';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"target_message_id":"","target_user_id":"","user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/moderation/unflag',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "target_message_id": "",\n "target_user_id": "",\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"target_message_id\": \"\",\n \"target_user_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/moderation/unflag")
.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/moderation/unflag',
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({
target_message_id: '',
target_user_id: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/moderation/unflag',
headers: {'content-type': 'application/json'},
body: {
target_message_id: '',
target_user_id: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/moderation/unflag');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
target_message_id: '',
target_user_id: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/moderation/unflag',
headers: {'content-type': 'application/json'},
data: {
target_message_id: '',
target_user_id: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/moderation/unflag';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"target_message_id":"","target_user_id":"","user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"target_message_id": @"",
@"target_user_id": @"",
@"user": @{ @"ban_expires": @"", @"banned": @NO, @"id": @"", @"invisible": @NO, @"language": @"", @"push_notifications": @{ @"disabled": @NO, @"disabled_until": @"" }, @"revoke_tokens_issued_before": @"", @"role": @"", @"teams": @[ ] },
@"user_id": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/moderation/unflag"]
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}}/moderation/unflag" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"target_message_id\": \"\",\n \"target_user_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/moderation/unflag",
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([
'target_message_id' => '',
'target_user_id' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/moderation/unflag', [
'body' => '{
"target_message_id": "",
"target_user_id": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/moderation/unflag');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'target_message_id' => '',
'target_user_id' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'target_message_id' => '',
'target_user_id' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]));
$request->setRequestUrl('{{baseUrl}}/moderation/unflag');
$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}}/moderation/unflag' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"target_message_id": "",
"target_user_id": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/moderation/unflag' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"target_message_id": "",
"target_user_id": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"target_message_id\": \"\",\n \"target_user_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/moderation/unflag", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/moderation/unflag"
payload = {
"target_message_id": "",
"target_user_id": "",
"user": {
"ban_expires": "",
"banned": False,
"id": "",
"invisible": False,
"language": "",
"push_notifications": {
"disabled": False,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/moderation/unflag"
payload <- "{\n \"target_message_id\": \"\",\n \"target_user_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/moderation/unflag")
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 \"target_message_id\": \"\",\n \"target_user_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/moderation/unflag') do |req|
req.body = "{\n \"target_message_id\": \"\",\n \"target_user_id\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/moderation/unflag";
let payload = json!({
"target_message_id": "",
"target_user_id": "",
"user": json!({
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": json!({
"disabled": false,
"disabled_until": ""
}),
"revoke_tokens_issued_before": "",
"role": "",
"teams": ()
}),
"user_id": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/moderation/unflag \
--header 'content-type: application/json' \
--data '{
"target_message_id": "",
"target_user_id": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
echo '{
"target_message_id": "",
"target_user_id": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}' | \
http POST {{baseUrl}}/moderation/unflag \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "target_message_id": "",\n "target_user_id": "",\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n}' \
--output-document \
- {{baseUrl}}/moderation/unflag
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"target_message_id": "",
"target_user_id": "",
"user": [
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": [
"disabled": false,
"disabled_until": ""
],
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
],
"user_id": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/moderation/unflag")! 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
Create role
{{baseUrl}}/roles
BODY json
{
"name": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/roles");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"name\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/roles" {:content-type :json
:form-params {:name ""}})
require "http/client"
url = "{{baseUrl}}/roles"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"name\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/roles"),
Content = new StringContent("{\n \"name\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/roles");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"name\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/roles"
payload := strings.NewReader("{\n \"name\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/roles HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 16
{
"name": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/roles")
.setHeader("content-type", "application/json")
.setBody("{\n \"name\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/roles"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"name\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"name\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/roles")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/roles")
.header("content-type", "application/json")
.body("{\n \"name\": \"\"\n}")
.asString();
const data = JSON.stringify({
name: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/roles');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/roles',
headers: {'content-type': 'application/json'},
data: {name: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/roles';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"name":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/roles',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "name": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"name\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/roles")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/roles',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({name: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/roles',
headers: {'content-type': 'application/json'},
body: {name: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/roles');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
name: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/roles',
headers: {'content-type': 'application/json'},
data: {name: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/roles';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"name":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"name": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/roles"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/roles" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"name\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/roles",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/roles', [
'body' => '{
"name": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/roles');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'name' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'name' => ''
]));
$request->setRequestUrl('{{baseUrl}}/roles');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/roles' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"name": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/roles' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"name": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"name\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/roles", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/roles"
payload = { "name": "" }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/roles"
payload <- "{\n \"name\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/roles")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"name\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/roles') do |req|
req.body = "{\n \"name\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/roles";
let payload = json!({"name": ""});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/roles \
--header 'content-type: application/json' \
--data '{
"name": ""
}'
echo '{
"name": ""
}' | \
http POST {{baseUrl}}/roles \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "name": ""\n}' \
--output-document \
- {{baseUrl}}/roles
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["name": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/roles")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
Delete role
{{baseUrl}}/roles/:name
QUERY PARAMS
name
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/roles/:name");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/roles/:name")
require "http/client"
url = "{{baseUrl}}/roles/:name"
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}}/roles/:name"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/roles/:name");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/roles/:name"
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/roles/:name HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/roles/:name")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/roles/:name"))
.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}}/roles/:name")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/roles/:name")
.asString();
const 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}}/roles/:name');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/roles/:name'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/roles/:name';
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}}/roles/:name',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/roles/:name")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/roles/:name',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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}}/roles/:name'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/roles/:name');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/roles/:name'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/roles/:name';
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}}/roles/:name"]
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}}/roles/:name" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/roles/:name",
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}}/roles/:name');
echo $response->getBody();
setUrl('{{baseUrl}}/roles/:name');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/roles/:name');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/roles/:name' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/roles/:name' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/roles/:name")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/roles/:name"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/roles/:name"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/roles/:name")
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/roles/:name') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/roles/:name";
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}}/roles/:name
http DELETE {{baseUrl}}/roles/:name
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/roles/:name
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/roles/:name")! 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
Get permission
{{baseUrl}}/permissions/: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}}/permissions/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/permissions/:id")
require "http/client"
url = "{{baseUrl}}/permissions/: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}}/permissions/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/permissions/:id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/permissions/: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/permissions/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/permissions/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/permissions/: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}}/permissions/:id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/permissions/: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}}/permissions/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/permissions/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/permissions/: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}}/permissions/:id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/permissions/:id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/permissions/: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}}/permissions/: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}}/permissions/: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}}/permissions/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/permissions/: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}}/permissions/: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}}/permissions/:id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/permissions/: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}}/permissions/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/permissions/:id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/permissions/:id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/permissions/:id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/permissions/:id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/permissions/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/permissions/:id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/permissions/:id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/permissions/: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/permissions/:id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/permissions/: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}}/permissions/:id
http GET {{baseUrl}}/permissions/:id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/permissions/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/permissions/: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
List permissions
{{baseUrl}}/permissions
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/permissions");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/permissions")
require "http/client"
url = "{{baseUrl}}/permissions"
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}}/permissions"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/permissions");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/permissions"
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/permissions HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/permissions")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/permissions"))
.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}}/permissions")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/permissions")
.asString();
const 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}}/permissions');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/permissions'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/permissions';
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}}/permissions',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/permissions")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/permissions',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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}}/permissions'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/permissions');
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}}/permissions'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/permissions';
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}}/permissions"]
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}}/permissions" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/permissions",
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}}/permissions');
echo $response->getBody();
setUrl('{{baseUrl}}/permissions');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/permissions');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/permissions' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/permissions' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/permissions")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/permissions"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/permissions"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/permissions")
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/permissions') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/permissions";
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}}/permissions
http GET {{baseUrl}}/permissions
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/permissions
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/permissions")! 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
List roles
{{baseUrl}}/roles
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/roles");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/roles")
require "http/client"
url = "{{baseUrl}}/roles"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/roles"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/roles");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/roles"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/roles HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/roles")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/roles"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/roles")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/roles")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/roles');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/roles'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/roles';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/roles',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/roles")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/roles',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/roles'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/roles');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/roles'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/roles';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/roles"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/roles" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/roles",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/roles');
echo $response->getBody();
setUrl('{{baseUrl}}/roles');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/roles');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/roles' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/roles' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/roles")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/roles"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/roles"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/roles")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/roles') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/roles";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/roles
http GET {{baseUrl}}/roles
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/roles
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/roles")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
Delete a push provider
{{baseUrl}}/push_providers/:type/:name
QUERY PARAMS
type
name
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/push_providers/:type/:name");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/push_providers/:type/:name")
require "http/client"
url = "{{baseUrl}}/push_providers/:type/:name"
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}}/push_providers/:type/:name"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/push_providers/:type/:name");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/push_providers/:type/:name"
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/push_providers/:type/:name HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/push_providers/:type/:name")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/push_providers/:type/:name"))
.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}}/push_providers/:type/:name")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/push_providers/:type/:name")
.asString();
const 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}}/push_providers/:type/:name');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/push_providers/:type/:name'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/push_providers/:type/:name';
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}}/push_providers/:type/:name',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/push_providers/:type/:name")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/push_providers/:type/:name',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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}}/push_providers/:type/:name'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/push_providers/:type/:name');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/push_providers/:type/:name'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/push_providers/:type/:name';
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}}/push_providers/:type/:name"]
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}}/push_providers/:type/:name" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/push_providers/:type/:name",
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}}/push_providers/:type/:name');
echo $response->getBody();
setUrl('{{baseUrl}}/push_providers/:type/:name');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/push_providers/:type/:name');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/push_providers/:type/:name' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/push_providers/:type/:name' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/push_providers/:type/:name")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/push_providers/:type/:name"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/push_providers/:type/:name"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/push_providers/:type/:name")
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/push_providers/:type/:name') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/push_providers/:type/:name";
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}}/push_providers/:type/:name
http DELETE {{baseUrl}}/push_providers/:type/:name
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/push_providers/:type/:name
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/push_providers/:type/:name")! 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
List push providers
{{baseUrl}}/push_providers
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/push_providers");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/push_providers")
require "http/client"
url = "{{baseUrl}}/push_providers"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/push_providers"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/push_providers");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/push_providers"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/push_providers HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/push_providers")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/push_providers"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/push_providers")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/push_providers")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/push_providers');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/push_providers'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/push_providers';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/push_providers',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/push_providers")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/push_providers',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/push_providers'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/push_providers');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/push_providers'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/push_providers';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/push_providers"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/push_providers" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/push_providers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/push_providers');
echo $response->getBody();
setUrl('{{baseUrl}}/push_providers');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/push_providers');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/push_providers' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/push_providers' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/push_providers")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/push_providers"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/push_providers"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/push_providers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/push_providers') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/push_providers";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/push_providers
http GET {{baseUrl}}/push_providers
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/push_providers
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/push_providers")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Upsert a push provider
{{baseUrl}}/push_providers
BODY json
{
"push_provider": {
"apn_auth_key": "",
"apn_auth_type": "",
"apn_development": false,
"apn_host": "",
"apn_key_id": "",
"apn_notification_template": "",
"apn_p12_cert": "",
"apn_team_id": "",
"apn_topic": "",
"created_at": "",
"description": "",
"disabled_at": "",
"disabled_reason": "",
"firebase_apn_template": "",
"firebase_credentials": "",
"firebase_data_template": "",
"firebase_notification_template": "",
"firebase_server_key": "",
"huawei_app_id": "",
"huawei_app_secret": "",
"name": "",
"type": "",
"updated_at": "",
"xiaomi_app_secret": "",
"xiaomi_package_name": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/push_providers");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"push_provider\": {\n \"apn_auth_key\": \"\",\n \"apn_auth_type\": \"\",\n \"apn_development\": false,\n \"apn_host\": \"\",\n \"apn_key_id\": \"\",\n \"apn_notification_template\": \"\",\n \"apn_p12_cert\": \"\",\n \"apn_team_id\": \"\",\n \"apn_topic\": \"\",\n \"created_at\": \"\",\n \"description\": \"\",\n \"disabled_at\": \"\",\n \"disabled_reason\": \"\",\n \"firebase_apn_template\": \"\",\n \"firebase_credentials\": \"\",\n \"firebase_data_template\": \"\",\n \"firebase_notification_template\": \"\",\n \"firebase_server_key\": \"\",\n \"huawei_app_id\": \"\",\n \"huawei_app_secret\": \"\",\n \"name\": \"\",\n \"type\": \"\",\n \"updated_at\": \"\",\n \"xiaomi_app_secret\": \"\",\n \"xiaomi_package_name\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/push_providers" {:content-type :json
:form-params {:push_provider {:apn_auth_key ""
:apn_auth_type ""
:apn_development false
:apn_host ""
:apn_key_id ""
:apn_notification_template ""
:apn_p12_cert ""
:apn_team_id ""
:apn_topic ""
:created_at ""
:description ""
:disabled_at ""
:disabled_reason ""
:firebase_apn_template ""
:firebase_credentials ""
:firebase_data_template ""
:firebase_notification_template ""
:firebase_server_key ""
:huawei_app_id ""
:huawei_app_secret ""
:name ""
:type ""
:updated_at ""
:xiaomi_app_secret ""
:xiaomi_package_name ""}}})
require "http/client"
url = "{{baseUrl}}/push_providers"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"push_provider\": {\n \"apn_auth_key\": \"\",\n \"apn_auth_type\": \"\",\n \"apn_development\": false,\n \"apn_host\": \"\",\n \"apn_key_id\": \"\",\n \"apn_notification_template\": \"\",\n \"apn_p12_cert\": \"\",\n \"apn_team_id\": \"\",\n \"apn_topic\": \"\",\n \"created_at\": \"\",\n \"description\": \"\",\n \"disabled_at\": \"\",\n \"disabled_reason\": \"\",\n \"firebase_apn_template\": \"\",\n \"firebase_credentials\": \"\",\n \"firebase_data_template\": \"\",\n \"firebase_notification_template\": \"\",\n \"firebase_server_key\": \"\",\n \"huawei_app_id\": \"\",\n \"huawei_app_secret\": \"\",\n \"name\": \"\",\n \"type\": \"\",\n \"updated_at\": \"\",\n \"xiaomi_app_secret\": \"\",\n \"xiaomi_package_name\": \"\"\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/push_providers"),
Content = new StringContent("{\n \"push_provider\": {\n \"apn_auth_key\": \"\",\n \"apn_auth_type\": \"\",\n \"apn_development\": false,\n \"apn_host\": \"\",\n \"apn_key_id\": \"\",\n \"apn_notification_template\": \"\",\n \"apn_p12_cert\": \"\",\n \"apn_team_id\": \"\",\n \"apn_topic\": \"\",\n \"created_at\": \"\",\n \"description\": \"\",\n \"disabled_at\": \"\",\n \"disabled_reason\": \"\",\n \"firebase_apn_template\": \"\",\n \"firebase_credentials\": \"\",\n \"firebase_data_template\": \"\",\n \"firebase_notification_template\": \"\",\n \"firebase_server_key\": \"\",\n \"huawei_app_id\": \"\",\n \"huawei_app_secret\": \"\",\n \"name\": \"\",\n \"type\": \"\",\n \"updated_at\": \"\",\n \"xiaomi_app_secret\": \"\",\n \"xiaomi_package_name\": \"\"\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/push_providers");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"push_provider\": {\n \"apn_auth_key\": \"\",\n \"apn_auth_type\": \"\",\n \"apn_development\": false,\n \"apn_host\": \"\",\n \"apn_key_id\": \"\",\n \"apn_notification_template\": \"\",\n \"apn_p12_cert\": \"\",\n \"apn_team_id\": \"\",\n \"apn_topic\": \"\",\n \"created_at\": \"\",\n \"description\": \"\",\n \"disabled_at\": \"\",\n \"disabled_reason\": \"\",\n \"firebase_apn_template\": \"\",\n \"firebase_credentials\": \"\",\n \"firebase_data_template\": \"\",\n \"firebase_notification_template\": \"\",\n \"firebase_server_key\": \"\",\n \"huawei_app_id\": \"\",\n \"huawei_app_secret\": \"\",\n \"name\": \"\",\n \"type\": \"\",\n \"updated_at\": \"\",\n \"xiaomi_app_secret\": \"\",\n \"xiaomi_package_name\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/push_providers"
payload := strings.NewReader("{\n \"push_provider\": {\n \"apn_auth_key\": \"\",\n \"apn_auth_type\": \"\",\n \"apn_development\": false,\n \"apn_host\": \"\",\n \"apn_key_id\": \"\",\n \"apn_notification_template\": \"\",\n \"apn_p12_cert\": \"\",\n \"apn_team_id\": \"\",\n \"apn_topic\": \"\",\n \"created_at\": \"\",\n \"description\": \"\",\n \"disabled_at\": \"\",\n \"disabled_reason\": \"\",\n \"firebase_apn_template\": \"\",\n \"firebase_credentials\": \"\",\n \"firebase_data_template\": \"\",\n \"firebase_notification_template\": \"\",\n \"firebase_server_key\": \"\",\n \"huawei_app_id\": \"\",\n \"huawei_app_secret\": \"\",\n \"name\": \"\",\n \"type\": \"\",\n \"updated_at\": \"\",\n \"xiaomi_app_secret\": \"\",\n \"xiaomi_package_name\": \"\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/push_providers HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 688
{
"push_provider": {
"apn_auth_key": "",
"apn_auth_type": "",
"apn_development": false,
"apn_host": "",
"apn_key_id": "",
"apn_notification_template": "",
"apn_p12_cert": "",
"apn_team_id": "",
"apn_topic": "",
"created_at": "",
"description": "",
"disabled_at": "",
"disabled_reason": "",
"firebase_apn_template": "",
"firebase_credentials": "",
"firebase_data_template": "",
"firebase_notification_template": "",
"firebase_server_key": "",
"huawei_app_id": "",
"huawei_app_secret": "",
"name": "",
"type": "",
"updated_at": "",
"xiaomi_app_secret": "",
"xiaomi_package_name": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/push_providers")
.setHeader("content-type", "application/json")
.setBody("{\n \"push_provider\": {\n \"apn_auth_key\": \"\",\n \"apn_auth_type\": \"\",\n \"apn_development\": false,\n \"apn_host\": \"\",\n \"apn_key_id\": \"\",\n \"apn_notification_template\": \"\",\n \"apn_p12_cert\": \"\",\n \"apn_team_id\": \"\",\n \"apn_topic\": \"\",\n \"created_at\": \"\",\n \"description\": \"\",\n \"disabled_at\": \"\",\n \"disabled_reason\": \"\",\n \"firebase_apn_template\": \"\",\n \"firebase_credentials\": \"\",\n \"firebase_data_template\": \"\",\n \"firebase_notification_template\": \"\",\n \"firebase_server_key\": \"\",\n \"huawei_app_id\": \"\",\n \"huawei_app_secret\": \"\",\n \"name\": \"\",\n \"type\": \"\",\n \"updated_at\": \"\",\n \"xiaomi_app_secret\": \"\",\n \"xiaomi_package_name\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/push_providers"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"push_provider\": {\n \"apn_auth_key\": \"\",\n \"apn_auth_type\": \"\",\n \"apn_development\": false,\n \"apn_host\": \"\",\n \"apn_key_id\": \"\",\n \"apn_notification_template\": \"\",\n \"apn_p12_cert\": \"\",\n \"apn_team_id\": \"\",\n \"apn_topic\": \"\",\n \"created_at\": \"\",\n \"description\": \"\",\n \"disabled_at\": \"\",\n \"disabled_reason\": \"\",\n \"firebase_apn_template\": \"\",\n \"firebase_credentials\": \"\",\n \"firebase_data_template\": \"\",\n \"firebase_notification_template\": \"\",\n \"firebase_server_key\": \"\",\n \"huawei_app_id\": \"\",\n \"huawei_app_secret\": \"\",\n \"name\": \"\",\n \"type\": \"\",\n \"updated_at\": \"\",\n \"xiaomi_app_secret\": \"\",\n \"xiaomi_package_name\": \"\"\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"push_provider\": {\n \"apn_auth_key\": \"\",\n \"apn_auth_type\": \"\",\n \"apn_development\": false,\n \"apn_host\": \"\",\n \"apn_key_id\": \"\",\n \"apn_notification_template\": \"\",\n \"apn_p12_cert\": \"\",\n \"apn_team_id\": \"\",\n \"apn_topic\": \"\",\n \"created_at\": \"\",\n \"description\": \"\",\n \"disabled_at\": \"\",\n \"disabled_reason\": \"\",\n \"firebase_apn_template\": \"\",\n \"firebase_credentials\": \"\",\n \"firebase_data_template\": \"\",\n \"firebase_notification_template\": \"\",\n \"firebase_server_key\": \"\",\n \"huawei_app_id\": \"\",\n \"huawei_app_secret\": \"\",\n \"name\": \"\",\n \"type\": \"\",\n \"updated_at\": \"\",\n \"xiaomi_app_secret\": \"\",\n \"xiaomi_package_name\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/push_providers")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/push_providers")
.header("content-type", "application/json")
.body("{\n \"push_provider\": {\n \"apn_auth_key\": \"\",\n \"apn_auth_type\": \"\",\n \"apn_development\": false,\n \"apn_host\": \"\",\n \"apn_key_id\": \"\",\n \"apn_notification_template\": \"\",\n \"apn_p12_cert\": \"\",\n \"apn_team_id\": \"\",\n \"apn_topic\": \"\",\n \"created_at\": \"\",\n \"description\": \"\",\n \"disabled_at\": \"\",\n \"disabled_reason\": \"\",\n \"firebase_apn_template\": \"\",\n \"firebase_credentials\": \"\",\n \"firebase_data_template\": \"\",\n \"firebase_notification_template\": \"\",\n \"firebase_server_key\": \"\",\n \"huawei_app_id\": \"\",\n \"huawei_app_secret\": \"\",\n \"name\": \"\",\n \"type\": \"\",\n \"updated_at\": \"\",\n \"xiaomi_app_secret\": \"\",\n \"xiaomi_package_name\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
push_provider: {
apn_auth_key: '',
apn_auth_type: '',
apn_development: false,
apn_host: '',
apn_key_id: '',
apn_notification_template: '',
apn_p12_cert: '',
apn_team_id: '',
apn_topic: '',
created_at: '',
description: '',
disabled_at: '',
disabled_reason: '',
firebase_apn_template: '',
firebase_credentials: '',
firebase_data_template: '',
firebase_notification_template: '',
firebase_server_key: '',
huawei_app_id: '',
huawei_app_secret: '',
name: '',
type: '',
updated_at: '',
xiaomi_app_secret: '',
xiaomi_package_name: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/push_providers');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/push_providers',
headers: {'content-type': 'application/json'},
data: {
push_provider: {
apn_auth_key: '',
apn_auth_type: '',
apn_development: false,
apn_host: '',
apn_key_id: '',
apn_notification_template: '',
apn_p12_cert: '',
apn_team_id: '',
apn_topic: '',
created_at: '',
description: '',
disabled_at: '',
disabled_reason: '',
firebase_apn_template: '',
firebase_credentials: '',
firebase_data_template: '',
firebase_notification_template: '',
firebase_server_key: '',
huawei_app_id: '',
huawei_app_secret: '',
name: '',
type: '',
updated_at: '',
xiaomi_app_secret: '',
xiaomi_package_name: ''
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/push_providers';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"push_provider":{"apn_auth_key":"","apn_auth_type":"","apn_development":false,"apn_host":"","apn_key_id":"","apn_notification_template":"","apn_p12_cert":"","apn_team_id":"","apn_topic":"","created_at":"","description":"","disabled_at":"","disabled_reason":"","firebase_apn_template":"","firebase_credentials":"","firebase_data_template":"","firebase_notification_template":"","firebase_server_key":"","huawei_app_id":"","huawei_app_secret":"","name":"","type":"","updated_at":"","xiaomi_app_secret":"","xiaomi_package_name":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/push_providers',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "push_provider": {\n "apn_auth_key": "",\n "apn_auth_type": "",\n "apn_development": false,\n "apn_host": "",\n "apn_key_id": "",\n "apn_notification_template": "",\n "apn_p12_cert": "",\n "apn_team_id": "",\n "apn_topic": "",\n "created_at": "",\n "description": "",\n "disabled_at": "",\n "disabled_reason": "",\n "firebase_apn_template": "",\n "firebase_credentials": "",\n "firebase_data_template": "",\n "firebase_notification_template": "",\n "firebase_server_key": "",\n "huawei_app_id": "",\n "huawei_app_secret": "",\n "name": "",\n "type": "",\n "updated_at": "",\n "xiaomi_app_secret": "",\n "xiaomi_package_name": ""\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"push_provider\": {\n \"apn_auth_key\": \"\",\n \"apn_auth_type\": \"\",\n \"apn_development\": false,\n \"apn_host\": \"\",\n \"apn_key_id\": \"\",\n \"apn_notification_template\": \"\",\n \"apn_p12_cert\": \"\",\n \"apn_team_id\": \"\",\n \"apn_topic\": \"\",\n \"created_at\": \"\",\n \"description\": \"\",\n \"disabled_at\": \"\",\n \"disabled_reason\": \"\",\n \"firebase_apn_template\": \"\",\n \"firebase_credentials\": \"\",\n \"firebase_data_template\": \"\",\n \"firebase_notification_template\": \"\",\n \"firebase_server_key\": \"\",\n \"huawei_app_id\": \"\",\n \"huawei_app_secret\": \"\",\n \"name\": \"\",\n \"type\": \"\",\n \"updated_at\": \"\",\n \"xiaomi_app_secret\": \"\",\n \"xiaomi_package_name\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/push_providers")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/push_providers',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
push_provider: {
apn_auth_key: '',
apn_auth_type: '',
apn_development: false,
apn_host: '',
apn_key_id: '',
apn_notification_template: '',
apn_p12_cert: '',
apn_team_id: '',
apn_topic: '',
created_at: '',
description: '',
disabled_at: '',
disabled_reason: '',
firebase_apn_template: '',
firebase_credentials: '',
firebase_data_template: '',
firebase_notification_template: '',
firebase_server_key: '',
huawei_app_id: '',
huawei_app_secret: '',
name: '',
type: '',
updated_at: '',
xiaomi_app_secret: '',
xiaomi_package_name: ''
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/push_providers',
headers: {'content-type': 'application/json'},
body: {
push_provider: {
apn_auth_key: '',
apn_auth_type: '',
apn_development: false,
apn_host: '',
apn_key_id: '',
apn_notification_template: '',
apn_p12_cert: '',
apn_team_id: '',
apn_topic: '',
created_at: '',
description: '',
disabled_at: '',
disabled_reason: '',
firebase_apn_template: '',
firebase_credentials: '',
firebase_data_template: '',
firebase_notification_template: '',
firebase_server_key: '',
huawei_app_id: '',
huawei_app_secret: '',
name: '',
type: '',
updated_at: '',
xiaomi_app_secret: '',
xiaomi_package_name: ''
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/push_providers');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
push_provider: {
apn_auth_key: '',
apn_auth_type: '',
apn_development: false,
apn_host: '',
apn_key_id: '',
apn_notification_template: '',
apn_p12_cert: '',
apn_team_id: '',
apn_topic: '',
created_at: '',
description: '',
disabled_at: '',
disabled_reason: '',
firebase_apn_template: '',
firebase_credentials: '',
firebase_data_template: '',
firebase_notification_template: '',
firebase_server_key: '',
huawei_app_id: '',
huawei_app_secret: '',
name: '',
type: '',
updated_at: '',
xiaomi_app_secret: '',
xiaomi_package_name: ''
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/push_providers',
headers: {'content-type': 'application/json'},
data: {
push_provider: {
apn_auth_key: '',
apn_auth_type: '',
apn_development: false,
apn_host: '',
apn_key_id: '',
apn_notification_template: '',
apn_p12_cert: '',
apn_team_id: '',
apn_topic: '',
created_at: '',
description: '',
disabled_at: '',
disabled_reason: '',
firebase_apn_template: '',
firebase_credentials: '',
firebase_data_template: '',
firebase_notification_template: '',
firebase_server_key: '',
huawei_app_id: '',
huawei_app_secret: '',
name: '',
type: '',
updated_at: '',
xiaomi_app_secret: '',
xiaomi_package_name: ''
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/push_providers';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"push_provider":{"apn_auth_key":"","apn_auth_type":"","apn_development":false,"apn_host":"","apn_key_id":"","apn_notification_template":"","apn_p12_cert":"","apn_team_id":"","apn_topic":"","created_at":"","description":"","disabled_at":"","disabled_reason":"","firebase_apn_template":"","firebase_credentials":"","firebase_data_template":"","firebase_notification_template":"","firebase_server_key":"","huawei_app_id":"","huawei_app_secret":"","name":"","type":"","updated_at":"","xiaomi_app_secret":"","xiaomi_package_name":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"push_provider": @{ @"apn_auth_key": @"", @"apn_auth_type": @"", @"apn_development": @NO, @"apn_host": @"", @"apn_key_id": @"", @"apn_notification_template": @"", @"apn_p12_cert": @"", @"apn_team_id": @"", @"apn_topic": @"", @"created_at": @"", @"description": @"", @"disabled_at": @"", @"disabled_reason": @"", @"firebase_apn_template": @"", @"firebase_credentials": @"", @"firebase_data_template": @"", @"firebase_notification_template": @"", @"firebase_server_key": @"", @"huawei_app_id": @"", @"huawei_app_secret": @"", @"name": @"", @"type": @"", @"updated_at": @"", @"xiaomi_app_secret": @"", @"xiaomi_package_name": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/push_providers"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/push_providers" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"push_provider\": {\n \"apn_auth_key\": \"\",\n \"apn_auth_type\": \"\",\n \"apn_development\": false,\n \"apn_host\": \"\",\n \"apn_key_id\": \"\",\n \"apn_notification_template\": \"\",\n \"apn_p12_cert\": \"\",\n \"apn_team_id\": \"\",\n \"apn_topic\": \"\",\n \"created_at\": \"\",\n \"description\": \"\",\n \"disabled_at\": \"\",\n \"disabled_reason\": \"\",\n \"firebase_apn_template\": \"\",\n \"firebase_credentials\": \"\",\n \"firebase_data_template\": \"\",\n \"firebase_notification_template\": \"\",\n \"firebase_server_key\": \"\",\n \"huawei_app_id\": \"\",\n \"huawei_app_secret\": \"\",\n \"name\": \"\",\n \"type\": \"\",\n \"updated_at\": \"\",\n \"xiaomi_app_secret\": \"\",\n \"xiaomi_package_name\": \"\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/push_providers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'push_provider' => [
'apn_auth_key' => '',
'apn_auth_type' => '',
'apn_development' => null,
'apn_host' => '',
'apn_key_id' => '',
'apn_notification_template' => '',
'apn_p12_cert' => '',
'apn_team_id' => '',
'apn_topic' => '',
'created_at' => '',
'description' => '',
'disabled_at' => '',
'disabled_reason' => '',
'firebase_apn_template' => '',
'firebase_credentials' => '',
'firebase_data_template' => '',
'firebase_notification_template' => '',
'firebase_server_key' => '',
'huawei_app_id' => '',
'huawei_app_secret' => '',
'name' => '',
'type' => '',
'updated_at' => '',
'xiaomi_app_secret' => '',
'xiaomi_package_name' => ''
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/push_providers', [
'body' => '{
"push_provider": {
"apn_auth_key": "",
"apn_auth_type": "",
"apn_development": false,
"apn_host": "",
"apn_key_id": "",
"apn_notification_template": "",
"apn_p12_cert": "",
"apn_team_id": "",
"apn_topic": "",
"created_at": "",
"description": "",
"disabled_at": "",
"disabled_reason": "",
"firebase_apn_template": "",
"firebase_credentials": "",
"firebase_data_template": "",
"firebase_notification_template": "",
"firebase_server_key": "",
"huawei_app_id": "",
"huawei_app_secret": "",
"name": "",
"type": "",
"updated_at": "",
"xiaomi_app_secret": "",
"xiaomi_package_name": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/push_providers');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'push_provider' => [
'apn_auth_key' => '',
'apn_auth_type' => '',
'apn_development' => null,
'apn_host' => '',
'apn_key_id' => '',
'apn_notification_template' => '',
'apn_p12_cert' => '',
'apn_team_id' => '',
'apn_topic' => '',
'created_at' => '',
'description' => '',
'disabled_at' => '',
'disabled_reason' => '',
'firebase_apn_template' => '',
'firebase_credentials' => '',
'firebase_data_template' => '',
'firebase_notification_template' => '',
'firebase_server_key' => '',
'huawei_app_id' => '',
'huawei_app_secret' => '',
'name' => '',
'type' => '',
'updated_at' => '',
'xiaomi_app_secret' => '',
'xiaomi_package_name' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'push_provider' => [
'apn_auth_key' => '',
'apn_auth_type' => '',
'apn_development' => null,
'apn_host' => '',
'apn_key_id' => '',
'apn_notification_template' => '',
'apn_p12_cert' => '',
'apn_team_id' => '',
'apn_topic' => '',
'created_at' => '',
'description' => '',
'disabled_at' => '',
'disabled_reason' => '',
'firebase_apn_template' => '',
'firebase_credentials' => '',
'firebase_data_template' => '',
'firebase_notification_template' => '',
'firebase_server_key' => '',
'huawei_app_id' => '',
'huawei_app_secret' => '',
'name' => '',
'type' => '',
'updated_at' => '',
'xiaomi_app_secret' => '',
'xiaomi_package_name' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/push_providers');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/push_providers' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"push_provider": {
"apn_auth_key": "",
"apn_auth_type": "",
"apn_development": false,
"apn_host": "",
"apn_key_id": "",
"apn_notification_template": "",
"apn_p12_cert": "",
"apn_team_id": "",
"apn_topic": "",
"created_at": "",
"description": "",
"disabled_at": "",
"disabled_reason": "",
"firebase_apn_template": "",
"firebase_credentials": "",
"firebase_data_template": "",
"firebase_notification_template": "",
"firebase_server_key": "",
"huawei_app_id": "",
"huawei_app_secret": "",
"name": "",
"type": "",
"updated_at": "",
"xiaomi_app_secret": "",
"xiaomi_package_name": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/push_providers' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"push_provider": {
"apn_auth_key": "",
"apn_auth_type": "",
"apn_development": false,
"apn_host": "",
"apn_key_id": "",
"apn_notification_template": "",
"apn_p12_cert": "",
"apn_team_id": "",
"apn_topic": "",
"created_at": "",
"description": "",
"disabled_at": "",
"disabled_reason": "",
"firebase_apn_template": "",
"firebase_credentials": "",
"firebase_data_template": "",
"firebase_notification_template": "",
"firebase_server_key": "",
"huawei_app_id": "",
"huawei_app_secret": "",
"name": "",
"type": "",
"updated_at": "",
"xiaomi_app_secret": "",
"xiaomi_package_name": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"push_provider\": {\n \"apn_auth_key\": \"\",\n \"apn_auth_type\": \"\",\n \"apn_development\": false,\n \"apn_host\": \"\",\n \"apn_key_id\": \"\",\n \"apn_notification_template\": \"\",\n \"apn_p12_cert\": \"\",\n \"apn_team_id\": \"\",\n \"apn_topic\": \"\",\n \"created_at\": \"\",\n \"description\": \"\",\n \"disabled_at\": \"\",\n \"disabled_reason\": \"\",\n \"firebase_apn_template\": \"\",\n \"firebase_credentials\": \"\",\n \"firebase_data_template\": \"\",\n \"firebase_notification_template\": \"\",\n \"firebase_server_key\": \"\",\n \"huawei_app_id\": \"\",\n \"huawei_app_secret\": \"\",\n \"name\": \"\",\n \"type\": \"\",\n \"updated_at\": \"\",\n \"xiaomi_app_secret\": \"\",\n \"xiaomi_package_name\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/push_providers", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/push_providers"
payload = { "push_provider": {
"apn_auth_key": "",
"apn_auth_type": "",
"apn_development": False,
"apn_host": "",
"apn_key_id": "",
"apn_notification_template": "",
"apn_p12_cert": "",
"apn_team_id": "",
"apn_topic": "",
"created_at": "",
"description": "",
"disabled_at": "",
"disabled_reason": "",
"firebase_apn_template": "",
"firebase_credentials": "",
"firebase_data_template": "",
"firebase_notification_template": "",
"firebase_server_key": "",
"huawei_app_id": "",
"huawei_app_secret": "",
"name": "",
"type": "",
"updated_at": "",
"xiaomi_app_secret": "",
"xiaomi_package_name": ""
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/push_providers"
payload <- "{\n \"push_provider\": {\n \"apn_auth_key\": \"\",\n \"apn_auth_type\": \"\",\n \"apn_development\": false,\n \"apn_host\": \"\",\n \"apn_key_id\": \"\",\n \"apn_notification_template\": \"\",\n \"apn_p12_cert\": \"\",\n \"apn_team_id\": \"\",\n \"apn_topic\": \"\",\n \"created_at\": \"\",\n \"description\": \"\",\n \"disabled_at\": \"\",\n \"disabled_reason\": \"\",\n \"firebase_apn_template\": \"\",\n \"firebase_credentials\": \"\",\n \"firebase_data_template\": \"\",\n \"firebase_notification_template\": \"\",\n \"firebase_server_key\": \"\",\n \"huawei_app_id\": \"\",\n \"huawei_app_secret\": \"\",\n \"name\": \"\",\n \"type\": \"\",\n \"updated_at\": \"\",\n \"xiaomi_app_secret\": \"\",\n \"xiaomi_package_name\": \"\"\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/push_providers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"push_provider\": {\n \"apn_auth_key\": \"\",\n \"apn_auth_type\": \"\",\n \"apn_development\": false,\n \"apn_host\": \"\",\n \"apn_key_id\": \"\",\n \"apn_notification_template\": \"\",\n \"apn_p12_cert\": \"\",\n \"apn_team_id\": \"\",\n \"apn_topic\": \"\",\n \"created_at\": \"\",\n \"description\": \"\",\n \"disabled_at\": \"\",\n \"disabled_reason\": \"\",\n \"firebase_apn_template\": \"\",\n \"firebase_credentials\": \"\",\n \"firebase_data_template\": \"\",\n \"firebase_notification_template\": \"\",\n \"firebase_server_key\": \"\",\n \"huawei_app_id\": \"\",\n \"huawei_app_secret\": \"\",\n \"name\": \"\",\n \"type\": \"\",\n \"updated_at\": \"\",\n \"xiaomi_app_secret\": \"\",\n \"xiaomi_package_name\": \"\"\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/push_providers') do |req|
req.body = "{\n \"push_provider\": {\n \"apn_auth_key\": \"\",\n \"apn_auth_type\": \"\",\n \"apn_development\": false,\n \"apn_host\": \"\",\n \"apn_key_id\": \"\",\n \"apn_notification_template\": \"\",\n \"apn_p12_cert\": \"\",\n \"apn_team_id\": \"\",\n \"apn_topic\": \"\",\n \"created_at\": \"\",\n \"description\": \"\",\n \"disabled_at\": \"\",\n \"disabled_reason\": \"\",\n \"firebase_apn_template\": \"\",\n \"firebase_credentials\": \"\",\n \"firebase_data_template\": \"\",\n \"firebase_notification_template\": \"\",\n \"firebase_server_key\": \"\",\n \"huawei_app_id\": \"\",\n \"huawei_app_secret\": \"\",\n \"name\": \"\",\n \"type\": \"\",\n \"updated_at\": \"\",\n \"xiaomi_app_secret\": \"\",\n \"xiaomi_package_name\": \"\"\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/push_providers";
let payload = json!({"push_provider": json!({
"apn_auth_key": "",
"apn_auth_type": "",
"apn_development": false,
"apn_host": "",
"apn_key_id": "",
"apn_notification_template": "",
"apn_p12_cert": "",
"apn_team_id": "",
"apn_topic": "",
"created_at": "",
"description": "",
"disabled_at": "",
"disabled_reason": "",
"firebase_apn_template": "",
"firebase_credentials": "",
"firebase_data_template": "",
"firebase_notification_template": "",
"firebase_server_key": "",
"huawei_app_id": "",
"huawei_app_secret": "",
"name": "",
"type": "",
"updated_at": "",
"xiaomi_app_secret": "",
"xiaomi_package_name": ""
})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/push_providers \
--header 'content-type: application/json' \
--data '{
"push_provider": {
"apn_auth_key": "",
"apn_auth_type": "",
"apn_development": false,
"apn_host": "",
"apn_key_id": "",
"apn_notification_template": "",
"apn_p12_cert": "",
"apn_team_id": "",
"apn_topic": "",
"created_at": "",
"description": "",
"disabled_at": "",
"disabled_reason": "",
"firebase_apn_template": "",
"firebase_credentials": "",
"firebase_data_template": "",
"firebase_notification_template": "",
"firebase_server_key": "",
"huawei_app_id": "",
"huawei_app_secret": "",
"name": "",
"type": "",
"updated_at": "",
"xiaomi_app_secret": "",
"xiaomi_package_name": ""
}
}'
echo '{
"push_provider": {
"apn_auth_key": "",
"apn_auth_type": "",
"apn_development": false,
"apn_host": "",
"apn_key_id": "",
"apn_notification_template": "",
"apn_p12_cert": "",
"apn_team_id": "",
"apn_topic": "",
"created_at": "",
"description": "",
"disabled_at": "",
"disabled_reason": "",
"firebase_apn_template": "",
"firebase_credentials": "",
"firebase_data_template": "",
"firebase_notification_template": "",
"firebase_server_key": "",
"huawei_app_id": "",
"huawei_app_secret": "",
"name": "",
"type": "",
"updated_at": "",
"xiaomi_app_secret": "",
"xiaomi_package_name": ""
}
}' | \
http POST {{baseUrl}}/push_providers \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "push_provider": {\n "apn_auth_key": "",\n "apn_auth_type": "",\n "apn_development": false,\n "apn_host": "",\n "apn_key_id": "",\n "apn_notification_template": "",\n "apn_p12_cert": "",\n "apn_team_id": "",\n "apn_topic": "",\n "created_at": "",\n "description": "",\n "disabled_at": "",\n "disabled_reason": "",\n "firebase_apn_template": "",\n "firebase_credentials": "",\n "firebase_data_template": "",\n "firebase_notification_template": "",\n "firebase_server_key": "",\n "huawei_app_id": "",\n "huawei_app_secret": "",\n "name": "",\n "type": "",\n "updated_at": "",\n "xiaomi_app_secret": "",\n "xiaomi_package_name": ""\n }\n}' \
--output-document \
- {{baseUrl}}/push_providers
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["push_provider": [
"apn_auth_key": "",
"apn_auth_type": "",
"apn_development": false,
"apn_host": "",
"apn_key_id": "",
"apn_notification_template": "",
"apn_p12_cert": "",
"apn_team_id": "",
"apn_topic": "",
"created_at": "",
"description": "",
"disabled_at": "",
"disabled_reason": "",
"firebase_apn_template": "",
"firebase_credentials": "",
"firebase_data_template": "",
"firebase_notification_template": "",
"firebase_server_key": "",
"huawei_app_id": "",
"huawei_app_secret": "",
"name": "",
"type": "",
"updated_at": "",
"xiaomi_app_secret": "",
"xiaomi_package_name": ""
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/push_providers")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Check SQS
{{baseUrl}}/check_sqs
BODY json
{
"sqs_key": "",
"sqs_secret": "",
"sqs_url": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/check_sqs");
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 \"sqs_key\": \"\",\n \"sqs_secret\": \"\",\n \"sqs_url\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/check_sqs" {:content-type :json
:form-params {:sqs_key ""
:sqs_secret ""
:sqs_url ""}})
require "http/client"
url = "{{baseUrl}}/check_sqs"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"sqs_key\": \"\",\n \"sqs_secret\": \"\",\n \"sqs_url\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/check_sqs"),
Content = new StringContent("{\n \"sqs_key\": \"\",\n \"sqs_secret\": \"\",\n \"sqs_url\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/check_sqs");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"sqs_key\": \"\",\n \"sqs_secret\": \"\",\n \"sqs_url\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/check_sqs"
payload := strings.NewReader("{\n \"sqs_key\": \"\",\n \"sqs_secret\": \"\",\n \"sqs_url\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/check_sqs HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 56
{
"sqs_key": "",
"sqs_secret": "",
"sqs_url": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/check_sqs")
.setHeader("content-type", "application/json")
.setBody("{\n \"sqs_key\": \"\",\n \"sqs_secret\": \"\",\n \"sqs_url\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/check_sqs"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"sqs_key\": \"\",\n \"sqs_secret\": \"\",\n \"sqs_url\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"sqs_key\": \"\",\n \"sqs_secret\": \"\",\n \"sqs_url\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/check_sqs")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/check_sqs")
.header("content-type", "application/json")
.body("{\n \"sqs_key\": \"\",\n \"sqs_secret\": \"\",\n \"sqs_url\": \"\"\n}")
.asString();
const data = JSON.stringify({
sqs_key: '',
sqs_secret: '',
sqs_url: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/check_sqs');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/check_sqs',
headers: {'content-type': 'application/json'},
data: {sqs_key: '', sqs_secret: '', sqs_url: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/check_sqs';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"sqs_key":"","sqs_secret":"","sqs_url":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/check_sqs',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "sqs_key": "",\n "sqs_secret": "",\n "sqs_url": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"sqs_key\": \"\",\n \"sqs_secret\": \"\",\n \"sqs_url\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/check_sqs")
.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/check_sqs',
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({sqs_key: '', sqs_secret: '', sqs_url: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/check_sqs',
headers: {'content-type': 'application/json'},
body: {sqs_key: '', sqs_secret: '', sqs_url: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/check_sqs');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
sqs_key: '',
sqs_secret: '',
sqs_url: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/check_sqs',
headers: {'content-type': 'application/json'},
data: {sqs_key: '', sqs_secret: '', sqs_url: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/check_sqs';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"sqs_key":"","sqs_secret":"","sqs_url":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"sqs_key": @"",
@"sqs_secret": @"",
@"sqs_url": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/check_sqs"]
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}}/check_sqs" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"sqs_key\": \"\",\n \"sqs_secret\": \"\",\n \"sqs_url\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/check_sqs",
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([
'sqs_key' => '',
'sqs_secret' => '',
'sqs_url' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/check_sqs', [
'body' => '{
"sqs_key": "",
"sqs_secret": "",
"sqs_url": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/check_sqs');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'sqs_key' => '',
'sqs_secret' => '',
'sqs_url' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'sqs_key' => '',
'sqs_secret' => '',
'sqs_url' => ''
]));
$request->setRequestUrl('{{baseUrl}}/check_sqs');
$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}}/check_sqs' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"sqs_key": "",
"sqs_secret": "",
"sqs_url": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/check_sqs' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"sqs_key": "",
"sqs_secret": "",
"sqs_url": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"sqs_key\": \"\",\n \"sqs_secret\": \"\",\n \"sqs_url\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/check_sqs", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/check_sqs"
payload = {
"sqs_key": "",
"sqs_secret": "",
"sqs_url": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/check_sqs"
payload <- "{\n \"sqs_key\": \"\",\n \"sqs_secret\": \"\",\n \"sqs_url\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/check_sqs")
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 \"sqs_key\": \"\",\n \"sqs_secret\": \"\",\n \"sqs_url\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/check_sqs') do |req|
req.body = "{\n \"sqs_key\": \"\",\n \"sqs_secret\": \"\",\n \"sqs_url\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/check_sqs";
let payload = json!({
"sqs_key": "",
"sqs_secret": "",
"sqs_url": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/check_sqs \
--header 'content-type: application/json' \
--data '{
"sqs_key": "",
"sqs_secret": "",
"sqs_url": ""
}'
echo '{
"sqs_key": "",
"sqs_secret": "",
"sqs_url": ""
}' | \
http POST {{baseUrl}}/check_sqs \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "sqs_key": "",\n "sqs_secret": "",\n "sqs_url": ""\n}' \
--output-document \
- {{baseUrl}}/check_sqs
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"sqs_key": "",
"sqs_secret": "",
"sqs_url": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/check_sqs")! 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
Check push
{{baseUrl}}/check_push
BODY json
{
"apn_template": "",
"firebase_data_template": "",
"firebase_template": "",
"message_id": "",
"push_provider_name": "",
"push_provider_type": "",
"skip_devices": false,
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/check_push");
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 \"apn_template\": \"\",\n \"firebase_data_template\": \"\",\n \"firebase_template\": \"\",\n \"message_id\": \"\",\n \"push_provider_name\": \"\",\n \"push_provider_type\": \"\",\n \"skip_devices\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/check_push" {:content-type :json
:form-params {:apn_template ""
:firebase_data_template ""
:firebase_template ""
:message_id ""
:push_provider_name ""
:push_provider_type ""
:skip_devices false
:user {:ban_expires ""
:banned false
:id ""
:invisible false
:language ""
:push_notifications {:disabled false
:disabled_until ""}
:revoke_tokens_issued_before ""
:role ""
:teams []}
:user_id ""}})
require "http/client"
url = "{{baseUrl}}/check_push"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"apn_template\": \"\",\n \"firebase_data_template\": \"\",\n \"firebase_template\": \"\",\n \"message_id\": \"\",\n \"push_provider_name\": \"\",\n \"push_provider_type\": \"\",\n \"skip_devices\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/check_push"),
Content = new StringContent("{\n \"apn_template\": \"\",\n \"firebase_data_template\": \"\",\n \"firebase_template\": \"\",\n \"message_id\": \"\",\n \"push_provider_name\": \"\",\n \"push_provider_type\": \"\",\n \"skip_devices\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/check_push");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"apn_template\": \"\",\n \"firebase_data_template\": \"\",\n \"firebase_template\": \"\",\n \"message_id\": \"\",\n \"push_provider_name\": \"\",\n \"push_provider_type\": \"\",\n \"skip_devices\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/check_push"
payload := strings.NewReader("{\n \"apn_template\": \"\",\n \"firebase_data_template\": \"\",\n \"firebase_template\": \"\",\n \"message_id\": \"\",\n \"push_provider_name\": \"\",\n \"push_provider_type\": \"\",\n \"skip_devices\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/check_push HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 478
{
"apn_template": "",
"firebase_data_template": "",
"firebase_template": "",
"message_id": "",
"push_provider_name": "",
"push_provider_type": "",
"skip_devices": false,
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/check_push")
.setHeader("content-type", "application/json")
.setBody("{\n \"apn_template\": \"\",\n \"firebase_data_template\": \"\",\n \"firebase_template\": \"\",\n \"message_id\": \"\",\n \"push_provider_name\": \"\",\n \"push_provider_type\": \"\",\n \"skip_devices\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/check_push"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"apn_template\": \"\",\n \"firebase_data_template\": \"\",\n \"firebase_template\": \"\",\n \"message_id\": \"\",\n \"push_provider_name\": \"\",\n \"push_provider_type\": \"\",\n \"skip_devices\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"apn_template\": \"\",\n \"firebase_data_template\": \"\",\n \"firebase_template\": \"\",\n \"message_id\": \"\",\n \"push_provider_name\": \"\",\n \"push_provider_type\": \"\",\n \"skip_devices\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/check_push")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/check_push")
.header("content-type", "application/json")
.body("{\n \"apn_template\": \"\",\n \"firebase_data_template\": \"\",\n \"firebase_template\": \"\",\n \"message_id\": \"\",\n \"push_provider_name\": \"\",\n \"push_provider_type\": \"\",\n \"skip_devices\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
.asString();
const data = JSON.stringify({
apn_template: '',
firebase_data_template: '',
firebase_template: '',
message_id: '',
push_provider_name: '',
push_provider_type: '',
skip_devices: false,
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/check_push');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/check_push',
headers: {'content-type': 'application/json'},
data: {
apn_template: '',
firebase_data_template: '',
firebase_template: '',
message_id: '',
push_provider_name: '',
push_provider_type: '',
skip_devices: false,
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/check_push';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"apn_template":"","firebase_data_template":"","firebase_template":"","message_id":"","push_provider_name":"","push_provider_type":"","skip_devices":false,"user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/check_push',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "apn_template": "",\n "firebase_data_template": "",\n "firebase_template": "",\n "message_id": "",\n "push_provider_name": "",\n "push_provider_type": "",\n "skip_devices": false,\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"apn_template\": \"\",\n \"firebase_data_template\": \"\",\n \"firebase_template\": \"\",\n \"message_id\": \"\",\n \"push_provider_name\": \"\",\n \"push_provider_type\": \"\",\n \"skip_devices\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/check_push")
.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/check_push',
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({
apn_template: '',
firebase_data_template: '',
firebase_template: '',
message_id: '',
push_provider_name: '',
push_provider_type: '',
skip_devices: false,
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/check_push',
headers: {'content-type': 'application/json'},
body: {
apn_template: '',
firebase_data_template: '',
firebase_template: '',
message_id: '',
push_provider_name: '',
push_provider_type: '',
skip_devices: false,
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/check_push');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
apn_template: '',
firebase_data_template: '',
firebase_template: '',
message_id: '',
push_provider_name: '',
push_provider_type: '',
skip_devices: false,
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/check_push',
headers: {'content-type': 'application/json'},
data: {
apn_template: '',
firebase_data_template: '',
firebase_template: '',
message_id: '',
push_provider_name: '',
push_provider_type: '',
skip_devices: false,
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/check_push';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"apn_template":"","firebase_data_template":"","firebase_template":"","message_id":"","push_provider_name":"","push_provider_type":"","skip_devices":false,"user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"apn_template": @"",
@"firebase_data_template": @"",
@"firebase_template": @"",
@"message_id": @"",
@"push_provider_name": @"",
@"push_provider_type": @"",
@"skip_devices": @NO,
@"user": @{ @"ban_expires": @"", @"banned": @NO, @"id": @"", @"invisible": @NO, @"language": @"", @"push_notifications": @{ @"disabled": @NO, @"disabled_until": @"" }, @"revoke_tokens_issued_before": @"", @"role": @"", @"teams": @[ ] },
@"user_id": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/check_push"]
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}}/check_push" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"apn_template\": \"\",\n \"firebase_data_template\": \"\",\n \"firebase_template\": \"\",\n \"message_id\": \"\",\n \"push_provider_name\": \"\",\n \"push_provider_type\": \"\",\n \"skip_devices\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/check_push",
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([
'apn_template' => '',
'firebase_data_template' => '',
'firebase_template' => '',
'message_id' => '',
'push_provider_name' => '',
'push_provider_type' => '',
'skip_devices' => null,
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/check_push', [
'body' => '{
"apn_template": "",
"firebase_data_template": "",
"firebase_template": "",
"message_id": "",
"push_provider_name": "",
"push_provider_type": "",
"skip_devices": false,
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/check_push');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'apn_template' => '',
'firebase_data_template' => '',
'firebase_template' => '',
'message_id' => '',
'push_provider_name' => '',
'push_provider_type' => '',
'skip_devices' => null,
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'apn_template' => '',
'firebase_data_template' => '',
'firebase_template' => '',
'message_id' => '',
'push_provider_name' => '',
'push_provider_type' => '',
'skip_devices' => null,
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]));
$request->setRequestUrl('{{baseUrl}}/check_push');
$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}}/check_push' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"apn_template": "",
"firebase_data_template": "",
"firebase_template": "",
"message_id": "",
"push_provider_name": "",
"push_provider_type": "",
"skip_devices": false,
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/check_push' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"apn_template": "",
"firebase_data_template": "",
"firebase_template": "",
"message_id": "",
"push_provider_name": "",
"push_provider_type": "",
"skip_devices": false,
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"apn_template\": \"\",\n \"firebase_data_template\": \"\",\n \"firebase_template\": \"\",\n \"message_id\": \"\",\n \"push_provider_name\": \"\",\n \"push_provider_type\": \"\",\n \"skip_devices\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/check_push", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/check_push"
payload = {
"apn_template": "",
"firebase_data_template": "",
"firebase_template": "",
"message_id": "",
"push_provider_name": "",
"push_provider_type": "",
"skip_devices": False,
"user": {
"ban_expires": "",
"banned": False,
"id": "",
"invisible": False,
"language": "",
"push_notifications": {
"disabled": False,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/check_push"
payload <- "{\n \"apn_template\": \"\",\n \"firebase_data_template\": \"\",\n \"firebase_template\": \"\",\n \"message_id\": \"\",\n \"push_provider_name\": \"\",\n \"push_provider_type\": \"\",\n \"skip_devices\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/check_push")
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 \"apn_template\": \"\",\n \"firebase_data_template\": \"\",\n \"firebase_template\": \"\",\n \"message_id\": \"\",\n \"push_provider_name\": \"\",\n \"push_provider_type\": \"\",\n \"skip_devices\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/check_push') do |req|
req.body = "{\n \"apn_template\": \"\",\n \"firebase_data_template\": \"\",\n \"firebase_template\": \"\",\n \"message_id\": \"\",\n \"push_provider_name\": \"\",\n \"push_provider_type\": \"\",\n \"skip_devices\": false,\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/check_push";
let payload = json!({
"apn_template": "",
"firebase_data_template": "",
"firebase_template": "",
"message_id": "",
"push_provider_name": "",
"push_provider_type": "",
"skip_devices": false,
"user": json!({
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": json!({
"disabled": false,
"disabled_until": ""
}),
"revoke_tokens_issued_before": "",
"role": "",
"teams": ()
}),
"user_id": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/check_push \
--header 'content-type: application/json' \
--data '{
"apn_template": "",
"firebase_data_template": "",
"firebase_template": "",
"message_id": "",
"push_provider_name": "",
"push_provider_type": "",
"skip_devices": false,
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
echo '{
"apn_template": "",
"firebase_data_template": "",
"firebase_template": "",
"message_id": "",
"push_provider_name": "",
"push_provider_type": "",
"skip_devices": false,
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}' | \
http POST {{baseUrl}}/check_push \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "apn_template": "",\n "firebase_data_template": "",\n "firebase_template": "",\n "message_id": "",\n "push_provider_name": "",\n "push_provider_type": "",\n "skip_devices": false,\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n}' \
--output-document \
- {{baseUrl}}/check_push
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"apn_template": "",
"firebase_data_template": "",
"firebase_template": "",
"message_id": "",
"push_provider_name": "",
"push_provider_type": "",
"skip_devices": false,
"user": [
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": [
"disabled": false,
"disabled_until": ""
],
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
],
"user_id": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/check_push")! 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
Create block list
{{baseUrl}}/blocklists
BODY json
{
"name": "",
"words": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/blocklists");
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 \"words\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/blocklists" {:content-type :json
:form-params {:name ""
:words []}})
require "http/client"
url = "{{baseUrl}}/blocklists"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"name\": \"\",\n \"words\": []\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}}/blocklists"),
Content = new StringContent("{\n \"name\": \"\",\n \"words\": []\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}}/blocklists");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"name\": \"\",\n \"words\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/blocklists"
payload := strings.NewReader("{\n \"name\": \"\",\n \"words\": []\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/blocklists HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 31
{
"name": "",
"words": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/blocklists")
.setHeader("content-type", "application/json")
.setBody("{\n \"name\": \"\",\n \"words\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/blocklists"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"name\": \"\",\n \"words\": []\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 \"words\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/blocklists")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/blocklists")
.header("content-type", "application/json")
.body("{\n \"name\": \"\",\n \"words\": []\n}")
.asString();
const data = JSON.stringify({
name: '',
words: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/blocklists');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/blocklists',
headers: {'content-type': 'application/json'},
data: {name: '', words: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/blocklists';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"name":"","words":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/blocklists',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "name": "",\n "words": []\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 \"words\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/blocklists")
.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/blocklists',
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: '', words: []}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/blocklists',
headers: {'content-type': 'application/json'},
body: {name: '', words: []},
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}}/blocklists');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
name: '',
words: []
});
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}}/blocklists',
headers: {'content-type': 'application/json'},
data: {name: '', words: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/blocklists';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"name":"","words":[]}'
};
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": @"",
@"words": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/blocklists"]
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}}/blocklists" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"name\": \"\",\n \"words\": []\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/blocklists",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '',
'words' => [
]
]),
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}}/blocklists', [
'body' => '{
"name": "",
"words": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/blocklists');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'name' => '',
'words' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'name' => '',
'words' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/blocklists');
$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}}/blocklists' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"name": "",
"words": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/blocklists' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"name": "",
"words": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"name\": \"\",\n \"words\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/blocklists", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/blocklists"
payload = {
"name": "",
"words": []
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/blocklists"
payload <- "{\n \"name\": \"\",\n \"words\": []\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}}/blocklists")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"name\": \"\",\n \"words\": []\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/blocklists') do |req|
req.body = "{\n \"name\": \"\",\n \"words\": []\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/blocklists";
let payload = json!({
"name": "",
"words": ()
});
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}}/blocklists \
--header 'content-type: application/json' \
--data '{
"name": "",
"words": []
}'
echo '{
"name": "",
"words": []
}' | \
http POST {{baseUrl}}/blocklists \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "name": "",\n "words": []\n}' \
--output-document \
- {{baseUrl}}/blocklists
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"name": "",
"words": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/blocklists")! 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
Create channel type
{{baseUrl}}/channeltypes
BODY json
{
"automod": "",
"automod_behavior": "",
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"connect_events": false,
"custom_events": false,
"grants": {},
"max_message_length": "",
"message_retention": "",
"mutes": false,
"name": "",
"permissions": [
{
"action": "",
"name": "",
"owner": false,
"priority": "",
"resources": [],
"roles": []
}
],
"push_notifications": false,
"reactions": false,
"read_events": false,
"replies": false,
"search": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/channeltypes");
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 \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"connect_events\": false,\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"name\": \"\",\n \"permissions\": [\n {\n \"action\": \"\",\n \"name\": \"\",\n \"owner\": false,\n \"priority\": \"\",\n \"resources\": [],\n \"roles\": []\n }\n ],\n \"push_notifications\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/channeltypes" {:content-type :json
:form-params {:automod ""
:automod_behavior ""
:blocklist ""
:blocklist_behavior ""
:commands []
:connect_events false
:custom_events false
:grants {}
:max_message_length ""
:message_retention ""
:mutes false
:name ""
:permissions [{:action ""
:name ""
:owner false
:priority ""
:resources []
:roles []}]
:push_notifications false
:reactions false
:read_events false
:replies false
:search false
:typing_events false
:uploads false
:url_enrichment false}})
require "http/client"
url = "{{baseUrl}}/channeltypes"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"connect_events\": false,\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"name\": \"\",\n \"permissions\": [\n {\n \"action\": \"\",\n \"name\": \"\",\n \"owner\": false,\n \"priority\": \"\",\n \"resources\": [],\n \"roles\": []\n }\n ],\n \"push_notifications\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/channeltypes"),
Content = new StringContent("{\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"connect_events\": false,\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"name\": \"\",\n \"permissions\": [\n {\n \"action\": \"\",\n \"name\": \"\",\n \"owner\": false,\n \"priority\": \"\",\n \"resources\": [],\n \"roles\": []\n }\n ],\n \"push_notifications\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/channeltypes");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"connect_events\": false,\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"name\": \"\",\n \"permissions\": [\n {\n \"action\": \"\",\n \"name\": \"\",\n \"owner\": false,\n \"priority\": \"\",\n \"resources\": [],\n \"roles\": []\n }\n ],\n \"push_notifications\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/channeltypes"
payload := strings.NewReader("{\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"connect_events\": false,\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"name\": \"\",\n \"permissions\": [\n {\n \"action\": \"\",\n \"name\": \"\",\n \"owner\": false,\n \"priority\": \"\",\n \"resources\": [],\n \"roles\": []\n }\n ],\n \"push_notifications\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/channeltypes HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 614
{
"automod": "",
"automod_behavior": "",
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"connect_events": false,
"custom_events": false,
"grants": {},
"max_message_length": "",
"message_retention": "",
"mutes": false,
"name": "",
"permissions": [
{
"action": "",
"name": "",
"owner": false,
"priority": "",
"resources": [],
"roles": []
}
],
"push_notifications": false,
"reactions": false,
"read_events": false,
"replies": false,
"search": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/channeltypes")
.setHeader("content-type", "application/json")
.setBody("{\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"connect_events\": false,\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"name\": \"\",\n \"permissions\": [\n {\n \"action\": \"\",\n \"name\": \"\",\n \"owner\": false,\n \"priority\": \"\",\n \"resources\": [],\n \"roles\": []\n }\n ],\n \"push_notifications\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/channeltypes"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"connect_events\": false,\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"name\": \"\",\n \"permissions\": [\n {\n \"action\": \"\",\n \"name\": \"\",\n \"owner\": false,\n \"priority\": \"\",\n \"resources\": [],\n \"roles\": []\n }\n ],\n \"push_notifications\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"connect_events\": false,\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"name\": \"\",\n \"permissions\": [\n {\n \"action\": \"\",\n \"name\": \"\",\n \"owner\": false,\n \"priority\": \"\",\n \"resources\": [],\n \"roles\": []\n }\n ],\n \"push_notifications\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/channeltypes")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/channeltypes")
.header("content-type", "application/json")
.body("{\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"connect_events\": false,\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"name\": \"\",\n \"permissions\": [\n {\n \"action\": \"\",\n \"name\": \"\",\n \"owner\": false,\n \"priority\": \"\",\n \"resources\": [],\n \"roles\": []\n }\n ],\n \"push_notifications\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n}")
.asString();
const data = JSON.stringify({
automod: '',
automod_behavior: '',
blocklist: '',
blocklist_behavior: '',
commands: [],
connect_events: false,
custom_events: false,
grants: {},
max_message_length: '',
message_retention: '',
mutes: false,
name: '',
permissions: [
{
action: '',
name: '',
owner: false,
priority: '',
resources: [],
roles: []
}
],
push_notifications: false,
reactions: false,
read_events: false,
replies: false,
search: false,
typing_events: false,
uploads: false,
url_enrichment: false
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/channeltypes');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/channeltypes',
headers: {'content-type': 'application/json'},
data: {
automod: '',
automod_behavior: '',
blocklist: '',
blocklist_behavior: '',
commands: [],
connect_events: false,
custom_events: false,
grants: {},
max_message_length: '',
message_retention: '',
mutes: false,
name: '',
permissions: [{action: '', name: '', owner: false, priority: '', resources: [], roles: []}],
push_notifications: false,
reactions: false,
read_events: false,
replies: false,
search: false,
typing_events: false,
uploads: false,
url_enrichment: false
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/channeltypes';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"automod":"","automod_behavior":"","blocklist":"","blocklist_behavior":"","commands":[],"connect_events":false,"custom_events":false,"grants":{},"max_message_length":"","message_retention":"","mutes":false,"name":"","permissions":[{"action":"","name":"","owner":false,"priority":"","resources":[],"roles":[]}],"push_notifications":false,"reactions":false,"read_events":false,"replies":false,"search":false,"typing_events":false,"uploads":false,"url_enrichment":false}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/channeltypes',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "automod": "",\n "automod_behavior": "",\n "blocklist": "",\n "blocklist_behavior": "",\n "commands": [],\n "connect_events": false,\n "custom_events": false,\n "grants": {},\n "max_message_length": "",\n "message_retention": "",\n "mutes": false,\n "name": "",\n "permissions": [\n {\n "action": "",\n "name": "",\n "owner": false,\n "priority": "",\n "resources": [],\n "roles": []\n }\n ],\n "push_notifications": false,\n "reactions": false,\n "read_events": false,\n "replies": false,\n "search": false,\n "typing_events": false,\n "uploads": false,\n "url_enrichment": false\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"connect_events\": false,\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"name\": \"\",\n \"permissions\": [\n {\n \"action\": \"\",\n \"name\": \"\",\n \"owner\": false,\n \"priority\": \"\",\n \"resources\": [],\n \"roles\": []\n }\n ],\n \"push_notifications\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n}")
val request = Request.Builder()
.url("{{baseUrl}}/channeltypes")
.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/channeltypes',
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({
automod: '',
automod_behavior: '',
blocklist: '',
blocklist_behavior: '',
commands: [],
connect_events: false,
custom_events: false,
grants: {},
max_message_length: '',
message_retention: '',
mutes: false,
name: '',
permissions: [{action: '', name: '', owner: false, priority: '', resources: [], roles: []}],
push_notifications: false,
reactions: false,
read_events: false,
replies: false,
search: false,
typing_events: false,
uploads: false,
url_enrichment: false
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/channeltypes',
headers: {'content-type': 'application/json'},
body: {
automod: '',
automod_behavior: '',
blocklist: '',
blocklist_behavior: '',
commands: [],
connect_events: false,
custom_events: false,
grants: {},
max_message_length: '',
message_retention: '',
mutes: false,
name: '',
permissions: [{action: '', name: '', owner: false, priority: '', resources: [], roles: []}],
push_notifications: false,
reactions: false,
read_events: false,
replies: false,
search: false,
typing_events: false,
uploads: false,
url_enrichment: false
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/channeltypes');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
automod: '',
automod_behavior: '',
blocklist: '',
blocklist_behavior: '',
commands: [],
connect_events: false,
custom_events: false,
grants: {},
max_message_length: '',
message_retention: '',
mutes: false,
name: '',
permissions: [
{
action: '',
name: '',
owner: false,
priority: '',
resources: [],
roles: []
}
],
push_notifications: false,
reactions: false,
read_events: false,
replies: false,
search: false,
typing_events: false,
uploads: false,
url_enrichment: false
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/channeltypes',
headers: {'content-type': 'application/json'},
data: {
automod: '',
automod_behavior: '',
blocklist: '',
blocklist_behavior: '',
commands: [],
connect_events: false,
custom_events: false,
grants: {},
max_message_length: '',
message_retention: '',
mutes: false,
name: '',
permissions: [{action: '', name: '', owner: false, priority: '', resources: [], roles: []}],
push_notifications: false,
reactions: false,
read_events: false,
replies: false,
search: false,
typing_events: false,
uploads: false,
url_enrichment: false
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/channeltypes';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"automod":"","automod_behavior":"","blocklist":"","blocklist_behavior":"","commands":[],"connect_events":false,"custom_events":false,"grants":{},"max_message_length":"","message_retention":"","mutes":false,"name":"","permissions":[{"action":"","name":"","owner":false,"priority":"","resources":[],"roles":[]}],"push_notifications":false,"reactions":false,"read_events":false,"replies":false,"search":false,"typing_events":false,"uploads":false,"url_enrichment":false}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"automod": @"",
@"automod_behavior": @"",
@"blocklist": @"",
@"blocklist_behavior": @"",
@"commands": @[ ],
@"connect_events": @NO,
@"custom_events": @NO,
@"grants": @{ },
@"max_message_length": @"",
@"message_retention": @"",
@"mutes": @NO,
@"name": @"",
@"permissions": @[ @{ @"action": @"", @"name": @"", @"owner": @NO, @"priority": @"", @"resources": @[ ], @"roles": @[ ] } ],
@"push_notifications": @NO,
@"reactions": @NO,
@"read_events": @NO,
@"replies": @NO,
@"search": @NO,
@"typing_events": @NO,
@"uploads": @NO,
@"url_enrichment": @NO };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/channeltypes"]
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}}/channeltypes" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"connect_events\": false,\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"name\": \"\",\n \"permissions\": [\n {\n \"action\": \"\",\n \"name\": \"\",\n \"owner\": false,\n \"priority\": \"\",\n \"resources\": [],\n \"roles\": []\n }\n ],\n \"push_notifications\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/channeltypes",
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([
'automod' => '',
'automod_behavior' => '',
'blocklist' => '',
'blocklist_behavior' => '',
'commands' => [
],
'connect_events' => null,
'custom_events' => null,
'grants' => [
],
'max_message_length' => '',
'message_retention' => '',
'mutes' => null,
'name' => '',
'permissions' => [
[
'action' => '',
'name' => '',
'owner' => null,
'priority' => '',
'resources' => [
],
'roles' => [
]
]
],
'push_notifications' => null,
'reactions' => null,
'read_events' => null,
'replies' => null,
'search' => null,
'typing_events' => null,
'uploads' => null,
'url_enrichment' => null
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/channeltypes', [
'body' => '{
"automod": "",
"automod_behavior": "",
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"connect_events": false,
"custom_events": false,
"grants": {},
"max_message_length": "",
"message_retention": "",
"mutes": false,
"name": "",
"permissions": [
{
"action": "",
"name": "",
"owner": false,
"priority": "",
"resources": [],
"roles": []
}
],
"push_notifications": false,
"reactions": false,
"read_events": false,
"replies": false,
"search": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/channeltypes');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'automod' => '',
'automod_behavior' => '',
'blocklist' => '',
'blocklist_behavior' => '',
'commands' => [
],
'connect_events' => null,
'custom_events' => null,
'grants' => [
],
'max_message_length' => '',
'message_retention' => '',
'mutes' => null,
'name' => '',
'permissions' => [
[
'action' => '',
'name' => '',
'owner' => null,
'priority' => '',
'resources' => [
],
'roles' => [
]
]
],
'push_notifications' => null,
'reactions' => null,
'read_events' => null,
'replies' => null,
'search' => null,
'typing_events' => null,
'uploads' => null,
'url_enrichment' => null
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'automod' => '',
'automod_behavior' => '',
'blocklist' => '',
'blocklist_behavior' => '',
'commands' => [
],
'connect_events' => null,
'custom_events' => null,
'grants' => [
],
'max_message_length' => '',
'message_retention' => '',
'mutes' => null,
'name' => '',
'permissions' => [
[
'action' => '',
'name' => '',
'owner' => null,
'priority' => '',
'resources' => [
],
'roles' => [
]
]
],
'push_notifications' => null,
'reactions' => null,
'read_events' => null,
'replies' => null,
'search' => null,
'typing_events' => null,
'uploads' => null,
'url_enrichment' => null
]));
$request->setRequestUrl('{{baseUrl}}/channeltypes');
$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}}/channeltypes' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"automod": "",
"automod_behavior": "",
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"connect_events": false,
"custom_events": false,
"grants": {},
"max_message_length": "",
"message_retention": "",
"mutes": false,
"name": "",
"permissions": [
{
"action": "",
"name": "",
"owner": false,
"priority": "",
"resources": [],
"roles": []
}
],
"push_notifications": false,
"reactions": false,
"read_events": false,
"replies": false,
"search": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/channeltypes' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"automod": "",
"automod_behavior": "",
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"connect_events": false,
"custom_events": false,
"grants": {},
"max_message_length": "",
"message_retention": "",
"mutes": false,
"name": "",
"permissions": [
{
"action": "",
"name": "",
"owner": false,
"priority": "",
"resources": [],
"roles": []
}
],
"push_notifications": false,
"reactions": false,
"read_events": false,
"replies": false,
"search": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"connect_events\": false,\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"name\": \"\",\n \"permissions\": [\n {\n \"action\": \"\",\n \"name\": \"\",\n \"owner\": false,\n \"priority\": \"\",\n \"resources\": [],\n \"roles\": []\n }\n ],\n \"push_notifications\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/channeltypes", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/channeltypes"
payload = {
"automod": "",
"automod_behavior": "",
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"connect_events": False,
"custom_events": False,
"grants": {},
"max_message_length": "",
"message_retention": "",
"mutes": False,
"name": "",
"permissions": [
{
"action": "",
"name": "",
"owner": False,
"priority": "",
"resources": [],
"roles": []
}
],
"push_notifications": False,
"reactions": False,
"read_events": False,
"replies": False,
"search": False,
"typing_events": False,
"uploads": False,
"url_enrichment": False
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/channeltypes"
payload <- "{\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"connect_events\": false,\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"name\": \"\",\n \"permissions\": [\n {\n \"action\": \"\",\n \"name\": \"\",\n \"owner\": false,\n \"priority\": \"\",\n \"resources\": [],\n \"roles\": []\n }\n ],\n \"push_notifications\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/channeltypes")
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 \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"connect_events\": false,\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"name\": \"\",\n \"permissions\": [\n {\n \"action\": \"\",\n \"name\": \"\",\n \"owner\": false,\n \"priority\": \"\",\n \"resources\": [],\n \"roles\": []\n }\n ],\n \"push_notifications\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/channeltypes') do |req|
req.body = "{\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"connect_events\": false,\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"name\": \"\",\n \"permissions\": [\n {\n \"action\": \"\",\n \"name\": \"\",\n \"owner\": false,\n \"priority\": \"\",\n \"resources\": [],\n \"roles\": []\n }\n ],\n \"push_notifications\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/channeltypes";
let payload = json!({
"automod": "",
"automod_behavior": "",
"blocklist": "",
"blocklist_behavior": "",
"commands": (),
"connect_events": false,
"custom_events": false,
"grants": json!({}),
"max_message_length": "",
"message_retention": "",
"mutes": false,
"name": "",
"permissions": (
json!({
"action": "",
"name": "",
"owner": false,
"priority": "",
"resources": (),
"roles": ()
})
),
"push_notifications": false,
"reactions": false,
"read_events": false,
"replies": false,
"search": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/channeltypes \
--header 'content-type: application/json' \
--data '{
"automod": "",
"automod_behavior": "",
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"connect_events": false,
"custom_events": false,
"grants": {},
"max_message_length": "",
"message_retention": "",
"mutes": false,
"name": "",
"permissions": [
{
"action": "",
"name": "",
"owner": false,
"priority": "",
"resources": [],
"roles": []
}
],
"push_notifications": false,
"reactions": false,
"read_events": false,
"replies": false,
"search": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
}'
echo '{
"automod": "",
"automod_behavior": "",
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"connect_events": false,
"custom_events": false,
"grants": {},
"max_message_length": "",
"message_retention": "",
"mutes": false,
"name": "",
"permissions": [
{
"action": "",
"name": "",
"owner": false,
"priority": "",
"resources": [],
"roles": []
}
],
"push_notifications": false,
"reactions": false,
"read_events": false,
"replies": false,
"search": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
}' | \
http POST {{baseUrl}}/channeltypes \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "automod": "",\n "automod_behavior": "",\n "blocklist": "",\n "blocklist_behavior": "",\n "commands": [],\n "connect_events": false,\n "custom_events": false,\n "grants": {},\n "max_message_length": "",\n "message_retention": "",\n "mutes": false,\n "name": "",\n "permissions": [\n {\n "action": "",\n "name": "",\n "owner": false,\n "priority": "",\n "resources": [],\n "roles": []\n }\n ],\n "push_notifications": false,\n "reactions": false,\n "read_events": false,\n "replies": false,\n "search": false,\n "typing_events": false,\n "uploads": false,\n "url_enrichment": false\n}' \
--output-document \
- {{baseUrl}}/channeltypes
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"automod": "",
"automod_behavior": "",
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"connect_events": false,
"custom_events": false,
"grants": [],
"max_message_length": "",
"message_retention": "",
"mutes": false,
"name": "",
"permissions": [
[
"action": "",
"name": "",
"owner": false,
"priority": "",
"resources": [],
"roles": []
]
],
"push_notifications": false,
"reactions": false,
"read_events": false,
"replies": false,
"search": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/channeltypes")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
Delete block list
{{baseUrl}}/blocklists/:name
QUERY PARAMS
name
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/blocklists/:name");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/blocklists/:name")
require "http/client"
url = "{{baseUrl}}/blocklists/:name"
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}}/blocklists/:name"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/blocklists/:name");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/blocklists/:name"
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/blocklists/:name HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/blocklists/:name")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/blocklists/:name"))
.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}}/blocklists/:name")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/blocklists/:name")
.asString();
const 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}}/blocklists/:name');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/blocklists/:name'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/blocklists/:name';
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}}/blocklists/:name',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/blocklists/:name")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/blocklists/:name',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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}}/blocklists/:name'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/blocklists/:name');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/blocklists/:name'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/blocklists/:name';
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}}/blocklists/:name"]
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}}/blocklists/:name" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/blocklists/:name",
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}}/blocklists/:name');
echo $response->getBody();
setUrl('{{baseUrl}}/blocklists/:name');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/blocklists/:name');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/blocklists/:name' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/blocklists/:name' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/blocklists/:name")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/blocklists/:name"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/blocklists/:name"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/blocklists/:name")
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/blocklists/:name') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/blocklists/:name";
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}}/blocklists/:name
http DELETE {{baseUrl}}/blocklists/:name
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/blocklists/:name
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/blocklists/:name")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
Delete channel type
{{baseUrl}}/channeltypes/:name
QUERY PARAMS
name
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/channeltypes/:name");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/channeltypes/:name")
require "http/client"
url = "{{baseUrl}}/channeltypes/:name"
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}}/channeltypes/:name"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/channeltypes/:name");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/channeltypes/:name"
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/channeltypes/:name HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/channeltypes/:name")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/channeltypes/:name"))
.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}}/channeltypes/:name")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/channeltypes/:name")
.asString();
const 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}}/channeltypes/:name');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/channeltypes/:name'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/channeltypes/:name';
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}}/channeltypes/:name',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/channeltypes/:name")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/channeltypes/:name',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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}}/channeltypes/:name'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/channeltypes/:name');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/channeltypes/:name'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/channeltypes/:name';
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}}/channeltypes/:name"]
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}}/channeltypes/:name" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/channeltypes/:name",
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}}/channeltypes/:name');
echo $response->getBody();
setUrl('{{baseUrl}}/channeltypes/:name');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/channeltypes/:name');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/channeltypes/:name' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/channeltypes/:name' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/channeltypes/:name")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/channeltypes/:name"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/channeltypes/:name"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/channeltypes/:name")
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/channeltypes/:name') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/channeltypes/:name";
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}}/channeltypes/:name
http DELETE {{baseUrl}}/channeltypes/:name
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/channeltypes/:name
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/channeltypes/:name")! 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
Get App Settings
{{baseUrl}}/app
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/app");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/app")
require "http/client"
url = "{{baseUrl}}/app"
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}}/app"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/app");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/app"
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/app HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/app")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/app"))
.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}}/app")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/app")
.asString();
const 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}}/app');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/app'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/app';
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}}/app',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/app")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/app',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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}}/app'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/app');
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}}/app'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/app';
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}}/app"]
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}}/app" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/app",
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}}/app');
echo $response->getBody();
setUrl('{{baseUrl}}/app');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/app');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/app' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/app' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/app")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/app"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/app"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/app")
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/app') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/app";
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}}/app
http GET {{baseUrl}}/app
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/app
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/app")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Get block list
{{baseUrl}}/blocklists/:name
QUERY PARAMS
name
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/blocklists/:name");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/blocklists/:name")
require "http/client"
url = "{{baseUrl}}/blocklists/:name"
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}}/blocklists/:name"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/blocklists/:name");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/blocklists/:name"
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/blocklists/:name HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/blocklists/:name")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/blocklists/:name"))
.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}}/blocklists/:name")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/blocklists/:name")
.asString();
const 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}}/blocklists/:name');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/blocklists/:name'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/blocklists/:name';
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}}/blocklists/:name',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/blocklists/:name")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/blocklists/:name',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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}}/blocklists/:name'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/blocklists/:name');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/blocklists/:name'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/blocklists/:name';
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}}/blocklists/:name"]
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}}/blocklists/:name" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/blocklists/:name",
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}}/blocklists/:name');
echo $response->getBody();
setUrl('{{baseUrl}}/blocklists/:name');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/blocklists/:name');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/blocklists/:name' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/blocklists/:name' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/blocklists/:name")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/blocklists/:name"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/blocklists/:name"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/blocklists/:name")
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/blocklists/:name') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/blocklists/:name";
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}}/blocklists/:name
http GET {{baseUrl}}/blocklists/:name
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/blocklists/:name
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/blocklists/:name")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Get channel type
{{baseUrl}}/channeltypes/:name
QUERY PARAMS
name
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/channeltypes/:name");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/channeltypes/:name")
require "http/client"
url = "{{baseUrl}}/channeltypes/:name"
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}}/channeltypes/:name"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/channeltypes/:name");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/channeltypes/:name"
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/channeltypes/:name HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/channeltypes/:name")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/channeltypes/:name"))
.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}}/channeltypes/:name")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/channeltypes/:name")
.asString();
const 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}}/channeltypes/:name');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/channeltypes/:name'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/channeltypes/:name';
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}}/channeltypes/:name',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/channeltypes/:name")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/channeltypes/:name',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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}}/channeltypes/:name'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/channeltypes/:name');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/channeltypes/:name'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/channeltypes/:name';
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}}/channeltypes/:name"]
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}}/channeltypes/:name" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/channeltypes/:name",
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}}/channeltypes/:name');
echo $response->getBody();
setUrl('{{baseUrl}}/channeltypes/:name');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/channeltypes/:name');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/channeltypes/:name' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/channeltypes/:name' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/channeltypes/:name")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/channeltypes/:name"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/channeltypes/:name"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/channeltypes/:name")
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/channeltypes/:name') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/channeltypes/:name";
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}}/channeltypes/:name
http GET {{baseUrl}}/channeltypes/:name
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/channeltypes/:name
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/channeltypes/:name")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Get rate limits
{{baseUrl}}/rate_limits
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/rate_limits");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/rate_limits")
require "http/client"
url = "{{baseUrl}}/rate_limits"
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}}/rate_limits"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/rate_limits");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/rate_limits"
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/rate_limits HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/rate_limits")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/rate_limits"))
.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}}/rate_limits")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/rate_limits")
.asString();
const 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}}/rate_limits');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/rate_limits'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/rate_limits';
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}}/rate_limits',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/rate_limits")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/rate_limits',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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}}/rate_limits'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/rate_limits');
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}}/rate_limits'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/rate_limits';
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}}/rate_limits"]
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}}/rate_limits" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/rate_limits",
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}}/rate_limits');
echo $response->getBody();
setUrl('{{baseUrl}}/rate_limits');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/rate_limits');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/rate_limits' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/rate_limits' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/rate_limits")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/rate_limits"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/rate_limits"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/rate_limits")
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/rate_limits') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/rate_limits";
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}}/rate_limits
http GET {{baseUrl}}/rate_limits
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/rate_limits
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/rate_limits")! 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
List block lists
{{baseUrl}}/blocklists
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/blocklists");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/blocklists")
require "http/client"
url = "{{baseUrl}}/blocklists"
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}}/blocklists"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/blocklists");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/blocklists"
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/blocklists HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/blocklists")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/blocklists"))
.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}}/blocklists")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/blocklists")
.asString();
const 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}}/blocklists');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/blocklists'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/blocklists';
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}}/blocklists',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/blocklists")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/blocklists',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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}}/blocklists'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/blocklists');
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}}/blocklists'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/blocklists';
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}}/blocklists"]
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}}/blocklists" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/blocklists",
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}}/blocklists');
echo $response->getBody();
setUrl('{{baseUrl}}/blocklists');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/blocklists');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/blocklists' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/blocklists' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/blocklists")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/blocklists"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/blocklists"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/blocklists")
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/blocklists') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/blocklists";
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}}/blocklists
http GET {{baseUrl}}/blocklists
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/blocklists
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/blocklists")! 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
List channel types
{{baseUrl}}/channeltypes
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/channeltypes");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/channeltypes")
require "http/client"
url = "{{baseUrl}}/channeltypes"
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}}/channeltypes"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/channeltypes");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/channeltypes"
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/channeltypes HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/channeltypes")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/channeltypes"))
.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}}/channeltypes")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/channeltypes")
.asString();
const 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}}/channeltypes');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/channeltypes'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/channeltypes';
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}}/channeltypes',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/channeltypes")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/channeltypes',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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}}/channeltypes'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/channeltypes');
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}}/channeltypes'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/channeltypes';
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}}/channeltypes"]
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}}/channeltypes" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/channeltypes",
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}}/channeltypes');
echo $response->getBody();
setUrl('{{baseUrl}}/channeltypes');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/channeltypes');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/channeltypes' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/channeltypes' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/channeltypes")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/channeltypes"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/channeltypes"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/channeltypes")
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/channeltypes') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/channeltypes";
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}}/channeltypes
http GET {{baseUrl}}/channeltypes
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/channeltypes
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/channeltypes")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
Update App Settings
{{baseUrl}}/app
BODY json
{
"agora_options": {
"app_certificate": "",
"app_id": "",
"default_role": "",
"role_map": {}
},
"apn_config": {
"Disabled": false,
"auth_key": "",
"auth_type": "",
"bundle_id": "",
"development": false,
"host": "",
"key_id": "",
"notification_template": "",
"p12_cert": "",
"team_id": ""
},
"async_moderation_config": {
"callback": {
"mode": "",
"server_url": ""
},
"timeout_ms": ""
},
"async_url_enrich_enabled": false,
"auto_translation_enabled": false,
"before_message_send_hook_url": "",
"cdn_expiration_seconds": "",
"channel_hide_members_only": false,
"custom_action_handler_url": "",
"disable_auth_checks": false,
"disable_permissions_checks": false,
"enforce_unique_usernames": "",
"file_upload_config": {
"allowed_file_extensions": [],
"allowed_mime_types": [],
"blocked_file_extensions": [],
"blocked_mime_types": []
},
"firebase_config": {
"Disabled": false,
"apn_template": "",
"credentials_json": "",
"data_template": "",
"notification_template": "",
"server_key": ""
},
"grants": {},
"hms_options": {},
"huawei_config": {
"Disabled": false,
"id": "",
"secret": ""
},
"image_moderation_block_labels": [],
"image_moderation_enabled": false,
"image_moderation_labels": [],
"image_upload_config": {},
"migrate_permissions_to_v2": false,
"multi_tenant_enabled": false,
"permission_version": "",
"push_config": {
"offline_only": false,
"version": ""
},
"reminders_interval": "",
"revoke_tokens_issued_before": "",
"sqs_key": "",
"sqs_secret": "",
"sqs_url": "",
"user_search_disallowed_roles": [],
"video_provider": "",
"webhook_events": [],
"webhook_url": "",
"xiaomi_config": {
"Disabled": false,
"package_name": "",
"secret": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/app");
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 \"agora_options\": {\n \"app_certificate\": \"\",\n \"app_id\": \"\",\n \"default_role\": \"\",\n \"role_map\": {}\n },\n \"apn_config\": {\n \"Disabled\": false,\n \"auth_key\": \"\",\n \"auth_type\": \"\",\n \"bundle_id\": \"\",\n \"development\": false,\n \"host\": \"\",\n \"key_id\": \"\",\n \"notification_template\": \"\",\n \"p12_cert\": \"\",\n \"team_id\": \"\"\n },\n \"async_moderation_config\": {\n \"callback\": {\n \"mode\": \"\",\n \"server_url\": \"\"\n },\n \"timeout_ms\": \"\"\n },\n \"async_url_enrich_enabled\": false,\n \"auto_translation_enabled\": false,\n \"before_message_send_hook_url\": \"\",\n \"cdn_expiration_seconds\": \"\",\n \"channel_hide_members_only\": false,\n \"custom_action_handler_url\": \"\",\n \"disable_auth_checks\": false,\n \"disable_permissions_checks\": false,\n \"enforce_unique_usernames\": \"\",\n \"file_upload_config\": {\n \"allowed_file_extensions\": [],\n \"allowed_mime_types\": [],\n \"blocked_file_extensions\": [],\n \"blocked_mime_types\": []\n },\n \"firebase_config\": {\n \"Disabled\": false,\n \"apn_template\": \"\",\n \"credentials_json\": \"\",\n \"data_template\": \"\",\n \"notification_template\": \"\",\n \"server_key\": \"\"\n },\n \"grants\": {},\n \"hms_options\": {},\n \"huawei_config\": {\n \"Disabled\": false,\n \"id\": \"\",\n \"secret\": \"\"\n },\n \"image_moderation_block_labels\": [],\n \"image_moderation_enabled\": false,\n \"image_moderation_labels\": [],\n \"image_upload_config\": {},\n \"migrate_permissions_to_v2\": false,\n \"multi_tenant_enabled\": false,\n \"permission_version\": \"\",\n \"push_config\": {\n \"offline_only\": false,\n \"version\": \"\"\n },\n \"reminders_interval\": \"\",\n \"revoke_tokens_issued_before\": \"\",\n \"sqs_key\": \"\",\n \"sqs_secret\": \"\",\n \"sqs_url\": \"\",\n \"user_search_disallowed_roles\": [],\n \"video_provider\": \"\",\n \"webhook_events\": [],\n \"webhook_url\": \"\",\n \"xiaomi_config\": {\n \"Disabled\": false,\n \"package_name\": \"\",\n \"secret\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/app" {:content-type :json
:form-params {:agora_options {:app_certificate ""
:app_id ""
:default_role ""
:role_map {}}
:apn_config {:Disabled false
:auth_key ""
:auth_type ""
:bundle_id ""
:development false
:host ""
:key_id ""
:notification_template ""
:p12_cert ""
:team_id ""}
:async_moderation_config {:callback {:mode ""
:server_url ""}
:timeout_ms ""}
:async_url_enrich_enabled false
:auto_translation_enabled false
:before_message_send_hook_url ""
:cdn_expiration_seconds ""
:channel_hide_members_only false
:custom_action_handler_url ""
:disable_auth_checks false
:disable_permissions_checks false
:enforce_unique_usernames ""
:file_upload_config {:allowed_file_extensions []
:allowed_mime_types []
:blocked_file_extensions []
:blocked_mime_types []}
:firebase_config {:Disabled false
:apn_template ""
:credentials_json ""
:data_template ""
:notification_template ""
:server_key ""}
:grants {}
:hms_options {}
:huawei_config {:Disabled false
:id ""
:secret ""}
:image_moderation_block_labels []
:image_moderation_enabled false
:image_moderation_labels []
:image_upload_config {}
:migrate_permissions_to_v2 false
:multi_tenant_enabled false
:permission_version ""
:push_config {:offline_only false
:version ""}
:reminders_interval ""
:revoke_tokens_issued_before ""
:sqs_key ""
:sqs_secret ""
:sqs_url ""
:user_search_disallowed_roles []
:video_provider ""
:webhook_events []
:webhook_url ""
:xiaomi_config {:Disabled false
:package_name ""
:secret ""}}})
require "http/client"
url = "{{baseUrl}}/app"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"agora_options\": {\n \"app_certificate\": \"\",\n \"app_id\": \"\",\n \"default_role\": \"\",\n \"role_map\": {}\n },\n \"apn_config\": {\n \"Disabled\": false,\n \"auth_key\": \"\",\n \"auth_type\": \"\",\n \"bundle_id\": \"\",\n \"development\": false,\n \"host\": \"\",\n \"key_id\": \"\",\n \"notification_template\": \"\",\n \"p12_cert\": \"\",\n \"team_id\": \"\"\n },\n \"async_moderation_config\": {\n \"callback\": {\n \"mode\": \"\",\n \"server_url\": \"\"\n },\n \"timeout_ms\": \"\"\n },\n \"async_url_enrich_enabled\": false,\n \"auto_translation_enabled\": false,\n \"before_message_send_hook_url\": \"\",\n \"cdn_expiration_seconds\": \"\",\n \"channel_hide_members_only\": false,\n \"custom_action_handler_url\": \"\",\n \"disable_auth_checks\": false,\n \"disable_permissions_checks\": false,\n \"enforce_unique_usernames\": \"\",\n \"file_upload_config\": {\n \"allowed_file_extensions\": [],\n \"allowed_mime_types\": [],\n \"blocked_file_extensions\": [],\n \"blocked_mime_types\": []\n },\n \"firebase_config\": {\n \"Disabled\": false,\n \"apn_template\": \"\",\n \"credentials_json\": \"\",\n \"data_template\": \"\",\n \"notification_template\": \"\",\n \"server_key\": \"\"\n },\n \"grants\": {},\n \"hms_options\": {},\n \"huawei_config\": {\n \"Disabled\": false,\n \"id\": \"\",\n \"secret\": \"\"\n },\n \"image_moderation_block_labels\": [],\n \"image_moderation_enabled\": false,\n \"image_moderation_labels\": [],\n \"image_upload_config\": {},\n \"migrate_permissions_to_v2\": false,\n \"multi_tenant_enabled\": false,\n \"permission_version\": \"\",\n \"push_config\": {\n \"offline_only\": false,\n \"version\": \"\"\n },\n \"reminders_interval\": \"\",\n \"revoke_tokens_issued_before\": \"\",\n \"sqs_key\": \"\",\n \"sqs_secret\": \"\",\n \"sqs_url\": \"\",\n \"user_search_disallowed_roles\": [],\n \"video_provider\": \"\",\n \"webhook_events\": [],\n \"webhook_url\": \"\",\n \"xiaomi_config\": {\n \"Disabled\": false,\n \"package_name\": \"\",\n \"secret\": \"\"\n }\n}"
response = HTTP::Client.patch url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Patch,
RequestUri = new Uri("{{baseUrl}}/app"),
Content = new StringContent("{\n \"agora_options\": {\n \"app_certificate\": \"\",\n \"app_id\": \"\",\n \"default_role\": \"\",\n \"role_map\": {}\n },\n \"apn_config\": {\n \"Disabled\": false,\n \"auth_key\": \"\",\n \"auth_type\": \"\",\n \"bundle_id\": \"\",\n \"development\": false,\n \"host\": \"\",\n \"key_id\": \"\",\n \"notification_template\": \"\",\n \"p12_cert\": \"\",\n \"team_id\": \"\"\n },\n \"async_moderation_config\": {\n \"callback\": {\n \"mode\": \"\",\n \"server_url\": \"\"\n },\n \"timeout_ms\": \"\"\n },\n \"async_url_enrich_enabled\": false,\n \"auto_translation_enabled\": false,\n \"before_message_send_hook_url\": \"\",\n \"cdn_expiration_seconds\": \"\",\n \"channel_hide_members_only\": false,\n \"custom_action_handler_url\": \"\",\n \"disable_auth_checks\": false,\n \"disable_permissions_checks\": false,\n \"enforce_unique_usernames\": \"\",\n \"file_upload_config\": {\n \"allowed_file_extensions\": [],\n \"allowed_mime_types\": [],\n \"blocked_file_extensions\": [],\n \"blocked_mime_types\": []\n },\n \"firebase_config\": {\n \"Disabled\": false,\n \"apn_template\": \"\",\n \"credentials_json\": \"\",\n \"data_template\": \"\",\n \"notification_template\": \"\",\n \"server_key\": \"\"\n },\n \"grants\": {},\n \"hms_options\": {},\n \"huawei_config\": {\n \"Disabled\": false,\n \"id\": \"\",\n \"secret\": \"\"\n },\n \"image_moderation_block_labels\": [],\n \"image_moderation_enabled\": false,\n \"image_moderation_labels\": [],\n \"image_upload_config\": {},\n \"migrate_permissions_to_v2\": false,\n \"multi_tenant_enabled\": false,\n \"permission_version\": \"\",\n \"push_config\": {\n \"offline_only\": false,\n \"version\": \"\"\n },\n \"reminders_interval\": \"\",\n \"revoke_tokens_issued_before\": \"\",\n \"sqs_key\": \"\",\n \"sqs_secret\": \"\",\n \"sqs_url\": \"\",\n \"user_search_disallowed_roles\": [],\n \"video_provider\": \"\",\n \"webhook_events\": [],\n \"webhook_url\": \"\",\n \"xiaomi_config\": {\n \"Disabled\": false,\n \"package_name\": \"\",\n \"secret\": \"\"\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}}/app");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"agora_options\": {\n \"app_certificate\": \"\",\n \"app_id\": \"\",\n \"default_role\": \"\",\n \"role_map\": {}\n },\n \"apn_config\": {\n \"Disabled\": false,\n \"auth_key\": \"\",\n \"auth_type\": \"\",\n \"bundle_id\": \"\",\n \"development\": false,\n \"host\": \"\",\n \"key_id\": \"\",\n \"notification_template\": \"\",\n \"p12_cert\": \"\",\n \"team_id\": \"\"\n },\n \"async_moderation_config\": {\n \"callback\": {\n \"mode\": \"\",\n \"server_url\": \"\"\n },\n \"timeout_ms\": \"\"\n },\n \"async_url_enrich_enabled\": false,\n \"auto_translation_enabled\": false,\n \"before_message_send_hook_url\": \"\",\n \"cdn_expiration_seconds\": \"\",\n \"channel_hide_members_only\": false,\n \"custom_action_handler_url\": \"\",\n \"disable_auth_checks\": false,\n \"disable_permissions_checks\": false,\n \"enforce_unique_usernames\": \"\",\n \"file_upload_config\": {\n \"allowed_file_extensions\": [],\n \"allowed_mime_types\": [],\n \"blocked_file_extensions\": [],\n \"blocked_mime_types\": []\n },\n \"firebase_config\": {\n \"Disabled\": false,\n \"apn_template\": \"\",\n \"credentials_json\": \"\",\n \"data_template\": \"\",\n \"notification_template\": \"\",\n \"server_key\": \"\"\n },\n \"grants\": {},\n \"hms_options\": {},\n \"huawei_config\": {\n \"Disabled\": false,\n \"id\": \"\",\n \"secret\": \"\"\n },\n \"image_moderation_block_labels\": [],\n \"image_moderation_enabled\": false,\n \"image_moderation_labels\": [],\n \"image_upload_config\": {},\n \"migrate_permissions_to_v2\": false,\n \"multi_tenant_enabled\": false,\n \"permission_version\": \"\",\n \"push_config\": {\n \"offline_only\": false,\n \"version\": \"\"\n },\n \"reminders_interval\": \"\",\n \"revoke_tokens_issued_before\": \"\",\n \"sqs_key\": \"\",\n \"sqs_secret\": \"\",\n \"sqs_url\": \"\",\n \"user_search_disallowed_roles\": [],\n \"video_provider\": \"\",\n \"webhook_events\": [],\n \"webhook_url\": \"\",\n \"xiaomi_config\": {\n \"Disabled\": false,\n \"package_name\": \"\",\n \"secret\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/app"
payload := strings.NewReader("{\n \"agora_options\": {\n \"app_certificate\": \"\",\n \"app_id\": \"\",\n \"default_role\": \"\",\n \"role_map\": {}\n },\n \"apn_config\": {\n \"Disabled\": false,\n \"auth_key\": \"\",\n \"auth_type\": \"\",\n \"bundle_id\": \"\",\n \"development\": false,\n \"host\": \"\",\n \"key_id\": \"\",\n \"notification_template\": \"\",\n \"p12_cert\": \"\",\n \"team_id\": \"\"\n },\n \"async_moderation_config\": {\n \"callback\": {\n \"mode\": \"\",\n \"server_url\": \"\"\n },\n \"timeout_ms\": \"\"\n },\n \"async_url_enrich_enabled\": false,\n \"auto_translation_enabled\": false,\n \"before_message_send_hook_url\": \"\",\n \"cdn_expiration_seconds\": \"\",\n \"channel_hide_members_only\": false,\n \"custom_action_handler_url\": \"\",\n \"disable_auth_checks\": false,\n \"disable_permissions_checks\": false,\n \"enforce_unique_usernames\": \"\",\n \"file_upload_config\": {\n \"allowed_file_extensions\": [],\n \"allowed_mime_types\": [],\n \"blocked_file_extensions\": [],\n \"blocked_mime_types\": []\n },\n \"firebase_config\": {\n \"Disabled\": false,\n \"apn_template\": \"\",\n \"credentials_json\": \"\",\n \"data_template\": \"\",\n \"notification_template\": \"\",\n \"server_key\": \"\"\n },\n \"grants\": {},\n \"hms_options\": {},\n \"huawei_config\": {\n \"Disabled\": false,\n \"id\": \"\",\n \"secret\": \"\"\n },\n \"image_moderation_block_labels\": [],\n \"image_moderation_enabled\": false,\n \"image_moderation_labels\": [],\n \"image_upload_config\": {},\n \"migrate_permissions_to_v2\": false,\n \"multi_tenant_enabled\": false,\n \"permission_version\": \"\",\n \"push_config\": {\n \"offline_only\": false,\n \"version\": \"\"\n },\n \"reminders_interval\": \"\",\n \"revoke_tokens_issued_before\": \"\",\n \"sqs_key\": \"\",\n \"sqs_secret\": \"\",\n \"sqs_url\": \"\",\n \"user_search_disallowed_roles\": [],\n \"video_provider\": \"\",\n \"webhook_events\": [],\n \"webhook_url\": \"\",\n \"xiaomi_config\": {\n \"Disabled\": false,\n \"package_name\": \"\",\n \"secret\": \"\"\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PATCH /baseUrl/app HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 1881
{
"agora_options": {
"app_certificate": "",
"app_id": "",
"default_role": "",
"role_map": {}
},
"apn_config": {
"Disabled": false,
"auth_key": "",
"auth_type": "",
"bundle_id": "",
"development": false,
"host": "",
"key_id": "",
"notification_template": "",
"p12_cert": "",
"team_id": ""
},
"async_moderation_config": {
"callback": {
"mode": "",
"server_url": ""
},
"timeout_ms": ""
},
"async_url_enrich_enabled": false,
"auto_translation_enabled": false,
"before_message_send_hook_url": "",
"cdn_expiration_seconds": "",
"channel_hide_members_only": false,
"custom_action_handler_url": "",
"disable_auth_checks": false,
"disable_permissions_checks": false,
"enforce_unique_usernames": "",
"file_upload_config": {
"allowed_file_extensions": [],
"allowed_mime_types": [],
"blocked_file_extensions": [],
"blocked_mime_types": []
},
"firebase_config": {
"Disabled": false,
"apn_template": "",
"credentials_json": "",
"data_template": "",
"notification_template": "",
"server_key": ""
},
"grants": {},
"hms_options": {},
"huawei_config": {
"Disabled": false,
"id": "",
"secret": ""
},
"image_moderation_block_labels": [],
"image_moderation_enabled": false,
"image_moderation_labels": [],
"image_upload_config": {},
"migrate_permissions_to_v2": false,
"multi_tenant_enabled": false,
"permission_version": "",
"push_config": {
"offline_only": false,
"version": ""
},
"reminders_interval": "",
"revoke_tokens_issued_before": "",
"sqs_key": "",
"sqs_secret": "",
"sqs_url": "",
"user_search_disallowed_roles": [],
"video_provider": "",
"webhook_events": [],
"webhook_url": "",
"xiaomi_config": {
"Disabled": false,
"package_name": "",
"secret": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/app")
.setHeader("content-type", "application/json")
.setBody("{\n \"agora_options\": {\n \"app_certificate\": \"\",\n \"app_id\": \"\",\n \"default_role\": \"\",\n \"role_map\": {}\n },\n \"apn_config\": {\n \"Disabled\": false,\n \"auth_key\": \"\",\n \"auth_type\": \"\",\n \"bundle_id\": \"\",\n \"development\": false,\n \"host\": \"\",\n \"key_id\": \"\",\n \"notification_template\": \"\",\n \"p12_cert\": \"\",\n \"team_id\": \"\"\n },\n \"async_moderation_config\": {\n \"callback\": {\n \"mode\": \"\",\n \"server_url\": \"\"\n },\n \"timeout_ms\": \"\"\n },\n \"async_url_enrich_enabled\": false,\n \"auto_translation_enabled\": false,\n \"before_message_send_hook_url\": \"\",\n \"cdn_expiration_seconds\": \"\",\n \"channel_hide_members_only\": false,\n \"custom_action_handler_url\": \"\",\n \"disable_auth_checks\": false,\n \"disable_permissions_checks\": false,\n \"enforce_unique_usernames\": \"\",\n \"file_upload_config\": {\n \"allowed_file_extensions\": [],\n \"allowed_mime_types\": [],\n \"blocked_file_extensions\": [],\n \"blocked_mime_types\": []\n },\n \"firebase_config\": {\n \"Disabled\": false,\n \"apn_template\": \"\",\n \"credentials_json\": \"\",\n \"data_template\": \"\",\n \"notification_template\": \"\",\n \"server_key\": \"\"\n },\n \"grants\": {},\n \"hms_options\": {},\n \"huawei_config\": {\n \"Disabled\": false,\n \"id\": \"\",\n \"secret\": \"\"\n },\n \"image_moderation_block_labels\": [],\n \"image_moderation_enabled\": false,\n \"image_moderation_labels\": [],\n \"image_upload_config\": {},\n \"migrate_permissions_to_v2\": false,\n \"multi_tenant_enabled\": false,\n \"permission_version\": \"\",\n \"push_config\": {\n \"offline_only\": false,\n \"version\": \"\"\n },\n \"reminders_interval\": \"\",\n \"revoke_tokens_issued_before\": \"\",\n \"sqs_key\": \"\",\n \"sqs_secret\": \"\",\n \"sqs_url\": \"\",\n \"user_search_disallowed_roles\": [],\n \"video_provider\": \"\",\n \"webhook_events\": [],\n \"webhook_url\": \"\",\n \"xiaomi_config\": {\n \"Disabled\": false,\n \"package_name\": \"\",\n \"secret\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/app"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"agora_options\": {\n \"app_certificate\": \"\",\n \"app_id\": \"\",\n \"default_role\": \"\",\n \"role_map\": {}\n },\n \"apn_config\": {\n \"Disabled\": false,\n \"auth_key\": \"\",\n \"auth_type\": \"\",\n \"bundle_id\": \"\",\n \"development\": false,\n \"host\": \"\",\n \"key_id\": \"\",\n \"notification_template\": \"\",\n \"p12_cert\": \"\",\n \"team_id\": \"\"\n },\n \"async_moderation_config\": {\n \"callback\": {\n \"mode\": \"\",\n \"server_url\": \"\"\n },\n \"timeout_ms\": \"\"\n },\n \"async_url_enrich_enabled\": false,\n \"auto_translation_enabled\": false,\n \"before_message_send_hook_url\": \"\",\n \"cdn_expiration_seconds\": \"\",\n \"channel_hide_members_only\": false,\n \"custom_action_handler_url\": \"\",\n \"disable_auth_checks\": false,\n \"disable_permissions_checks\": false,\n \"enforce_unique_usernames\": \"\",\n \"file_upload_config\": {\n \"allowed_file_extensions\": [],\n \"allowed_mime_types\": [],\n \"blocked_file_extensions\": [],\n \"blocked_mime_types\": []\n },\n \"firebase_config\": {\n \"Disabled\": false,\n \"apn_template\": \"\",\n \"credentials_json\": \"\",\n \"data_template\": \"\",\n \"notification_template\": \"\",\n \"server_key\": \"\"\n },\n \"grants\": {},\n \"hms_options\": {},\n \"huawei_config\": {\n \"Disabled\": false,\n \"id\": \"\",\n \"secret\": \"\"\n },\n \"image_moderation_block_labels\": [],\n \"image_moderation_enabled\": false,\n \"image_moderation_labels\": [],\n \"image_upload_config\": {},\n \"migrate_permissions_to_v2\": false,\n \"multi_tenant_enabled\": false,\n \"permission_version\": \"\",\n \"push_config\": {\n \"offline_only\": false,\n \"version\": \"\"\n },\n \"reminders_interval\": \"\",\n \"revoke_tokens_issued_before\": \"\",\n \"sqs_key\": \"\",\n \"sqs_secret\": \"\",\n \"sqs_url\": \"\",\n \"user_search_disallowed_roles\": [],\n \"video_provider\": \"\",\n \"webhook_events\": [],\n \"webhook_url\": \"\",\n \"xiaomi_config\": {\n \"Disabled\": false,\n \"package_name\": \"\",\n \"secret\": \"\"\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 \"agora_options\": {\n \"app_certificate\": \"\",\n \"app_id\": \"\",\n \"default_role\": \"\",\n \"role_map\": {}\n },\n \"apn_config\": {\n \"Disabled\": false,\n \"auth_key\": \"\",\n \"auth_type\": \"\",\n \"bundle_id\": \"\",\n \"development\": false,\n \"host\": \"\",\n \"key_id\": \"\",\n \"notification_template\": \"\",\n \"p12_cert\": \"\",\n \"team_id\": \"\"\n },\n \"async_moderation_config\": {\n \"callback\": {\n \"mode\": \"\",\n \"server_url\": \"\"\n },\n \"timeout_ms\": \"\"\n },\n \"async_url_enrich_enabled\": false,\n \"auto_translation_enabled\": false,\n \"before_message_send_hook_url\": \"\",\n \"cdn_expiration_seconds\": \"\",\n \"channel_hide_members_only\": false,\n \"custom_action_handler_url\": \"\",\n \"disable_auth_checks\": false,\n \"disable_permissions_checks\": false,\n \"enforce_unique_usernames\": \"\",\n \"file_upload_config\": {\n \"allowed_file_extensions\": [],\n \"allowed_mime_types\": [],\n \"blocked_file_extensions\": [],\n \"blocked_mime_types\": []\n },\n \"firebase_config\": {\n \"Disabled\": false,\n \"apn_template\": \"\",\n \"credentials_json\": \"\",\n \"data_template\": \"\",\n \"notification_template\": \"\",\n \"server_key\": \"\"\n },\n \"grants\": {},\n \"hms_options\": {},\n \"huawei_config\": {\n \"Disabled\": false,\n \"id\": \"\",\n \"secret\": \"\"\n },\n \"image_moderation_block_labels\": [],\n \"image_moderation_enabled\": false,\n \"image_moderation_labels\": [],\n \"image_upload_config\": {},\n \"migrate_permissions_to_v2\": false,\n \"multi_tenant_enabled\": false,\n \"permission_version\": \"\",\n \"push_config\": {\n \"offline_only\": false,\n \"version\": \"\"\n },\n \"reminders_interval\": \"\",\n \"revoke_tokens_issued_before\": \"\",\n \"sqs_key\": \"\",\n \"sqs_secret\": \"\",\n \"sqs_url\": \"\",\n \"user_search_disallowed_roles\": [],\n \"video_provider\": \"\",\n \"webhook_events\": [],\n \"webhook_url\": \"\",\n \"xiaomi_config\": {\n \"Disabled\": false,\n \"package_name\": \"\",\n \"secret\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/app")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/app")
.header("content-type", "application/json")
.body("{\n \"agora_options\": {\n \"app_certificate\": \"\",\n \"app_id\": \"\",\n \"default_role\": \"\",\n \"role_map\": {}\n },\n \"apn_config\": {\n \"Disabled\": false,\n \"auth_key\": \"\",\n \"auth_type\": \"\",\n \"bundle_id\": \"\",\n \"development\": false,\n \"host\": \"\",\n \"key_id\": \"\",\n \"notification_template\": \"\",\n \"p12_cert\": \"\",\n \"team_id\": \"\"\n },\n \"async_moderation_config\": {\n \"callback\": {\n \"mode\": \"\",\n \"server_url\": \"\"\n },\n \"timeout_ms\": \"\"\n },\n \"async_url_enrich_enabled\": false,\n \"auto_translation_enabled\": false,\n \"before_message_send_hook_url\": \"\",\n \"cdn_expiration_seconds\": \"\",\n \"channel_hide_members_only\": false,\n \"custom_action_handler_url\": \"\",\n \"disable_auth_checks\": false,\n \"disable_permissions_checks\": false,\n \"enforce_unique_usernames\": \"\",\n \"file_upload_config\": {\n \"allowed_file_extensions\": [],\n \"allowed_mime_types\": [],\n \"blocked_file_extensions\": [],\n \"blocked_mime_types\": []\n },\n \"firebase_config\": {\n \"Disabled\": false,\n \"apn_template\": \"\",\n \"credentials_json\": \"\",\n \"data_template\": \"\",\n \"notification_template\": \"\",\n \"server_key\": \"\"\n },\n \"grants\": {},\n \"hms_options\": {},\n \"huawei_config\": {\n \"Disabled\": false,\n \"id\": \"\",\n \"secret\": \"\"\n },\n \"image_moderation_block_labels\": [],\n \"image_moderation_enabled\": false,\n \"image_moderation_labels\": [],\n \"image_upload_config\": {},\n \"migrate_permissions_to_v2\": false,\n \"multi_tenant_enabled\": false,\n \"permission_version\": \"\",\n \"push_config\": {\n \"offline_only\": false,\n \"version\": \"\"\n },\n \"reminders_interval\": \"\",\n \"revoke_tokens_issued_before\": \"\",\n \"sqs_key\": \"\",\n \"sqs_secret\": \"\",\n \"sqs_url\": \"\",\n \"user_search_disallowed_roles\": [],\n \"video_provider\": \"\",\n \"webhook_events\": [],\n \"webhook_url\": \"\",\n \"xiaomi_config\": {\n \"Disabled\": false,\n \"package_name\": \"\",\n \"secret\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
agora_options: {
app_certificate: '',
app_id: '',
default_role: '',
role_map: {}
},
apn_config: {
Disabled: false,
auth_key: '',
auth_type: '',
bundle_id: '',
development: false,
host: '',
key_id: '',
notification_template: '',
p12_cert: '',
team_id: ''
},
async_moderation_config: {
callback: {
mode: '',
server_url: ''
},
timeout_ms: ''
},
async_url_enrich_enabled: false,
auto_translation_enabled: false,
before_message_send_hook_url: '',
cdn_expiration_seconds: '',
channel_hide_members_only: false,
custom_action_handler_url: '',
disable_auth_checks: false,
disable_permissions_checks: false,
enforce_unique_usernames: '',
file_upload_config: {
allowed_file_extensions: [],
allowed_mime_types: [],
blocked_file_extensions: [],
blocked_mime_types: []
},
firebase_config: {
Disabled: false,
apn_template: '',
credentials_json: '',
data_template: '',
notification_template: '',
server_key: ''
},
grants: {},
hms_options: {},
huawei_config: {
Disabled: false,
id: '',
secret: ''
},
image_moderation_block_labels: [],
image_moderation_enabled: false,
image_moderation_labels: [],
image_upload_config: {},
migrate_permissions_to_v2: false,
multi_tenant_enabled: false,
permission_version: '',
push_config: {
offline_only: false,
version: ''
},
reminders_interval: '',
revoke_tokens_issued_before: '',
sqs_key: '',
sqs_secret: '',
sqs_url: '',
user_search_disallowed_roles: [],
video_provider: '',
webhook_events: [],
webhook_url: '',
xiaomi_config: {
Disabled: false,
package_name: '',
secret: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/app');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/app',
headers: {'content-type': 'application/json'},
data: {
agora_options: {app_certificate: '', app_id: '', default_role: '', role_map: {}},
apn_config: {
Disabled: false,
auth_key: '',
auth_type: '',
bundle_id: '',
development: false,
host: '',
key_id: '',
notification_template: '',
p12_cert: '',
team_id: ''
},
async_moderation_config: {callback: {mode: '', server_url: ''}, timeout_ms: ''},
async_url_enrich_enabled: false,
auto_translation_enabled: false,
before_message_send_hook_url: '',
cdn_expiration_seconds: '',
channel_hide_members_only: false,
custom_action_handler_url: '',
disable_auth_checks: false,
disable_permissions_checks: false,
enforce_unique_usernames: '',
file_upload_config: {
allowed_file_extensions: [],
allowed_mime_types: [],
blocked_file_extensions: [],
blocked_mime_types: []
},
firebase_config: {
Disabled: false,
apn_template: '',
credentials_json: '',
data_template: '',
notification_template: '',
server_key: ''
},
grants: {},
hms_options: {},
huawei_config: {Disabled: false, id: '', secret: ''},
image_moderation_block_labels: [],
image_moderation_enabled: false,
image_moderation_labels: [],
image_upload_config: {},
migrate_permissions_to_v2: false,
multi_tenant_enabled: false,
permission_version: '',
push_config: {offline_only: false, version: ''},
reminders_interval: '',
revoke_tokens_issued_before: '',
sqs_key: '',
sqs_secret: '',
sqs_url: '',
user_search_disallowed_roles: [],
video_provider: '',
webhook_events: [],
webhook_url: '',
xiaomi_config: {Disabled: false, package_name: '', secret: ''}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/app';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"agora_options":{"app_certificate":"","app_id":"","default_role":"","role_map":{}},"apn_config":{"Disabled":false,"auth_key":"","auth_type":"","bundle_id":"","development":false,"host":"","key_id":"","notification_template":"","p12_cert":"","team_id":""},"async_moderation_config":{"callback":{"mode":"","server_url":""},"timeout_ms":""},"async_url_enrich_enabled":false,"auto_translation_enabled":false,"before_message_send_hook_url":"","cdn_expiration_seconds":"","channel_hide_members_only":false,"custom_action_handler_url":"","disable_auth_checks":false,"disable_permissions_checks":false,"enforce_unique_usernames":"","file_upload_config":{"allowed_file_extensions":[],"allowed_mime_types":[],"blocked_file_extensions":[],"blocked_mime_types":[]},"firebase_config":{"Disabled":false,"apn_template":"","credentials_json":"","data_template":"","notification_template":"","server_key":""},"grants":{},"hms_options":{},"huawei_config":{"Disabled":false,"id":"","secret":""},"image_moderation_block_labels":[],"image_moderation_enabled":false,"image_moderation_labels":[],"image_upload_config":{},"migrate_permissions_to_v2":false,"multi_tenant_enabled":false,"permission_version":"","push_config":{"offline_only":false,"version":""},"reminders_interval":"","revoke_tokens_issued_before":"","sqs_key":"","sqs_secret":"","sqs_url":"","user_search_disallowed_roles":[],"video_provider":"","webhook_events":[],"webhook_url":"","xiaomi_config":{"Disabled":false,"package_name":"","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}}/app',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "agora_options": {\n "app_certificate": "",\n "app_id": "",\n "default_role": "",\n "role_map": {}\n },\n "apn_config": {\n "Disabled": false,\n "auth_key": "",\n "auth_type": "",\n "bundle_id": "",\n "development": false,\n "host": "",\n "key_id": "",\n "notification_template": "",\n "p12_cert": "",\n "team_id": ""\n },\n "async_moderation_config": {\n "callback": {\n "mode": "",\n "server_url": ""\n },\n "timeout_ms": ""\n },\n "async_url_enrich_enabled": false,\n "auto_translation_enabled": false,\n "before_message_send_hook_url": "",\n "cdn_expiration_seconds": "",\n "channel_hide_members_only": false,\n "custom_action_handler_url": "",\n "disable_auth_checks": false,\n "disable_permissions_checks": false,\n "enforce_unique_usernames": "",\n "file_upload_config": {\n "allowed_file_extensions": [],\n "allowed_mime_types": [],\n "blocked_file_extensions": [],\n "blocked_mime_types": []\n },\n "firebase_config": {\n "Disabled": false,\n "apn_template": "",\n "credentials_json": "",\n "data_template": "",\n "notification_template": "",\n "server_key": ""\n },\n "grants": {},\n "hms_options": {},\n "huawei_config": {\n "Disabled": false,\n "id": "",\n "secret": ""\n },\n "image_moderation_block_labels": [],\n "image_moderation_enabled": false,\n "image_moderation_labels": [],\n "image_upload_config": {},\n "migrate_permissions_to_v2": false,\n "multi_tenant_enabled": false,\n "permission_version": "",\n "push_config": {\n "offline_only": false,\n "version": ""\n },\n "reminders_interval": "",\n "revoke_tokens_issued_before": "",\n "sqs_key": "",\n "sqs_secret": "",\n "sqs_url": "",\n "user_search_disallowed_roles": [],\n "video_provider": "",\n "webhook_events": [],\n "webhook_url": "",\n "xiaomi_config": {\n "Disabled": false,\n "package_name": "",\n "secret": ""\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 \"agora_options\": {\n \"app_certificate\": \"\",\n \"app_id\": \"\",\n \"default_role\": \"\",\n \"role_map\": {}\n },\n \"apn_config\": {\n \"Disabled\": false,\n \"auth_key\": \"\",\n \"auth_type\": \"\",\n \"bundle_id\": \"\",\n \"development\": false,\n \"host\": \"\",\n \"key_id\": \"\",\n \"notification_template\": \"\",\n \"p12_cert\": \"\",\n \"team_id\": \"\"\n },\n \"async_moderation_config\": {\n \"callback\": {\n \"mode\": \"\",\n \"server_url\": \"\"\n },\n \"timeout_ms\": \"\"\n },\n \"async_url_enrich_enabled\": false,\n \"auto_translation_enabled\": false,\n \"before_message_send_hook_url\": \"\",\n \"cdn_expiration_seconds\": \"\",\n \"channel_hide_members_only\": false,\n \"custom_action_handler_url\": \"\",\n \"disable_auth_checks\": false,\n \"disable_permissions_checks\": false,\n \"enforce_unique_usernames\": \"\",\n \"file_upload_config\": {\n \"allowed_file_extensions\": [],\n \"allowed_mime_types\": [],\n \"blocked_file_extensions\": [],\n \"blocked_mime_types\": []\n },\n \"firebase_config\": {\n \"Disabled\": false,\n \"apn_template\": \"\",\n \"credentials_json\": \"\",\n \"data_template\": \"\",\n \"notification_template\": \"\",\n \"server_key\": \"\"\n },\n \"grants\": {},\n \"hms_options\": {},\n \"huawei_config\": {\n \"Disabled\": false,\n \"id\": \"\",\n \"secret\": \"\"\n },\n \"image_moderation_block_labels\": [],\n \"image_moderation_enabled\": false,\n \"image_moderation_labels\": [],\n \"image_upload_config\": {},\n \"migrate_permissions_to_v2\": false,\n \"multi_tenant_enabled\": false,\n \"permission_version\": \"\",\n \"push_config\": {\n \"offline_only\": false,\n \"version\": \"\"\n },\n \"reminders_interval\": \"\",\n \"revoke_tokens_issued_before\": \"\",\n \"sqs_key\": \"\",\n \"sqs_secret\": \"\",\n \"sqs_url\": \"\",\n \"user_search_disallowed_roles\": [],\n \"video_provider\": \"\",\n \"webhook_events\": [],\n \"webhook_url\": \"\",\n \"xiaomi_config\": {\n \"Disabled\": false,\n \"package_name\": \"\",\n \"secret\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/app")
.patch(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PATCH',
hostname: 'example.com',
port: null,
path: '/baseUrl/app',
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({
agora_options: {app_certificate: '', app_id: '', default_role: '', role_map: {}},
apn_config: {
Disabled: false,
auth_key: '',
auth_type: '',
bundle_id: '',
development: false,
host: '',
key_id: '',
notification_template: '',
p12_cert: '',
team_id: ''
},
async_moderation_config: {callback: {mode: '', server_url: ''}, timeout_ms: ''},
async_url_enrich_enabled: false,
auto_translation_enabled: false,
before_message_send_hook_url: '',
cdn_expiration_seconds: '',
channel_hide_members_only: false,
custom_action_handler_url: '',
disable_auth_checks: false,
disable_permissions_checks: false,
enforce_unique_usernames: '',
file_upload_config: {
allowed_file_extensions: [],
allowed_mime_types: [],
blocked_file_extensions: [],
blocked_mime_types: []
},
firebase_config: {
Disabled: false,
apn_template: '',
credentials_json: '',
data_template: '',
notification_template: '',
server_key: ''
},
grants: {},
hms_options: {},
huawei_config: {Disabled: false, id: '', secret: ''},
image_moderation_block_labels: [],
image_moderation_enabled: false,
image_moderation_labels: [],
image_upload_config: {},
migrate_permissions_to_v2: false,
multi_tenant_enabled: false,
permission_version: '',
push_config: {offline_only: false, version: ''},
reminders_interval: '',
revoke_tokens_issued_before: '',
sqs_key: '',
sqs_secret: '',
sqs_url: '',
user_search_disallowed_roles: [],
video_provider: '',
webhook_events: [],
webhook_url: '',
xiaomi_config: {Disabled: false, package_name: '', secret: ''}
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/app',
headers: {'content-type': 'application/json'},
body: {
agora_options: {app_certificate: '', app_id: '', default_role: '', role_map: {}},
apn_config: {
Disabled: false,
auth_key: '',
auth_type: '',
bundle_id: '',
development: false,
host: '',
key_id: '',
notification_template: '',
p12_cert: '',
team_id: ''
},
async_moderation_config: {callback: {mode: '', server_url: ''}, timeout_ms: ''},
async_url_enrich_enabled: false,
auto_translation_enabled: false,
before_message_send_hook_url: '',
cdn_expiration_seconds: '',
channel_hide_members_only: false,
custom_action_handler_url: '',
disable_auth_checks: false,
disable_permissions_checks: false,
enforce_unique_usernames: '',
file_upload_config: {
allowed_file_extensions: [],
allowed_mime_types: [],
blocked_file_extensions: [],
blocked_mime_types: []
},
firebase_config: {
Disabled: false,
apn_template: '',
credentials_json: '',
data_template: '',
notification_template: '',
server_key: ''
},
grants: {},
hms_options: {},
huawei_config: {Disabled: false, id: '', secret: ''},
image_moderation_block_labels: [],
image_moderation_enabled: false,
image_moderation_labels: [],
image_upload_config: {},
migrate_permissions_to_v2: false,
multi_tenant_enabled: false,
permission_version: '',
push_config: {offline_only: false, version: ''},
reminders_interval: '',
revoke_tokens_issued_before: '',
sqs_key: '',
sqs_secret: '',
sqs_url: '',
user_search_disallowed_roles: [],
video_provider: '',
webhook_events: [],
webhook_url: '',
xiaomi_config: {Disabled: false, package_name: '', 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('PATCH', '{{baseUrl}}/app');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
agora_options: {
app_certificate: '',
app_id: '',
default_role: '',
role_map: {}
},
apn_config: {
Disabled: false,
auth_key: '',
auth_type: '',
bundle_id: '',
development: false,
host: '',
key_id: '',
notification_template: '',
p12_cert: '',
team_id: ''
},
async_moderation_config: {
callback: {
mode: '',
server_url: ''
},
timeout_ms: ''
},
async_url_enrich_enabled: false,
auto_translation_enabled: false,
before_message_send_hook_url: '',
cdn_expiration_seconds: '',
channel_hide_members_only: false,
custom_action_handler_url: '',
disable_auth_checks: false,
disable_permissions_checks: false,
enforce_unique_usernames: '',
file_upload_config: {
allowed_file_extensions: [],
allowed_mime_types: [],
blocked_file_extensions: [],
blocked_mime_types: []
},
firebase_config: {
Disabled: false,
apn_template: '',
credentials_json: '',
data_template: '',
notification_template: '',
server_key: ''
},
grants: {},
hms_options: {},
huawei_config: {
Disabled: false,
id: '',
secret: ''
},
image_moderation_block_labels: [],
image_moderation_enabled: false,
image_moderation_labels: [],
image_upload_config: {},
migrate_permissions_to_v2: false,
multi_tenant_enabled: false,
permission_version: '',
push_config: {
offline_only: false,
version: ''
},
reminders_interval: '',
revoke_tokens_issued_before: '',
sqs_key: '',
sqs_secret: '',
sqs_url: '',
user_search_disallowed_roles: [],
video_provider: '',
webhook_events: [],
webhook_url: '',
xiaomi_config: {
Disabled: false,
package_name: '',
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: 'PATCH',
url: '{{baseUrl}}/app',
headers: {'content-type': 'application/json'},
data: {
agora_options: {app_certificate: '', app_id: '', default_role: '', role_map: {}},
apn_config: {
Disabled: false,
auth_key: '',
auth_type: '',
bundle_id: '',
development: false,
host: '',
key_id: '',
notification_template: '',
p12_cert: '',
team_id: ''
},
async_moderation_config: {callback: {mode: '', server_url: ''}, timeout_ms: ''},
async_url_enrich_enabled: false,
auto_translation_enabled: false,
before_message_send_hook_url: '',
cdn_expiration_seconds: '',
channel_hide_members_only: false,
custom_action_handler_url: '',
disable_auth_checks: false,
disable_permissions_checks: false,
enforce_unique_usernames: '',
file_upload_config: {
allowed_file_extensions: [],
allowed_mime_types: [],
blocked_file_extensions: [],
blocked_mime_types: []
},
firebase_config: {
Disabled: false,
apn_template: '',
credentials_json: '',
data_template: '',
notification_template: '',
server_key: ''
},
grants: {},
hms_options: {},
huawei_config: {Disabled: false, id: '', secret: ''},
image_moderation_block_labels: [],
image_moderation_enabled: false,
image_moderation_labels: [],
image_upload_config: {},
migrate_permissions_to_v2: false,
multi_tenant_enabled: false,
permission_version: '',
push_config: {offline_only: false, version: ''},
reminders_interval: '',
revoke_tokens_issued_before: '',
sqs_key: '',
sqs_secret: '',
sqs_url: '',
user_search_disallowed_roles: [],
video_provider: '',
webhook_events: [],
webhook_url: '',
xiaomi_config: {Disabled: false, package_name: '', secret: ''}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/app';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"agora_options":{"app_certificate":"","app_id":"","default_role":"","role_map":{}},"apn_config":{"Disabled":false,"auth_key":"","auth_type":"","bundle_id":"","development":false,"host":"","key_id":"","notification_template":"","p12_cert":"","team_id":""},"async_moderation_config":{"callback":{"mode":"","server_url":""},"timeout_ms":""},"async_url_enrich_enabled":false,"auto_translation_enabled":false,"before_message_send_hook_url":"","cdn_expiration_seconds":"","channel_hide_members_only":false,"custom_action_handler_url":"","disable_auth_checks":false,"disable_permissions_checks":false,"enforce_unique_usernames":"","file_upload_config":{"allowed_file_extensions":[],"allowed_mime_types":[],"blocked_file_extensions":[],"blocked_mime_types":[]},"firebase_config":{"Disabled":false,"apn_template":"","credentials_json":"","data_template":"","notification_template":"","server_key":""},"grants":{},"hms_options":{},"huawei_config":{"Disabled":false,"id":"","secret":""},"image_moderation_block_labels":[],"image_moderation_enabled":false,"image_moderation_labels":[],"image_upload_config":{},"migrate_permissions_to_v2":false,"multi_tenant_enabled":false,"permission_version":"","push_config":{"offline_only":false,"version":""},"reminders_interval":"","revoke_tokens_issued_before":"","sqs_key":"","sqs_secret":"","sqs_url":"","user_search_disallowed_roles":[],"video_provider":"","webhook_events":[],"webhook_url":"","xiaomi_config":{"Disabled":false,"package_name":"","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 = @{ @"agora_options": @{ @"app_certificate": @"", @"app_id": @"", @"default_role": @"", @"role_map": @{ } },
@"apn_config": @{ @"Disabled": @NO, @"auth_key": @"", @"auth_type": @"", @"bundle_id": @"", @"development": @NO, @"host": @"", @"key_id": @"", @"notification_template": @"", @"p12_cert": @"", @"team_id": @"" },
@"async_moderation_config": @{ @"callback": @{ @"mode": @"", @"server_url": @"" }, @"timeout_ms": @"" },
@"async_url_enrich_enabled": @NO,
@"auto_translation_enabled": @NO,
@"before_message_send_hook_url": @"",
@"cdn_expiration_seconds": @"",
@"channel_hide_members_only": @NO,
@"custom_action_handler_url": @"",
@"disable_auth_checks": @NO,
@"disable_permissions_checks": @NO,
@"enforce_unique_usernames": @"",
@"file_upload_config": @{ @"allowed_file_extensions": @[ ], @"allowed_mime_types": @[ ], @"blocked_file_extensions": @[ ], @"blocked_mime_types": @[ ] },
@"firebase_config": @{ @"Disabled": @NO, @"apn_template": @"", @"credentials_json": @"", @"data_template": @"", @"notification_template": @"", @"server_key": @"" },
@"grants": @{ },
@"hms_options": @{ },
@"huawei_config": @{ @"Disabled": @NO, @"id": @"", @"secret": @"" },
@"image_moderation_block_labels": @[ ],
@"image_moderation_enabled": @NO,
@"image_moderation_labels": @[ ],
@"image_upload_config": @{ },
@"migrate_permissions_to_v2": @NO,
@"multi_tenant_enabled": @NO,
@"permission_version": @"",
@"push_config": @{ @"offline_only": @NO, @"version": @"" },
@"reminders_interval": @"",
@"revoke_tokens_issued_before": @"",
@"sqs_key": @"",
@"sqs_secret": @"",
@"sqs_url": @"",
@"user_search_disallowed_roles": @[ ],
@"video_provider": @"",
@"webhook_events": @[ ],
@"webhook_url": @"",
@"xiaomi_config": @{ @"Disabled": @NO, @"package_name": @"", @"secret": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/app"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PATCH"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/app" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"agora_options\": {\n \"app_certificate\": \"\",\n \"app_id\": \"\",\n \"default_role\": \"\",\n \"role_map\": {}\n },\n \"apn_config\": {\n \"Disabled\": false,\n \"auth_key\": \"\",\n \"auth_type\": \"\",\n \"bundle_id\": \"\",\n \"development\": false,\n \"host\": \"\",\n \"key_id\": \"\",\n \"notification_template\": \"\",\n \"p12_cert\": \"\",\n \"team_id\": \"\"\n },\n \"async_moderation_config\": {\n \"callback\": {\n \"mode\": \"\",\n \"server_url\": \"\"\n },\n \"timeout_ms\": \"\"\n },\n \"async_url_enrich_enabled\": false,\n \"auto_translation_enabled\": false,\n \"before_message_send_hook_url\": \"\",\n \"cdn_expiration_seconds\": \"\",\n \"channel_hide_members_only\": false,\n \"custom_action_handler_url\": \"\",\n \"disable_auth_checks\": false,\n \"disable_permissions_checks\": false,\n \"enforce_unique_usernames\": \"\",\n \"file_upload_config\": {\n \"allowed_file_extensions\": [],\n \"allowed_mime_types\": [],\n \"blocked_file_extensions\": [],\n \"blocked_mime_types\": []\n },\n \"firebase_config\": {\n \"Disabled\": false,\n \"apn_template\": \"\",\n \"credentials_json\": \"\",\n \"data_template\": \"\",\n \"notification_template\": \"\",\n \"server_key\": \"\"\n },\n \"grants\": {},\n \"hms_options\": {},\n \"huawei_config\": {\n \"Disabled\": false,\n \"id\": \"\",\n \"secret\": \"\"\n },\n \"image_moderation_block_labels\": [],\n \"image_moderation_enabled\": false,\n \"image_moderation_labels\": [],\n \"image_upload_config\": {},\n \"migrate_permissions_to_v2\": false,\n \"multi_tenant_enabled\": false,\n \"permission_version\": \"\",\n \"push_config\": {\n \"offline_only\": false,\n \"version\": \"\"\n },\n \"reminders_interval\": \"\",\n \"revoke_tokens_issued_before\": \"\",\n \"sqs_key\": \"\",\n \"sqs_secret\": \"\",\n \"sqs_url\": \"\",\n \"user_search_disallowed_roles\": [],\n \"video_provider\": \"\",\n \"webhook_events\": [],\n \"webhook_url\": \"\",\n \"xiaomi_config\": {\n \"Disabled\": false,\n \"package_name\": \"\",\n \"secret\": \"\"\n }\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/app",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'agora_options' => [
'app_certificate' => '',
'app_id' => '',
'default_role' => '',
'role_map' => [
]
],
'apn_config' => [
'Disabled' => null,
'auth_key' => '',
'auth_type' => '',
'bundle_id' => '',
'development' => null,
'host' => '',
'key_id' => '',
'notification_template' => '',
'p12_cert' => '',
'team_id' => ''
],
'async_moderation_config' => [
'callback' => [
'mode' => '',
'server_url' => ''
],
'timeout_ms' => ''
],
'async_url_enrich_enabled' => null,
'auto_translation_enabled' => null,
'before_message_send_hook_url' => '',
'cdn_expiration_seconds' => '',
'channel_hide_members_only' => null,
'custom_action_handler_url' => '',
'disable_auth_checks' => null,
'disable_permissions_checks' => null,
'enforce_unique_usernames' => '',
'file_upload_config' => [
'allowed_file_extensions' => [
],
'allowed_mime_types' => [
],
'blocked_file_extensions' => [
],
'blocked_mime_types' => [
]
],
'firebase_config' => [
'Disabled' => null,
'apn_template' => '',
'credentials_json' => '',
'data_template' => '',
'notification_template' => '',
'server_key' => ''
],
'grants' => [
],
'hms_options' => [
],
'huawei_config' => [
'Disabled' => null,
'id' => '',
'secret' => ''
],
'image_moderation_block_labels' => [
],
'image_moderation_enabled' => null,
'image_moderation_labels' => [
],
'image_upload_config' => [
],
'migrate_permissions_to_v2' => null,
'multi_tenant_enabled' => null,
'permission_version' => '',
'push_config' => [
'offline_only' => null,
'version' => ''
],
'reminders_interval' => '',
'revoke_tokens_issued_before' => '',
'sqs_key' => '',
'sqs_secret' => '',
'sqs_url' => '',
'user_search_disallowed_roles' => [
],
'video_provider' => '',
'webhook_events' => [
],
'webhook_url' => '',
'xiaomi_config' => [
'Disabled' => null,
'package_name' => '',
'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('PATCH', '{{baseUrl}}/app', [
'body' => '{
"agora_options": {
"app_certificate": "",
"app_id": "",
"default_role": "",
"role_map": {}
},
"apn_config": {
"Disabled": false,
"auth_key": "",
"auth_type": "",
"bundle_id": "",
"development": false,
"host": "",
"key_id": "",
"notification_template": "",
"p12_cert": "",
"team_id": ""
},
"async_moderation_config": {
"callback": {
"mode": "",
"server_url": ""
},
"timeout_ms": ""
},
"async_url_enrich_enabled": false,
"auto_translation_enabled": false,
"before_message_send_hook_url": "",
"cdn_expiration_seconds": "",
"channel_hide_members_only": false,
"custom_action_handler_url": "",
"disable_auth_checks": false,
"disable_permissions_checks": false,
"enforce_unique_usernames": "",
"file_upload_config": {
"allowed_file_extensions": [],
"allowed_mime_types": [],
"blocked_file_extensions": [],
"blocked_mime_types": []
},
"firebase_config": {
"Disabled": false,
"apn_template": "",
"credentials_json": "",
"data_template": "",
"notification_template": "",
"server_key": ""
},
"grants": {},
"hms_options": {},
"huawei_config": {
"Disabled": false,
"id": "",
"secret": ""
},
"image_moderation_block_labels": [],
"image_moderation_enabled": false,
"image_moderation_labels": [],
"image_upload_config": {},
"migrate_permissions_to_v2": false,
"multi_tenant_enabled": false,
"permission_version": "",
"push_config": {
"offline_only": false,
"version": ""
},
"reminders_interval": "",
"revoke_tokens_issued_before": "",
"sqs_key": "",
"sqs_secret": "",
"sqs_url": "",
"user_search_disallowed_roles": [],
"video_provider": "",
"webhook_events": [],
"webhook_url": "",
"xiaomi_config": {
"Disabled": false,
"package_name": "",
"secret": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/app');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'agora_options' => [
'app_certificate' => '',
'app_id' => '',
'default_role' => '',
'role_map' => [
]
],
'apn_config' => [
'Disabled' => null,
'auth_key' => '',
'auth_type' => '',
'bundle_id' => '',
'development' => null,
'host' => '',
'key_id' => '',
'notification_template' => '',
'p12_cert' => '',
'team_id' => ''
],
'async_moderation_config' => [
'callback' => [
'mode' => '',
'server_url' => ''
],
'timeout_ms' => ''
],
'async_url_enrich_enabled' => null,
'auto_translation_enabled' => null,
'before_message_send_hook_url' => '',
'cdn_expiration_seconds' => '',
'channel_hide_members_only' => null,
'custom_action_handler_url' => '',
'disable_auth_checks' => null,
'disable_permissions_checks' => null,
'enforce_unique_usernames' => '',
'file_upload_config' => [
'allowed_file_extensions' => [
],
'allowed_mime_types' => [
],
'blocked_file_extensions' => [
],
'blocked_mime_types' => [
]
],
'firebase_config' => [
'Disabled' => null,
'apn_template' => '',
'credentials_json' => '',
'data_template' => '',
'notification_template' => '',
'server_key' => ''
],
'grants' => [
],
'hms_options' => [
],
'huawei_config' => [
'Disabled' => null,
'id' => '',
'secret' => ''
],
'image_moderation_block_labels' => [
],
'image_moderation_enabled' => null,
'image_moderation_labels' => [
],
'image_upload_config' => [
],
'migrate_permissions_to_v2' => null,
'multi_tenant_enabled' => null,
'permission_version' => '',
'push_config' => [
'offline_only' => null,
'version' => ''
],
'reminders_interval' => '',
'revoke_tokens_issued_before' => '',
'sqs_key' => '',
'sqs_secret' => '',
'sqs_url' => '',
'user_search_disallowed_roles' => [
],
'video_provider' => '',
'webhook_events' => [
],
'webhook_url' => '',
'xiaomi_config' => [
'Disabled' => null,
'package_name' => '',
'secret' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'agora_options' => [
'app_certificate' => '',
'app_id' => '',
'default_role' => '',
'role_map' => [
]
],
'apn_config' => [
'Disabled' => null,
'auth_key' => '',
'auth_type' => '',
'bundle_id' => '',
'development' => null,
'host' => '',
'key_id' => '',
'notification_template' => '',
'p12_cert' => '',
'team_id' => ''
],
'async_moderation_config' => [
'callback' => [
'mode' => '',
'server_url' => ''
],
'timeout_ms' => ''
],
'async_url_enrich_enabled' => null,
'auto_translation_enabled' => null,
'before_message_send_hook_url' => '',
'cdn_expiration_seconds' => '',
'channel_hide_members_only' => null,
'custom_action_handler_url' => '',
'disable_auth_checks' => null,
'disable_permissions_checks' => null,
'enforce_unique_usernames' => '',
'file_upload_config' => [
'allowed_file_extensions' => [
],
'allowed_mime_types' => [
],
'blocked_file_extensions' => [
],
'blocked_mime_types' => [
]
],
'firebase_config' => [
'Disabled' => null,
'apn_template' => '',
'credentials_json' => '',
'data_template' => '',
'notification_template' => '',
'server_key' => ''
],
'grants' => [
],
'hms_options' => [
],
'huawei_config' => [
'Disabled' => null,
'id' => '',
'secret' => ''
],
'image_moderation_block_labels' => [
],
'image_moderation_enabled' => null,
'image_moderation_labels' => [
],
'image_upload_config' => [
],
'migrate_permissions_to_v2' => null,
'multi_tenant_enabled' => null,
'permission_version' => '',
'push_config' => [
'offline_only' => null,
'version' => ''
],
'reminders_interval' => '',
'revoke_tokens_issued_before' => '',
'sqs_key' => '',
'sqs_secret' => '',
'sqs_url' => '',
'user_search_disallowed_roles' => [
],
'video_provider' => '',
'webhook_events' => [
],
'webhook_url' => '',
'xiaomi_config' => [
'Disabled' => null,
'package_name' => '',
'secret' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/app');
$request->setRequestMethod('PATCH');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/app' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"agora_options": {
"app_certificate": "",
"app_id": "",
"default_role": "",
"role_map": {}
},
"apn_config": {
"Disabled": false,
"auth_key": "",
"auth_type": "",
"bundle_id": "",
"development": false,
"host": "",
"key_id": "",
"notification_template": "",
"p12_cert": "",
"team_id": ""
},
"async_moderation_config": {
"callback": {
"mode": "",
"server_url": ""
},
"timeout_ms": ""
},
"async_url_enrich_enabled": false,
"auto_translation_enabled": false,
"before_message_send_hook_url": "",
"cdn_expiration_seconds": "",
"channel_hide_members_only": false,
"custom_action_handler_url": "",
"disable_auth_checks": false,
"disable_permissions_checks": false,
"enforce_unique_usernames": "",
"file_upload_config": {
"allowed_file_extensions": [],
"allowed_mime_types": [],
"blocked_file_extensions": [],
"blocked_mime_types": []
},
"firebase_config": {
"Disabled": false,
"apn_template": "",
"credentials_json": "",
"data_template": "",
"notification_template": "",
"server_key": ""
},
"grants": {},
"hms_options": {},
"huawei_config": {
"Disabled": false,
"id": "",
"secret": ""
},
"image_moderation_block_labels": [],
"image_moderation_enabled": false,
"image_moderation_labels": [],
"image_upload_config": {},
"migrate_permissions_to_v2": false,
"multi_tenant_enabled": false,
"permission_version": "",
"push_config": {
"offline_only": false,
"version": ""
},
"reminders_interval": "",
"revoke_tokens_issued_before": "",
"sqs_key": "",
"sqs_secret": "",
"sqs_url": "",
"user_search_disallowed_roles": [],
"video_provider": "",
"webhook_events": [],
"webhook_url": "",
"xiaomi_config": {
"Disabled": false,
"package_name": "",
"secret": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/app' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"agora_options": {
"app_certificate": "",
"app_id": "",
"default_role": "",
"role_map": {}
},
"apn_config": {
"Disabled": false,
"auth_key": "",
"auth_type": "",
"bundle_id": "",
"development": false,
"host": "",
"key_id": "",
"notification_template": "",
"p12_cert": "",
"team_id": ""
},
"async_moderation_config": {
"callback": {
"mode": "",
"server_url": ""
},
"timeout_ms": ""
},
"async_url_enrich_enabled": false,
"auto_translation_enabled": false,
"before_message_send_hook_url": "",
"cdn_expiration_seconds": "",
"channel_hide_members_only": false,
"custom_action_handler_url": "",
"disable_auth_checks": false,
"disable_permissions_checks": false,
"enforce_unique_usernames": "",
"file_upload_config": {
"allowed_file_extensions": [],
"allowed_mime_types": [],
"blocked_file_extensions": [],
"blocked_mime_types": []
},
"firebase_config": {
"Disabled": false,
"apn_template": "",
"credentials_json": "",
"data_template": "",
"notification_template": "",
"server_key": ""
},
"grants": {},
"hms_options": {},
"huawei_config": {
"Disabled": false,
"id": "",
"secret": ""
},
"image_moderation_block_labels": [],
"image_moderation_enabled": false,
"image_moderation_labels": [],
"image_upload_config": {},
"migrate_permissions_to_v2": false,
"multi_tenant_enabled": false,
"permission_version": "",
"push_config": {
"offline_only": false,
"version": ""
},
"reminders_interval": "",
"revoke_tokens_issued_before": "",
"sqs_key": "",
"sqs_secret": "",
"sqs_url": "",
"user_search_disallowed_roles": [],
"video_provider": "",
"webhook_events": [],
"webhook_url": "",
"xiaomi_config": {
"Disabled": false,
"package_name": "",
"secret": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"agora_options\": {\n \"app_certificate\": \"\",\n \"app_id\": \"\",\n \"default_role\": \"\",\n \"role_map\": {}\n },\n \"apn_config\": {\n \"Disabled\": false,\n \"auth_key\": \"\",\n \"auth_type\": \"\",\n \"bundle_id\": \"\",\n \"development\": false,\n \"host\": \"\",\n \"key_id\": \"\",\n \"notification_template\": \"\",\n \"p12_cert\": \"\",\n \"team_id\": \"\"\n },\n \"async_moderation_config\": {\n \"callback\": {\n \"mode\": \"\",\n \"server_url\": \"\"\n },\n \"timeout_ms\": \"\"\n },\n \"async_url_enrich_enabled\": false,\n \"auto_translation_enabled\": false,\n \"before_message_send_hook_url\": \"\",\n \"cdn_expiration_seconds\": \"\",\n \"channel_hide_members_only\": false,\n \"custom_action_handler_url\": \"\",\n \"disable_auth_checks\": false,\n \"disable_permissions_checks\": false,\n \"enforce_unique_usernames\": \"\",\n \"file_upload_config\": {\n \"allowed_file_extensions\": [],\n \"allowed_mime_types\": [],\n \"blocked_file_extensions\": [],\n \"blocked_mime_types\": []\n },\n \"firebase_config\": {\n \"Disabled\": false,\n \"apn_template\": \"\",\n \"credentials_json\": \"\",\n \"data_template\": \"\",\n \"notification_template\": \"\",\n \"server_key\": \"\"\n },\n \"grants\": {},\n \"hms_options\": {},\n \"huawei_config\": {\n \"Disabled\": false,\n \"id\": \"\",\n \"secret\": \"\"\n },\n \"image_moderation_block_labels\": [],\n \"image_moderation_enabled\": false,\n \"image_moderation_labels\": [],\n \"image_upload_config\": {},\n \"migrate_permissions_to_v2\": false,\n \"multi_tenant_enabled\": false,\n \"permission_version\": \"\",\n \"push_config\": {\n \"offline_only\": false,\n \"version\": \"\"\n },\n \"reminders_interval\": \"\",\n \"revoke_tokens_issued_before\": \"\",\n \"sqs_key\": \"\",\n \"sqs_secret\": \"\",\n \"sqs_url\": \"\",\n \"user_search_disallowed_roles\": [],\n \"video_provider\": \"\",\n \"webhook_events\": [],\n \"webhook_url\": \"\",\n \"xiaomi_config\": {\n \"Disabled\": false,\n \"package_name\": \"\",\n \"secret\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/app", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/app"
payload = {
"agora_options": {
"app_certificate": "",
"app_id": "",
"default_role": "",
"role_map": {}
},
"apn_config": {
"Disabled": False,
"auth_key": "",
"auth_type": "",
"bundle_id": "",
"development": False,
"host": "",
"key_id": "",
"notification_template": "",
"p12_cert": "",
"team_id": ""
},
"async_moderation_config": {
"callback": {
"mode": "",
"server_url": ""
},
"timeout_ms": ""
},
"async_url_enrich_enabled": False,
"auto_translation_enabled": False,
"before_message_send_hook_url": "",
"cdn_expiration_seconds": "",
"channel_hide_members_only": False,
"custom_action_handler_url": "",
"disable_auth_checks": False,
"disable_permissions_checks": False,
"enforce_unique_usernames": "",
"file_upload_config": {
"allowed_file_extensions": [],
"allowed_mime_types": [],
"blocked_file_extensions": [],
"blocked_mime_types": []
},
"firebase_config": {
"Disabled": False,
"apn_template": "",
"credentials_json": "",
"data_template": "",
"notification_template": "",
"server_key": ""
},
"grants": {},
"hms_options": {},
"huawei_config": {
"Disabled": False,
"id": "",
"secret": ""
},
"image_moderation_block_labels": [],
"image_moderation_enabled": False,
"image_moderation_labels": [],
"image_upload_config": {},
"migrate_permissions_to_v2": False,
"multi_tenant_enabled": False,
"permission_version": "",
"push_config": {
"offline_only": False,
"version": ""
},
"reminders_interval": "",
"revoke_tokens_issued_before": "",
"sqs_key": "",
"sqs_secret": "",
"sqs_url": "",
"user_search_disallowed_roles": [],
"video_provider": "",
"webhook_events": [],
"webhook_url": "",
"xiaomi_config": {
"Disabled": False,
"package_name": "",
"secret": ""
}
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/app"
payload <- "{\n \"agora_options\": {\n \"app_certificate\": \"\",\n \"app_id\": \"\",\n \"default_role\": \"\",\n \"role_map\": {}\n },\n \"apn_config\": {\n \"Disabled\": false,\n \"auth_key\": \"\",\n \"auth_type\": \"\",\n \"bundle_id\": \"\",\n \"development\": false,\n \"host\": \"\",\n \"key_id\": \"\",\n \"notification_template\": \"\",\n \"p12_cert\": \"\",\n \"team_id\": \"\"\n },\n \"async_moderation_config\": {\n \"callback\": {\n \"mode\": \"\",\n \"server_url\": \"\"\n },\n \"timeout_ms\": \"\"\n },\n \"async_url_enrich_enabled\": false,\n \"auto_translation_enabled\": false,\n \"before_message_send_hook_url\": \"\",\n \"cdn_expiration_seconds\": \"\",\n \"channel_hide_members_only\": false,\n \"custom_action_handler_url\": \"\",\n \"disable_auth_checks\": false,\n \"disable_permissions_checks\": false,\n \"enforce_unique_usernames\": \"\",\n \"file_upload_config\": {\n \"allowed_file_extensions\": [],\n \"allowed_mime_types\": [],\n \"blocked_file_extensions\": [],\n \"blocked_mime_types\": []\n },\n \"firebase_config\": {\n \"Disabled\": false,\n \"apn_template\": \"\",\n \"credentials_json\": \"\",\n \"data_template\": \"\",\n \"notification_template\": \"\",\n \"server_key\": \"\"\n },\n \"grants\": {},\n \"hms_options\": {},\n \"huawei_config\": {\n \"Disabled\": false,\n \"id\": \"\",\n \"secret\": \"\"\n },\n \"image_moderation_block_labels\": [],\n \"image_moderation_enabled\": false,\n \"image_moderation_labels\": [],\n \"image_upload_config\": {},\n \"migrate_permissions_to_v2\": false,\n \"multi_tenant_enabled\": false,\n \"permission_version\": \"\",\n \"push_config\": {\n \"offline_only\": false,\n \"version\": \"\"\n },\n \"reminders_interval\": \"\",\n \"revoke_tokens_issued_before\": \"\",\n \"sqs_key\": \"\",\n \"sqs_secret\": \"\",\n \"sqs_url\": \"\",\n \"user_search_disallowed_roles\": [],\n \"video_provider\": \"\",\n \"webhook_events\": [],\n \"webhook_url\": \"\",\n \"xiaomi_config\": {\n \"Disabled\": false,\n \"package_name\": \"\",\n \"secret\": \"\"\n }\n}"
encode <- "json"
response <- VERB("PATCH", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/app")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"agora_options\": {\n \"app_certificate\": \"\",\n \"app_id\": \"\",\n \"default_role\": \"\",\n \"role_map\": {}\n },\n \"apn_config\": {\n \"Disabled\": false,\n \"auth_key\": \"\",\n \"auth_type\": \"\",\n \"bundle_id\": \"\",\n \"development\": false,\n \"host\": \"\",\n \"key_id\": \"\",\n \"notification_template\": \"\",\n \"p12_cert\": \"\",\n \"team_id\": \"\"\n },\n \"async_moderation_config\": {\n \"callback\": {\n \"mode\": \"\",\n \"server_url\": \"\"\n },\n \"timeout_ms\": \"\"\n },\n \"async_url_enrich_enabled\": false,\n \"auto_translation_enabled\": false,\n \"before_message_send_hook_url\": \"\",\n \"cdn_expiration_seconds\": \"\",\n \"channel_hide_members_only\": false,\n \"custom_action_handler_url\": \"\",\n \"disable_auth_checks\": false,\n \"disable_permissions_checks\": false,\n \"enforce_unique_usernames\": \"\",\n \"file_upload_config\": {\n \"allowed_file_extensions\": [],\n \"allowed_mime_types\": [],\n \"blocked_file_extensions\": [],\n \"blocked_mime_types\": []\n },\n \"firebase_config\": {\n \"Disabled\": false,\n \"apn_template\": \"\",\n \"credentials_json\": \"\",\n \"data_template\": \"\",\n \"notification_template\": \"\",\n \"server_key\": \"\"\n },\n \"grants\": {},\n \"hms_options\": {},\n \"huawei_config\": {\n \"Disabled\": false,\n \"id\": \"\",\n \"secret\": \"\"\n },\n \"image_moderation_block_labels\": [],\n \"image_moderation_enabled\": false,\n \"image_moderation_labels\": [],\n \"image_upload_config\": {},\n \"migrate_permissions_to_v2\": false,\n \"multi_tenant_enabled\": false,\n \"permission_version\": \"\",\n \"push_config\": {\n \"offline_only\": false,\n \"version\": \"\"\n },\n \"reminders_interval\": \"\",\n \"revoke_tokens_issued_before\": \"\",\n \"sqs_key\": \"\",\n \"sqs_secret\": \"\",\n \"sqs_url\": \"\",\n \"user_search_disallowed_roles\": [],\n \"video_provider\": \"\",\n \"webhook_events\": [],\n \"webhook_url\": \"\",\n \"xiaomi_config\": {\n \"Disabled\": false,\n \"package_name\": \"\",\n \"secret\": \"\"\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/app') do |req|
req.body = "{\n \"agora_options\": {\n \"app_certificate\": \"\",\n \"app_id\": \"\",\n \"default_role\": \"\",\n \"role_map\": {}\n },\n \"apn_config\": {\n \"Disabled\": false,\n \"auth_key\": \"\",\n \"auth_type\": \"\",\n \"bundle_id\": \"\",\n \"development\": false,\n \"host\": \"\",\n \"key_id\": \"\",\n \"notification_template\": \"\",\n \"p12_cert\": \"\",\n \"team_id\": \"\"\n },\n \"async_moderation_config\": {\n \"callback\": {\n \"mode\": \"\",\n \"server_url\": \"\"\n },\n \"timeout_ms\": \"\"\n },\n \"async_url_enrich_enabled\": false,\n \"auto_translation_enabled\": false,\n \"before_message_send_hook_url\": \"\",\n \"cdn_expiration_seconds\": \"\",\n \"channel_hide_members_only\": false,\n \"custom_action_handler_url\": \"\",\n \"disable_auth_checks\": false,\n \"disable_permissions_checks\": false,\n \"enforce_unique_usernames\": \"\",\n \"file_upload_config\": {\n \"allowed_file_extensions\": [],\n \"allowed_mime_types\": [],\n \"blocked_file_extensions\": [],\n \"blocked_mime_types\": []\n },\n \"firebase_config\": {\n \"Disabled\": false,\n \"apn_template\": \"\",\n \"credentials_json\": \"\",\n \"data_template\": \"\",\n \"notification_template\": \"\",\n \"server_key\": \"\"\n },\n \"grants\": {},\n \"hms_options\": {},\n \"huawei_config\": {\n \"Disabled\": false,\n \"id\": \"\",\n \"secret\": \"\"\n },\n \"image_moderation_block_labels\": [],\n \"image_moderation_enabled\": false,\n \"image_moderation_labels\": [],\n \"image_upload_config\": {},\n \"migrate_permissions_to_v2\": false,\n \"multi_tenant_enabled\": false,\n \"permission_version\": \"\",\n \"push_config\": {\n \"offline_only\": false,\n \"version\": \"\"\n },\n \"reminders_interval\": \"\",\n \"revoke_tokens_issued_before\": \"\",\n \"sqs_key\": \"\",\n \"sqs_secret\": \"\",\n \"sqs_url\": \"\",\n \"user_search_disallowed_roles\": [],\n \"video_provider\": \"\",\n \"webhook_events\": [],\n \"webhook_url\": \"\",\n \"xiaomi_config\": {\n \"Disabled\": false,\n \"package_name\": \"\",\n \"secret\": \"\"\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}}/app";
let payload = json!({
"agora_options": json!({
"app_certificate": "",
"app_id": "",
"default_role": "",
"role_map": json!({})
}),
"apn_config": json!({
"Disabled": false,
"auth_key": "",
"auth_type": "",
"bundle_id": "",
"development": false,
"host": "",
"key_id": "",
"notification_template": "",
"p12_cert": "",
"team_id": ""
}),
"async_moderation_config": json!({
"callback": json!({
"mode": "",
"server_url": ""
}),
"timeout_ms": ""
}),
"async_url_enrich_enabled": false,
"auto_translation_enabled": false,
"before_message_send_hook_url": "",
"cdn_expiration_seconds": "",
"channel_hide_members_only": false,
"custom_action_handler_url": "",
"disable_auth_checks": false,
"disable_permissions_checks": false,
"enforce_unique_usernames": "",
"file_upload_config": json!({
"allowed_file_extensions": (),
"allowed_mime_types": (),
"blocked_file_extensions": (),
"blocked_mime_types": ()
}),
"firebase_config": json!({
"Disabled": false,
"apn_template": "",
"credentials_json": "",
"data_template": "",
"notification_template": "",
"server_key": ""
}),
"grants": json!({}),
"hms_options": json!({}),
"huawei_config": json!({
"Disabled": false,
"id": "",
"secret": ""
}),
"image_moderation_block_labels": (),
"image_moderation_enabled": false,
"image_moderation_labels": (),
"image_upload_config": json!({}),
"migrate_permissions_to_v2": false,
"multi_tenant_enabled": false,
"permission_version": "",
"push_config": json!({
"offline_only": false,
"version": ""
}),
"reminders_interval": "",
"revoke_tokens_issued_before": "",
"sqs_key": "",
"sqs_secret": "",
"sqs_url": "",
"user_search_disallowed_roles": (),
"video_provider": "",
"webhook_events": (),
"webhook_url": "",
"xiaomi_config": json!({
"Disabled": false,
"package_name": "",
"secret": ""
})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/app \
--header 'content-type: application/json' \
--data '{
"agora_options": {
"app_certificate": "",
"app_id": "",
"default_role": "",
"role_map": {}
},
"apn_config": {
"Disabled": false,
"auth_key": "",
"auth_type": "",
"bundle_id": "",
"development": false,
"host": "",
"key_id": "",
"notification_template": "",
"p12_cert": "",
"team_id": ""
},
"async_moderation_config": {
"callback": {
"mode": "",
"server_url": ""
},
"timeout_ms": ""
},
"async_url_enrich_enabled": false,
"auto_translation_enabled": false,
"before_message_send_hook_url": "",
"cdn_expiration_seconds": "",
"channel_hide_members_only": false,
"custom_action_handler_url": "",
"disable_auth_checks": false,
"disable_permissions_checks": false,
"enforce_unique_usernames": "",
"file_upload_config": {
"allowed_file_extensions": [],
"allowed_mime_types": [],
"blocked_file_extensions": [],
"blocked_mime_types": []
},
"firebase_config": {
"Disabled": false,
"apn_template": "",
"credentials_json": "",
"data_template": "",
"notification_template": "",
"server_key": ""
},
"grants": {},
"hms_options": {},
"huawei_config": {
"Disabled": false,
"id": "",
"secret": ""
},
"image_moderation_block_labels": [],
"image_moderation_enabled": false,
"image_moderation_labels": [],
"image_upload_config": {},
"migrate_permissions_to_v2": false,
"multi_tenant_enabled": false,
"permission_version": "",
"push_config": {
"offline_only": false,
"version": ""
},
"reminders_interval": "",
"revoke_tokens_issued_before": "",
"sqs_key": "",
"sqs_secret": "",
"sqs_url": "",
"user_search_disallowed_roles": [],
"video_provider": "",
"webhook_events": [],
"webhook_url": "",
"xiaomi_config": {
"Disabled": false,
"package_name": "",
"secret": ""
}
}'
echo '{
"agora_options": {
"app_certificate": "",
"app_id": "",
"default_role": "",
"role_map": {}
},
"apn_config": {
"Disabled": false,
"auth_key": "",
"auth_type": "",
"bundle_id": "",
"development": false,
"host": "",
"key_id": "",
"notification_template": "",
"p12_cert": "",
"team_id": ""
},
"async_moderation_config": {
"callback": {
"mode": "",
"server_url": ""
},
"timeout_ms": ""
},
"async_url_enrich_enabled": false,
"auto_translation_enabled": false,
"before_message_send_hook_url": "",
"cdn_expiration_seconds": "",
"channel_hide_members_only": false,
"custom_action_handler_url": "",
"disable_auth_checks": false,
"disable_permissions_checks": false,
"enforce_unique_usernames": "",
"file_upload_config": {
"allowed_file_extensions": [],
"allowed_mime_types": [],
"blocked_file_extensions": [],
"blocked_mime_types": []
},
"firebase_config": {
"Disabled": false,
"apn_template": "",
"credentials_json": "",
"data_template": "",
"notification_template": "",
"server_key": ""
},
"grants": {},
"hms_options": {},
"huawei_config": {
"Disabled": false,
"id": "",
"secret": ""
},
"image_moderation_block_labels": [],
"image_moderation_enabled": false,
"image_moderation_labels": [],
"image_upload_config": {},
"migrate_permissions_to_v2": false,
"multi_tenant_enabled": false,
"permission_version": "",
"push_config": {
"offline_only": false,
"version": ""
},
"reminders_interval": "",
"revoke_tokens_issued_before": "",
"sqs_key": "",
"sqs_secret": "",
"sqs_url": "",
"user_search_disallowed_roles": [],
"video_provider": "",
"webhook_events": [],
"webhook_url": "",
"xiaomi_config": {
"Disabled": false,
"package_name": "",
"secret": ""
}
}' | \
http PATCH {{baseUrl}}/app \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "agora_options": {\n "app_certificate": "",\n "app_id": "",\n "default_role": "",\n "role_map": {}\n },\n "apn_config": {\n "Disabled": false,\n "auth_key": "",\n "auth_type": "",\n "bundle_id": "",\n "development": false,\n "host": "",\n "key_id": "",\n "notification_template": "",\n "p12_cert": "",\n "team_id": ""\n },\n "async_moderation_config": {\n "callback": {\n "mode": "",\n "server_url": ""\n },\n "timeout_ms": ""\n },\n "async_url_enrich_enabled": false,\n "auto_translation_enabled": false,\n "before_message_send_hook_url": "",\n "cdn_expiration_seconds": "",\n "channel_hide_members_only": false,\n "custom_action_handler_url": "",\n "disable_auth_checks": false,\n "disable_permissions_checks": false,\n "enforce_unique_usernames": "",\n "file_upload_config": {\n "allowed_file_extensions": [],\n "allowed_mime_types": [],\n "blocked_file_extensions": [],\n "blocked_mime_types": []\n },\n "firebase_config": {\n "Disabled": false,\n "apn_template": "",\n "credentials_json": "",\n "data_template": "",\n "notification_template": "",\n "server_key": ""\n },\n "grants": {},\n "hms_options": {},\n "huawei_config": {\n "Disabled": false,\n "id": "",\n "secret": ""\n },\n "image_moderation_block_labels": [],\n "image_moderation_enabled": false,\n "image_moderation_labels": [],\n "image_upload_config": {},\n "migrate_permissions_to_v2": false,\n "multi_tenant_enabled": false,\n "permission_version": "",\n "push_config": {\n "offline_only": false,\n "version": ""\n },\n "reminders_interval": "",\n "revoke_tokens_issued_before": "",\n "sqs_key": "",\n "sqs_secret": "",\n "sqs_url": "",\n "user_search_disallowed_roles": [],\n "video_provider": "",\n "webhook_events": [],\n "webhook_url": "",\n "xiaomi_config": {\n "Disabled": false,\n "package_name": "",\n "secret": ""\n }\n}' \
--output-document \
- {{baseUrl}}/app
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"agora_options": [
"app_certificate": "",
"app_id": "",
"default_role": "",
"role_map": []
],
"apn_config": [
"Disabled": false,
"auth_key": "",
"auth_type": "",
"bundle_id": "",
"development": false,
"host": "",
"key_id": "",
"notification_template": "",
"p12_cert": "",
"team_id": ""
],
"async_moderation_config": [
"callback": [
"mode": "",
"server_url": ""
],
"timeout_ms": ""
],
"async_url_enrich_enabled": false,
"auto_translation_enabled": false,
"before_message_send_hook_url": "",
"cdn_expiration_seconds": "",
"channel_hide_members_only": false,
"custom_action_handler_url": "",
"disable_auth_checks": false,
"disable_permissions_checks": false,
"enforce_unique_usernames": "",
"file_upload_config": [
"allowed_file_extensions": [],
"allowed_mime_types": [],
"blocked_file_extensions": [],
"blocked_mime_types": []
],
"firebase_config": [
"Disabled": false,
"apn_template": "",
"credentials_json": "",
"data_template": "",
"notification_template": "",
"server_key": ""
],
"grants": [],
"hms_options": [],
"huawei_config": [
"Disabled": false,
"id": "",
"secret": ""
],
"image_moderation_block_labels": [],
"image_moderation_enabled": false,
"image_moderation_labels": [],
"image_upload_config": [],
"migrate_permissions_to_v2": false,
"multi_tenant_enabled": false,
"permission_version": "",
"push_config": [
"offline_only": false,
"version": ""
],
"reminders_interval": "",
"revoke_tokens_issued_before": "",
"sqs_key": "",
"sqs_secret": "",
"sqs_url": "",
"user_search_disallowed_roles": [],
"video_provider": "",
"webhook_events": [],
"webhook_url": "",
"xiaomi_config": [
"Disabled": false,
"package_name": "",
"secret": ""
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/app")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
Update block list
{{baseUrl}}/blocklists/:name
QUERY PARAMS
name
BODY json
{
"Name": "",
"words": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/blocklists/:name");
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 \"words\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/blocklists/:name" {:content-type :json
:form-params {:Name ""
:words []}})
require "http/client"
url = "{{baseUrl}}/blocklists/:name"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"Name\": \"\",\n \"words\": []\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}}/blocklists/:name"),
Content = new StringContent("{\n \"Name\": \"\",\n \"words\": []\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}}/blocklists/:name");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"Name\": \"\",\n \"words\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/blocklists/:name"
payload := strings.NewReader("{\n \"Name\": \"\",\n \"words\": []\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/blocklists/:name HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 31
{
"Name": "",
"words": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/blocklists/:name")
.setHeader("content-type", "application/json")
.setBody("{\n \"Name\": \"\",\n \"words\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/blocklists/:name"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"Name\": \"\",\n \"words\": []\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 \"words\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/blocklists/:name")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/blocklists/:name")
.header("content-type", "application/json")
.body("{\n \"Name\": \"\",\n \"words\": []\n}")
.asString();
const data = JSON.stringify({
Name: '',
words: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/blocklists/:name');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/blocklists/:name',
headers: {'content-type': 'application/json'},
data: {Name: '', words: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/blocklists/:name';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"Name":"","words":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/blocklists/:name',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "Name": "",\n "words": []\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 \"words\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/blocklists/:name")
.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/blocklists/:name',
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: '', words: []}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/blocklists/:name',
headers: {'content-type': 'application/json'},
body: {Name: '', words: []},
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}}/blocklists/:name');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
Name: '',
words: []
});
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}}/blocklists/:name',
headers: {'content-type': 'application/json'},
data: {Name: '', words: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/blocklists/:name';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"Name":"","words":[]}'
};
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": @"",
@"words": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/blocklists/:name"]
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}}/blocklists/:name" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"Name\": \"\",\n \"words\": []\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/blocklists/:name",
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' => '',
'words' => [
]
]),
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}}/blocklists/:name', [
'body' => '{
"Name": "",
"words": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/blocklists/:name');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'Name' => '',
'words' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'Name' => '',
'words' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/blocklists/:name');
$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}}/blocklists/:name' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"Name": "",
"words": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/blocklists/:name' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"Name": "",
"words": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"Name\": \"\",\n \"words\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/blocklists/:name", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/blocklists/:name"
payload = {
"Name": "",
"words": []
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/blocklists/:name"
payload <- "{\n \"Name\": \"\",\n \"words\": []\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}}/blocklists/:name")
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 \"words\": []\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/blocklists/:name') do |req|
req.body = "{\n \"Name\": \"\",\n \"words\": []\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}}/blocklists/:name";
let payload = json!({
"Name": "",
"words": ()
});
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}}/blocklists/:name \
--header 'content-type: application/json' \
--data '{
"Name": "",
"words": []
}'
echo '{
"Name": "",
"words": []
}' | \
http PUT {{baseUrl}}/blocklists/:name \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "Name": "",\n "words": []\n}' \
--output-document \
- {{baseUrl}}/blocklists/:name
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"Name": "",
"words": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/blocklists/:name")! 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()
PUT
Update channel type
{{baseUrl}}/channeltypes/:name
QUERY PARAMS
name
BODY json
{
"NameFromPath": "",
"automod": "",
"automod_behavior": "",
"automod_thresholds": {
"explicit": {
"block": "",
"flag": ""
},
"spam": {},
"toxic": {}
},
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"connect_events": false,
"custom_events": false,
"grants": {},
"max_message_length": "",
"message_retention": "",
"mutes": false,
"permissions": [
{
"action": "",
"name": "",
"owner": false,
"priority": "",
"resources": [],
"roles": []
}
],
"push_notifications": false,
"quotes": false,
"reactions": false,
"read_events": false,
"reminders": false,
"replies": false,
"search": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/channeltypes/:name");
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 \"NameFromPath\": \"\",\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"automod_thresholds\": {\n \"explicit\": {\n \"block\": \"\",\n \"flag\": \"\"\n },\n \"spam\": {},\n \"toxic\": {}\n },\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"connect_events\": false,\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"permissions\": [\n {\n \"action\": \"\",\n \"name\": \"\",\n \"owner\": false,\n \"priority\": \"\",\n \"resources\": [],\n \"roles\": []\n }\n ],\n \"push_notifications\": false,\n \"quotes\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"reminders\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/channeltypes/:name" {:content-type :json
:form-params {:NameFromPath ""
:automod ""
:automod_behavior ""
:automod_thresholds {:explicit {:block ""
:flag ""}
:spam {}
:toxic {}}
:blocklist ""
:blocklist_behavior ""
:commands []
:connect_events false
:custom_events false
:grants {}
:max_message_length ""
:message_retention ""
:mutes false
:permissions [{:action ""
:name ""
:owner false
:priority ""
:resources []
:roles []}]
:push_notifications false
:quotes false
:reactions false
:read_events false
:reminders false
:replies false
:search false
:typing_events false
:uploads false
:url_enrichment false}})
require "http/client"
url = "{{baseUrl}}/channeltypes/:name"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"NameFromPath\": \"\",\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"automod_thresholds\": {\n \"explicit\": {\n \"block\": \"\",\n \"flag\": \"\"\n },\n \"spam\": {},\n \"toxic\": {}\n },\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"connect_events\": false,\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"permissions\": [\n {\n \"action\": \"\",\n \"name\": \"\",\n \"owner\": false,\n \"priority\": \"\",\n \"resources\": [],\n \"roles\": []\n }\n ],\n \"push_notifications\": false,\n \"quotes\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"reminders\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/channeltypes/:name"),
Content = new StringContent("{\n \"NameFromPath\": \"\",\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"automod_thresholds\": {\n \"explicit\": {\n \"block\": \"\",\n \"flag\": \"\"\n },\n \"spam\": {},\n \"toxic\": {}\n },\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"connect_events\": false,\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"permissions\": [\n {\n \"action\": \"\",\n \"name\": \"\",\n \"owner\": false,\n \"priority\": \"\",\n \"resources\": [],\n \"roles\": []\n }\n ],\n \"push_notifications\": false,\n \"quotes\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"reminders\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/channeltypes/:name");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"NameFromPath\": \"\",\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"automod_thresholds\": {\n \"explicit\": {\n \"block\": \"\",\n \"flag\": \"\"\n },\n \"spam\": {},\n \"toxic\": {}\n },\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"connect_events\": false,\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"permissions\": [\n {\n \"action\": \"\",\n \"name\": \"\",\n \"owner\": false,\n \"priority\": \"\",\n \"resources\": [],\n \"roles\": []\n }\n ],\n \"push_notifications\": false,\n \"quotes\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"reminders\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/channeltypes/:name"
payload := strings.NewReader("{\n \"NameFromPath\": \"\",\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"automod_thresholds\": {\n \"explicit\": {\n \"block\": \"\",\n \"flag\": \"\"\n },\n \"spam\": {},\n \"toxic\": {}\n },\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"connect_events\": false,\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"permissions\": [\n {\n \"action\": \"\",\n \"name\": \"\",\n \"owner\": false,\n \"priority\": \"\",\n \"resources\": [],\n \"roles\": []\n }\n ],\n \"push_notifications\": false,\n \"quotes\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"reminders\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/channeltypes/:name HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 787
{
"NameFromPath": "",
"automod": "",
"automod_behavior": "",
"automod_thresholds": {
"explicit": {
"block": "",
"flag": ""
},
"spam": {},
"toxic": {}
},
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"connect_events": false,
"custom_events": false,
"grants": {},
"max_message_length": "",
"message_retention": "",
"mutes": false,
"permissions": [
{
"action": "",
"name": "",
"owner": false,
"priority": "",
"resources": [],
"roles": []
}
],
"push_notifications": false,
"quotes": false,
"reactions": false,
"read_events": false,
"reminders": false,
"replies": false,
"search": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/channeltypes/:name")
.setHeader("content-type", "application/json")
.setBody("{\n \"NameFromPath\": \"\",\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"automod_thresholds\": {\n \"explicit\": {\n \"block\": \"\",\n \"flag\": \"\"\n },\n \"spam\": {},\n \"toxic\": {}\n },\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"connect_events\": false,\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"permissions\": [\n {\n \"action\": \"\",\n \"name\": \"\",\n \"owner\": false,\n \"priority\": \"\",\n \"resources\": [],\n \"roles\": []\n }\n ],\n \"push_notifications\": false,\n \"quotes\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"reminders\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/channeltypes/:name"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"NameFromPath\": \"\",\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"automod_thresholds\": {\n \"explicit\": {\n \"block\": \"\",\n \"flag\": \"\"\n },\n \"spam\": {},\n \"toxic\": {}\n },\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"connect_events\": false,\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"permissions\": [\n {\n \"action\": \"\",\n \"name\": \"\",\n \"owner\": false,\n \"priority\": \"\",\n \"resources\": [],\n \"roles\": []\n }\n ],\n \"push_notifications\": false,\n \"quotes\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"reminders\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"NameFromPath\": \"\",\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"automod_thresholds\": {\n \"explicit\": {\n \"block\": \"\",\n \"flag\": \"\"\n },\n \"spam\": {},\n \"toxic\": {}\n },\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"connect_events\": false,\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"permissions\": [\n {\n \"action\": \"\",\n \"name\": \"\",\n \"owner\": false,\n \"priority\": \"\",\n \"resources\": [],\n \"roles\": []\n }\n ],\n \"push_notifications\": false,\n \"quotes\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"reminders\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/channeltypes/:name")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/channeltypes/:name")
.header("content-type", "application/json")
.body("{\n \"NameFromPath\": \"\",\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"automod_thresholds\": {\n \"explicit\": {\n \"block\": \"\",\n \"flag\": \"\"\n },\n \"spam\": {},\n \"toxic\": {}\n },\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"connect_events\": false,\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"permissions\": [\n {\n \"action\": \"\",\n \"name\": \"\",\n \"owner\": false,\n \"priority\": \"\",\n \"resources\": [],\n \"roles\": []\n }\n ],\n \"push_notifications\": false,\n \"quotes\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"reminders\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n}")
.asString();
const data = JSON.stringify({
NameFromPath: '',
automod: '',
automod_behavior: '',
automod_thresholds: {
explicit: {
block: '',
flag: ''
},
spam: {},
toxic: {}
},
blocklist: '',
blocklist_behavior: '',
commands: [],
connect_events: false,
custom_events: false,
grants: {},
max_message_length: '',
message_retention: '',
mutes: false,
permissions: [
{
action: '',
name: '',
owner: false,
priority: '',
resources: [],
roles: []
}
],
push_notifications: false,
quotes: false,
reactions: false,
read_events: false,
reminders: false,
replies: false,
search: false,
typing_events: false,
uploads: false,
url_enrichment: false
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/channeltypes/:name');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/channeltypes/:name',
headers: {'content-type': 'application/json'},
data: {
NameFromPath: '',
automod: '',
automod_behavior: '',
automod_thresholds: {explicit: {block: '', flag: ''}, spam: {}, toxic: {}},
blocklist: '',
blocklist_behavior: '',
commands: [],
connect_events: false,
custom_events: false,
grants: {},
max_message_length: '',
message_retention: '',
mutes: false,
permissions: [{action: '', name: '', owner: false, priority: '', resources: [], roles: []}],
push_notifications: false,
quotes: false,
reactions: false,
read_events: false,
reminders: false,
replies: false,
search: false,
typing_events: false,
uploads: false,
url_enrichment: false
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/channeltypes/:name';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"NameFromPath":"","automod":"","automod_behavior":"","automod_thresholds":{"explicit":{"block":"","flag":""},"spam":{},"toxic":{}},"blocklist":"","blocklist_behavior":"","commands":[],"connect_events":false,"custom_events":false,"grants":{},"max_message_length":"","message_retention":"","mutes":false,"permissions":[{"action":"","name":"","owner":false,"priority":"","resources":[],"roles":[]}],"push_notifications":false,"quotes":false,"reactions":false,"read_events":false,"reminders":false,"replies":false,"search":false,"typing_events":false,"uploads":false,"url_enrichment":false}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/channeltypes/:name',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "NameFromPath": "",\n "automod": "",\n "automod_behavior": "",\n "automod_thresholds": {\n "explicit": {\n "block": "",\n "flag": ""\n },\n "spam": {},\n "toxic": {}\n },\n "blocklist": "",\n "blocklist_behavior": "",\n "commands": [],\n "connect_events": false,\n "custom_events": false,\n "grants": {},\n "max_message_length": "",\n "message_retention": "",\n "mutes": false,\n "permissions": [\n {\n "action": "",\n "name": "",\n "owner": false,\n "priority": "",\n "resources": [],\n "roles": []\n }\n ],\n "push_notifications": false,\n "quotes": false,\n "reactions": false,\n "read_events": false,\n "reminders": false,\n "replies": false,\n "search": false,\n "typing_events": false,\n "uploads": false,\n "url_enrichment": false\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"NameFromPath\": \"\",\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"automod_thresholds\": {\n \"explicit\": {\n \"block\": \"\",\n \"flag\": \"\"\n },\n \"spam\": {},\n \"toxic\": {}\n },\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"connect_events\": false,\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"permissions\": [\n {\n \"action\": \"\",\n \"name\": \"\",\n \"owner\": false,\n \"priority\": \"\",\n \"resources\": [],\n \"roles\": []\n }\n ],\n \"push_notifications\": false,\n \"quotes\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"reminders\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n}")
val request = Request.Builder()
.url("{{baseUrl}}/channeltypes/:name")
.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/channeltypes/:name',
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({
NameFromPath: '',
automod: '',
automod_behavior: '',
automod_thresholds: {explicit: {block: '', flag: ''}, spam: {}, toxic: {}},
blocklist: '',
blocklist_behavior: '',
commands: [],
connect_events: false,
custom_events: false,
grants: {},
max_message_length: '',
message_retention: '',
mutes: false,
permissions: [{action: '', name: '', owner: false, priority: '', resources: [], roles: []}],
push_notifications: false,
quotes: false,
reactions: false,
read_events: false,
reminders: false,
replies: false,
search: false,
typing_events: false,
uploads: false,
url_enrichment: false
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/channeltypes/:name',
headers: {'content-type': 'application/json'},
body: {
NameFromPath: '',
automod: '',
automod_behavior: '',
automod_thresholds: {explicit: {block: '', flag: ''}, spam: {}, toxic: {}},
blocklist: '',
blocklist_behavior: '',
commands: [],
connect_events: false,
custom_events: false,
grants: {},
max_message_length: '',
message_retention: '',
mutes: false,
permissions: [{action: '', name: '', owner: false, priority: '', resources: [], roles: []}],
push_notifications: false,
quotes: false,
reactions: false,
read_events: false,
reminders: false,
replies: false,
search: false,
typing_events: false,
uploads: false,
url_enrichment: false
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/channeltypes/:name');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
NameFromPath: '',
automod: '',
automod_behavior: '',
automod_thresholds: {
explicit: {
block: '',
flag: ''
},
spam: {},
toxic: {}
},
blocklist: '',
blocklist_behavior: '',
commands: [],
connect_events: false,
custom_events: false,
grants: {},
max_message_length: '',
message_retention: '',
mutes: false,
permissions: [
{
action: '',
name: '',
owner: false,
priority: '',
resources: [],
roles: []
}
],
push_notifications: false,
quotes: false,
reactions: false,
read_events: false,
reminders: false,
replies: false,
search: false,
typing_events: false,
uploads: false,
url_enrichment: false
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/channeltypes/:name',
headers: {'content-type': 'application/json'},
data: {
NameFromPath: '',
automod: '',
automod_behavior: '',
automod_thresholds: {explicit: {block: '', flag: ''}, spam: {}, toxic: {}},
blocklist: '',
blocklist_behavior: '',
commands: [],
connect_events: false,
custom_events: false,
grants: {},
max_message_length: '',
message_retention: '',
mutes: false,
permissions: [{action: '', name: '', owner: false, priority: '', resources: [], roles: []}],
push_notifications: false,
quotes: false,
reactions: false,
read_events: false,
reminders: false,
replies: false,
search: false,
typing_events: false,
uploads: false,
url_enrichment: false
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/channeltypes/:name';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"NameFromPath":"","automod":"","automod_behavior":"","automod_thresholds":{"explicit":{"block":"","flag":""},"spam":{},"toxic":{}},"blocklist":"","blocklist_behavior":"","commands":[],"connect_events":false,"custom_events":false,"grants":{},"max_message_length":"","message_retention":"","mutes":false,"permissions":[{"action":"","name":"","owner":false,"priority":"","resources":[],"roles":[]}],"push_notifications":false,"quotes":false,"reactions":false,"read_events":false,"reminders":false,"replies":false,"search":false,"typing_events":false,"uploads":false,"url_enrichment":false}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"NameFromPath": @"",
@"automod": @"",
@"automod_behavior": @"",
@"automod_thresholds": @{ @"explicit": @{ @"block": @"", @"flag": @"" }, @"spam": @{ }, @"toxic": @{ } },
@"blocklist": @"",
@"blocklist_behavior": @"",
@"commands": @[ ],
@"connect_events": @NO,
@"custom_events": @NO,
@"grants": @{ },
@"max_message_length": @"",
@"message_retention": @"",
@"mutes": @NO,
@"permissions": @[ @{ @"action": @"", @"name": @"", @"owner": @NO, @"priority": @"", @"resources": @[ ], @"roles": @[ ] } ],
@"push_notifications": @NO,
@"quotes": @NO,
@"reactions": @NO,
@"read_events": @NO,
@"reminders": @NO,
@"replies": @NO,
@"search": @NO,
@"typing_events": @NO,
@"uploads": @NO,
@"url_enrichment": @NO };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/channeltypes/:name"]
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}}/channeltypes/:name" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"NameFromPath\": \"\",\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"automod_thresholds\": {\n \"explicit\": {\n \"block\": \"\",\n \"flag\": \"\"\n },\n \"spam\": {},\n \"toxic\": {}\n },\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"connect_events\": false,\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"permissions\": [\n {\n \"action\": \"\",\n \"name\": \"\",\n \"owner\": false,\n \"priority\": \"\",\n \"resources\": [],\n \"roles\": []\n }\n ],\n \"push_notifications\": false,\n \"quotes\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"reminders\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/channeltypes/:name",
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([
'NameFromPath' => '',
'automod' => '',
'automod_behavior' => '',
'automod_thresholds' => [
'explicit' => [
'block' => '',
'flag' => ''
],
'spam' => [
],
'toxic' => [
]
],
'blocklist' => '',
'blocklist_behavior' => '',
'commands' => [
],
'connect_events' => null,
'custom_events' => null,
'grants' => [
],
'max_message_length' => '',
'message_retention' => '',
'mutes' => null,
'permissions' => [
[
'action' => '',
'name' => '',
'owner' => null,
'priority' => '',
'resources' => [
],
'roles' => [
]
]
],
'push_notifications' => null,
'quotes' => null,
'reactions' => null,
'read_events' => null,
'reminders' => null,
'replies' => null,
'search' => null,
'typing_events' => null,
'uploads' => null,
'url_enrichment' => null
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/channeltypes/:name', [
'body' => '{
"NameFromPath": "",
"automod": "",
"automod_behavior": "",
"automod_thresholds": {
"explicit": {
"block": "",
"flag": ""
},
"spam": {},
"toxic": {}
},
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"connect_events": false,
"custom_events": false,
"grants": {},
"max_message_length": "",
"message_retention": "",
"mutes": false,
"permissions": [
{
"action": "",
"name": "",
"owner": false,
"priority": "",
"resources": [],
"roles": []
}
],
"push_notifications": false,
"quotes": false,
"reactions": false,
"read_events": false,
"reminders": false,
"replies": false,
"search": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/channeltypes/:name');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'NameFromPath' => '',
'automod' => '',
'automod_behavior' => '',
'automod_thresholds' => [
'explicit' => [
'block' => '',
'flag' => ''
],
'spam' => [
],
'toxic' => [
]
],
'blocklist' => '',
'blocklist_behavior' => '',
'commands' => [
],
'connect_events' => null,
'custom_events' => null,
'grants' => [
],
'max_message_length' => '',
'message_retention' => '',
'mutes' => null,
'permissions' => [
[
'action' => '',
'name' => '',
'owner' => null,
'priority' => '',
'resources' => [
],
'roles' => [
]
]
],
'push_notifications' => null,
'quotes' => null,
'reactions' => null,
'read_events' => null,
'reminders' => null,
'replies' => null,
'search' => null,
'typing_events' => null,
'uploads' => null,
'url_enrichment' => null
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'NameFromPath' => '',
'automod' => '',
'automod_behavior' => '',
'automod_thresholds' => [
'explicit' => [
'block' => '',
'flag' => ''
],
'spam' => [
],
'toxic' => [
]
],
'blocklist' => '',
'blocklist_behavior' => '',
'commands' => [
],
'connect_events' => null,
'custom_events' => null,
'grants' => [
],
'max_message_length' => '',
'message_retention' => '',
'mutes' => null,
'permissions' => [
[
'action' => '',
'name' => '',
'owner' => null,
'priority' => '',
'resources' => [
],
'roles' => [
]
]
],
'push_notifications' => null,
'quotes' => null,
'reactions' => null,
'read_events' => null,
'reminders' => null,
'replies' => null,
'search' => null,
'typing_events' => null,
'uploads' => null,
'url_enrichment' => null
]));
$request->setRequestUrl('{{baseUrl}}/channeltypes/:name');
$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}}/channeltypes/:name' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"NameFromPath": "",
"automod": "",
"automod_behavior": "",
"automod_thresholds": {
"explicit": {
"block": "",
"flag": ""
},
"spam": {},
"toxic": {}
},
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"connect_events": false,
"custom_events": false,
"grants": {},
"max_message_length": "",
"message_retention": "",
"mutes": false,
"permissions": [
{
"action": "",
"name": "",
"owner": false,
"priority": "",
"resources": [],
"roles": []
}
],
"push_notifications": false,
"quotes": false,
"reactions": false,
"read_events": false,
"reminders": false,
"replies": false,
"search": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/channeltypes/:name' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"NameFromPath": "",
"automod": "",
"automod_behavior": "",
"automod_thresholds": {
"explicit": {
"block": "",
"flag": ""
},
"spam": {},
"toxic": {}
},
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"connect_events": false,
"custom_events": false,
"grants": {},
"max_message_length": "",
"message_retention": "",
"mutes": false,
"permissions": [
{
"action": "",
"name": "",
"owner": false,
"priority": "",
"resources": [],
"roles": []
}
],
"push_notifications": false,
"quotes": false,
"reactions": false,
"read_events": false,
"reminders": false,
"replies": false,
"search": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"NameFromPath\": \"\",\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"automod_thresholds\": {\n \"explicit\": {\n \"block\": \"\",\n \"flag\": \"\"\n },\n \"spam\": {},\n \"toxic\": {}\n },\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"connect_events\": false,\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"permissions\": [\n {\n \"action\": \"\",\n \"name\": \"\",\n \"owner\": false,\n \"priority\": \"\",\n \"resources\": [],\n \"roles\": []\n }\n ],\n \"push_notifications\": false,\n \"quotes\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"reminders\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/channeltypes/:name", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/channeltypes/:name"
payload = {
"NameFromPath": "",
"automod": "",
"automod_behavior": "",
"automod_thresholds": {
"explicit": {
"block": "",
"flag": ""
},
"spam": {},
"toxic": {}
},
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"connect_events": False,
"custom_events": False,
"grants": {},
"max_message_length": "",
"message_retention": "",
"mutes": False,
"permissions": [
{
"action": "",
"name": "",
"owner": False,
"priority": "",
"resources": [],
"roles": []
}
],
"push_notifications": False,
"quotes": False,
"reactions": False,
"read_events": False,
"reminders": False,
"replies": False,
"search": False,
"typing_events": False,
"uploads": False,
"url_enrichment": False
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/channeltypes/:name"
payload <- "{\n \"NameFromPath\": \"\",\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"automod_thresholds\": {\n \"explicit\": {\n \"block\": \"\",\n \"flag\": \"\"\n },\n \"spam\": {},\n \"toxic\": {}\n },\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"connect_events\": false,\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"permissions\": [\n {\n \"action\": \"\",\n \"name\": \"\",\n \"owner\": false,\n \"priority\": \"\",\n \"resources\": [],\n \"roles\": []\n }\n ],\n \"push_notifications\": false,\n \"quotes\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"reminders\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/channeltypes/:name")
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 \"NameFromPath\": \"\",\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"automod_thresholds\": {\n \"explicit\": {\n \"block\": \"\",\n \"flag\": \"\"\n },\n \"spam\": {},\n \"toxic\": {}\n },\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"connect_events\": false,\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"permissions\": [\n {\n \"action\": \"\",\n \"name\": \"\",\n \"owner\": false,\n \"priority\": \"\",\n \"resources\": [],\n \"roles\": []\n }\n ],\n \"push_notifications\": false,\n \"quotes\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"reminders\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/channeltypes/:name') do |req|
req.body = "{\n \"NameFromPath\": \"\",\n \"automod\": \"\",\n \"automod_behavior\": \"\",\n \"automod_thresholds\": {\n \"explicit\": {\n \"block\": \"\",\n \"flag\": \"\"\n },\n \"spam\": {},\n \"toxic\": {}\n },\n \"blocklist\": \"\",\n \"blocklist_behavior\": \"\",\n \"commands\": [],\n \"connect_events\": false,\n \"custom_events\": false,\n \"grants\": {},\n \"max_message_length\": \"\",\n \"message_retention\": \"\",\n \"mutes\": false,\n \"permissions\": [\n {\n \"action\": \"\",\n \"name\": \"\",\n \"owner\": false,\n \"priority\": \"\",\n \"resources\": [],\n \"roles\": []\n }\n ],\n \"push_notifications\": false,\n \"quotes\": false,\n \"reactions\": false,\n \"read_events\": false,\n \"reminders\": false,\n \"replies\": false,\n \"search\": false,\n \"typing_events\": false,\n \"uploads\": false,\n \"url_enrichment\": false\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/channeltypes/:name";
let payload = json!({
"NameFromPath": "",
"automod": "",
"automod_behavior": "",
"automod_thresholds": json!({
"explicit": json!({
"block": "",
"flag": ""
}),
"spam": json!({}),
"toxic": json!({})
}),
"blocklist": "",
"blocklist_behavior": "",
"commands": (),
"connect_events": false,
"custom_events": false,
"grants": json!({}),
"max_message_length": "",
"message_retention": "",
"mutes": false,
"permissions": (
json!({
"action": "",
"name": "",
"owner": false,
"priority": "",
"resources": (),
"roles": ()
})
),
"push_notifications": false,
"quotes": false,
"reactions": false,
"read_events": false,
"reminders": false,
"replies": false,
"search": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/channeltypes/:name \
--header 'content-type: application/json' \
--data '{
"NameFromPath": "",
"automod": "",
"automod_behavior": "",
"automod_thresholds": {
"explicit": {
"block": "",
"flag": ""
},
"spam": {},
"toxic": {}
},
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"connect_events": false,
"custom_events": false,
"grants": {},
"max_message_length": "",
"message_retention": "",
"mutes": false,
"permissions": [
{
"action": "",
"name": "",
"owner": false,
"priority": "",
"resources": [],
"roles": []
}
],
"push_notifications": false,
"quotes": false,
"reactions": false,
"read_events": false,
"reminders": false,
"replies": false,
"search": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
}'
echo '{
"NameFromPath": "",
"automod": "",
"automod_behavior": "",
"automod_thresholds": {
"explicit": {
"block": "",
"flag": ""
},
"spam": {},
"toxic": {}
},
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"connect_events": false,
"custom_events": false,
"grants": {},
"max_message_length": "",
"message_retention": "",
"mutes": false,
"permissions": [
{
"action": "",
"name": "",
"owner": false,
"priority": "",
"resources": [],
"roles": []
}
],
"push_notifications": false,
"quotes": false,
"reactions": false,
"read_events": false,
"reminders": false,
"replies": false,
"search": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
}' | \
http PUT {{baseUrl}}/channeltypes/:name \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "NameFromPath": "",\n "automod": "",\n "automod_behavior": "",\n "automod_thresholds": {\n "explicit": {\n "block": "",\n "flag": ""\n },\n "spam": {},\n "toxic": {}\n },\n "blocklist": "",\n "blocklist_behavior": "",\n "commands": [],\n "connect_events": false,\n "custom_events": false,\n "grants": {},\n "max_message_length": "",\n "message_retention": "",\n "mutes": false,\n "permissions": [\n {\n "action": "",\n "name": "",\n "owner": false,\n "priority": "",\n "resources": [],\n "roles": []\n }\n ],\n "push_notifications": false,\n "quotes": false,\n "reactions": false,\n "read_events": false,\n "reminders": false,\n "replies": false,\n "search": false,\n "typing_events": false,\n "uploads": false,\n "url_enrichment": false\n}' \
--output-document \
- {{baseUrl}}/channeltypes/:name
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"NameFromPath": "",
"automod": "",
"automod_behavior": "",
"automod_thresholds": [
"explicit": [
"block": "",
"flag": ""
],
"spam": [],
"toxic": []
],
"blocklist": "",
"blocklist_behavior": "",
"commands": [],
"connect_events": false,
"custom_events": false,
"grants": [],
"max_message_length": "",
"message_retention": "",
"mutes": false,
"permissions": [
[
"action": "",
"name": "",
"owner": false,
"priority": "",
"resources": [],
"roles": []
]
],
"push_notifications": false,
"quotes": false,
"reactions": false,
"read_events": false,
"reminders": false,
"replies": false,
"search": false,
"typing_events": false,
"uploads": false,
"url_enrichment": false
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/channeltypes/:name")! 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
Get status of a task
{{baseUrl}}/tasks/: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}}/tasks/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/tasks/:id")
require "http/client"
url = "{{baseUrl}}/tasks/: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}}/tasks/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/tasks/:id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/tasks/: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/tasks/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/tasks/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/tasks/: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}}/tasks/:id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/tasks/: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}}/tasks/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/tasks/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/tasks/: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}}/tasks/:id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/tasks/:id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/tasks/: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}}/tasks/: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}}/tasks/: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}}/tasks/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/tasks/: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}}/tasks/: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}}/tasks/:id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/tasks/: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}}/tasks/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/tasks/:id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/tasks/:id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/tasks/:id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/tasks/:id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/tasks/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/tasks/:id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/tasks/:id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/tasks/: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/tasks/:id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/tasks/: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}}/tasks/:id
http GET {{baseUrl}}/tasks/:id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/tasks/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/tasks/:id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Ban user
{{baseUrl}}/moderation/ban
BODY json
{
"banned_by": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"banned_by_id": "",
"id": "",
"ip_ban": false,
"reason": "",
"shadow": false,
"target_user_id": "",
"timeout": "",
"type": "",
"user": {},
"user_id": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/moderation/ban");
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 \"banned_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"banned_by_id\": \"\",\n \"id\": \"\",\n \"ip_ban\": false,\n \"reason\": \"\",\n \"shadow\": false,\n \"target_user_id\": \"\",\n \"timeout\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/moderation/ban" {:content-type :json
:form-params {:banned_by {:ban_expires ""
:banned false
:id ""
:invisible false
:language ""
:push_notifications {:disabled false
:disabled_until ""}
:revoke_tokens_issued_before ""
:role ""
:teams []}
:banned_by_id ""
:id ""
:ip_ban false
:reason ""
:shadow false
:target_user_id ""
:timeout ""
:type ""
:user {}
:user_id ""}})
require "http/client"
url = "{{baseUrl}}/moderation/ban"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"banned_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"banned_by_id\": \"\",\n \"id\": \"\",\n \"ip_ban\": false,\n \"reason\": \"\",\n \"shadow\": false,\n \"target_user_id\": \"\",\n \"timeout\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/moderation/ban"),
Content = new StringContent("{\n \"banned_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"banned_by_id\": \"\",\n \"id\": \"\",\n \"ip_ban\": false,\n \"reason\": \"\",\n \"shadow\": false,\n \"target_user_id\": \"\",\n \"timeout\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/moderation/ban");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"banned_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"banned_by_id\": \"\",\n \"id\": \"\",\n \"ip_ban\": false,\n \"reason\": \"\",\n \"shadow\": false,\n \"target_user_id\": \"\",\n \"timeout\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/moderation/ban"
payload := strings.NewReader("{\n \"banned_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"banned_by_id\": \"\",\n \"id\": \"\",\n \"ip_ban\": false,\n \"reason\": \"\",\n \"shadow\": false,\n \"target_user_id\": \"\",\n \"timeout\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/moderation/ban HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 458
{
"banned_by": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"banned_by_id": "",
"id": "",
"ip_ban": false,
"reason": "",
"shadow": false,
"target_user_id": "",
"timeout": "",
"type": "",
"user": {},
"user_id": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/moderation/ban")
.setHeader("content-type", "application/json")
.setBody("{\n \"banned_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"banned_by_id\": \"\",\n \"id\": \"\",\n \"ip_ban\": false,\n \"reason\": \"\",\n \"shadow\": false,\n \"target_user_id\": \"\",\n \"timeout\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/moderation/ban"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"banned_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"banned_by_id\": \"\",\n \"id\": \"\",\n \"ip_ban\": false,\n \"reason\": \"\",\n \"shadow\": false,\n \"target_user_id\": \"\",\n \"timeout\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"banned_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"banned_by_id\": \"\",\n \"id\": \"\",\n \"ip_ban\": false,\n \"reason\": \"\",\n \"shadow\": false,\n \"target_user_id\": \"\",\n \"timeout\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/moderation/ban")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/moderation/ban")
.header("content-type", "application/json")
.body("{\n \"banned_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"banned_by_id\": \"\",\n \"id\": \"\",\n \"ip_ban\": false,\n \"reason\": \"\",\n \"shadow\": false,\n \"target_user_id\": \"\",\n \"timeout\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n}")
.asString();
const data = JSON.stringify({
banned_by: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
banned_by_id: '',
id: '',
ip_ban: false,
reason: '',
shadow: false,
target_user_id: '',
timeout: '',
type: '',
user: {},
user_id: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/moderation/ban');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/moderation/ban',
headers: {'content-type': 'application/json'},
data: {
banned_by: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
banned_by_id: '',
id: '',
ip_ban: false,
reason: '',
shadow: false,
target_user_id: '',
timeout: '',
type: '',
user: {},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/moderation/ban';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"banned_by":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"banned_by_id":"","id":"","ip_ban":false,"reason":"","shadow":false,"target_user_id":"","timeout":"","type":"","user":{},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/moderation/ban',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "banned_by": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "banned_by_id": "",\n "id": "",\n "ip_ban": false,\n "reason": "",\n "shadow": false,\n "target_user_id": "",\n "timeout": "",\n "type": "",\n "user": {},\n "user_id": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"banned_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"banned_by_id\": \"\",\n \"id\": \"\",\n \"ip_ban\": false,\n \"reason\": \"\",\n \"shadow\": false,\n \"target_user_id\": \"\",\n \"timeout\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/moderation/ban")
.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/moderation/ban',
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({
banned_by: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
banned_by_id: '',
id: '',
ip_ban: false,
reason: '',
shadow: false,
target_user_id: '',
timeout: '',
type: '',
user: {},
user_id: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/moderation/ban',
headers: {'content-type': 'application/json'},
body: {
banned_by: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
banned_by_id: '',
id: '',
ip_ban: false,
reason: '',
shadow: false,
target_user_id: '',
timeout: '',
type: '',
user: {},
user_id: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/moderation/ban');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
banned_by: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
banned_by_id: '',
id: '',
ip_ban: false,
reason: '',
shadow: false,
target_user_id: '',
timeout: '',
type: '',
user: {},
user_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/moderation/ban',
headers: {'content-type': 'application/json'},
data: {
banned_by: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
banned_by_id: '',
id: '',
ip_ban: false,
reason: '',
shadow: false,
target_user_id: '',
timeout: '',
type: '',
user: {},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/moderation/ban';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"banned_by":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"banned_by_id":"","id":"","ip_ban":false,"reason":"","shadow":false,"target_user_id":"","timeout":"","type":"","user":{},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"banned_by": @{ @"ban_expires": @"", @"banned": @NO, @"id": @"", @"invisible": @NO, @"language": @"", @"push_notifications": @{ @"disabled": @NO, @"disabled_until": @"" }, @"revoke_tokens_issued_before": @"", @"role": @"", @"teams": @[ ] },
@"banned_by_id": @"",
@"id": @"",
@"ip_ban": @NO,
@"reason": @"",
@"shadow": @NO,
@"target_user_id": @"",
@"timeout": @"",
@"type": @"",
@"user": @{ },
@"user_id": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/moderation/ban"]
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}}/moderation/ban" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"banned_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"banned_by_id\": \"\",\n \"id\": \"\",\n \"ip_ban\": false,\n \"reason\": \"\",\n \"shadow\": false,\n \"target_user_id\": \"\",\n \"timeout\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/moderation/ban",
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([
'banned_by' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'banned_by_id' => '',
'id' => '',
'ip_ban' => null,
'reason' => '',
'shadow' => null,
'target_user_id' => '',
'timeout' => '',
'type' => '',
'user' => [
],
'user_id' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/moderation/ban', [
'body' => '{
"banned_by": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"banned_by_id": "",
"id": "",
"ip_ban": false,
"reason": "",
"shadow": false,
"target_user_id": "",
"timeout": "",
"type": "",
"user": {},
"user_id": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/moderation/ban');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'banned_by' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'banned_by_id' => '',
'id' => '',
'ip_ban' => null,
'reason' => '',
'shadow' => null,
'target_user_id' => '',
'timeout' => '',
'type' => '',
'user' => [
],
'user_id' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'banned_by' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'banned_by_id' => '',
'id' => '',
'ip_ban' => null,
'reason' => '',
'shadow' => null,
'target_user_id' => '',
'timeout' => '',
'type' => '',
'user' => [
],
'user_id' => ''
]));
$request->setRequestUrl('{{baseUrl}}/moderation/ban');
$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}}/moderation/ban' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"banned_by": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"banned_by_id": "",
"id": "",
"ip_ban": false,
"reason": "",
"shadow": false,
"target_user_id": "",
"timeout": "",
"type": "",
"user": {},
"user_id": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/moderation/ban' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"banned_by": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"banned_by_id": "",
"id": "",
"ip_ban": false,
"reason": "",
"shadow": false,
"target_user_id": "",
"timeout": "",
"type": "",
"user": {},
"user_id": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"banned_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"banned_by_id\": \"\",\n \"id\": \"\",\n \"ip_ban\": false,\n \"reason\": \"\",\n \"shadow\": false,\n \"target_user_id\": \"\",\n \"timeout\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/moderation/ban", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/moderation/ban"
payload = {
"banned_by": {
"ban_expires": "",
"banned": False,
"id": "",
"invisible": False,
"language": "",
"push_notifications": {
"disabled": False,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"banned_by_id": "",
"id": "",
"ip_ban": False,
"reason": "",
"shadow": False,
"target_user_id": "",
"timeout": "",
"type": "",
"user": {},
"user_id": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/moderation/ban"
payload <- "{\n \"banned_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"banned_by_id\": \"\",\n \"id\": \"\",\n \"ip_ban\": false,\n \"reason\": \"\",\n \"shadow\": false,\n \"target_user_id\": \"\",\n \"timeout\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/moderation/ban")
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 \"banned_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"banned_by_id\": \"\",\n \"id\": \"\",\n \"ip_ban\": false,\n \"reason\": \"\",\n \"shadow\": false,\n \"target_user_id\": \"\",\n \"timeout\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/moderation/ban') do |req|
req.body = "{\n \"banned_by\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"banned_by_id\": \"\",\n \"id\": \"\",\n \"ip_ban\": false,\n \"reason\": \"\",\n \"shadow\": false,\n \"target_user_id\": \"\",\n \"timeout\": \"\",\n \"type\": \"\",\n \"user\": {},\n \"user_id\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/moderation/ban";
let payload = json!({
"banned_by": json!({
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": json!({
"disabled": false,
"disabled_until": ""
}),
"revoke_tokens_issued_before": "",
"role": "",
"teams": ()
}),
"banned_by_id": "",
"id": "",
"ip_ban": false,
"reason": "",
"shadow": false,
"target_user_id": "",
"timeout": "",
"type": "",
"user": json!({}),
"user_id": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/moderation/ban \
--header 'content-type: application/json' \
--data '{
"banned_by": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"banned_by_id": "",
"id": "",
"ip_ban": false,
"reason": "",
"shadow": false,
"target_user_id": "",
"timeout": "",
"type": "",
"user": {},
"user_id": ""
}'
echo '{
"banned_by": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"banned_by_id": "",
"id": "",
"ip_ban": false,
"reason": "",
"shadow": false,
"target_user_id": "",
"timeout": "",
"type": "",
"user": {},
"user_id": ""
}' | \
http POST {{baseUrl}}/moderation/ban \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "banned_by": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "banned_by_id": "",\n "id": "",\n "ip_ban": false,\n "reason": "",\n "shadow": false,\n "target_user_id": "",\n "timeout": "",\n "type": "",\n "user": {},\n "user_id": ""\n}' \
--output-document \
- {{baseUrl}}/moderation/ban
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"banned_by": [
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": [
"disabled": false,
"disabled_until": ""
],
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
],
"banned_by_id": "",
"id": "",
"ip_ban": false,
"reason": "",
"shadow": false,
"target_user_id": "",
"timeout": "",
"type": "",
"user": [],
"user_id": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/moderation/ban")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Connect (WebSocket)
{{baseUrl}}/connect
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/connect");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/connect")
require "http/client"
url = "{{baseUrl}}/connect"
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}}/connect"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/connect");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/connect"
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/connect HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/connect")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/connect"))
.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}}/connect")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/connect")
.asString();
const 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}}/connect');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/connect'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/connect';
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}}/connect',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/connect")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/connect',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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}}/connect'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/connect');
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}}/connect'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/connect';
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}}/connect"]
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}}/connect" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/connect",
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}}/connect');
echo $response->getBody();
setUrl('{{baseUrl}}/connect');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/connect');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/connect' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/connect' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/connect")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/connect"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/connect"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/connect")
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/connect') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/connect";
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}}/connect
http GET {{baseUrl}}/connect
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/connect
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/connect")! 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
Create guest
{{baseUrl}}/guest
BODY json
{
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/guest");
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 \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/guest" {:content-type :json
:form-params {:user {:ban_expires ""
:banned false
:id ""
:invisible false
:language ""
:push_notifications {:disabled false
:disabled_until ""}
:revoke_tokens_issued_before ""
:role ""
:teams []}}})
require "http/client"
url = "{{baseUrl}}/guest"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/guest"),
Content = new StringContent("{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\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}}/guest");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/guest"
payload := strings.NewReader("{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/guest HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 279
{
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/guest")
.setHeader("content-type", "application/json")
.setBody("{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/guest"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\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 \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/guest")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/guest")
.header("content-type", "application/json")
.body("{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n }\n}")
.asString();
const data = JSON.stringify({
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/guest');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/guest',
headers: {'content-type': 'application/json'},
data: {
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/guest';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/guest',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\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 \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/guest")
.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/guest',
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({
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/guest',
headers: {'content-type': 'application/json'},
body: {
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
}
},
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}}/guest');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
}
});
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}}/guest',
headers: {'content-type': 'application/json'},
data: {
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/guest';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]}}'
};
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 = @{ @"user": @{ @"ban_expires": @"", @"banned": @NO, @"id": @"", @"invisible": @NO, @"language": @"", @"push_notifications": @{ @"disabled": @NO, @"disabled_until": @"" }, @"revoke_tokens_issued_before": @"", @"role": @"", @"teams": @[ ] } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/guest"]
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}}/guest" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/guest",
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([
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
]
]),
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}}/guest', [
'body' => '{
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/guest');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
]
]));
$request->setRequestUrl('{{baseUrl}}/guest');
$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}}/guest' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/guest' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/guest", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/guest"
payload = { "user": {
"ban_expires": "",
"banned": False,
"id": "",
"invisible": False,
"language": "",
"push_notifications": {
"disabled": False,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/guest"
payload <- "{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/guest")
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 \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/guest') do |req|
req.body = "{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/guest";
let payload = json!({"user": json!({
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": json!({
"disabled": false,
"disabled_until": ""
}),
"revoke_tokens_issued_before": "",
"role": "",
"teams": ()
})});
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}}/guest \
--header 'content-type: application/json' \
--data '{
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
}
}'
echo '{
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
}
}' | \
http POST {{baseUrl}}/guest \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n }\n}' \
--output-document \
- {{baseUrl}}/guest
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["user": [
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": [
"disabled": false,
"disabled_until": ""
],
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/guest")! 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
Deactivate user
{{baseUrl}}/users/:user_id/deactivate
QUERY PARAMS
user_id
BODY json
{
"created_by_id": "",
"mark_messages_deleted": false,
"user_id": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/users/:user_id/deactivate");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"created_by_id\": \"\",\n \"mark_messages_deleted\": false,\n \"user_id\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/users/:user_id/deactivate" {:content-type :json
:form-params {:created_by_id ""
:mark_messages_deleted false
:user_id ""}})
require "http/client"
url = "{{baseUrl}}/users/:user_id/deactivate"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"created_by_id\": \"\",\n \"mark_messages_deleted\": false,\n \"user_id\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/users/:user_id/deactivate"),
Content = new StringContent("{\n \"created_by_id\": \"\",\n \"mark_messages_deleted\": false,\n \"user_id\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/users/:user_id/deactivate");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"created_by_id\": \"\",\n \"mark_messages_deleted\": false,\n \"user_id\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/users/:user_id/deactivate"
payload := strings.NewReader("{\n \"created_by_id\": \"\",\n \"mark_messages_deleted\": false,\n \"user_id\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/users/:user_id/deactivate HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 76
{
"created_by_id": "",
"mark_messages_deleted": false,
"user_id": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/users/:user_id/deactivate")
.setHeader("content-type", "application/json")
.setBody("{\n \"created_by_id\": \"\",\n \"mark_messages_deleted\": false,\n \"user_id\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/users/:user_id/deactivate"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"created_by_id\": \"\",\n \"mark_messages_deleted\": false,\n \"user_id\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"created_by_id\": \"\",\n \"mark_messages_deleted\": false,\n \"user_id\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/users/:user_id/deactivate")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/users/:user_id/deactivate")
.header("content-type", "application/json")
.body("{\n \"created_by_id\": \"\",\n \"mark_messages_deleted\": false,\n \"user_id\": \"\"\n}")
.asString();
const data = JSON.stringify({
created_by_id: '',
mark_messages_deleted: false,
user_id: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/users/:user_id/deactivate');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/users/:user_id/deactivate',
headers: {'content-type': 'application/json'},
data: {created_by_id: '', mark_messages_deleted: false, user_id: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/users/:user_id/deactivate';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"created_by_id":"","mark_messages_deleted":false,"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/users/:user_id/deactivate',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "created_by_id": "",\n "mark_messages_deleted": false,\n "user_id": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"created_by_id\": \"\",\n \"mark_messages_deleted\": false,\n \"user_id\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/users/:user_id/deactivate")
.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/users/:user_id/deactivate',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({created_by_id: '', mark_messages_deleted: false, user_id: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/users/:user_id/deactivate',
headers: {'content-type': 'application/json'},
body: {created_by_id: '', mark_messages_deleted: false, user_id: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/users/:user_id/deactivate');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
created_by_id: '',
mark_messages_deleted: false,
user_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/users/:user_id/deactivate',
headers: {'content-type': 'application/json'},
data: {created_by_id: '', mark_messages_deleted: false, user_id: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/users/:user_id/deactivate';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"created_by_id":"","mark_messages_deleted":false,"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"created_by_id": @"",
@"mark_messages_deleted": @NO,
@"user_id": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/users/:user_id/deactivate"]
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}}/users/:user_id/deactivate" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"created_by_id\": \"\",\n \"mark_messages_deleted\": false,\n \"user_id\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/users/:user_id/deactivate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'created_by_id' => '',
'mark_messages_deleted' => null,
'user_id' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/users/:user_id/deactivate', [
'body' => '{
"created_by_id": "",
"mark_messages_deleted": false,
"user_id": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/users/:user_id/deactivate');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'created_by_id' => '',
'mark_messages_deleted' => null,
'user_id' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'created_by_id' => '',
'mark_messages_deleted' => null,
'user_id' => ''
]));
$request->setRequestUrl('{{baseUrl}}/users/:user_id/deactivate');
$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}}/users/:user_id/deactivate' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"created_by_id": "",
"mark_messages_deleted": false,
"user_id": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/users/:user_id/deactivate' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"created_by_id": "",
"mark_messages_deleted": false,
"user_id": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"created_by_id\": \"\",\n \"mark_messages_deleted\": false,\n \"user_id\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/users/:user_id/deactivate", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/users/:user_id/deactivate"
payload = {
"created_by_id": "",
"mark_messages_deleted": False,
"user_id": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/users/:user_id/deactivate"
payload <- "{\n \"created_by_id\": \"\",\n \"mark_messages_deleted\": false,\n \"user_id\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/users/:user_id/deactivate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"created_by_id\": \"\",\n \"mark_messages_deleted\": false,\n \"user_id\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/users/:user_id/deactivate') do |req|
req.body = "{\n \"created_by_id\": \"\",\n \"mark_messages_deleted\": false,\n \"user_id\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/users/:user_id/deactivate";
let payload = json!({
"created_by_id": "",
"mark_messages_deleted": false,
"user_id": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/users/:user_id/deactivate \
--header 'content-type: application/json' \
--data '{
"created_by_id": "",
"mark_messages_deleted": false,
"user_id": ""
}'
echo '{
"created_by_id": "",
"mark_messages_deleted": false,
"user_id": ""
}' | \
http POST {{baseUrl}}/users/:user_id/deactivate \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "created_by_id": "",\n "mark_messages_deleted": false,\n "user_id": ""\n}' \
--output-document \
- {{baseUrl}}/users/:user_id/deactivate
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"created_by_id": "",
"mark_messages_deleted": false,
"user_id": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/users/:user_id/deactivate")! 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
Deactivate users
{{baseUrl}}/users/deactivate
BODY json
{
"created_by_id": "",
"mark_messages_deleted": false,
"user_ids": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/users/deactivate");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"created_by_id\": \"\",\n \"mark_messages_deleted\": false,\n \"user_ids\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/users/deactivate" {:content-type :json
:form-params {:created_by_id ""
:mark_messages_deleted false
:user_ids []}})
require "http/client"
url = "{{baseUrl}}/users/deactivate"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"created_by_id\": \"\",\n \"mark_messages_deleted\": false,\n \"user_ids\": []\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}}/users/deactivate"),
Content = new StringContent("{\n \"created_by_id\": \"\",\n \"mark_messages_deleted\": false,\n \"user_ids\": []\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}}/users/deactivate");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"created_by_id\": \"\",\n \"mark_messages_deleted\": false,\n \"user_ids\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/users/deactivate"
payload := strings.NewReader("{\n \"created_by_id\": \"\",\n \"mark_messages_deleted\": false,\n \"user_ids\": []\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/users/deactivate HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 77
{
"created_by_id": "",
"mark_messages_deleted": false,
"user_ids": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/users/deactivate")
.setHeader("content-type", "application/json")
.setBody("{\n \"created_by_id\": \"\",\n \"mark_messages_deleted\": false,\n \"user_ids\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/users/deactivate"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"created_by_id\": \"\",\n \"mark_messages_deleted\": false,\n \"user_ids\": []\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"created_by_id\": \"\",\n \"mark_messages_deleted\": false,\n \"user_ids\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/users/deactivate")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/users/deactivate")
.header("content-type", "application/json")
.body("{\n \"created_by_id\": \"\",\n \"mark_messages_deleted\": false,\n \"user_ids\": []\n}")
.asString();
const data = JSON.stringify({
created_by_id: '',
mark_messages_deleted: false,
user_ids: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/users/deactivate');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/users/deactivate',
headers: {'content-type': 'application/json'},
data: {created_by_id: '', mark_messages_deleted: false, user_ids: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/users/deactivate';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"created_by_id":"","mark_messages_deleted":false,"user_ids":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/users/deactivate',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "created_by_id": "",\n "mark_messages_deleted": false,\n "user_ids": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"created_by_id\": \"\",\n \"mark_messages_deleted\": false,\n \"user_ids\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/users/deactivate")
.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/users/deactivate',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({created_by_id: '', mark_messages_deleted: false, user_ids: []}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/users/deactivate',
headers: {'content-type': 'application/json'},
body: {created_by_id: '', mark_messages_deleted: false, user_ids: []},
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}}/users/deactivate');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
created_by_id: '',
mark_messages_deleted: false,
user_ids: []
});
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}}/users/deactivate',
headers: {'content-type': 'application/json'},
data: {created_by_id: '', mark_messages_deleted: false, user_ids: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/users/deactivate';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"created_by_id":"","mark_messages_deleted":false,"user_ids":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"created_by_id": @"",
@"mark_messages_deleted": @NO,
@"user_ids": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/users/deactivate"]
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}}/users/deactivate" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"created_by_id\": \"\",\n \"mark_messages_deleted\": false,\n \"user_ids\": []\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/users/deactivate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'created_by_id' => '',
'mark_messages_deleted' => null,
'user_ids' => [
]
]),
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}}/users/deactivate', [
'body' => '{
"created_by_id": "",
"mark_messages_deleted": false,
"user_ids": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/users/deactivate');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'created_by_id' => '',
'mark_messages_deleted' => null,
'user_ids' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'created_by_id' => '',
'mark_messages_deleted' => null,
'user_ids' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/users/deactivate');
$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}}/users/deactivate' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"created_by_id": "",
"mark_messages_deleted": false,
"user_ids": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/users/deactivate' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"created_by_id": "",
"mark_messages_deleted": false,
"user_ids": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"created_by_id\": \"\",\n \"mark_messages_deleted\": false,\n \"user_ids\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/users/deactivate", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/users/deactivate"
payload = {
"created_by_id": "",
"mark_messages_deleted": False,
"user_ids": []
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/users/deactivate"
payload <- "{\n \"created_by_id\": \"\",\n \"mark_messages_deleted\": false,\n \"user_ids\": []\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}}/users/deactivate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"created_by_id\": \"\",\n \"mark_messages_deleted\": false,\n \"user_ids\": []\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/users/deactivate') do |req|
req.body = "{\n \"created_by_id\": \"\",\n \"mark_messages_deleted\": false,\n \"user_ids\": []\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/users/deactivate";
let payload = json!({
"created_by_id": "",
"mark_messages_deleted": false,
"user_ids": ()
});
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}}/users/deactivate \
--header 'content-type: application/json' \
--data '{
"created_by_id": "",
"mark_messages_deleted": false,
"user_ids": []
}'
echo '{
"created_by_id": "",
"mark_messages_deleted": false,
"user_ids": []
}' | \
http POST {{baseUrl}}/users/deactivate \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "created_by_id": "",\n "mark_messages_deleted": false,\n "user_ids": []\n}' \
--output-document \
- {{baseUrl}}/users/deactivate
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"created_by_id": "",
"mark_messages_deleted": false,
"user_ids": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/users/deactivate")! 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
Delete Users
{{baseUrl}}/users/delete
BODY json
{
"conversations": "",
"messages": "",
"new_channel_owner_id": "",
"user": "",
"user_ids": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/users/delete");
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 \"conversations\": \"\",\n \"messages\": \"\",\n \"new_channel_owner_id\": \"\",\n \"user\": \"\",\n \"user_ids\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/users/delete" {:content-type :json
:form-params {:conversations ""
:messages ""
:new_channel_owner_id ""
:user ""
:user_ids []}})
require "http/client"
url = "{{baseUrl}}/users/delete"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"conversations\": \"\",\n \"messages\": \"\",\n \"new_channel_owner_id\": \"\",\n \"user\": \"\",\n \"user_ids\": []\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}}/users/delete"),
Content = new StringContent("{\n \"conversations\": \"\",\n \"messages\": \"\",\n \"new_channel_owner_id\": \"\",\n \"user\": \"\",\n \"user_ids\": []\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}}/users/delete");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"conversations\": \"\",\n \"messages\": \"\",\n \"new_channel_owner_id\": \"\",\n \"user\": \"\",\n \"user_ids\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/users/delete"
payload := strings.NewReader("{\n \"conversations\": \"\",\n \"messages\": \"\",\n \"new_channel_owner_id\": \"\",\n \"user\": \"\",\n \"user_ids\": []\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/users/delete HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 105
{
"conversations": "",
"messages": "",
"new_channel_owner_id": "",
"user": "",
"user_ids": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/users/delete")
.setHeader("content-type", "application/json")
.setBody("{\n \"conversations\": \"\",\n \"messages\": \"\",\n \"new_channel_owner_id\": \"\",\n \"user\": \"\",\n \"user_ids\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/users/delete"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"conversations\": \"\",\n \"messages\": \"\",\n \"new_channel_owner_id\": \"\",\n \"user\": \"\",\n \"user_ids\": []\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 \"conversations\": \"\",\n \"messages\": \"\",\n \"new_channel_owner_id\": \"\",\n \"user\": \"\",\n \"user_ids\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/users/delete")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/users/delete")
.header("content-type", "application/json")
.body("{\n \"conversations\": \"\",\n \"messages\": \"\",\n \"new_channel_owner_id\": \"\",\n \"user\": \"\",\n \"user_ids\": []\n}")
.asString();
const data = JSON.stringify({
conversations: '',
messages: '',
new_channel_owner_id: '',
user: '',
user_ids: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/users/delete');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/users/delete',
headers: {'content-type': 'application/json'},
data: {
conversations: '',
messages: '',
new_channel_owner_id: '',
user: '',
user_ids: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/users/delete';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"conversations":"","messages":"","new_channel_owner_id":"","user":"","user_ids":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/users/delete',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "conversations": "",\n "messages": "",\n "new_channel_owner_id": "",\n "user": "",\n "user_ids": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"conversations\": \"\",\n \"messages\": \"\",\n \"new_channel_owner_id\": \"\",\n \"user\": \"\",\n \"user_ids\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/users/delete")
.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/users/delete',
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({
conversations: '',
messages: '',
new_channel_owner_id: '',
user: '',
user_ids: []
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/users/delete',
headers: {'content-type': 'application/json'},
body: {
conversations: '',
messages: '',
new_channel_owner_id: '',
user: '',
user_ids: []
},
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}}/users/delete');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
conversations: '',
messages: '',
new_channel_owner_id: '',
user: '',
user_ids: []
});
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}}/users/delete',
headers: {'content-type': 'application/json'},
data: {
conversations: '',
messages: '',
new_channel_owner_id: '',
user: '',
user_ids: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/users/delete';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"conversations":"","messages":"","new_channel_owner_id":"","user":"","user_ids":[]}'
};
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 = @{ @"conversations": @"",
@"messages": @"",
@"new_channel_owner_id": @"",
@"user": @"",
@"user_ids": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/users/delete"]
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}}/users/delete" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"conversations\": \"\",\n \"messages\": \"\",\n \"new_channel_owner_id\": \"\",\n \"user\": \"\",\n \"user_ids\": []\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/users/delete",
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([
'conversations' => '',
'messages' => '',
'new_channel_owner_id' => '',
'user' => '',
'user_ids' => [
]
]),
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}}/users/delete', [
'body' => '{
"conversations": "",
"messages": "",
"new_channel_owner_id": "",
"user": "",
"user_ids": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/users/delete');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'conversations' => '',
'messages' => '',
'new_channel_owner_id' => '',
'user' => '',
'user_ids' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'conversations' => '',
'messages' => '',
'new_channel_owner_id' => '',
'user' => '',
'user_ids' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/users/delete');
$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}}/users/delete' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"conversations": "",
"messages": "",
"new_channel_owner_id": "",
"user": "",
"user_ids": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/users/delete' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"conversations": "",
"messages": "",
"new_channel_owner_id": "",
"user": "",
"user_ids": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"conversations\": \"\",\n \"messages\": \"\",\n \"new_channel_owner_id\": \"\",\n \"user\": \"\",\n \"user_ids\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/users/delete", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/users/delete"
payload = {
"conversations": "",
"messages": "",
"new_channel_owner_id": "",
"user": "",
"user_ids": []
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/users/delete"
payload <- "{\n \"conversations\": \"\",\n \"messages\": \"\",\n \"new_channel_owner_id\": \"\",\n \"user\": \"\",\n \"user_ids\": []\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}}/users/delete")
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 \"conversations\": \"\",\n \"messages\": \"\",\n \"new_channel_owner_id\": \"\",\n \"user\": \"\",\n \"user_ids\": []\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/users/delete') do |req|
req.body = "{\n \"conversations\": \"\",\n \"messages\": \"\",\n \"new_channel_owner_id\": \"\",\n \"user\": \"\",\n \"user_ids\": []\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/users/delete";
let payload = json!({
"conversations": "",
"messages": "",
"new_channel_owner_id": "",
"user": "",
"user_ids": ()
});
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}}/users/delete \
--header 'content-type: application/json' \
--data '{
"conversations": "",
"messages": "",
"new_channel_owner_id": "",
"user": "",
"user_ids": []
}'
echo '{
"conversations": "",
"messages": "",
"new_channel_owner_id": "",
"user": "",
"user_ids": []
}' | \
http POST {{baseUrl}}/users/delete \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "conversations": "",\n "messages": "",\n "new_channel_owner_id": "",\n "user": "",\n "user_ids": []\n}' \
--output-document \
- {{baseUrl}}/users/delete
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"conversations": "",
"messages": "",
"new_channel_owner_id": "",
"user": "",
"user_ids": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/users/delete")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
Delete user
{{baseUrl}}/users/:user_id
QUERY PARAMS
user_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/users/:user_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/users/:user_id")
require "http/client"
url = "{{baseUrl}}/users/:user_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}}/users/:user_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/users/:user_id");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/users/:user_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/users/:user_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/users/:user_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/users/:user_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}}/users/:user_id")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/users/:user_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}}/users/:user_id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/users/:user_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/users/:user_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}}/users/:user_id',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/users/:user_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/users/:user_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}}/users/:user_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}}/users/:user_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}}/users/:user_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/users/:user_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}}/users/:user_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}}/users/:user_id" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/users/:user_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}}/users/:user_id');
echo $response->getBody();
setUrl('{{baseUrl}}/users/:user_id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/users/:user_id');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/users/:user_id' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/users/:user_id' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/users/:user_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/users/:user_id"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/users/:user_id"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/users/:user_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/users/:user_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}}/users/:user_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}}/users/:user_id
http DELETE {{baseUrl}}/users/:user_id
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/users/:user_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/users/:user_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
Export user
{{baseUrl}}/users/:user_id/export
QUERY PARAMS
user_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/users/:user_id/export");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/users/:user_id/export")
require "http/client"
url = "{{baseUrl}}/users/:user_id/export"
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}}/users/:user_id/export"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/users/:user_id/export");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/users/:user_id/export"
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/users/:user_id/export HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/users/:user_id/export")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/users/:user_id/export"))
.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}}/users/:user_id/export")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/users/:user_id/export")
.asString();
const 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}}/users/:user_id/export');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/users/:user_id/export'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/users/:user_id/export';
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}}/users/:user_id/export',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/users/:user_id/export")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/users/:user_id/export',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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}}/users/:user_id/export'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/users/:user_id/export');
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}}/users/:user_id/export'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/users/:user_id/export';
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}}/users/:user_id/export"]
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}}/users/:user_id/export" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/users/:user_id/export",
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}}/users/:user_id/export');
echo $response->getBody();
setUrl('{{baseUrl}}/users/:user_id/export');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/users/:user_id/export');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/users/:user_id/export' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/users/:user_id/export' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/users/:user_id/export")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/users/:user_id/export"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/users/:user_id/export"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/users/:user_id/export")
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/users/:user_id/export') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/users/:user_id/export";
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}}/users/:user_id/export
http GET {{baseUrl}}/users/:user_id/export
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/users/:user_id/export
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/users/:user_id/export")! 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
Export users
{{baseUrl}}/export/users
BODY json
{
"user_ids": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/export/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 \"user_ids\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/export/users" {:content-type :json
:form-params {:user_ids []}})
require "http/client"
url = "{{baseUrl}}/export/users"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"user_ids\": []\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}}/export/users"),
Content = new StringContent("{\n \"user_ids\": []\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}}/export/users");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"user_ids\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/export/users"
payload := strings.NewReader("{\n \"user_ids\": []\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/export/users HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 20
{
"user_ids": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/export/users")
.setHeader("content-type", "application/json")
.setBody("{\n \"user_ids\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/export/users"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"user_ids\": []\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 \"user_ids\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/export/users")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/export/users")
.header("content-type", "application/json")
.body("{\n \"user_ids\": []\n}")
.asString();
const data = JSON.stringify({
user_ids: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/export/users');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/export/users',
headers: {'content-type': 'application/json'},
data: {user_ids: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/export/users';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"user_ids":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/export/users',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "user_ids": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"user_ids\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/export/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/export/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({user_ids: []}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/export/users',
headers: {'content-type': 'application/json'},
body: {user_ids: []},
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}}/export/users');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
user_ids: []
});
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}}/export/users',
headers: {'content-type': 'application/json'},
data: {user_ids: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/export/users';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"user_ids":[]}'
};
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 = @{ @"user_ids": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/export/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}}/export/users" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"user_ids\": []\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/export/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([
'user_ids' => [
]
]),
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}}/export/users', [
'body' => '{
"user_ids": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/export/users');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'user_ids' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'user_ids' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/export/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}}/export/users' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"user_ids": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/export/users' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"user_ids": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"user_ids\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/export/users", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/export/users"
payload = { "user_ids": [] }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/export/users"
payload <- "{\n \"user_ids\": []\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}}/export/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 \"user_ids\": []\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/export/users') do |req|
req.body = "{\n \"user_ids\": []\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/export/users";
let payload = json!({"user_ids": ()});
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}}/export/users \
--header 'content-type: application/json' \
--data '{
"user_ids": []
}'
echo '{
"user_ids": []
}' | \
http POST {{baseUrl}}/export/users \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "user_ids": []\n}' \
--output-document \
- {{baseUrl}}/export/users
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["user_ids": []] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/export/users")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Long Poll (Transport)
{{baseUrl}}/longpoll
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/longpoll");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/longpoll")
require "http/client"
url = "{{baseUrl}}/longpoll"
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}}/longpoll"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/longpoll");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/longpoll"
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/longpoll HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/longpoll")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/longpoll"))
.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}}/longpoll")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/longpoll")
.asString();
const 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}}/longpoll');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/longpoll'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/longpoll';
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}}/longpoll',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/longpoll")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/longpoll',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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}}/longpoll'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/longpoll');
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}}/longpoll'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/longpoll';
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}}/longpoll"]
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}}/longpoll" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/longpoll",
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}}/longpoll');
echo $response->getBody();
setUrl('{{baseUrl}}/longpoll');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/longpoll');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/longpoll' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/longpoll' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/longpoll")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/longpoll"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/longpoll"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/longpoll")
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/longpoll') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/longpoll";
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}}/longpoll
http GET {{baseUrl}}/longpoll
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/longpoll
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/longpoll")! 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
Mute user
{{baseUrl}}/moderation/mute
BODY json
{
"target_ids": [],
"timeout": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/moderation/mute");
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 \"target_ids\": [],\n \"timeout\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/moderation/mute" {:content-type :json
:form-params {:target_ids []
:timeout ""
:user {:ban_expires ""
:banned false
:id ""
:invisible false
:language ""
:push_notifications {:disabled false
:disabled_until ""}
:revoke_tokens_issued_before ""
:role ""
:teams []}
:user_id ""}})
require "http/client"
url = "{{baseUrl}}/moderation/mute"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"target_ids\": [],\n \"timeout\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/moderation/mute"),
Content = new StringContent("{\n \"target_ids\": [],\n \"timeout\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/moderation/mute");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"target_ids\": [],\n \"timeout\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/moderation/mute"
payload := strings.NewReader("{\n \"target_ids\": [],\n \"timeout\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/moderation/mute HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 333
{
"target_ids": [],
"timeout": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/moderation/mute")
.setHeader("content-type", "application/json")
.setBody("{\n \"target_ids\": [],\n \"timeout\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/moderation/mute"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"target_ids\": [],\n \"timeout\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"target_ids\": [],\n \"timeout\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/moderation/mute")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/moderation/mute")
.header("content-type", "application/json")
.body("{\n \"target_ids\": [],\n \"timeout\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
.asString();
const data = JSON.stringify({
target_ids: [],
timeout: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/moderation/mute');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/moderation/mute',
headers: {'content-type': 'application/json'},
data: {
target_ids: [],
timeout: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/moderation/mute';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"target_ids":[],"timeout":"","user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/moderation/mute',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "target_ids": [],\n "timeout": "",\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"target_ids\": [],\n \"timeout\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/moderation/mute")
.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/moderation/mute',
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({
target_ids: [],
timeout: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/moderation/mute',
headers: {'content-type': 'application/json'},
body: {
target_ids: [],
timeout: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/moderation/mute');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
target_ids: [],
timeout: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/moderation/mute',
headers: {'content-type': 'application/json'},
data: {
target_ids: [],
timeout: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/moderation/mute';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"target_ids":[],"timeout":"","user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"target_ids": @[ ],
@"timeout": @"",
@"user": @{ @"ban_expires": @"", @"banned": @NO, @"id": @"", @"invisible": @NO, @"language": @"", @"push_notifications": @{ @"disabled": @NO, @"disabled_until": @"" }, @"revoke_tokens_issued_before": @"", @"role": @"", @"teams": @[ ] },
@"user_id": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/moderation/mute"]
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}}/moderation/mute" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"target_ids\": [],\n \"timeout\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/moderation/mute",
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([
'target_ids' => [
],
'timeout' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/moderation/mute', [
'body' => '{
"target_ids": [],
"timeout": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/moderation/mute');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'target_ids' => [
],
'timeout' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'target_ids' => [
],
'timeout' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]));
$request->setRequestUrl('{{baseUrl}}/moderation/mute');
$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}}/moderation/mute' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"target_ids": [],
"timeout": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/moderation/mute' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"target_ids": [],
"timeout": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"target_ids\": [],\n \"timeout\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/moderation/mute", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/moderation/mute"
payload = {
"target_ids": [],
"timeout": "",
"user": {
"ban_expires": "",
"banned": False,
"id": "",
"invisible": False,
"language": "",
"push_notifications": {
"disabled": False,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/moderation/mute"
payload <- "{\n \"target_ids\": [],\n \"timeout\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/moderation/mute")
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 \"target_ids\": [],\n \"timeout\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/moderation/mute') do |req|
req.body = "{\n \"target_ids\": [],\n \"timeout\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/moderation/mute";
let payload = json!({
"target_ids": (),
"timeout": "",
"user": json!({
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": json!({
"disabled": false,
"disabled_until": ""
}),
"revoke_tokens_issued_before": "",
"role": "",
"teams": ()
}),
"user_id": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/moderation/mute \
--header 'content-type: application/json' \
--data '{
"target_ids": [],
"timeout": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
echo '{
"target_ids": [],
"timeout": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}' | \
http POST {{baseUrl}}/moderation/mute \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "target_ids": [],\n "timeout": "",\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n}' \
--output-document \
- {{baseUrl}}/moderation/mute
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"target_ids": [],
"timeout": "",
"user": [
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": [
"disabled": false,
"disabled_until": ""
],
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
],
"user_id": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/moderation/mute")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
Partially update user
{{baseUrl}}/users
BODY json
{
"id": "",
"set": {},
"unset": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/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\": \"\",\n \"set\": {},\n \"unset\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/users" {:content-type :json
:form-params {:id ""
:set {}
:unset []}})
require "http/client"
url = "{{baseUrl}}/users"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"id\": \"\",\n \"set\": {},\n \"unset\": []\n}"
response = HTTP::Client.patch url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Patch,
RequestUri = new Uri("{{baseUrl}}/users"),
Content = new StringContent("{\n \"id\": \"\",\n \"set\": {},\n \"unset\": []\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}}/users");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"id\": \"\",\n \"set\": {},\n \"unset\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/users"
payload := strings.NewReader("{\n \"id\": \"\",\n \"set\": {},\n \"unset\": []\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PATCH /baseUrl/users HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 42
{
"id": "",
"set": {},
"unset": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/users")
.setHeader("content-type", "application/json")
.setBody("{\n \"id\": \"\",\n \"set\": {},\n \"unset\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/users"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"id\": \"\",\n \"set\": {},\n \"unset\": []\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 \"set\": {},\n \"unset\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/users")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/users")
.header("content-type", "application/json")
.body("{\n \"id\": \"\",\n \"set\": {},\n \"unset\": []\n}")
.asString();
const data = JSON.stringify({
id: '',
set: {},
unset: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/users');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/users',
headers: {'content-type': 'application/json'},
data: {id: '', set: {}, unset: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/users';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"id":"","set":{},"unset":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/users',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "id": "",\n "set": {},\n "unset": []\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 \"set\": {},\n \"unset\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/users")
.patch(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PATCH',
hostname: 'example.com',
port: null,
path: '/baseUrl/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: '', set: {}, unset: []}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/users',
headers: {'content-type': 'application/json'},
body: {id: '', set: {}, unset: []},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/users');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
id: '',
set: {},
unset: []
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/users',
headers: {'content-type': 'application/json'},
data: {id: '', set: {}, unset: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/users';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"id":"","set":{},"unset":[]}'
};
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": @"",
@"set": @{ },
@"unset": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/users"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PATCH"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/users" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"id\": \"\",\n \"set\": {},\n \"unset\": []\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/users",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'id' => '',
'set' => [
],
'unset' => [
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/users', [
'body' => '{
"id": "",
"set": {},
"unset": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/users');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'id' => '',
'set' => [
],
'unset' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'id' => '',
'set' => [
],
'unset' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/users');
$request->setRequestMethod('PATCH');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/users' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"id": "",
"set": {},
"unset": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/users' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"id": "",
"set": {},
"unset": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"id\": \"\",\n \"set\": {},\n \"unset\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/users", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/users"
payload = {
"id": "",
"set": {},
"unset": []
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/users"
payload <- "{\n \"id\": \"\",\n \"set\": {},\n \"unset\": []\n}"
encode <- "json"
response <- VERB("PATCH", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/users")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"id\": \"\",\n \"set\": {},\n \"unset\": []\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/users') do |req|
req.body = "{\n \"id\": \"\",\n \"set\": {},\n \"unset\": []\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}}/users";
let payload = json!({
"id": "",
"set": json!({}),
"unset": ()
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/users \
--header 'content-type: application/json' \
--data '{
"id": "",
"set": {},
"unset": []
}'
echo '{
"id": "",
"set": {},
"unset": []
}' | \
http PATCH {{baseUrl}}/users \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "id": "",\n "set": {},\n "unset": []\n}' \
--output-document \
- {{baseUrl}}/users
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"id": "",
"set": [],
"unset": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/users")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Query Banned Users
{{baseUrl}}/query_banned_users
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/query_banned_users");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/query_banned_users")
require "http/client"
url = "{{baseUrl}}/query_banned_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}}/query_banned_users"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/query_banned_users");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/query_banned_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/query_banned_users HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/query_banned_users")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/query_banned_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}}/query_banned_users")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/query_banned_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}}/query_banned_users');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/query_banned_users'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/query_banned_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}}/query_banned_users',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/query_banned_users")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/query_banned_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}}/query_banned_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}}/query_banned_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}}/query_banned_users'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/query_banned_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}}/query_banned_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}}/query_banned_users" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/query_banned_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}}/query_banned_users');
echo $response->getBody();
setUrl('{{baseUrl}}/query_banned_users');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/query_banned_users');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/query_banned_users' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/query_banned_users' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/query_banned_users")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/query_banned_users"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/query_banned_users"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/query_banned_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/query_banned_users') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/query_banned_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}}/query_banned_users
http GET {{baseUrl}}/query_banned_users
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/query_banned_users
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/query_banned_users")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Query users
{{baseUrl}}/users
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/users");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/users")
require "http/client"
url = "{{baseUrl}}/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}}/users"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/users");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/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/users HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/users")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/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}}/users")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/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}}/users');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/users'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/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}}/users',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/users")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/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}}/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}}/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}}/users'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/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}}/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}}/users" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/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}}/users');
echo $response->getBody();
setUrl('{{baseUrl}}/users');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/users');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/users' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/users' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/users")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/users"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/users"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/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/users') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/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}}/users
http GET {{baseUrl}}/users
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/users
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/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()
POST
Reactivate user
{{baseUrl}}/users/:user_id/reactivate
QUERY PARAMS
user_id
BODY json
{
"created_by_id": "",
"name": "",
"restore_messages": false,
"user_id": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/users/:user_id/reactivate");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"created_by_id\": \"\",\n \"name\": \"\",\n \"restore_messages\": false,\n \"user_id\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/users/:user_id/reactivate" {:content-type :json
:form-params {:created_by_id ""
:name ""
:restore_messages false
:user_id ""}})
require "http/client"
url = "{{baseUrl}}/users/:user_id/reactivate"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"created_by_id\": \"\",\n \"name\": \"\",\n \"restore_messages\": false,\n \"user_id\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/users/:user_id/reactivate"),
Content = new StringContent("{\n \"created_by_id\": \"\",\n \"name\": \"\",\n \"restore_messages\": false,\n \"user_id\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/users/:user_id/reactivate");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"created_by_id\": \"\",\n \"name\": \"\",\n \"restore_messages\": false,\n \"user_id\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/users/:user_id/reactivate"
payload := strings.NewReader("{\n \"created_by_id\": \"\",\n \"name\": \"\",\n \"restore_messages\": false,\n \"user_id\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/users/:user_id/reactivate HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 85
{
"created_by_id": "",
"name": "",
"restore_messages": false,
"user_id": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/users/:user_id/reactivate")
.setHeader("content-type", "application/json")
.setBody("{\n \"created_by_id\": \"\",\n \"name\": \"\",\n \"restore_messages\": false,\n \"user_id\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/users/:user_id/reactivate"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"created_by_id\": \"\",\n \"name\": \"\",\n \"restore_messages\": false,\n \"user_id\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"created_by_id\": \"\",\n \"name\": \"\",\n \"restore_messages\": false,\n \"user_id\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/users/:user_id/reactivate")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/users/:user_id/reactivate")
.header("content-type", "application/json")
.body("{\n \"created_by_id\": \"\",\n \"name\": \"\",\n \"restore_messages\": false,\n \"user_id\": \"\"\n}")
.asString();
const data = JSON.stringify({
created_by_id: '',
name: '',
restore_messages: false,
user_id: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/users/:user_id/reactivate');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/users/:user_id/reactivate',
headers: {'content-type': 'application/json'},
data: {created_by_id: '', name: '', restore_messages: false, user_id: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/users/:user_id/reactivate';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"created_by_id":"","name":"","restore_messages":false,"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/users/:user_id/reactivate',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "created_by_id": "",\n "name": "",\n "restore_messages": false,\n "user_id": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"created_by_id\": \"\",\n \"name\": \"\",\n \"restore_messages\": false,\n \"user_id\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/users/:user_id/reactivate")
.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/users/:user_id/reactivate',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({created_by_id: '', name: '', restore_messages: false, user_id: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/users/:user_id/reactivate',
headers: {'content-type': 'application/json'},
body: {created_by_id: '', name: '', restore_messages: false, user_id: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/users/:user_id/reactivate');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
created_by_id: '',
name: '',
restore_messages: false,
user_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/users/:user_id/reactivate',
headers: {'content-type': 'application/json'},
data: {created_by_id: '', name: '', restore_messages: false, user_id: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/users/:user_id/reactivate';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"created_by_id":"","name":"","restore_messages":false,"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"created_by_id": @"",
@"name": @"",
@"restore_messages": @NO,
@"user_id": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/users/:user_id/reactivate"]
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}}/users/:user_id/reactivate" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"created_by_id\": \"\",\n \"name\": \"\",\n \"restore_messages\": false,\n \"user_id\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/users/:user_id/reactivate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'created_by_id' => '',
'name' => '',
'restore_messages' => null,
'user_id' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/users/:user_id/reactivate', [
'body' => '{
"created_by_id": "",
"name": "",
"restore_messages": false,
"user_id": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/users/:user_id/reactivate');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'created_by_id' => '',
'name' => '',
'restore_messages' => null,
'user_id' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'created_by_id' => '',
'name' => '',
'restore_messages' => null,
'user_id' => ''
]));
$request->setRequestUrl('{{baseUrl}}/users/:user_id/reactivate');
$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}}/users/:user_id/reactivate' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"created_by_id": "",
"name": "",
"restore_messages": false,
"user_id": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/users/:user_id/reactivate' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"created_by_id": "",
"name": "",
"restore_messages": false,
"user_id": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"created_by_id\": \"\",\n \"name\": \"\",\n \"restore_messages\": false,\n \"user_id\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/users/:user_id/reactivate", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/users/:user_id/reactivate"
payload = {
"created_by_id": "",
"name": "",
"restore_messages": False,
"user_id": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/users/:user_id/reactivate"
payload <- "{\n \"created_by_id\": \"\",\n \"name\": \"\",\n \"restore_messages\": false,\n \"user_id\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/users/:user_id/reactivate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"created_by_id\": \"\",\n \"name\": \"\",\n \"restore_messages\": false,\n \"user_id\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/users/:user_id/reactivate') do |req|
req.body = "{\n \"created_by_id\": \"\",\n \"name\": \"\",\n \"restore_messages\": false,\n \"user_id\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/users/:user_id/reactivate";
let payload = json!({
"created_by_id": "",
"name": "",
"restore_messages": false,
"user_id": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/users/:user_id/reactivate \
--header 'content-type: application/json' \
--data '{
"created_by_id": "",
"name": "",
"restore_messages": false,
"user_id": ""
}'
echo '{
"created_by_id": "",
"name": "",
"restore_messages": false,
"user_id": ""
}' | \
http POST {{baseUrl}}/users/:user_id/reactivate \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "created_by_id": "",\n "name": "",\n "restore_messages": false,\n "user_id": ""\n}' \
--output-document \
- {{baseUrl}}/users/:user_id/reactivate
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"created_by_id": "",
"name": "",
"restore_messages": false,
"user_id": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/users/:user_id/reactivate")! 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
Reactivate users
{{baseUrl}}/users/reactivate
BODY json
{
"created_by_id": "",
"restore_messages": false,
"user_ids": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/users/reactivate");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"created_by_id\": \"\",\n \"restore_messages\": false,\n \"user_ids\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/users/reactivate" {:content-type :json
:form-params {:created_by_id ""
:restore_messages false
:user_ids []}})
require "http/client"
url = "{{baseUrl}}/users/reactivate"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"created_by_id\": \"\",\n \"restore_messages\": false,\n \"user_ids\": []\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}}/users/reactivate"),
Content = new StringContent("{\n \"created_by_id\": \"\",\n \"restore_messages\": false,\n \"user_ids\": []\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}}/users/reactivate");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"created_by_id\": \"\",\n \"restore_messages\": false,\n \"user_ids\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/users/reactivate"
payload := strings.NewReader("{\n \"created_by_id\": \"\",\n \"restore_messages\": false,\n \"user_ids\": []\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/users/reactivate HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 72
{
"created_by_id": "",
"restore_messages": false,
"user_ids": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/users/reactivate")
.setHeader("content-type", "application/json")
.setBody("{\n \"created_by_id\": \"\",\n \"restore_messages\": false,\n \"user_ids\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/users/reactivate"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"created_by_id\": \"\",\n \"restore_messages\": false,\n \"user_ids\": []\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"created_by_id\": \"\",\n \"restore_messages\": false,\n \"user_ids\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/users/reactivate")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/users/reactivate")
.header("content-type", "application/json")
.body("{\n \"created_by_id\": \"\",\n \"restore_messages\": false,\n \"user_ids\": []\n}")
.asString();
const data = JSON.stringify({
created_by_id: '',
restore_messages: false,
user_ids: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/users/reactivate');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/users/reactivate',
headers: {'content-type': 'application/json'},
data: {created_by_id: '', restore_messages: false, user_ids: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/users/reactivate';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"created_by_id":"","restore_messages":false,"user_ids":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/users/reactivate',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "created_by_id": "",\n "restore_messages": false,\n "user_ids": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"created_by_id\": \"\",\n \"restore_messages\": false,\n \"user_ids\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/users/reactivate")
.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/users/reactivate',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({created_by_id: '', restore_messages: false, user_ids: []}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/users/reactivate',
headers: {'content-type': 'application/json'},
body: {created_by_id: '', restore_messages: false, user_ids: []},
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}}/users/reactivate');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
created_by_id: '',
restore_messages: false,
user_ids: []
});
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}}/users/reactivate',
headers: {'content-type': 'application/json'},
data: {created_by_id: '', restore_messages: false, user_ids: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/users/reactivate';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"created_by_id":"","restore_messages":false,"user_ids":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"created_by_id": @"",
@"restore_messages": @NO,
@"user_ids": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/users/reactivate"]
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}}/users/reactivate" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"created_by_id\": \"\",\n \"restore_messages\": false,\n \"user_ids\": []\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/users/reactivate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'created_by_id' => '',
'restore_messages' => null,
'user_ids' => [
]
]),
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}}/users/reactivate', [
'body' => '{
"created_by_id": "",
"restore_messages": false,
"user_ids": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/users/reactivate');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'created_by_id' => '',
'restore_messages' => null,
'user_ids' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'created_by_id' => '',
'restore_messages' => null,
'user_ids' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/users/reactivate');
$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}}/users/reactivate' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"created_by_id": "",
"restore_messages": false,
"user_ids": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/users/reactivate' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"created_by_id": "",
"restore_messages": false,
"user_ids": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"created_by_id\": \"\",\n \"restore_messages\": false,\n \"user_ids\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/users/reactivate", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/users/reactivate"
payload = {
"created_by_id": "",
"restore_messages": False,
"user_ids": []
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/users/reactivate"
payload <- "{\n \"created_by_id\": \"\",\n \"restore_messages\": false,\n \"user_ids\": []\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}}/users/reactivate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"created_by_id\": \"\",\n \"restore_messages\": false,\n \"user_ids\": []\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/users/reactivate') do |req|
req.body = "{\n \"created_by_id\": \"\",\n \"restore_messages\": false,\n \"user_ids\": []\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/users/reactivate";
let payload = json!({
"created_by_id": "",
"restore_messages": false,
"user_ids": ()
});
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}}/users/reactivate \
--header 'content-type: application/json' \
--data '{
"created_by_id": "",
"restore_messages": false,
"user_ids": []
}'
echo '{
"created_by_id": "",
"restore_messages": false,
"user_ids": []
}' | \
http POST {{baseUrl}}/users/reactivate \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "created_by_id": "",\n "restore_messages": false,\n "user_ids": []\n}' \
--output-document \
- {{baseUrl}}/users/reactivate
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"created_by_id": "",
"restore_messages": false,
"user_ids": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/users/reactivate")! 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
Restore users
{{baseUrl}}/users/restore
BODY json
{
"user_ids": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/users/restore");
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 \"user_ids\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/users/restore" {:content-type :json
:form-params {:user_ids []}})
require "http/client"
url = "{{baseUrl}}/users/restore"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"user_ids\": []\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}}/users/restore"),
Content = new StringContent("{\n \"user_ids\": []\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}}/users/restore");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"user_ids\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/users/restore"
payload := strings.NewReader("{\n \"user_ids\": []\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/users/restore HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 20
{
"user_ids": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/users/restore")
.setHeader("content-type", "application/json")
.setBody("{\n \"user_ids\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/users/restore"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"user_ids\": []\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 \"user_ids\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/users/restore")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/users/restore")
.header("content-type", "application/json")
.body("{\n \"user_ids\": []\n}")
.asString();
const data = JSON.stringify({
user_ids: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/users/restore');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/users/restore',
headers: {'content-type': 'application/json'},
data: {user_ids: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/users/restore';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"user_ids":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/users/restore',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "user_ids": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"user_ids\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/users/restore")
.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/users/restore',
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({user_ids: []}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/users/restore',
headers: {'content-type': 'application/json'},
body: {user_ids: []},
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}}/users/restore');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
user_ids: []
});
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}}/users/restore',
headers: {'content-type': 'application/json'},
data: {user_ids: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/users/restore';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"user_ids":[]}'
};
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 = @{ @"user_ids": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/users/restore"]
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}}/users/restore" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"user_ids\": []\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/users/restore",
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([
'user_ids' => [
]
]),
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}}/users/restore', [
'body' => '{
"user_ids": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/users/restore');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'user_ids' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'user_ids' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/users/restore');
$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}}/users/restore' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"user_ids": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/users/restore' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"user_ids": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"user_ids\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/users/restore", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/users/restore"
payload = { "user_ids": [] }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/users/restore"
payload <- "{\n \"user_ids\": []\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}}/users/restore")
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 \"user_ids\": []\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/users/restore') do |req|
req.body = "{\n \"user_ids\": []\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/users/restore";
let payload = json!({"user_ids": ()});
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}}/users/restore \
--header 'content-type: application/json' \
--data '{
"user_ids": []
}'
echo '{
"user_ids": []
}' | \
http POST {{baseUrl}}/users/restore \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "user_ids": []\n}' \
--output-document \
- {{baseUrl}}/users/restore
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["user_ids": []] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/users/restore")! 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
Unban user
{{baseUrl}}/moderation/ban
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/moderation/ban");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/moderation/ban")
require "http/client"
url = "{{baseUrl}}/moderation/ban"
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}}/moderation/ban"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/moderation/ban");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/moderation/ban"
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/moderation/ban HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/moderation/ban")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/moderation/ban"))
.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}}/moderation/ban")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/moderation/ban")
.asString();
const 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}}/moderation/ban');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/moderation/ban'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/moderation/ban';
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}}/moderation/ban',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/moderation/ban")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/moderation/ban',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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}}/moderation/ban'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/moderation/ban');
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}}/moderation/ban'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/moderation/ban';
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}}/moderation/ban"]
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}}/moderation/ban" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/moderation/ban",
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}}/moderation/ban');
echo $response->getBody();
setUrl('{{baseUrl}}/moderation/ban');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/moderation/ban');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/moderation/ban' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/moderation/ban' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/moderation/ban")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/moderation/ban"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/moderation/ban"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/moderation/ban")
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/moderation/ban') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/moderation/ban";
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}}/moderation/ban
http DELETE {{baseUrl}}/moderation/ban
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/moderation/ban
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/moderation/ban")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Unmute user
{{baseUrl}}/moderation/unmute
BODY json
{
"target_id": "",
"target_ids": [],
"timeout": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/moderation/unmute");
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 \"target_id\": \"\",\n \"target_ids\": [],\n \"timeout\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/moderation/unmute" {:content-type :json
:form-params {:target_id ""
:target_ids []
:timeout ""
:user {:ban_expires ""
:banned false
:id ""
:invisible false
:language ""
:push_notifications {:disabled false
:disabled_until ""}
:revoke_tokens_issued_before ""
:role ""
:teams []}
:user_id ""}})
require "http/client"
url = "{{baseUrl}}/moderation/unmute"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"target_id\": \"\",\n \"target_ids\": [],\n \"timeout\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/moderation/unmute"),
Content = new StringContent("{\n \"target_id\": \"\",\n \"target_ids\": [],\n \"timeout\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/moderation/unmute");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"target_id\": \"\",\n \"target_ids\": [],\n \"timeout\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/moderation/unmute"
payload := strings.NewReader("{\n \"target_id\": \"\",\n \"target_ids\": [],\n \"timeout\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/moderation/unmute HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 352
{
"target_id": "",
"target_ids": [],
"timeout": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/moderation/unmute")
.setHeader("content-type", "application/json")
.setBody("{\n \"target_id\": \"\",\n \"target_ids\": [],\n \"timeout\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/moderation/unmute"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"target_id\": \"\",\n \"target_ids\": [],\n \"timeout\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"target_id\": \"\",\n \"target_ids\": [],\n \"timeout\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/moderation/unmute")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/moderation/unmute")
.header("content-type", "application/json")
.body("{\n \"target_id\": \"\",\n \"target_ids\": [],\n \"timeout\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
.asString();
const data = JSON.stringify({
target_id: '',
target_ids: [],
timeout: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/moderation/unmute');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/moderation/unmute',
headers: {'content-type': 'application/json'},
data: {
target_id: '',
target_ids: [],
timeout: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/moderation/unmute';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"target_id":"","target_ids":[],"timeout":"","user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/moderation/unmute',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "target_id": "",\n "target_ids": [],\n "timeout": "",\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"target_id\": \"\",\n \"target_ids\": [],\n \"timeout\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/moderation/unmute")
.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/moderation/unmute',
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({
target_id: '',
target_ids: [],
timeout: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/moderation/unmute',
headers: {'content-type': 'application/json'},
body: {
target_id: '',
target_ids: [],
timeout: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/moderation/unmute');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
target_id: '',
target_ids: [],
timeout: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/moderation/unmute',
headers: {'content-type': 'application/json'},
data: {
target_id: '',
target_ids: [],
timeout: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/moderation/unmute';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"target_id":"","target_ids":[],"timeout":"","user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"target_id": @"",
@"target_ids": @[ ],
@"timeout": @"",
@"user": @{ @"ban_expires": @"", @"banned": @NO, @"id": @"", @"invisible": @NO, @"language": @"", @"push_notifications": @{ @"disabled": @NO, @"disabled_until": @"" }, @"revoke_tokens_issued_before": @"", @"role": @"", @"teams": @[ ] },
@"user_id": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/moderation/unmute"]
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}}/moderation/unmute" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"target_id\": \"\",\n \"target_ids\": [],\n \"timeout\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/moderation/unmute",
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([
'target_id' => '',
'target_ids' => [
],
'timeout' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/moderation/unmute', [
'body' => '{
"target_id": "",
"target_ids": [],
"timeout": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/moderation/unmute');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'target_id' => '',
'target_ids' => [
],
'timeout' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'target_id' => '',
'target_ids' => [
],
'timeout' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]));
$request->setRequestUrl('{{baseUrl}}/moderation/unmute');
$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}}/moderation/unmute' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"target_id": "",
"target_ids": [],
"timeout": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/moderation/unmute' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"target_id": "",
"target_ids": [],
"timeout": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"target_id\": \"\",\n \"target_ids\": [],\n \"timeout\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/moderation/unmute", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/moderation/unmute"
payload = {
"target_id": "",
"target_ids": [],
"timeout": "",
"user": {
"ban_expires": "",
"banned": False,
"id": "",
"invisible": False,
"language": "",
"push_notifications": {
"disabled": False,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/moderation/unmute"
payload <- "{\n \"target_id\": \"\",\n \"target_ids\": [],\n \"timeout\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/moderation/unmute")
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 \"target_id\": \"\",\n \"target_ids\": [],\n \"timeout\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/moderation/unmute') do |req|
req.body = "{\n \"target_id\": \"\",\n \"target_ids\": [],\n \"timeout\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/moderation/unmute";
let payload = json!({
"target_id": "",
"target_ids": (),
"timeout": "",
"user": json!({
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": json!({
"disabled": false,
"disabled_until": ""
}),
"revoke_tokens_issued_before": "",
"role": "",
"teams": ()
}),
"user_id": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/moderation/unmute \
--header 'content-type: application/json' \
--data '{
"target_id": "",
"target_ids": [],
"timeout": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
echo '{
"target_id": "",
"target_ids": [],
"timeout": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}' | \
http POST {{baseUrl}}/moderation/unmute \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "target_id": "",\n "target_ids": [],\n "timeout": "",\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n}' \
--output-document \
- {{baseUrl}}/moderation/unmute
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"target_id": "",
"target_ids": [],
"timeout": "",
"user": [
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": [
"disabled": false,
"disabled_until": ""
],
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
],
"user_id": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/moderation/unmute")! 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
Upsert users
{{baseUrl}}/users
BODY json
{
"users": {}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/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 \"users\": {}\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/users" {:content-type :json
:form-params {:users {}}})
require "http/client"
url = "{{baseUrl}}/users"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"users\": {}\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}}/users"),
Content = new StringContent("{\n \"users\": {}\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}}/users");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"users\": {}\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/users"
payload := strings.NewReader("{\n \"users\": {}\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/users HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 17
{
"users": {}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/users")
.setHeader("content-type", "application/json")
.setBody("{\n \"users\": {}\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/users"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"users\": {}\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 \"users\": {}\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/users")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/users")
.header("content-type", "application/json")
.body("{\n \"users\": {}\n}")
.asString();
const data = JSON.stringify({
users: {}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/users');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/users',
headers: {'content-type': 'application/json'},
data: {users: {}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/users';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"users":{}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/users',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "users": {}\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"users\": {}\n}")
val request = Request.Builder()
.url("{{baseUrl}}/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/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({users: {}}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/users',
headers: {'content-type': 'application/json'},
body: {users: {}},
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}}/users');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
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: 'POST',
url: '{{baseUrl}}/users',
headers: {'content-type': 'application/json'},
data: {users: {}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/users';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"users":{}}'
};
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 = @{ @"users": @{ } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/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}}/users" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"users\": {}\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/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([
'users' => [
]
]),
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}}/users', [
'body' => '{
"users": {}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/users');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'users' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'users' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/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}}/users' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"users": {}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/users' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"users": {}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"users\": {}\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/users", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/users"
payload = { "users": {} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/users"
payload <- "{\n \"users\": {}\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}}/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 \"users\": {}\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/users') do |req|
req.body = "{\n \"users\": {}\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/users";
let payload = json!({"users": json!({})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/users \
--header 'content-type: application/json' \
--data '{
"users": {}
}'
echo '{
"users": {}
}' | \
http POST {{baseUrl}}/users \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "users": {}\n}' \
--output-document \
- {{baseUrl}}/users
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["users": []] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/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()
POST
Commit message
{{baseUrl}}/messages/:id/commit
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/messages/:id/commit");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/messages/:id/commit")
require "http/client"
url = "{{baseUrl}}/messages/:id/commit"
response = HTTP::Client.post url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/messages/:id/commit"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/messages/:id/commit");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/messages/:id/commit"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/messages/:id/commit HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/messages/:id/commit")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/messages/:id/commit"))
.method("POST", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/messages/:id/commit")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/messages/:id/commit")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/messages/:id/commit');
xhr.send(data);
import axios from 'axios';
const options = {method: 'POST', url: '{{baseUrl}}/messages/:id/commit'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/messages/:id/commit';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/messages/:id/commit',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/messages/:id/commit")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/messages/:id/commit',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'POST', url: '{{baseUrl}}/messages/:id/commit'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/messages/:id/commit');
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}}/messages/:id/commit'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/messages/:id/commit';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/messages/:id/commit"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/messages/:id/commit" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/messages/:id/commit",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/messages/:id/commit');
echo $response->getBody();
setUrl('{{baseUrl}}/messages/:id/commit');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/messages/:id/commit');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/messages/:id/commit' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/messages/:id/commit' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/messages/:id/commit")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/messages/:id/commit"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/messages/:id/commit"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/messages/:id/commit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.post('/baseUrl/messages/:id/commit') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/messages/:id/commit";
let client = reqwest::Client::new();
let response = client.post(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/messages/:id/commit
http POST {{baseUrl}}/messages/:id/commit
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/messages/:id/commit
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/messages/:id/commit")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Create a call
{{baseUrl}}/channels/:type/:id/call
QUERY PARAMS
type
id
BODY json
{
"id": "",
"options": {},
"type": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/channels/:type/:id/call");
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 \"options\": {},\n \"type\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/channels/:type/:id/call" {:content-type :json
:form-params {:id ""
:options {}
:type ""
:user {:ban_expires ""
:banned false
:id ""
:invisible false
:language ""
:push_notifications {:disabled false
:disabled_until ""}
:revoke_tokens_issued_before ""
:role ""
:teams []}
:user_id ""}})
require "http/client"
url = "{{baseUrl}}/channels/:type/:id/call"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"id\": \"\",\n \"options\": {},\n \"type\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/channels/:type/:id/call"),
Content = new StringContent("{\n \"id\": \"\",\n \"options\": {},\n \"type\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/channels/:type/:id/call");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"id\": \"\",\n \"options\": {},\n \"type\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/channels/:type/:id/call"
payload := strings.NewReader("{\n \"id\": \"\",\n \"options\": {},\n \"type\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/channels/:type/:id/call HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 339
{
"id": "",
"options": {},
"type": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/channels/:type/:id/call")
.setHeader("content-type", "application/json")
.setBody("{\n \"id\": \"\",\n \"options\": {},\n \"type\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/channels/:type/:id/call"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"id\": \"\",\n \"options\": {},\n \"type\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"id\": \"\",\n \"options\": {},\n \"type\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/channels/:type/:id/call")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/channels/:type/:id/call")
.header("content-type", "application/json")
.body("{\n \"id\": \"\",\n \"options\": {},\n \"type\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
.asString();
const data = JSON.stringify({
id: '',
options: {},
type: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/channels/:type/:id/call');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:type/:id/call',
headers: {'content-type': 'application/json'},
data: {
id: '',
options: {},
type: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/channels/:type/:id/call';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"id":"","options":{},"type":"","user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/channels/:type/:id/call',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "id": "",\n "options": {},\n "type": "",\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"id\": \"\",\n \"options\": {},\n \"type\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/channels/:type/:id/call")
.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/channels/:type/:id/call',
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: '',
options: {},
type: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:type/:id/call',
headers: {'content-type': 'application/json'},
body: {
id: '',
options: {},
type: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/channels/:type/:id/call');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
id: '',
options: {},
type: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:type/:id/call',
headers: {'content-type': 'application/json'},
data: {
id: '',
options: {},
type: '',
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/channels/:type/:id/call';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"id":"","options":{},"type":"","user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"id": @"",
@"options": @{ },
@"type": @"",
@"user": @{ @"ban_expires": @"", @"banned": @NO, @"id": @"", @"invisible": @NO, @"language": @"", @"push_notifications": @{ @"disabled": @NO, @"disabled_until": @"" }, @"revoke_tokens_issued_before": @"", @"role": @"", @"teams": @[ ] },
@"user_id": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/channels/:type/:id/call"]
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}}/channels/:type/:id/call" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"id\": \"\",\n \"options\": {},\n \"type\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/channels/:type/:id/call",
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' => '',
'options' => [
],
'type' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/channels/:type/:id/call', [
'body' => '{
"id": "",
"options": {},
"type": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/channels/:type/:id/call');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'id' => '',
'options' => [
],
'type' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'id' => '',
'options' => [
],
'type' => '',
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]));
$request->setRequestUrl('{{baseUrl}}/channels/:type/:id/call');
$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}}/channels/:type/:id/call' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"id": "",
"options": {},
"type": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/channels/:type/:id/call' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"id": "",
"options": {},
"type": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"id\": \"\",\n \"options\": {},\n \"type\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/channels/:type/:id/call", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/channels/:type/:id/call"
payload = {
"id": "",
"options": {},
"type": "",
"user": {
"ban_expires": "",
"banned": False,
"id": "",
"invisible": False,
"language": "",
"push_notifications": {
"disabled": False,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/channels/:type/:id/call"
payload <- "{\n \"id\": \"\",\n \"options\": {},\n \"type\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/channels/:type/:id/call")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"id\": \"\",\n \"options\": {},\n \"type\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/channels/:type/:id/call') do |req|
req.body = "{\n \"id\": \"\",\n \"options\": {},\n \"type\": \"\",\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/channels/:type/:id/call";
let payload = json!({
"id": "",
"options": json!({}),
"type": "",
"user": json!({
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": json!({
"disabled": false,
"disabled_until": ""
}),
"revoke_tokens_issued_before": "",
"role": "",
"teams": ()
}),
"user_id": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/channels/:type/:id/call \
--header 'content-type: application/json' \
--data '{
"id": "",
"options": {},
"type": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
echo '{
"id": "",
"options": {},
"type": "",
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}' | \
http POST {{baseUrl}}/channels/:type/:id/call \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "id": "",\n "options": {},\n "type": "",\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n}' \
--output-document \
- {{baseUrl}}/channels/:type/:id/call
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"id": "",
"options": [],
"type": "",
"user": [
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": [
"disabled": false,
"disabled_until": ""
],
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
],
"user_id": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/channels/:type/:id/call")! 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
Get Call Token ()
{{baseUrl}}/calls/
BODY json
{
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/calls/");
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 \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/calls/" {:content-type :json
:form-params {:user {:ban_expires ""
:banned false
:id ""
:invisible false
:language ""
:push_notifications {:disabled false
:disabled_until ""}
:revoke_tokens_issued_before ""
:role ""
:teams []}
:user_id ""}})
require "http/client"
url = "{{baseUrl}}/calls/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/calls/"),
Content = new StringContent("{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/calls/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/calls/"
payload := strings.NewReader("{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/calls/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 296
{
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/calls/")
.setHeader("content-type", "application/json")
.setBody("{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/calls/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/calls/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/calls/")
.header("content-type", "application/json")
.body("{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
.asString();
const data = JSON.stringify({
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/calls/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/calls/',
headers: {'content-type': 'application/json'},
data: {
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/calls/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/calls/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/calls/")
.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/calls/',
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({
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/calls/',
headers: {'content-type': 'application/json'},
body: {
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/calls/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/calls/',
headers: {'content-type': 'application/json'},
data: {
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/calls/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"user": @{ @"ban_expires": @"", @"banned": @NO, @"id": @"", @"invisible": @NO, @"language": @"", @"push_notifications": @{ @"disabled": @NO, @"disabled_until": @"" }, @"revoke_tokens_issued_before": @"", @"role": @"", @"teams": @[ ] },
@"user_id": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/calls/"]
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}}/calls/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/calls/",
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([
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/calls/', [
'body' => '{
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/calls/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]));
$request->setRequestUrl('{{baseUrl}}/calls/');
$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}}/calls/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/calls/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/calls/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/calls/"
payload = {
"user": {
"ban_expires": "",
"banned": False,
"id": "",
"invisible": False,
"language": "",
"push_notifications": {
"disabled": False,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/calls/"
payload <- "{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/calls/")
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 \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/calls/') do |req|
req.body = "{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/calls/";
let payload = json!({
"user": json!({
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": json!({
"disabled": false,
"disabled_until": ""
}),
"revoke_tokens_issued_before": "",
"role": "",
"teams": ()
}),
"user_id": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/calls/ \
--header 'content-type: application/json' \
--data '{
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
echo '{
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}' | \
http POST {{baseUrl}}/calls/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n}' \
--output-document \
- {{baseUrl}}/calls/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"user": [
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": [
"disabled": false,
"disabled_until": ""
],
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
],
"user_id": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/calls/")! 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
Get Call Token (call_id)
{{baseUrl}}/calls/:call_id
QUERY PARAMS
call_id
BODY json
{
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/calls/:call_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 \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/calls/:call_id" {:content-type :json
:form-params {:user {:ban_expires ""
:banned false
:id ""
:invisible false
:language ""
:push_notifications {:disabled false
:disabled_until ""}
:revoke_tokens_issued_before ""
:role ""
:teams []}
:user_id ""}})
require "http/client"
url = "{{baseUrl}}/calls/:call_id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/calls/:call_id"),
Content = new StringContent("{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/calls/:call_id");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/calls/:call_id"
payload := strings.NewReader("{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/calls/:call_id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 296
{
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/calls/:call_id")
.setHeader("content-type", "application/json")
.setBody("{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/calls/:call_id"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/calls/:call_id")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/calls/:call_id")
.header("content-type", "application/json")
.body("{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
.asString();
const data = JSON.stringify({
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/calls/:call_id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/calls/:call_id',
headers: {'content-type': 'application/json'},
data: {
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/calls/:call_id';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/calls/:call_id',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/calls/:call_id")
.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/calls/:call_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({
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/calls/:call_id',
headers: {'content-type': 'application/json'},
body: {
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/calls/:call_id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {
disabled: false,
disabled_until: ''
},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/calls/:call_id',
headers: {'content-type': 'application/json'},
data: {
user: {
ban_expires: '',
banned: false,
id: '',
invisible: false,
language: '',
push_notifications: {disabled: false, disabled_until: ''},
revoke_tokens_issued_before: '',
role: '',
teams: []
},
user_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/calls/:call_id';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"user":{"ban_expires":"","banned":false,"id":"","invisible":false,"language":"","push_notifications":{"disabled":false,"disabled_until":""},"revoke_tokens_issued_before":"","role":"","teams":[]},"user_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"user": @{ @"ban_expires": @"", @"banned": @NO, @"id": @"", @"invisible": @NO, @"language": @"", @"push_notifications": @{ @"disabled": @NO, @"disabled_until": @"" }, @"revoke_tokens_issued_before": @"", @"role": @"", @"teams": @[ ] },
@"user_id": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/calls/:call_id"]
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}}/calls/:call_id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/calls/:call_id",
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([
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/calls/:call_id', [
'body' => '{
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/calls/:call_id');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'user' => [
'ban_expires' => '',
'banned' => null,
'id' => '',
'invisible' => null,
'language' => '',
'push_notifications' => [
'disabled' => null,
'disabled_until' => ''
],
'revoke_tokens_issued_before' => '',
'role' => '',
'teams' => [
]
],
'user_id' => ''
]));
$request->setRequestUrl('{{baseUrl}}/calls/:call_id');
$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}}/calls/:call_id' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/calls/:call_id' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/calls/:call_id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/calls/:call_id"
payload = {
"user": {
"ban_expires": "",
"banned": False,
"id": "",
"invisible": False,
"language": "",
"push_notifications": {
"disabled": False,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/calls/:call_id"
payload <- "{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/calls/:call_id")
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 \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/calls/:call_id') do |req|
req.body = "{\n \"user\": {\n \"ban_expires\": \"\",\n \"banned\": false,\n \"id\": \"\",\n \"invisible\": false,\n \"language\": \"\",\n \"push_notifications\": {\n \"disabled\": false,\n \"disabled_until\": \"\"\n },\n \"revoke_tokens_issued_before\": \"\",\n \"role\": \"\",\n \"teams\": []\n },\n \"user_id\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/calls/:call_id";
let payload = json!({
"user": json!({
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": json!({
"disabled": false,
"disabled_until": ""
}),
"revoke_tokens_issued_before": "",
"role": "",
"teams": ()
}),
"user_id": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/calls/:call_id \
--header 'content-type: application/json' \
--data '{
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}'
echo '{
"user": {
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": {
"disabled": false,
"disabled_until": ""
},
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
},
"user_id": ""
}' | \
http POST {{baseUrl}}/calls/:call_id \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "user": {\n "ban_expires": "",\n "banned": false,\n "id": "",\n "invisible": false,\n "language": "",\n "push_notifications": {\n "disabled": false,\n "disabled_until": ""\n },\n "revoke_tokens_issued_before": "",\n "role": "",\n "teams": []\n },\n "user_id": ""\n}' \
--output-document \
- {{baseUrl}}/calls/:call_id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"user": [
"ban_expires": "",
"banned": false,
"id": "",
"invisible": false,
"language": "",
"push_notifications": [
"disabled": false,
"disabled_until": ""
],
"revoke_tokens_issued_before": "",
"role": "",
"teams": []
],
"user_id": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/calls/:call_id")! 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()