POST https://{endpoint}/ (from MCDB given info)/webhookUrl

userId string
message object
IMMsg object
Authorization string Defaults to Bearer {token}
200
Response body:object
code double
Return coderesult object
Return resultmessage string
cid string
count double
total double
| Based URL | https://endpoint/(from MCDB given info)/webhookUrl |
|---|
LANGUAGE: Shell
curl --request POST \
--url 'https://endpoint/%20(from%20MCDB%20given%20info)/webhookUrl' \
--header 'Authorization: Bearer {token}' \
--header 'accept: application/json' \
--header 'content-type: application/json'
$ brew install httpie
http POST 'https://endpoint/%20(from%20MCDB%20given%20info)/webhookUrl' \
Authorization:'Bearer {token}' \
accept:application/json \
content-type:application/json
LANGUAGE: Node
$ npm install axios --save
import axios from 'axios';
const options = {
method: 'POST',
url: 'https://endpoint/%20(from%20MCDB%20given%20info)/webhookUrl',
headers: {
accept: 'application/json',
Authorization: 'Bearer {token}',
'content-type': 'application/json'
}
};
axios
.request(options)
.then(res => console.log(res.data))
.catch(err => console.error(err));
const url = 'https://endpoint/%20(from%20MCDB%20given%20info)/webhookUrl';
const options = {
method: 'POST',
headers: {
accept: 'application/json',
Authorization: 'Bearer {token}',
'content-type': 'application/json'
}
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));
const http = require('https');
const options = {
method: 'POST',
hostname: 'endpoint',
port: null,
path: '/%20(from%20MCDB%20given%20info)/webhookUrl',
headers: {
accept: 'application/json',
Authorization: 'Bearer {token}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const url = 'https://endpoint/%20(from%20MCDB%20given%20info)/webhookUrl';
const options = {
method: 'POST',
headers: {
accept: 'application/json',
Authorization: 'Bearer {token}',
'content-type': 'application/json'
}
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));
LANGUAGE: Ruby
require 'uri'
require 'net/http'
url = URI("https://endpoint/%20(from%20MCDB%20given%20info)/webhookUrl")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["accept"] = 'application/json'
request["Authorization"] = 'Bearer {token}'
request["content-type"] = 'application/json'
response = http.request(request)
puts response.read_body
LANGUAGE: PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://endpoint/%20(from%20MCDB%20given%20info)/webhookUrl",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer {token}",
"accept: application/json",
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
$ composer require guzzlehttp/guzzle
<?php
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://endpoint/%20(from%20MCDB%20given%20info)/webhookUrl', [
'headers' => [
'Authorization' => 'Bearer {token}',
'accept' => 'application/json',
'content-type' => 'application/json',
],
]);
echo $response->getBody();
LANGUAGE: Python
$ python -m pip install requests
import requests
url = "https://endpoint/%20(from%20MCDB%20given%20info)/webhookUrl"
headers = {
"accept": "application/json",
"Authorization": "Bearer {token}",
"content-type": "application/json"
}
response = requests.post(url, headers=headers)
print(response.text)
LANGUAGE: C
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://endpoint/%20(from%20MCDB%20given%20info)/webhookUrl");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "accept: application/json");
headers = curl_slist_append(headers, "Authorization: Bearer {token}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
LANGUAGE: C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("https://endpoint/%20(from%20MCDB%20given%20info)/webhookUrl"),
Headers =
{
{ "accept", "application/json" },
{ "Authorization", "Bearer {token}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
$ dotnet add package RestSharp
using RestSharp;
var options = new RestClientOptions("https://endpoint/%20(from%20MCDB%20given%20info)/webhookUrl");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("accept", "application/json");
request.AddHeader("Authorization", "Bearer {token}");
request.AddHeader("content-type", "application/json");
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
LANGUAGE: C++
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://endpoint/%20(from%20MCDB%20given%20info)/webhookUrl");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "accept: application/json");
headers = curl_slist_append(headers, "Authorization: Bearer {token}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
LANGUAGE: Clojure
(require '[clj-http.client :as client])
(client/post "https://endpoint/%20(from%20MCDB%20given%20info)/webhookUrl" {:headers {:Authorization "Bearer {token}"}
:content-type :json
:accept :json})
LANGUAGE: Go
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://endpoint/%20(from%20MCDB%20given%20info)/webhookUrl"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("accept", "application/json")
req.Header.Add("Authorization", "Bearer {token}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
LANGUAGE: HTTP
POST /%20(from%20MCDB%20given%20info)/webhookUrl HTTP/1.1
Accept: application/json
Authorization: Bearer {token}
Content-Type: application/json
Host: endpoint
LANGUAGE: Java
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "https://endpoint/%20(from%20MCDB%20given%20info)/webhookUrl")
.setHeader("accept", "application/json")
.setHeader("Authorization", "Bearer {token}")
.setHeader("content-type", "application/json")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://endpoint/%20(from%20MCDB%20given%20info)/webhookUrl"))
.header("accept", "application/json")
.header("Authorization", "Bearer {token}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://endpoint/%20(from%20MCDB%20given%20info)/webhookUrl")
.post(null)
.addHeader("accept", "application/json")
.addHeader("Authorization", "Bearer {token}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse<String> response = Unirest.post("https://endpoint/%20(from%20MCDB%20given%20info)/webhookUrl")
.header("accept", "application/json")
.header("Authorization", "Bearer {token}")
.header("content-type", "application/json")
.asString();
LANGUAGE: JavaScript
$ npm install axios --save
import axios from 'axios';
const options = {
method: 'POST',
url: 'https://endpoint/%20(from%20MCDB%20given%20info)/webhookUrl',
headers: {
accept: 'application/json',
Authorization: 'Bearer {token}',
'content-type': 'application/json'
}
};
axios
.request(options)
.then(res => console.log(res.data))
.catch(err => console.error(err));
const options = {
method: 'POST',
headers: {
accept: 'application/json',
Authorization: 'Bearer {token}',
'content-type': 'application/json'
}
};
fetch('https://endpoint/%20(from%20MCDB%20given%20info)/webhookUrl', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
const settings = {
async: true,
crossDomain: true,
url: 'https://endpoint/%20(from%20MCDB%20given%20info)/webhookUrl',
method: 'POST',
headers: {
accept: 'application/json',
Authorization: 'Bearer {token}',
'content-type': 'application/json'
},
processData: false,
data: undefined
};
$.ajax(settings).done(res => {
console.log(res);
});
const data = JSON.stringify(undefined);
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', 'https://endpoint/%20(from%20MCDB%20given%20info)/webhookUrl');
xhr.setRequestHeader('accept', 'application/json');
xhr.setRequestHeader('Authorization', 'Bearer {token}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
LANGUAGE: JSON
No JSON body
LANGUAGE: Kotlin
val client = OkHttpClient()
val request = Request.Builder()
.url("https://endpoint/%20(from%20MCDB%20given%20info)/webhookUrl")
.post(null)
.addHeader("accept", "application/json")
.addHeader("Authorization", "Bearer {token}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
LANGUAGE: Objectve-C
#import <Foundation/Foundation.h>
NSDictionary *headers = @{ @"accept": @"application/json",
@"Authorization": @"Bearer {token}",
@"content-type": @"application/json" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://endpoint/%20(from%20MCDB%20given%20info)/webhookUrl"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
LANGUAGE: OCaml
$ opam install cohttp-lwt-unix cohttp-async
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "https://endpoint/%20(from%20MCDB%20given%20info)/webhookUrl" in
let headers = Header.add_list (Header.init ()) [
("accept", "application/json");
("Authorization", "Bearer {token}");
("content-type", "application/json");
] in
Client.call ~headers `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
LANGUAGE: PowerShell
$headers=@{}
$headers.Add("accept", "application/json")
$headers.Add("Authorization", "Bearer {token}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri 'https://endpoint/%20(from%20MCDB%20given%20info)/webhookUrl' -Method POST -Headers $headers
$headers=@{}
$headers.Add("accept", "application/json")
$headers.Add("Authorization", "Bearer {token}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri 'https://endpoint/%20(from%20MCDB%20given%20info)/webhookUrl' -Method POST -Headers $headers
LANGUAGE: R
library(httr)
url <- "https://endpoint/%20(from%20MCDB%20given%20info)/webhookUrl"
response <- VERB("POST", url, add_headers('Authorization' = 'Bearer {token}'), content_type("application/json"), accept("application/json"))
content(response, "text")
LANGUAGE: Swift
import Foundation
let url = URL(string: "https://endpoint/%20(from%20MCDB%20given%20info)/webhookUrl")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.timeoutInterval = 10
request.allHTTPHeaderFields = [
"accept": "application/json",
"Authorization": "Bearer {token}",
"content-type": "application/json"
]
let (data, _) = try await URLSession.shared.data(for: request)
print(String(decoding: data, as: UTF8.self))
RESPONSE: 200-Result
{
"code": 0
}