Platform API
POST
Request an access token
{{baseUrl}}/keys/:keyName/requestToken
QUERY PARAMS
keyName
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/keys/:keyName/requestToken");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"capability\": {\n \"channel1\": [\n \"publish\",\n \"subscribe\"\n ],\n \"wildcard:channels:*\": [\n \"publish\"\n ]\n },\n \"keyName\": \"YourKey.Name\",\n \"timestamp\": \"1559124196551\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/keys/:keyName/requestToken" {:content-type :json
:form-params {:capability {:channel1 ["publish" "subscribe"]
:wildcard:channels:* ["publish"]}
:keyName "YourKey.Name"
:timestamp "1559124196551"}})
require "http/client"
url = "{{baseUrl}}/keys/:keyName/requestToken"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"capability\": {\n \"channel1\": [\n \"publish\",\n \"subscribe\"\n ],\n \"wildcard:channels:*\": [\n \"publish\"\n ]\n },\n \"keyName\": \"YourKey.Name\",\n \"timestamp\": \"1559124196551\"\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}}/keys/:keyName/requestToken"),
Content = new StringContent("{\n \"capability\": {\n \"channel1\": [\n \"publish\",\n \"subscribe\"\n ],\n \"wildcard:channels:*\": [\n \"publish\"\n ]\n },\n \"keyName\": \"YourKey.Name\",\n \"timestamp\": \"1559124196551\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/keys/:keyName/requestToken");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"capability\": {\n \"channel1\": [\n \"publish\",\n \"subscribe\"\n ],\n \"wildcard:channels:*\": [\n \"publish\"\n ]\n },\n \"keyName\": \"YourKey.Name\",\n \"timestamp\": \"1559124196551\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/keys/:keyName/requestToken"
payload := strings.NewReader("{\n \"capability\": {\n \"channel1\": [\n \"publish\",\n \"subscribe\"\n ],\n \"wildcard:channels:*\": [\n \"publish\"\n ]\n },\n \"keyName\": \"YourKey.Name\",\n \"timestamp\": \"1559124196551\"\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/keys/:keyName/requestToken HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 197
{
"capability": {
"channel1": [
"publish",
"subscribe"
],
"wildcard:channels:*": [
"publish"
]
},
"keyName": "YourKey.Name",
"timestamp": "1559124196551"
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/keys/:keyName/requestToken")
.setHeader("content-type", "application/json")
.setBody("{\n \"capability\": {\n \"channel1\": [\n \"publish\",\n \"subscribe\"\n ],\n \"wildcard:channels:*\": [\n \"publish\"\n ]\n },\n \"keyName\": \"YourKey.Name\",\n \"timestamp\": \"1559124196551\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/keys/:keyName/requestToken"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"capability\": {\n \"channel1\": [\n \"publish\",\n \"subscribe\"\n ],\n \"wildcard:channels:*\": [\n \"publish\"\n ]\n },\n \"keyName\": \"YourKey.Name\",\n \"timestamp\": \"1559124196551\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"capability\": {\n \"channel1\": [\n \"publish\",\n \"subscribe\"\n ],\n \"wildcard:channels:*\": [\n \"publish\"\n ]\n },\n \"keyName\": \"YourKey.Name\",\n \"timestamp\": \"1559124196551\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/keys/:keyName/requestToken")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/keys/:keyName/requestToken")
.header("content-type", "application/json")
.body("{\n \"capability\": {\n \"channel1\": [\n \"publish\",\n \"subscribe\"\n ],\n \"wildcard:channels:*\": [\n \"publish\"\n ]\n },\n \"keyName\": \"YourKey.Name\",\n \"timestamp\": \"1559124196551\"\n}")
.asString();
const data = JSON.stringify({
capability: {
channel1: [
'publish',
'subscribe'
],
'wildcard:channels:*': [
'publish'
]
},
keyName: 'YourKey.Name',
timestamp: '1559124196551'
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/keys/:keyName/requestToken');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/keys/:keyName/requestToken',
headers: {'content-type': 'application/json'},
data: {
capability: {channel1: ['publish', 'subscribe'], 'wildcard:channels:*': ['publish']},
keyName: 'YourKey.Name',
timestamp: '1559124196551'
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/keys/:keyName/requestToken';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"capability":{"channel1":["publish","subscribe"],"wildcard:channels:*":["publish"]},"keyName":"YourKey.Name","timestamp":"1559124196551"}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/keys/:keyName/requestToken',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "capability": {\n "channel1": [\n "publish",\n "subscribe"\n ],\n "wildcard:channels:*": [\n "publish"\n ]\n },\n "keyName": "YourKey.Name",\n "timestamp": "1559124196551"\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"capability\": {\n \"channel1\": [\n \"publish\",\n \"subscribe\"\n ],\n \"wildcard:channels:*\": [\n \"publish\"\n ]\n },\n \"keyName\": \"YourKey.Name\",\n \"timestamp\": \"1559124196551\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/keys/:keyName/requestToken")
.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/keys/:keyName/requestToken',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
capability: {channel1: ['publish', 'subscribe'], 'wildcard:channels:*': ['publish']},
keyName: 'YourKey.Name',
timestamp: '1559124196551'
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/keys/:keyName/requestToken',
headers: {'content-type': 'application/json'},
body: {
capability: {channel1: ['publish', 'subscribe'], 'wildcard:channels:*': ['publish']},
keyName: 'YourKey.Name',
timestamp: '1559124196551'
},
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}}/keys/:keyName/requestToken');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
capability: {
channel1: [
'publish',
'subscribe'
],
'wildcard:channels:*': [
'publish'
]
},
keyName: 'YourKey.Name',
timestamp: '1559124196551'
});
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}}/keys/:keyName/requestToken',
headers: {'content-type': 'application/json'},
data: {
capability: {channel1: ['publish', 'subscribe'], 'wildcard:channels:*': ['publish']},
keyName: 'YourKey.Name',
timestamp: '1559124196551'
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/keys/:keyName/requestToken';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"capability":{"channel1":["publish","subscribe"],"wildcard:channels:*":["publish"]},"keyName":"YourKey.Name","timestamp":"1559124196551"}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"capability": @{ @"channel1": @[ @"publish", @"subscribe" ], @"wildcard:channels:*": @[ @"publish" ] },
@"keyName": @"YourKey.Name",
@"timestamp": @"1559124196551" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/keys/:keyName/requestToken"]
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}}/keys/:keyName/requestToken" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"capability\": {\n \"channel1\": [\n \"publish\",\n \"subscribe\"\n ],\n \"wildcard:channels:*\": [\n \"publish\"\n ]\n },\n \"keyName\": \"YourKey.Name\",\n \"timestamp\": \"1559124196551\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/keys/:keyName/requestToken",
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([
'capability' => [
'channel1' => [
'publish',
'subscribe'
],
'wildcard:channels:*' => [
'publish'
]
],
'keyName' => 'YourKey.Name',
'timestamp' => '1559124196551'
]),
CURLOPT_HTTPHEADER => [
"content-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}}/keys/:keyName/requestToken', [
'body' => '{
"capability": {
"channel1": [
"publish",
"subscribe"
],
"wildcard:channels:*": [
"publish"
]
},
"keyName": "YourKey.Name",
"timestamp": "1559124196551"
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/keys/:keyName/requestToken');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'capability' => [
'channel1' => [
'publish',
'subscribe'
],
'wildcard:channels:*' => [
'publish'
]
],
'keyName' => 'YourKey.Name',
'timestamp' => '1559124196551'
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'capability' => [
'channel1' => [
'publish',
'subscribe'
],
'wildcard:channels:*' => [
'publish'
]
],
'keyName' => 'YourKey.Name',
'timestamp' => '1559124196551'
]));
$request->setRequestUrl('{{baseUrl}}/keys/:keyName/requestToken');
$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}}/keys/:keyName/requestToken' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"capability": {
"channel1": [
"publish",
"subscribe"
],
"wildcard:channels:*": [
"publish"
]
},
"keyName": "YourKey.Name",
"timestamp": "1559124196551"
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/keys/:keyName/requestToken' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"capability": {
"channel1": [
"publish",
"subscribe"
],
"wildcard:channels:*": [
"publish"
]
},
"keyName": "YourKey.Name",
"timestamp": "1559124196551"
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"capability\": {\n \"channel1\": [\n \"publish\",\n \"subscribe\"\n ],\n \"wildcard:channels:*\": [\n \"publish\"\n ]\n },\n \"keyName\": \"YourKey.Name\",\n \"timestamp\": \"1559124196551\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/keys/:keyName/requestToken", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/keys/:keyName/requestToken"
payload = {
"capability": {
"channel1": ["publish", "subscribe"],
"wildcard:channels:*": ["publish"]
},
"keyName": "YourKey.Name",
"timestamp": "1559124196551"
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/keys/:keyName/requestToken"
payload <- "{\n \"capability\": {\n \"channel1\": [\n \"publish\",\n \"subscribe\"\n ],\n \"wildcard:channels:*\": [\n \"publish\"\n ]\n },\n \"keyName\": \"YourKey.Name\",\n \"timestamp\": \"1559124196551\"\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}}/keys/:keyName/requestToken")
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 \"capability\": {\n \"channel1\": [\n \"publish\",\n \"subscribe\"\n ],\n \"wildcard:channels:*\": [\n \"publish\"\n ]\n },\n \"keyName\": \"YourKey.Name\",\n \"timestamp\": \"1559124196551\"\n}"
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/keys/:keyName/requestToken') do |req|
req.body = "{\n \"capability\": {\n \"channel1\": [\n \"publish\",\n \"subscribe\"\n ],\n \"wildcard:channels:*\": [\n \"publish\"\n ]\n },\n \"keyName\": \"YourKey.Name\",\n \"timestamp\": \"1559124196551\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/keys/:keyName/requestToken";
let payload = json!({
"capability": json!({
"channel1": ("publish", "subscribe"),
"wildcard:channels:*": ("publish")
}),
"keyName": "YourKey.Name",
"timestamp": "1559124196551"
});
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}}/keys/:keyName/requestToken \
--header 'content-type: application/json' \
--data '{
"capability": {
"channel1": [
"publish",
"subscribe"
],
"wildcard:channels:*": [
"publish"
]
},
"keyName": "YourKey.Name",
"timestamp": "1559124196551"
}'
echo '{
"capability": {
"channel1": [
"publish",
"subscribe"
],
"wildcard:channels:*": [
"publish"
]
},
"keyName": "YourKey.Name",
"timestamp": "1559124196551"
}' | \
http POST {{baseUrl}}/keys/:keyName/requestToken \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "capability": {\n "channel1": [\n "publish",\n "subscribe"\n ],\n "wildcard:channels:*": [\n "publish"\n ]\n },\n "keyName": "YourKey.Name",\n "timestamp": "1559124196551"\n}' \
--output-document \
- {{baseUrl}}/keys/:keyName/requestToken
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"capability": [
"channel1": ["publish", "subscribe"],
"wildcard:channels:*": ["publish"]
],
"keyName": "YourKey.Name",
"timestamp": "1559124196551"
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/keys/:keyName/requestToken")! 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 message history for a channel
{{baseUrl}}/channels/:channel_id/messages
QUERY PARAMS
channel_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/channels/:channel_id/messages");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/channels/:channel_id/messages")
require "http/client"
url = "{{baseUrl}}/channels/:channel_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/:channel_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/:channel_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/:channel_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/:channel_id/messages HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/channels/:channel_id/messages")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/channels/:channel_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/:channel_id/messages")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/channels/:channel_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/:channel_id/messages');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/channels/:channel_id/messages'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/channels/:channel_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/:channel_id/messages',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/channels/:channel_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/:channel_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/:channel_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/:channel_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/:channel_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/:channel_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/:channel_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/:channel_id/messages" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/channels/:channel_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/:channel_id/messages');
echo $response->getBody();
setUrl('{{baseUrl}}/channels/:channel_id/messages');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/channels/:channel_id/messages');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/channels/:channel_id/messages' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/channels/:channel_id/messages' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/channels/:channel_id/messages")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/channels/:channel_id/messages"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/channels/:channel_id/messages"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/channels/:channel_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/:channel_id/messages') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/channels/:channel_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/:channel_id/messages
http GET {{baseUrl}}/channels/:channel_id/messages
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/channels/:channel_id/messages
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/channels/:channel_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 presence history of a channel
{{baseUrl}}/channels/:channel_id/presence/history
QUERY PARAMS
channel_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/channels/:channel_id/presence/history");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/channels/:channel_id/presence/history")
require "http/client"
url = "{{baseUrl}}/channels/:channel_id/presence/history"
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/:channel_id/presence/history"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/channels/:channel_id/presence/history");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/channels/:channel_id/presence/history"
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/:channel_id/presence/history HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/channels/:channel_id/presence/history")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/channels/:channel_id/presence/history"))
.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/:channel_id/presence/history")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/channels/:channel_id/presence/history")
.asString();
const 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/:channel_id/presence/history');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/channels/:channel_id/presence/history'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/channels/:channel_id/presence/history';
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/:channel_id/presence/history',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/channels/:channel_id/presence/history")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/channels/:channel_id/presence/history',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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/:channel_id/presence/history'
};
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/:channel_id/presence/history');
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/:channel_id/presence/history'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/channels/:channel_id/presence/history';
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/:channel_id/presence/history"]
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/:channel_id/presence/history" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/channels/:channel_id/presence/history",
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/:channel_id/presence/history');
echo $response->getBody();
setUrl('{{baseUrl}}/channels/:channel_id/presence/history');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/channels/:channel_id/presence/history');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/channels/:channel_id/presence/history' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/channels/:channel_id/presence/history' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/channels/:channel_id/presence/history")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/channels/:channel_id/presence/history"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/channels/:channel_id/presence/history"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/channels/:channel_id/presence/history")
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/:channel_id/presence/history') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/channels/:channel_id/presence/history";
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/:channel_id/presence/history
http GET {{baseUrl}}/channels/:channel_id/presence/history
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/channels/:channel_id/presence/history
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/channels/:channel_id/presence/history")! 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
Publish a message to a channel
{{baseUrl}}/channels/:channel_id/messages
QUERY PARAMS
channel_id
BODY json
{
"clientId": "",
"connectionId": "",
"data": "",
"encoding": "",
"extras": {
"push": {
"apns": {
"notification": {
"body": "",
"collapseKey": "",
"icon": "",
"sound": "",
"title": ""
}
},
"data": "",
"fcm": {
"notification": {}
},
"notification": {},
"web": {
"notification": {}
}
}
},
"id": "",
"name": "",
"timestamp": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/channels/:channel_id/messages");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"clientId\": \"\",\n \"connectionId\": \"\",\n \"data\": \"\",\n \"encoding\": \"\",\n \"extras\": {\n \"push\": {\n \"apns\": {\n \"notification\": {\n \"body\": \"\",\n \"collapseKey\": \"\",\n \"icon\": \"\",\n \"sound\": \"\",\n \"title\": \"\"\n }\n },\n \"data\": \"\",\n \"fcm\": {\n \"notification\": {}\n },\n \"notification\": {},\n \"web\": {\n \"notification\": {}\n }\n }\n },\n \"id\": \"\",\n \"name\": \"\",\n \"timestamp\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/channels/:channel_id/messages" {:content-type :json
:form-params {:clientId ""
:connectionId ""
:data ""
:encoding ""
:extras {:push {:apns {:notification {:body ""
:collapseKey ""
:icon ""
:sound ""
:title ""}}
:data ""
:fcm {:notification {}}
:notification {}
:web {:notification {}}}}
:id ""
:name ""
:timestamp 0}})
require "http/client"
url = "{{baseUrl}}/channels/:channel_id/messages"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"clientId\": \"\",\n \"connectionId\": \"\",\n \"data\": \"\",\n \"encoding\": \"\",\n \"extras\": {\n \"push\": {\n \"apns\": {\n \"notification\": {\n \"body\": \"\",\n \"collapseKey\": \"\",\n \"icon\": \"\",\n \"sound\": \"\",\n \"title\": \"\"\n }\n },\n \"data\": \"\",\n \"fcm\": {\n \"notification\": {}\n },\n \"notification\": {},\n \"web\": {\n \"notification\": {}\n }\n }\n },\n \"id\": \"\",\n \"name\": \"\",\n \"timestamp\": 0\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/channels/:channel_id/messages"),
Content = new StringContent("{\n \"clientId\": \"\",\n \"connectionId\": \"\",\n \"data\": \"\",\n \"encoding\": \"\",\n \"extras\": {\n \"push\": {\n \"apns\": {\n \"notification\": {\n \"body\": \"\",\n \"collapseKey\": \"\",\n \"icon\": \"\",\n \"sound\": \"\",\n \"title\": \"\"\n }\n },\n \"data\": \"\",\n \"fcm\": {\n \"notification\": {}\n },\n \"notification\": {},\n \"web\": {\n \"notification\": {}\n }\n }\n },\n \"id\": \"\",\n \"name\": \"\",\n \"timestamp\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/channels/:channel_id/messages");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"clientId\": \"\",\n \"connectionId\": \"\",\n \"data\": \"\",\n \"encoding\": \"\",\n \"extras\": {\n \"push\": {\n \"apns\": {\n \"notification\": {\n \"body\": \"\",\n \"collapseKey\": \"\",\n \"icon\": \"\",\n \"sound\": \"\",\n \"title\": \"\"\n }\n },\n \"data\": \"\",\n \"fcm\": {\n \"notification\": {}\n },\n \"notification\": {},\n \"web\": {\n \"notification\": {}\n }\n }\n },\n \"id\": \"\",\n \"name\": \"\",\n \"timestamp\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/channels/:channel_id/messages"
payload := strings.NewReader("{\n \"clientId\": \"\",\n \"connectionId\": \"\",\n \"data\": \"\",\n \"encoding\": \"\",\n \"extras\": {\n \"push\": {\n \"apns\": {\n \"notification\": {\n \"body\": \"\",\n \"collapseKey\": \"\",\n \"icon\": \"\",\n \"sound\": \"\",\n \"title\": \"\"\n }\n },\n \"data\": \"\",\n \"fcm\": {\n \"notification\": {}\n },\n \"notification\": {},\n \"web\": {\n \"notification\": {}\n }\n }\n },\n \"id\": \"\",\n \"name\": \"\",\n \"timestamp\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/channels/:channel_id/messages HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 481
{
"clientId": "",
"connectionId": "",
"data": "",
"encoding": "",
"extras": {
"push": {
"apns": {
"notification": {
"body": "",
"collapseKey": "",
"icon": "",
"sound": "",
"title": ""
}
},
"data": "",
"fcm": {
"notification": {}
},
"notification": {},
"web": {
"notification": {}
}
}
},
"id": "",
"name": "",
"timestamp": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/channels/:channel_id/messages")
.setHeader("content-type", "application/json")
.setBody("{\n \"clientId\": \"\",\n \"connectionId\": \"\",\n \"data\": \"\",\n \"encoding\": \"\",\n \"extras\": {\n \"push\": {\n \"apns\": {\n \"notification\": {\n \"body\": \"\",\n \"collapseKey\": \"\",\n \"icon\": \"\",\n \"sound\": \"\",\n \"title\": \"\"\n }\n },\n \"data\": \"\",\n \"fcm\": {\n \"notification\": {}\n },\n \"notification\": {},\n \"web\": {\n \"notification\": {}\n }\n }\n },\n \"id\": \"\",\n \"name\": \"\",\n \"timestamp\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/channels/:channel_id/messages"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"clientId\": \"\",\n \"connectionId\": \"\",\n \"data\": \"\",\n \"encoding\": \"\",\n \"extras\": {\n \"push\": {\n \"apns\": {\n \"notification\": {\n \"body\": \"\",\n \"collapseKey\": \"\",\n \"icon\": \"\",\n \"sound\": \"\",\n \"title\": \"\"\n }\n },\n \"data\": \"\",\n \"fcm\": {\n \"notification\": {}\n },\n \"notification\": {},\n \"web\": {\n \"notification\": {}\n }\n }\n },\n \"id\": \"\",\n \"name\": \"\",\n \"timestamp\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"clientId\": \"\",\n \"connectionId\": \"\",\n \"data\": \"\",\n \"encoding\": \"\",\n \"extras\": {\n \"push\": {\n \"apns\": {\n \"notification\": {\n \"body\": \"\",\n \"collapseKey\": \"\",\n \"icon\": \"\",\n \"sound\": \"\",\n \"title\": \"\"\n }\n },\n \"data\": \"\",\n \"fcm\": {\n \"notification\": {}\n },\n \"notification\": {},\n \"web\": {\n \"notification\": {}\n }\n }\n },\n \"id\": \"\",\n \"name\": \"\",\n \"timestamp\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/channels/:channel_id/messages")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/channels/:channel_id/messages")
.header("content-type", "application/json")
.body("{\n \"clientId\": \"\",\n \"connectionId\": \"\",\n \"data\": \"\",\n \"encoding\": \"\",\n \"extras\": {\n \"push\": {\n \"apns\": {\n \"notification\": {\n \"body\": \"\",\n \"collapseKey\": \"\",\n \"icon\": \"\",\n \"sound\": \"\",\n \"title\": \"\"\n }\n },\n \"data\": \"\",\n \"fcm\": {\n \"notification\": {}\n },\n \"notification\": {},\n \"web\": {\n \"notification\": {}\n }\n }\n },\n \"id\": \"\",\n \"name\": \"\",\n \"timestamp\": 0\n}")
.asString();
const data = JSON.stringify({
clientId: '',
connectionId: '',
data: '',
encoding: '',
extras: {
push: {
apns: {
notification: {
body: '',
collapseKey: '',
icon: '',
sound: '',
title: ''
}
},
data: '',
fcm: {
notification: {}
},
notification: {},
web: {
notification: {}
}
}
},
id: '',
name: '',
timestamp: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/channels/:channel_id/messages');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:channel_id/messages',
headers: {'content-type': 'application/json'},
data: {
clientId: '',
connectionId: '',
data: '',
encoding: '',
extras: {
push: {
apns: {notification: {body: '', collapseKey: '', icon: '', sound: '', title: ''}},
data: '',
fcm: {notification: {}},
notification: {},
web: {notification: {}}
}
},
id: '',
name: '',
timestamp: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/channels/:channel_id/messages';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"clientId":"","connectionId":"","data":"","encoding":"","extras":{"push":{"apns":{"notification":{"body":"","collapseKey":"","icon":"","sound":"","title":""}},"data":"","fcm":{"notification":{}},"notification":{},"web":{"notification":{}}}},"id":"","name":"","timestamp":0}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/channels/:channel_id/messages',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "clientId": "",\n "connectionId": "",\n "data": "",\n "encoding": "",\n "extras": {\n "push": {\n "apns": {\n "notification": {\n "body": "",\n "collapseKey": "",\n "icon": "",\n "sound": "",\n "title": ""\n }\n },\n "data": "",\n "fcm": {\n "notification": {}\n },\n "notification": {},\n "web": {\n "notification": {}\n }\n }\n },\n "id": "",\n "name": "",\n "timestamp": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"clientId\": \"\",\n \"connectionId\": \"\",\n \"data\": \"\",\n \"encoding\": \"\",\n \"extras\": {\n \"push\": {\n \"apns\": {\n \"notification\": {\n \"body\": \"\",\n \"collapseKey\": \"\",\n \"icon\": \"\",\n \"sound\": \"\",\n \"title\": \"\"\n }\n },\n \"data\": \"\",\n \"fcm\": {\n \"notification\": {}\n },\n \"notification\": {},\n \"web\": {\n \"notification\": {}\n }\n }\n },\n \"id\": \"\",\n \"name\": \"\",\n \"timestamp\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/channels/:channel_id/messages")
.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/:channel_id/messages',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
clientId: '',
connectionId: '',
data: '',
encoding: '',
extras: {
push: {
apns: {notification: {body: '', collapseKey: '', icon: '', sound: '', title: ''}},
data: '',
fcm: {notification: {}},
notification: {},
web: {notification: {}}
}
},
id: '',
name: '',
timestamp: 0
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:channel_id/messages',
headers: {'content-type': 'application/json'},
body: {
clientId: '',
connectionId: '',
data: '',
encoding: '',
extras: {
push: {
apns: {notification: {body: '', collapseKey: '', icon: '', sound: '', title: ''}},
data: '',
fcm: {notification: {}},
notification: {},
web: {notification: {}}
}
},
id: '',
name: '',
timestamp: 0
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/channels/:channel_id/messages');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
clientId: '',
connectionId: '',
data: '',
encoding: '',
extras: {
push: {
apns: {
notification: {
body: '',
collapseKey: '',
icon: '',
sound: '',
title: ''
}
},
data: '',
fcm: {
notification: {}
},
notification: {},
web: {
notification: {}
}
}
},
id: '',
name: '',
timestamp: 0
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/channels/:channel_id/messages',
headers: {'content-type': 'application/json'},
data: {
clientId: '',
connectionId: '',
data: '',
encoding: '',
extras: {
push: {
apns: {notification: {body: '', collapseKey: '', icon: '', sound: '', title: ''}},
data: '',
fcm: {notification: {}},
notification: {},
web: {notification: {}}
}
},
id: '',
name: '',
timestamp: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/channels/:channel_id/messages';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"clientId":"","connectionId":"","data":"","encoding":"","extras":{"push":{"apns":{"notification":{"body":"","collapseKey":"","icon":"","sound":"","title":""}},"data":"","fcm":{"notification":{}},"notification":{},"web":{"notification":{}}}},"id":"","name":"","timestamp":0}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"clientId": @"",
@"connectionId": @"",
@"data": @"",
@"encoding": @"",
@"extras": @{ @"push": @{ @"apns": @{ @"notification": @{ @"body": @"", @"collapseKey": @"", @"icon": @"", @"sound": @"", @"title": @"" } }, @"data": @"", @"fcm": @{ @"notification": @{ } }, @"notification": @{ }, @"web": @{ @"notification": @{ } } } },
@"id": @"",
@"name": @"",
@"timestamp": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/channels/:channel_id/messages"]
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/:channel_id/messages" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"clientId\": \"\",\n \"connectionId\": \"\",\n \"data\": \"\",\n \"encoding\": \"\",\n \"extras\": {\n \"push\": {\n \"apns\": {\n \"notification\": {\n \"body\": \"\",\n \"collapseKey\": \"\",\n \"icon\": \"\",\n \"sound\": \"\",\n \"title\": \"\"\n }\n },\n \"data\": \"\",\n \"fcm\": {\n \"notification\": {}\n },\n \"notification\": {},\n \"web\": {\n \"notification\": {}\n }\n }\n },\n \"id\": \"\",\n \"name\": \"\",\n \"timestamp\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/channels/:channel_id/messages",
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([
'clientId' => '',
'connectionId' => '',
'data' => '',
'encoding' => '',
'extras' => [
'push' => [
'apns' => [
'notification' => [
'body' => '',
'collapseKey' => '',
'icon' => '',
'sound' => '',
'title' => ''
]
],
'data' => '',
'fcm' => [
'notification' => [
]
],
'notification' => [
],
'web' => [
'notification' => [
]
]
]
],
'id' => '',
'name' => '',
'timestamp' => 0
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/channels/:channel_id/messages', [
'body' => '{
"clientId": "",
"connectionId": "",
"data": "",
"encoding": "",
"extras": {
"push": {
"apns": {
"notification": {
"body": "",
"collapseKey": "",
"icon": "",
"sound": "",
"title": ""
}
},
"data": "",
"fcm": {
"notification": {}
},
"notification": {},
"web": {
"notification": {}
}
}
},
"id": "",
"name": "",
"timestamp": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/channels/:channel_id/messages');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'clientId' => '',
'connectionId' => '',
'data' => '',
'encoding' => '',
'extras' => [
'push' => [
'apns' => [
'notification' => [
'body' => '',
'collapseKey' => '',
'icon' => '',
'sound' => '',
'title' => ''
]
],
'data' => '',
'fcm' => [
'notification' => [
]
],
'notification' => [
],
'web' => [
'notification' => [
]
]
]
],
'id' => '',
'name' => '',
'timestamp' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'clientId' => '',
'connectionId' => '',
'data' => '',
'encoding' => '',
'extras' => [
'push' => [
'apns' => [
'notification' => [
'body' => '',
'collapseKey' => '',
'icon' => '',
'sound' => '',
'title' => ''
]
],
'data' => '',
'fcm' => [
'notification' => [
]
],
'notification' => [
],
'web' => [
'notification' => [
]
]
]
],
'id' => '',
'name' => '',
'timestamp' => 0
]));
$request->setRequestUrl('{{baseUrl}}/channels/:channel_id/messages');
$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/:channel_id/messages' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"clientId": "",
"connectionId": "",
"data": "",
"encoding": "",
"extras": {
"push": {
"apns": {
"notification": {
"body": "",
"collapseKey": "",
"icon": "",
"sound": "",
"title": ""
}
},
"data": "",
"fcm": {
"notification": {}
},
"notification": {},
"web": {
"notification": {}
}
}
},
"id": "",
"name": "",
"timestamp": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/channels/:channel_id/messages' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"clientId": "",
"connectionId": "",
"data": "",
"encoding": "",
"extras": {
"push": {
"apns": {
"notification": {
"body": "",
"collapseKey": "",
"icon": "",
"sound": "",
"title": ""
}
},
"data": "",
"fcm": {
"notification": {}
},
"notification": {},
"web": {
"notification": {}
}
}
},
"id": "",
"name": "",
"timestamp": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"clientId\": \"\",\n \"connectionId\": \"\",\n \"data\": \"\",\n \"encoding\": \"\",\n \"extras\": {\n \"push\": {\n \"apns\": {\n \"notification\": {\n \"body\": \"\",\n \"collapseKey\": \"\",\n \"icon\": \"\",\n \"sound\": \"\",\n \"title\": \"\"\n }\n },\n \"data\": \"\",\n \"fcm\": {\n \"notification\": {}\n },\n \"notification\": {},\n \"web\": {\n \"notification\": {}\n }\n }\n },\n \"id\": \"\",\n \"name\": \"\",\n \"timestamp\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/channels/:channel_id/messages", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/channels/:channel_id/messages"
payload = {
"clientId": "",
"connectionId": "",
"data": "",
"encoding": "",
"extras": { "push": {
"apns": { "notification": {
"body": "",
"collapseKey": "",
"icon": "",
"sound": "",
"title": ""
} },
"data": "",
"fcm": { "notification": {} },
"notification": {},
"web": { "notification": {} }
} },
"id": "",
"name": "",
"timestamp": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/channels/:channel_id/messages"
payload <- "{\n \"clientId\": \"\",\n \"connectionId\": \"\",\n \"data\": \"\",\n \"encoding\": \"\",\n \"extras\": {\n \"push\": {\n \"apns\": {\n \"notification\": {\n \"body\": \"\",\n \"collapseKey\": \"\",\n \"icon\": \"\",\n \"sound\": \"\",\n \"title\": \"\"\n }\n },\n \"data\": \"\",\n \"fcm\": {\n \"notification\": {}\n },\n \"notification\": {},\n \"web\": {\n \"notification\": {}\n }\n }\n },\n \"id\": \"\",\n \"name\": \"\",\n \"timestamp\": 0\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/channels/:channel_id/messages")
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 \"clientId\": \"\",\n \"connectionId\": \"\",\n \"data\": \"\",\n \"encoding\": \"\",\n \"extras\": {\n \"push\": {\n \"apns\": {\n \"notification\": {\n \"body\": \"\",\n \"collapseKey\": \"\",\n \"icon\": \"\",\n \"sound\": \"\",\n \"title\": \"\"\n }\n },\n \"data\": \"\",\n \"fcm\": {\n \"notification\": {}\n },\n \"notification\": {},\n \"web\": {\n \"notification\": {}\n }\n }\n },\n \"id\": \"\",\n \"name\": \"\",\n \"timestamp\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/channels/:channel_id/messages') do |req|
req.body = "{\n \"clientId\": \"\",\n \"connectionId\": \"\",\n \"data\": \"\",\n \"encoding\": \"\",\n \"extras\": {\n \"push\": {\n \"apns\": {\n \"notification\": {\n \"body\": \"\",\n \"collapseKey\": \"\",\n \"icon\": \"\",\n \"sound\": \"\",\n \"title\": \"\"\n }\n },\n \"data\": \"\",\n \"fcm\": {\n \"notification\": {}\n },\n \"notification\": {},\n \"web\": {\n \"notification\": {}\n }\n }\n },\n \"id\": \"\",\n \"name\": \"\",\n \"timestamp\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/channels/:channel_id/messages";
let payload = json!({
"clientId": "",
"connectionId": "",
"data": "",
"encoding": "",
"extras": json!({"push": json!({
"apns": json!({"notification": json!({
"body": "",
"collapseKey": "",
"icon": "",
"sound": "",
"title": ""
})}),
"data": "",
"fcm": json!({"notification": json!({})}),
"notification": json!({}),
"web": json!({"notification": json!({})})
})}),
"id": "",
"name": "",
"timestamp": 0
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/channels/:channel_id/messages \
--header 'content-type: application/json' \
--data '{
"clientId": "",
"connectionId": "",
"data": "",
"encoding": "",
"extras": {
"push": {
"apns": {
"notification": {
"body": "",
"collapseKey": "",
"icon": "",
"sound": "",
"title": ""
}
},
"data": "",
"fcm": {
"notification": {}
},
"notification": {},
"web": {
"notification": {}
}
}
},
"id": "",
"name": "",
"timestamp": 0
}'
echo '{
"clientId": "",
"connectionId": "",
"data": "",
"encoding": "",
"extras": {
"push": {
"apns": {
"notification": {
"body": "",
"collapseKey": "",
"icon": "",
"sound": "",
"title": ""
}
},
"data": "",
"fcm": {
"notification": {}
},
"notification": {},
"web": {
"notification": {}
}
}
},
"id": "",
"name": "",
"timestamp": 0
}' | \
http POST {{baseUrl}}/channels/:channel_id/messages \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "clientId": "",\n "connectionId": "",\n "data": "",\n "encoding": "",\n "extras": {\n "push": {\n "apns": {\n "notification": {\n "body": "",\n "collapseKey": "",\n "icon": "",\n "sound": "",\n "title": ""\n }\n },\n "data": "",\n "fcm": {\n "notification": {}\n },\n "notification": {},\n "web": {\n "notification": {}\n }\n }\n },\n "id": "",\n "name": "",\n "timestamp": 0\n}' \
--output-document \
- {{baseUrl}}/channels/:channel_id/messages
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"clientId": "",
"connectionId": "",
"data": "",
"encoding": "",
"extras": ["push": [
"apns": ["notification": [
"body": "",
"collapseKey": "",
"icon": "",
"sound": "",
"title": ""
]],
"data": "",
"fcm": ["notification": []],
"notification": [],
"web": ["notification": []]
]],
"id": "",
"name": "",
"timestamp": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/channels/:channel_id/messages")! 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 a registered device's update token
{{baseUrl}}/push/channelSubscriptions
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/push/channelSubscriptions");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/push/channelSubscriptions")
require "http/client"
url = "{{baseUrl}}/push/channelSubscriptions"
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/channelSubscriptions"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/push/channelSubscriptions");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/push/channelSubscriptions"
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/channelSubscriptions HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/push/channelSubscriptions")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/push/channelSubscriptions"))
.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/channelSubscriptions")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/push/channelSubscriptions")
.asString();
const 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/channelSubscriptions');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/push/channelSubscriptions'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/push/channelSubscriptions';
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/channelSubscriptions',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/push/channelSubscriptions")
.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/channelSubscriptions',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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/channelSubscriptions'};
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/channelSubscriptions');
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/channelSubscriptions'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/push/channelSubscriptions';
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/channelSubscriptions"]
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/channelSubscriptions" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/push/channelSubscriptions",
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/channelSubscriptions');
echo $response->getBody();
setUrl('{{baseUrl}}/push/channelSubscriptions');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/push/channelSubscriptions');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/push/channelSubscriptions' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/push/channelSubscriptions' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/push/channelSubscriptions")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/push/channelSubscriptions"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/push/channelSubscriptions"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/push/channelSubscriptions")
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/channelSubscriptions') 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/channelSubscriptions";
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/channelSubscriptions
http DELETE {{baseUrl}}/push/channelSubscriptions
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/push/channelSubscriptions
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/push/channelSubscriptions")! 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 a device registration
{{baseUrl}}/push/deviceRegistrations/:device_id
QUERY PARAMS
device_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/push/deviceRegistrations/:device_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/push/deviceRegistrations/:device_id")
require "http/client"
url = "{{baseUrl}}/push/deviceRegistrations/:device_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}}/push/deviceRegistrations/:device_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/push/deviceRegistrations/:device_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/push/deviceRegistrations/:device_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/push/deviceRegistrations/:device_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/push/deviceRegistrations/:device_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/push/deviceRegistrations/:device_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}}/push/deviceRegistrations/:device_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/push/deviceRegistrations/:device_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}}/push/deviceRegistrations/:device_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/push/deviceRegistrations/:device_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/push/deviceRegistrations/:device_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}}/push/deviceRegistrations/:device_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/push/deviceRegistrations/:device_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/push/deviceRegistrations/:device_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}}/push/deviceRegistrations/:device_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}}/push/deviceRegistrations/:device_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}}/push/deviceRegistrations/:device_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/push/deviceRegistrations/:device_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}}/push/deviceRegistrations/:device_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}}/push/deviceRegistrations/:device_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/push/deviceRegistrations/:device_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}}/push/deviceRegistrations/:device_id');
echo $response->getBody();
setUrl('{{baseUrl}}/push/deviceRegistrations/:device_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/push/deviceRegistrations/:device_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/push/deviceRegistrations/:device_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/push/deviceRegistrations/:device_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/push/deviceRegistrations/:device_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/push/deviceRegistrations/:device_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/push/deviceRegistrations/:device_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/push/deviceRegistrations/:device_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/push/deviceRegistrations/:device_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/push/deviceRegistrations/:device_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}}/push/deviceRegistrations/:device_id
http GET {{baseUrl}}/push/deviceRegistrations/:device_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/push/deviceRegistrations/:device_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/push/deviceRegistrations/:device_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 all channels with at least one subscribed device
{{baseUrl}}/push/channels
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/push/channels");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/push/channels")
require "http/client"
url = "{{baseUrl}}/push/channels"
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/channels"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/push/channels");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/push/channels"
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/channels HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/push/channels")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/push/channels"))
.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/channels")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/push/channels")
.asString();
const 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/channels');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/push/channels'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/push/channels';
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/channels',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/push/channels")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/push/channels',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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/channels'};
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/channels');
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/channels'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/push/channels';
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/channels"]
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/channels" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/push/channels",
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/channels');
echo $response->getBody();
setUrl('{{baseUrl}}/push/channels');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/push/channels');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/push/channels' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/push/channels' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/push/channels")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/push/channels"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/push/channels"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/push/channels")
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/channels') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/push/channels";
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/channels
http GET {{baseUrl}}/push/channels
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/push/channels
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/push/channels")! 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 subscriptions
{{baseUrl}}/push/channelSubscriptions
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/push/channelSubscriptions");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/push/channelSubscriptions")
require "http/client"
url = "{{baseUrl}}/push/channelSubscriptions"
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/channelSubscriptions"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/push/channelSubscriptions");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/push/channelSubscriptions"
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/channelSubscriptions HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/push/channelSubscriptions")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/push/channelSubscriptions"))
.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/channelSubscriptions")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/push/channelSubscriptions")
.asString();
const 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/channelSubscriptions');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/push/channelSubscriptions'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/push/channelSubscriptions';
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/channelSubscriptions',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/push/channelSubscriptions")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/push/channelSubscriptions',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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/channelSubscriptions'};
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/channelSubscriptions');
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/channelSubscriptions'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/push/channelSubscriptions';
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/channelSubscriptions"]
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/channelSubscriptions" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/push/channelSubscriptions",
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/channelSubscriptions');
echo $response->getBody();
setUrl('{{baseUrl}}/push/channelSubscriptions');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/push/channelSubscriptions');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/push/channelSubscriptions' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/push/channelSubscriptions' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/push/channelSubscriptions")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/push/channelSubscriptions"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/push/channelSubscriptions"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/push/channelSubscriptions")
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/channelSubscriptions') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/push/channelSubscriptions";
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/channelSubscriptions
http GET {{baseUrl}}/push/channelSubscriptions
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/push/channelSubscriptions
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/push/channelSubscriptions")! 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 devices registered for receiving push notifications
{{baseUrl}}/push/deviceRegistrations
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/push/deviceRegistrations");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/push/deviceRegistrations")
require "http/client"
url = "{{baseUrl}}/push/deviceRegistrations"
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/deviceRegistrations"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/push/deviceRegistrations");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/push/deviceRegistrations"
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/deviceRegistrations HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/push/deviceRegistrations")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/push/deviceRegistrations"))
.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/deviceRegistrations")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/push/deviceRegistrations")
.asString();
const 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/deviceRegistrations');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/push/deviceRegistrations'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/push/deviceRegistrations';
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/deviceRegistrations',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/push/deviceRegistrations")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/push/deviceRegistrations',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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/deviceRegistrations'};
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/deviceRegistrations');
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/deviceRegistrations'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/push/deviceRegistrations';
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/deviceRegistrations"]
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/deviceRegistrations" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/push/deviceRegistrations",
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/deviceRegistrations');
echo $response->getBody();
setUrl('{{baseUrl}}/push/deviceRegistrations');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/push/deviceRegistrations');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/push/deviceRegistrations' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/push/deviceRegistrations' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/push/deviceRegistrations")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/push/deviceRegistrations"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/push/deviceRegistrations"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/push/deviceRegistrations")
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/deviceRegistrations') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/push/deviceRegistrations";
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/deviceRegistrations
http GET {{baseUrl}}/push/deviceRegistrations
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/push/deviceRegistrations
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/push/deviceRegistrations")! 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
Publish a push notification to device(s)
{{baseUrl}}/push/publish
BODY json
{
"push": {
"apns": {
"notification": {
"body": "",
"collapseKey": "",
"icon": "",
"sound": "",
"title": ""
}
},
"data": "",
"fcm": {
"notification": {}
},
"notification": {},
"web": {
"notification": {}
}
},
"recipient": {
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/push/publish");
struct curl_slist *headers = 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\": {\n \"apns\": {\n \"notification\": {\n \"body\": \"\",\n \"collapseKey\": \"\",\n \"icon\": \"\",\n \"sound\": \"\",\n \"title\": \"\"\n }\n },\n \"data\": \"\",\n \"fcm\": {\n \"notification\": {}\n },\n \"notification\": {},\n \"web\": {\n \"notification\": {}\n }\n },\n \"recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/push/publish" {:content-type :json
:form-params {:push {:apns {:notification {:body ""
:collapseKey ""
:icon ""
:sound ""
:title ""}}
:data ""
:fcm {:notification {}}
:notification {}
:web {:notification {}}}
:recipient {:clientId ""
:deviceId ""
:deviceToken ""
:registrationToken ""
:transportType ""}}})
require "http/client"
url = "{{baseUrl}}/push/publish"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"push\": {\n \"apns\": {\n \"notification\": {\n \"body\": \"\",\n \"collapseKey\": \"\",\n \"icon\": \"\",\n \"sound\": \"\",\n \"title\": \"\"\n }\n },\n \"data\": \"\",\n \"fcm\": {\n \"notification\": {}\n },\n \"notification\": {},\n \"web\": {\n \"notification\": {}\n }\n },\n \"recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\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/publish"),
Content = new StringContent("{\n \"push\": {\n \"apns\": {\n \"notification\": {\n \"body\": \"\",\n \"collapseKey\": \"\",\n \"icon\": \"\",\n \"sound\": \"\",\n \"title\": \"\"\n }\n },\n \"data\": \"\",\n \"fcm\": {\n \"notification\": {}\n },\n \"notification\": {},\n \"web\": {\n \"notification\": {}\n }\n },\n \"recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\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/publish");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"push\": {\n \"apns\": {\n \"notification\": {\n \"body\": \"\",\n \"collapseKey\": \"\",\n \"icon\": \"\",\n \"sound\": \"\",\n \"title\": \"\"\n }\n },\n \"data\": \"\",\n \"fcm\": {\n \"notification\": {}\n },\n \"notification\": {},\n \"web\": {\n \"notification\": {}\n }\n },\n \"recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/push/publish"
payload := strings.NewReader("{\n \"push\": {\n \"apns\": {\n \"notification\": {\n \"body\": \"\",\n \"collapseKey\": \"\",\n \"icon\": \"\",\n \"sound\": \"\",\n \"title\": \"\"\n }\n },\n \"data\": \"\",\n \"fcm\": {\n \"notification\": {}\n },\n \"notification\": {},\n \"web\": {\n \"notification\": {}\n }\n },\n \"recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\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/publish HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 447
{
"push": {
"apns": {
"notification": {
"body": "",
"collapseKey": "",
"icon": "",
"sound": "",
"title": ""
}
},
"data": "",
"fcm": {
"notification": {}
},
"notification": {},
"web": {
"notification": {}
}
},
"recipient": {
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/push/publish")
.setHeader("content-type", "application/json")
.setBody("{\n \"push\": {\n \"apns\": {\n \"notification\": {\n \"body\": \"\",\n \"collapseKey\": \"\",\n \"icon\": \"\",\n \"sound\": \"\",\n \"title\": \"\"\n }\n },\n \"data\": \"\",\n \"fcm\": {\n \"notification\": {}\n },\n \"notification\": {},\n \"web\": {\n \"notification\": {}\n }\n },\n \"recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/push/publish"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"push\": {\n \"apns\": {\n \"notification\": {\n \"body\": \"\",\n \"collapseKey\": \"\",\n \"icon\": \"\",\n \"sound\": \"\",\n \"title\": \"\"\n }\n },\n \"data\": \"\",\n \"fcm\": {\n \"notification\": {}\n },\n \"notification\": {},\n \"web\": {\n \"notification\": {}\n }\n },\n \"recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\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\": {\n \"apns\": {\n \"notification\": {\n \"body\": \"\",\n \"collapseKey\": \"\",\n \"icon\": \"\",\n \"sound\": \"\",\n \"title\": \"\"\n }\n },\n \"data\": \"\",\n \"fcm\": {\n \"notification\": {}\n },\n \"notification\": {},\n \"web\": {\n \"notification\": {}\n }\n },\n \"recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/push/publish")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/push/publish")
.header("content-type", "application/json")
.body("{\n \"push\": {\n \"apns\": {\n \"notification\": {\n \"body\": \"\",\n \"collapseKey\": \"\",\n \"icon\": \"\",\n \"sound\": \"\",\n \"title\": \"\"\n }\n },\n \"data\": \"\",\n \"fcm\": {\n \"notification\": {}\n },\n \"notification\": {},\n \"web\": {\n \"notification\": {}\n }\n },\n \"recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
push: {
apns: {
notification: {
body: '',
collapseKey: '',
icon: '',
sound: '',
title: ''
}
},
data: '',
fcm: {
notification: {}
},
notification: {},
web: {
notification: {}
}
},
recipient: {
clientId: '',
deviceId: '',
deviceToken: '',
registrationToken: '',
transportType: ''
}
});
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/publish');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/push/publish',
headers: {'content-type': 'application/json'},
data: {
push: {
apns: {notification: {body: '', collapseKey: '', icon: '', sound: '', title: ''}},
data: '',
fcm: {notification: {}},
notification: {},
web: {notification: {}}
},
recipient: {
clientId: '',
deviceId: '',
deviceToken: '',
registrationToken: '',
transportType: ''
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/push/publish';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"push":{"apns":{"notification":{"body":"","collapseKey":"","icon":"","sound":"","title":""}},"data":"","fcm":{"notification":{}},"notification":{},"web":{"notification":{}}},"recipient":{"clientId":"","deviceId":"","deviceToken":"","registrationToken":"","transportType":""}}'
};
try {
const response = await 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/publish',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "push": {\n "apns": {\n "notification": {\n "body": "",\n "collapseKey": "",\n "icon": "",\n "sound": "",\n "title": ""\n }\n },\n "data": "",\n "fcm": {\n "notification": {}\n },\n "notification": {},\n "web": {\n "notification": {}\n }\n },\n "recipient": {\n "clientId": "",\n "deviceId": "",\n "deviceToken": "",\n "registrationToken": "",\n "transportType": ""\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\": {\n \"apns\": {\n \"notification\": {\n \"body\": \"\",\n \"collapseKey\": \"\",\n \"icon\": \"\",\n \"sound\": \"\",\n \"title\": \"\"\n }\n },\n \"data\": \"\",\n \"fcm\": {\n \"notification\": {}\n },\n \"notification\": {},\n \"web\": {\n \"notification\": {}\n }\n },\n \"recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/push/publish")
.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/publish',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.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: {
apns: {notification: {body: '', collapseKey: '', icon: '', sound: '', title: ''}},
data: '',
fcm: {notification: {}},
notification: {},
web: {notification: {}}
},
recipient: {
clientId: '',
deviceId: '',
deviceToken: '',
registrationToken: '',
transportType: ''
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/push/publish',
headers: {'content-type': 'application/json'},
body: {
push: {
apns: {notification: {body: '', collapseKey: '', icon: '', sound: '', title: ''}},
data: '',
fcm: {notification: {}},
notification: {},
web: {notification: {}}
},
recipient: {
clientId: '',
deviceId: '',
deviceToken: '',
registrationToken: '',
transportType: ''
}
},
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/publish');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
push: {
apns: {
notification: {
body: '',
collapseKey: '',
icon: '',
sound: '',
title: ''
}
},
data: '',
fcm: {
notification: {}
},
notification: {},
web: {
notification: {}
}
},
recipient: {
clientId: '',
deviceId: '',
deviceToken: '',
registrationToken: '',
transportType: ''
}
});
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/publish',
headers: {'content-type': 'application/json'},
data: {
push: {
apns: {notification: {body: '', collapseKey: '', icon: '', sound: '', title: ''}},
data: '',
fcm: {notification: {}},
notification: {},
web: {notification: {}}
},
recipient: {
clientId: '',
deviceId: '',
deviceToken: '',
registrationToken: '',
transportType: ''
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/push/publish';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"push":{"apns":{"notification":{"body":"","collapseKey":"","icon":"","sound":"","title":""}},"data":"","fcm":{"notification":{}},"notification":{},"web":{"notification":{}}},"recipient":{"clientId":"","deviceId":"","deviceToken":"","registrationToken":"","transportType":""}}'
};
try {
const response = await fetch(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": @{ @"apns": @{ @"notification": @{ @"body": @"", @"collapseKey": @"", @"icon": @"", @"sound": @"", @"title": @"" } }, @"data": @"", @"fcm": @{ @"notification": @{ } }, @"notification": @{ }, @"web": @{ @"notification": @{ } } },
@"recipient": @{ @"clientId": @"", @"deviceId": @"", @"deviceToken": @"", @"registrationToken": @"", @"transportType": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/push/publish"]
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/publish" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"push\": {\n \"apns\": {\n \"notification\": {\n \"body\": \"\",\n \"collapseKey\": \"\",\n \"icon\": \"\",\n \"sound\": \"\",\n \"title\": \"\"\n }\n },\n \"data\": \"\",\n \"fcm\": {\n \"notification\": {}\n },\n \"notification\": {},\n \"web\": {\n \"notification\": {}\n }\n },\n \"recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/push/publish",
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' => [
'apns' => [
'notification' => [
'body' => '',
'collapseKey' => '',
'icon' => '',
'sound' => '',
'title' => ''
]
],
'data' => '',
'fcm' => [
'notification' => [
]
],
'notification' => [
],
'web' => [
'notification' => [
]
]
],
'recipient' => [
'clientId' => '',
'deviceId' => '',
'deviceToken' => '',
'registrationToken' => '',
'transportType' => ''
]
]),
CURLOPT_HTTPHEADER => [
"content-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/publish', [
'body' => '{
"push": {
"apns": {
"notification": {
"body": "",
"collapseKey": "",
"icon": "",
"sound": "",
"title": ""
}
},
"data": "",
"fcm": {
"notification": {}
},
"notification": {},
"web": {
"notification": {}
}
},
"recipient": {
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/push/publish');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'push' => [
'apns' => [
'notification' => [
'body' => '',
'collapseKey' => '',
'icon' => '',
'sound' => '',
'title' => ''
]
],
'data' => '',
'fcm' => [
'notification' => [
]
],
'notification' => [
],
'web' => [
'notification' => [
]
]
],
'recipient' => [
'clientId' => '',
'deviceId' => '',
'deviceToken' => '',
'registrationToken' => '',
'transportType' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'push' => [
'apns' => [
'notification' => [
'body' => '',
'collapseKey' => '',
'icon' => '',
'sound' => '',
'title' => ''
]
],
'data' => '',
'fcm' => [
'notification' => [
]
],
'notification' => [
],
'web' => [
'notification' => [
]
]
],
'recipient' => [
'clientId' => '',
'deviceId' => '',
'deviceToken' => '',
'registrationToken' => '',
'transportType' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/push/publish');
$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/publish' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"push": {
"apns": {
"notification": {
"body": "",
"collapseKey": "",
"icon": "",
"sound": "",
"title": ""
}
},
"data": "",
"fcm": {
"notification": {}
},
"notification": {},
"web": {
"notification": {}
}
},
"recipient": {
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/push/publish' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"push": {
"apns": {
"notification": {
"body": "",
"collapseKey": "",
"icon": "",
"sound": "",
"title": ""
}
},
"data": "",
"fcm": {
"notification": {}
},
"notification": {},
"web": {
"notification": {}
}
},
"recipient": {
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"push\": {\n \"apns\": {\n \"notification\": {\n \"body\": \"\",\n \"collapseKey\": \"\",\n \"icon\": \"\",\n \"sound\": \"\",\n \"title\": \"\"\n }\n },\n \"data\": \"\",\n \"fcm\": {\n \"notification\": {}\n },\n \"notification\": {},\n \"web\": {\n \"notification\": {}\n }\n },\n \"recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/push/publish", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/push/publish"
payload = {
"push": {
"apns": { "notification": {
"body": "",
"collapseKey": "",
"icon": "",
"sound": "",
"title": ""
} },
"data": "",
"fcm": { "notification": {} },
"notification": {},
"web": { "notification": {} }
},
"recipient": {
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/push/publish"
payload <- "{\n \"push\": {\n \"apns\": {\n \"notification\": {\n \"body\": \"\",\n \"collapseKey\": \"\",\n \"icon\": \"\",\n \"sound\": \"\",\n \"title\": \"\"\n }\n },\n \"data\": \"\",\n \"fcm\": {\n \"notification\": {}\n },\n \"notification\": {},\n \"web\": {\n \"notification\": {}\n }\n },\n \"recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\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/publish")
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\": {\n \"apns\": {\n \"notification\": {\n \"body\": \"\",\n \"collapseKey\": \"\",\n \"icon\": \"\",\n \"sound\": \"\",\n \"title\": \"\"\n }\n },\n \"data\": \"\",\n \"fcm\": {\n \"notification\": {}\n },\n \"notification\": {},\n \"web\": {\n \"notification\": {}\n }\n },\n \"recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\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/publish') do |req|
req.body = "{\n \"push\": {\n \"apns\": {\n \"notification\": {\n \"body\": \"\",\n \"collapseKey\": \"\",\n \"icon\": \"\",\n \"sound\": \"\",\n \"title\": \"\"\n }\n },\n \"data\": \"\",\n \"fcm\": {\n \"notification\": {}\n },\n \"notification\": {},\n \"web\": {\n \"notification\": {}\n }\n },\n \"recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\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/publish";
let payload = json!({
"push": json!({
"apns": json!({"notification": json!({
"body": "",
"collapseKey": "",
"icon": "",
"sound": "",
"title": ""
})}),
"data": "",
"fcm": json!({"notification": json!({})}),
"notification": json!({}),
"web": json!({"notification": json!({})})
}),
"recipient": json!({
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
})
});
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/publish \
--header 'content-type: application/json' \
--data '{
"push": {
"apns": {
"notification": {
"body": "",
"collapseKey": "",
"icon": "",
"sound": "",
"title": ""
}
},
"data": "",
"fcm": {
"notification": {}
},
"notification": {},
"web": {
"notification": {}
}
},
"recipient": {
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
}
}'
echo '{
"push": {
"apns": {
"notification": {
"body": "",
"collapseKey": "",
"icon": "",
"sound": "",
"title": ""
}
},
"data": "",
"fcm": {
"notification": {}
},
"notification": {},
"web": {
"notification": {}
}
},
"recipient": {
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
}
}' | \
http POST {{baseUrl}}/push/publish \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "push": {\n "apns": {\n "notification": {\n "body": "",\n "collapseKey": "",\n "icon": "",\n "sound": "",\n "title": ""\n }\n },\n "data": "",\n "fcm": {\n "notification": {}\n },\n "notification": {},\n "web": {\n "notification": {}\n }\n },\n "recipient": {\n "clientId": "",\n "deviceId": "",\n "deviceToken": "",\n "registrationToken": "",\n "transportType": ""\n }\n}' \
--output-document \
- {{baseUrl}}/push/publish
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"push": [
"apns": ["notification": [
"body": "",
"collapseKey": "",
"icon": "",
"sound": "",
"title": ""
]],
"data": "",
"fcm": ["notification": []],
"notification": [],
"web": ["notification": []]
],
"recipient": [
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/push/publish")! 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
Register a device for receiving push notifications
{{baseUrl}}/push/deviceRegistrations
BODY json
{
"clientId": "",
"deviceSecret": "",
"formFactor": "",
"id": "",
"metadata": {},
"platform": "",
"push.recipient": {
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
},
"push.state": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/push/deviceRegistrations");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/push/deviceRegistrations" {:content-type :json
:form-params {:clientId ""
:deviceSecret ""
:formFactor ""
:id ""
:metadata {}
:platform ""
:push.recipient {:clientId ""
:deviceId ""
:deviceToken ""
:registrationToken ""
:transportType ""}
:push.state ""}})
require "http/client"
url = "{{baseUrl}}/push/deviceRegistrations"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\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/deviceRegistrations"),
Content = new StringContent("{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/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/deviceRegistrations");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/push/deviceRegistrations"
payload := strings.NewReader("{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\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/deviceRegistrations HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 273
{
"clientId": "",
"deviceSecret": "",
"formFactor": "",
"id": "",
"metadata": {},
"platform": "",
"push.recipient": {
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
},
"push.state": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/push/deviceRegistrations")
.setHeader("content-type", "application/json")
.setBody("{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/push/deviceRegistrations"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/push/deviceRegistrations")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/push/deviceRegistrations")
.header("content-type", "application/json")
.body("{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\n}")
.asString();
const data = JSON.stringify({
clientId: '',
deviceSecret: '',
formFactor: '',
id: '',
metadata: {},
platform: '',
'push.recipient': {
clientId: '',
deviceId: '',
deviceToken: '',
registrationToken: '',
transportType: ''
},
'push.state': ''
});
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/deviceRegistrations');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/push/deviceRegistrations',
headers: {'content-type': 'application/json'},
data: {
clientId: '',
deviceSecret: '',
formFactor: '',
id: '',
metadata: {},
platform: '',
'push.recipient': {
clientId: '',
deviceId: '',
deviceToken: '',
registrationToken: '',
transportType: ''
},
'push.state': ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/push/deviceRegistrations';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"clientId":"","deviceSecret":"","formFactor":"","id":"","metadata":{},"platform":"","push.recipient":{"clientId":"","deviceId":"","deviceToken":"","registrationToken":"","transportType":""},"push.state":""}'
};
try {
const response = await 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/deviceRegistrations',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "clientId": "",\n "deviceSecret": "",\n "formFactor": "",\n "id": "",\n "metadata": {},\n "platform": "",\n "push.recipient": {\n "clientId": "",\n "deviceId": "",\n "deviceToken": "",\n "registrationToken": "",\n "transportType": ""\n },\n "push.state": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/push/deviceRegistrations")
.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/deviceRegistrations',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
clientId: '',
deviceSecret: '',
formFactor: '',
id: '',
metadata: {},
platform: '',
'push.recipient': {
clientId: '',
deviceId: '',
deviceToken: '',
registrationToken: '',
transportType: ''
},
'push.state': ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/push/deviceRegistrations',
headers: {'content-type': 'application/json'},
body: {
clientId: '',
deviceSecret: '',
formFactor: '',
id: '',
metadata: {},
platform: '',
'push.recipient': {
clientId: '',
deviceId: '',
deviceToken: '',
registrationToken: '',
transportType: ''
},
'push.state': ''
},
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/deviceRegistrations');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
clientId: '',
deviceSecret: '',
formFactor: '',
id: '',
metadata: {},
platform: '',
'push.recipient': {
clientId: '',
deviceId: '',
deviceToken: '',
registrationToken: '',
transportType: ''
},
'push.state': ''
});
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/deviceRegistrations',
headers: {'content-type': 'application/json'},
data: {
clientId: '',
deviceSecret: '',
formFactor: '',
id: '',
metadata: {},
platform: '',
'push.recipient': {
clientId: '',
deviceId: '',
deviceToken: '',
registrationToken: '',
transportType: ''
},
'push.state': ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/push/deviceRegistrations';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"clientId":"","deviceSecret":"","formFactor":"","id":"","metadata":{},"platform":"","push.recipient":{"clientId":"","deviceId":"","deviceToken":"","registrationToken":"","transportType":""},"push.state":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"clientId": @"",
@"deviceSecret": @"",
@"formFactor": @"",
@"id": @"",
@"metadata": @{ },
@"platform": @"",
@"push.recipient": @{ @"clientId": @"", @"deviceId": @"", @"deviceToken": @"", @"registrationToken": @"", @"transportType": @"" },
@"push.state": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/push/deviceRegistrations"]
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/deviceRegistrations" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/push/deviceRegistrations",
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([
'clientId' => '',
'deviceSecret' => '',
'formFactor' => '',
'id' => '',
'metadata' => [
],
'platform' => '',
'push.recipient' => [
'clientId' => '',
'deviceId' => '',
'deviceToken' => '',
'registrationToken' => '',
'transportType' => ''
],
'push.state' => ''
]),
CURLOPT_HTTPHEADER => [
"content-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/deviceRegistrations', [
'body' => '{
"clientId": "",
"deviceSecret": "",
"formFactor": "",
"id": "",
"metadata": {},
"platform": "",
"push.recipient": {
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
},
"push.state": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/push/deviceRegistrations');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'clientId' => '',
'deviceSecret' => '',
'formFactor' => '',
'id' => '',
'metadata' => [
],
'platform' => '',
'push.recipient' => [
'clientId' => '',
'deviceId' => '',
'deviceToken' => '',
'registrationToken' => '',
'transportType' => ''
],
'push.state' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'clientId' => '',
'deviceSecret' => '',
'formFactor' => '',
'id' => '',
'metadata' => [
],
'platform' => '',
'push.recipient' => [
'clientId' => '',
'deviceId' => '',
'deviceToken' => '',
'registrationToken' => '',
'transportType' => ''
],
'push.state' => ''
]));
$request->setRequestUrl('{{baseUrl}}/push/deviceRegistrations');
$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/deviceRegistrations' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"clientId": "",
"deviceSecret": "",
"formFactor": "",
"id": "",
"metadata": {},
"platform": "",
"push.recipient": {
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
},
"push.state": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/push/deviceRegistrations' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"clientId": "",
"deviceSecret": "",
"formFactor": "",
"id": "",
"metadata": {},
"platform": "",
"push.recipient": {
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
},
"push.state": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/push/deviceRegistrations", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/push/deviceRegistrations"
payload = {
"clientId": "",
"deviceSecret": "",
"formFactor": "",
"id": "",
"metadata": {},
"platform": "",
"push.recipient": {
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
},
"push.state": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/push/deviceRegistrations"
payload <- "{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\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/deviceRegistrations")
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 \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\n}"
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/deviceRegistrations') do |req|
req.body = "{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/push/deviceRegistrations";
let payload = json!({
"clientId": "",
"deviceSecret": "",
"formFactor": "",
"id": "",
"metadata": json!({}),
"platform": "",
"push.recipient": json!({
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
}),
"push.state": ""
});
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/deviceRegistrations \
--header 'content-type: application/json' \
--data '{
"clientId": "",
"deviceSecret": "",
"formFactor": "",
"id": "",
"metadata": {},
"platform": "",
"push.recipient": {
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
},
"push.state": ""
}'
echo '{
"clientId": "",
"deviceSecret": "",
"formFactor": "",
"id": "",
"metadata": {},
"platform": "",
"push.recipient": {
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
},
"push.state": ""
}' | \
http POST {{baseUrl}}/push/deviceRegistrations \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "clientId": "",\n "deviceSecret": "",\n "formFactor": "",\n "id": "",\n "metadata": {},\n "platform": "",\n "push.recipient": {\n "clientId": "",\n "deviceId": "",\n "deviceToken": "",\n "registrationToken": "",\n "transportType": ""\n },\n "push.state": ""\n}' \
--output-document \
- {{baseUrl}}/push/deviceRegistrations
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"clientId": "",
"deviceSecret": "",
"formFactor": "",
"id": "",
"metadata": [],
"platform": "",
"push.recipient": [
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
],
"push.state": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/push/deviceRegistrations")! 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
Reset a registered device's update token
{{baseUrl}}/push/deviceRegistrations/:device_id/resetUpdateToken
QUERY PARAMS
device_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/push/deviceRegistrations/:device_id/resetUpdateToken");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/push/deviceRegistrations/:device_id/resetUpdateToken")
require "http/client"
url = "{{baseUrl}}/push/deviceRegistrations/:device_id/resetUpdateToken"
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/deviceRegistrations/:device_id/resetUpdateToken"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/push/deviceRegistrations/:device_id/resetUpdateToken");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/push/deviceRegistrations/:device_id/resetUpdateToken"
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/deviceRegistrations/:device_id/resetUpdateToken HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/push/deviceRegistrations/:device_id/resetUpdateToken")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/push/deviceRegistrations/:device_id/resetUpdateToken"))
.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/deviceRegistrations/:device_id/resetUpdateToken")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/push/deviceRegistrations/:device_id/resetUpdateToken")
.asString();
const 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/deviceRegistrations/:device_id/resetUpdateToken');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/push/deviceRegistrations/:device_id/resetUpdateToken'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/push/deviceRegistrations/:device_id/resetUpdateToken';
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/deviceRegistrations/:device_id/resetUpdateToken',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/push/deviceRegistrations/:device_id/resetUpdateToken")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/push/deviceRegistrations/:device_id/resetUpdateToken',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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/deviceRegistrations/:device_id/resetUpdateToken'
};
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/deviceRegistrations/:device_id/resetUpdateToken');
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/deviceRegistrations/:device_id/resetUpdateToken'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/push/deviceRegistrations/:device_id/resetUpdateToken';
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/deviceRegistrations/:device_id/resetUpdateToken"]
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/deviceRegistrations/:device_id/resetUpdateToken" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/push/deviceRegistrations/:device_id/resetUpdateToken",
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/deviceRegistrations/:device_id/resetUpdateToken');
echo $response->getBody();
setUrl('{{baseUrl}}/push/deviceRegistrations/:device_id/resetUpdateToken');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/push/deviceRegistrations/:device_id/resetUpdateToken');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/push/deviceRegistrations/:device_id/resetUpdateToken' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/push/deviceRegistrations/:device_id/resetUpdateToken' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/push/deviceRegistrations/:device_id/resetUpdateToken")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/push/deviceRegistrations/:device_id/resetUpdateToken"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/push/deviceRegistrations/:device_id/resetUpdateToken"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/push/deviceRegistrations/:device_id/resetUpdateToken")
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/deviceRegistrations/:device_id/resetUpdateToken') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/push/deviceRegistrations/:device_id/resetUpdateToken";
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/deviceRegistrations/:device_id/resetUpdateToken
http GET {{baseUrl}}/push/deviceRegistrations/:device_id/resetUpdateToken
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/push/deviceRegistrations/:device_id/resetUpdateToken
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/push/deviceRegistrations/:device_id/resetUpdateToken")! 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
Subscribe a device to a channel
{{baseUrl}}/push/channelSubscriptions
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/push/channelSubscriptions");
struct curl_slist *headers = 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\": \"my:channel\",\n \"clientId\": \"myClientId\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/push/channelSubscriptions" {:content-type :json
:form-params {:channel "my:channel"
:clientId "myClientId"}})
require "http/client"
url = "{{baseUrl}}/push/channelSubscriptions"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"channel\": \"my:channel\",\n \"clientId\": \"myClientId\"\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/channelSubscriptions"),
Content = new StringContent("{\n \"channel\": \"my:channel\",\n \"clientId\": \"myClientId\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/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/channelSubscriptions");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"channel\": \"my:channel\",\n \"clientId\": \"myClientId\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/push/channelSubscriptions"
payload := strings.NewReader("{\n \"channel\": \"my:channel\",\n \"clientId\": \"myClientId\"\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/channelSubscriptions HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 57
{
"channel": "my:channel",
"clientId": "myClientId"
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/push/channelSubscriptions")
.setHeader("content-type", "application/json")
.setBody("{\n \"channel\": \"my:channel\",\n \"clientId\": \"myClientId\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/push/channelSubscriptions"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"channel\": \"my:channel\",\n \"clientId\": \"myClientId\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, 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\": \"my:channel\",\n \"clientId\": \"myClientId\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/push/channelSubscriptions")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/push/channelSubscriptions")
.header("content-type", "application/json")
.body("{\n \"channel\": \"my:channel\",\n \"clientId\": \"myClientId\"\n}")
.asString();
const data = JSON.stringify({
channel: 'my:channel',
clientId: 'myClientId'
});
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/channelSubscriptions');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/push/channelSubscriptions',
headers: {'content-type': 'application/json'},
data: {channel: 'my:channel', clientId: 'myClientId'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/push/channelSubscriptions';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"channel":"my:channel","clientId":"myClientId"}'
};
try {
const response = await 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/channelSubscriptions',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "channel": "my:channel",\n "clientId": "myClientId"\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\": \"my:channel\",\n \"clientId\": \"myClientId\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/push/channelSubscriptions")
.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/channelSubscriptions',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.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: 'my:channel', clientId: 'myClientId'}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/push/channelSubscriptions',
headers: {'content-type': 'application/json'},
body: {channel: 'my:channel', clientId: 'myClientId'},
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/channelSubscriptions');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
channel: 'my:channel',
clientId: 'myClientId'
});
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/channelSubscriptions',
headers: {'content-type': 'application/json'},
data: {channel: 'my:channel', clientId: 'myClientId'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/push/channelSubscriptions';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"channel":"my:channel","clientId":"myClientId"}'
};
try {
const response = await fetch(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": @"my:channel",
@"clientId": @"myClientId" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/push/channelSubscriptions"]
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/channelSubscriptions" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"channel\": \"my:channel\",\n \"clientId\": \"myClientId\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/push/channelSubscriptions",
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' => 'my:channel',
'clientId' => 'myClientId'
]),
CURLOPT_HTTPHEADER => [
"content-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/channelSubscriptions', [
'body' => '{
"channel": "my:channel",
"clientId": "myClientId"
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/push/channelSubscriptions');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'channel' => 'my:channel',
'clientId' => 'myClientId'
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'channel' => 'my:channel',
'clientId' => 'myClientId'
]));
$request->setRequestUrl('{{baseUrl}}/push/channelSubscriptions');
$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/channelSubscriptions' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"channel": "my:channel",
"clientId": "myClientId"
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/push/channelSubscriptions' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"channel": "my:channel",
"clientId": "myClientId"
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"channel\": \"my:channel\",\n \"clientId\": \"myClientId\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/push/channelSubscriptions", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/push/channelSubscriptions"
payload = {
"channel": "my:channel",
"clientId": "myClientId"
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/push/channelSubscriptions"
payload <- "{\n \"channel\": \"my:channel\",\n \"clientId\": \"myClientId\"\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/channelSubscriptions")
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\": \"my:channel\",\n \"clientId\": \"myClientId\"\n}"
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/channelSubscriptions') do |req|
req.body = "{\n \"channel\": \"my:channel\",\n \"clientId\": \"myClientId\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/push/channelSubscriptions";
let payload = json!({
"channel": "my:channel",
"clientId": "myClientId"
});
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/channelSubscriptions \
--header 'content-type: application/json' \
--data '{
"channel": "my:channel",
"clientId": "myClientId"
}'
echo '{
"channel": "my:channel",
"clientId": "myClientId"
}' | \
http POST {{baseUrl}}/push/channelSubscriptions \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "channel": "my:channel",\n "clientId": "myClientId"\n}' \
--output-document \
- {{baseUrl}}/push/channelSubscriptions
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"channel": "my:channel",
"clientId": "myClientId"
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/push/channelSubscriptions")! 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
Unregister a single device for push notifications
{{baseUrl}}/push/deviceRegistrations/:device_id
QUERY PARAMS
device_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/push/deviceRegistrations/:device_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/push/deviceRegistrations/:device_id")
require "http/client"
url = "{{baseUrl}}/push/deviceRegistrations/:device_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}}/push/deviceRegistrations/:device_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/push/deviceRegistrations/:device_id");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/push/deviceRegistrations/:device_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/push/deviceRegistrations/:device_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/push/deviceRegistrations/:device_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/push/deviceRegistrations/:device_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}}/push/deviceRegistrations/:device_id")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/push/deviceRegistrations/:device_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}}/push/deviceRegistrations/:device_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/push/deviceRegistrations/:device_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/push/deviceRegistrations/:device_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}}/push/deviceRegistrations/:device_id',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/push/deviceRegistrations/:device_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/push/deviceRegistrations/:device_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}}/push/deviceRegistrations/:device_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}}/push/deviceRegistrations/:device_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}}/push/deviceRegistrations/:device_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/push/deviceRegistrations/:device_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}}/push/deviceRegistrations/:device_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}}/push/deviceRegistrations/:device_id" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/push/deviceRegistrations/:device_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}}/push/deviceRegistrations/:device_id');
echo $response->getBody();
setUrl('{{baseUrl}}/push/deviceRegistrations/:device_id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/push/deviceRegistrations/:device_id');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/push/deviceRegistrations/:device_id' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/push/deviceRegistrations/:device_id' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/push/deviceRegistrations/:device_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/push/deviceRegistrations/:device_id"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/push/deviceRegistrations/:device_id"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/push/deviceRegistrations/:device_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/push/deviceRegistrations/:device_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}}/push/deviceRegistrations/:device_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}}/push/deviceRegistrations/:device_id
http DELETE {{baseUrl}}/push/deviceRegistrations/:device_id
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/push/deviceRegistrations/:device_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/push/deviceRegistrations/:device_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
Unregister matching devices for push notifications
{{baseUrl}}/push/deviceRegistrations
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/push/deviceRegistrations");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/push/deviceRegistrations")
require "http/client"
url = "{{baseUrl}}/push/deviceRegistrations"
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/deviceRegistrations"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/push/deviceRegistrations");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/push/deviceRegistrations"
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/deviceRegistrations HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/push/deviceRegistrations")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/push/deviceRegistrations"))
.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/deviceRegistrations")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/push/deviceRegistrations")
.asString();
const 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/deviceRegistrations');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/push/deviceRegistrations'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/push/deviceRegistrations';
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/deviceRegistrations',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/push/deviceRegistrations")
.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/deviceRegistrations',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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/deviceRegistrations'};
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/deviceRegistrations');
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/deviceRegistrations'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/push/deviceRegistrations';
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/deviceRegistrations"]
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/deviceRegistrations" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/push/deviceRegistrations",
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/deviceRegistrations');
echo $response->getBody();
setUrl('{{baseUrl}}/push/deviceRegistrations');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/push/deviceRegistrations');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/push/deviceRegistrations' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/push/deviceRegistrations' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/push/deviceRegistrations")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/push/deviceRegistrations"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/push/deviceRegistrations"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/push/deviceRegistrations")
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/deviceRegistrations') 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/deviceRegistrations";
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/deviceRegistrations
http DELETE {{baseUrl}}/push/deviceRegistrations
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/push/deviceRegistrations
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/push/deviceRegistrations")! 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()
PUT
Update a device registration (PUT)
{{baseUrl}}/push/deviceRegistrations/:device_id
QUERY PARAMS
device_id
BODY json
{
"clientId": "",
"deviceSecret": "",
"formFactor": "",
"id": "",
"metadata": {},
"platform": "",
"push.recipient": {
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
},
"push.state": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/push/deviceRegistrations/:device_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 \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/push/deviceRegistrations/:device_id" {:content-type :json
:form-params {:clientId ""
:deviceSecret ""
:formFactor ""
:id ""
:metadata {}
:platform ""
:push.recipient {:clientId ""
:deviceId ""
:deviceToken ""
:registrationToken ""
:transportType ""}
:push.state ""}})
require "http/client"
url = "{{baseUrl}}/push/deviceRegistrations/:device_id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\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}}/push/deviceRegistrations/:device_id"),
Content = new StringContent("{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/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/deviceRegistrations/:device_id");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/push/deviceRegistrations/:device_id"
payload := strings.NewReader("{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\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/push/deviceRegistrations/:device_id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 273
{
"clientId": "",
"deviceSecret": "",
"formFactor": "",
"id": "",
"metadata": {},
"platform": "",
"push.recipient": {
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
},
"push.state": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/push/deviceRegistrations/:device_id")
.setHeader("content-type", "application/json")
.setBody("{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/push/deviceRegistrations/:device_id"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/push/deviceRegistrations/:device_id")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/push/deviceRegistrations/:device_id")
.header("content-type", "application/json")
.body("{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\n}")
.asString();
const data = JSON.stringify({
clientId: '',
deviceSecret: '',
formFactor: '',
id: '',
metadata: {},
platform: '',
'push.recipient': {
clientId: '',
deviceId: '',
deviceToken: '',
registrationToken: '',
transportType: ''
},
'push.state': ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/push/deviceRegistrations/:device_id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/push/deviceRegistrations/:device_id',
headers: {'content-type': 'application/json'},
data: {
clientId: '',
deviceSecret: '',
formFactor: '',
id: '',
metadata: {},
platform: '',
'push.recipient': {
clientId: '',
deviceId: '',
deviceToken: '',
registrationToken: '',
transportType: ''
},
'push.state': ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/push/deviceRegistrations/:device_id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"clientId":"","deviceSecret":"","formFactor":"","id":"","metadata":{},"platform":"","push.recipient":{"clientId":"","deviceId":"","deviceToken":"","registrationToken":"","transportType":""},"push.state":""}'
};
try {
const response = await 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/deviceRegistrations/:device_id',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "clientId": "",\n "deviceSecret": "",\n "formFactor": "",\n "id": "",\n "metadata": {},\n "platform": "",\n "push.recipient": {\n "clientId": "",\n "deviceId": "",\n "deviceToken": "",\n "registrationToken": "",\n "transportType": ""\n },\n "push.state": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/push/deviceRegistrations/:device_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/push/deviceRegistrations/:device_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({
clientId: '',
deviceSecret: '',
formFactor: '',
id: '',
metadata: {},
platform: '',
'push.recipient': {
clientId: '',
deviceId: '',
deviceToken: '',
registrationToken: '',
transportType: ''
},
'push.state': ''
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/push/deviceRegistrations/:device_id',
headers: {'content-type': 'application/json'},
body: {
clientId: '',
deviceSecret: '',
formFactor: '',
id: '',
metadata: {},
platform: '',
'push.recipient': {
clientId: '',
deviceId: '',
deviceToken: '',
registrationToken: '',
transportType: ''
},
'push.state': ''
},
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}}/push/deviceRegistrations/:device_id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
clientId: '',
deviceSecret: '',
formFactor: '',
id: '',
metadata: {},
platform: '',
'push.recipient': {
clientId: '',
deviceId: '',
deviceToken: '',
registrationToken: '',
transportType: ''
},
'push.state': ''
});
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}}/push/deviceRegistrations/:device_id',
headers: {'content-type': 'application/json'},
data: {
clientId: '',
deviceSecret: '',
formFactor: '',
id: '',
metadata: {},
platform: '',
'push.recipient': {
clientId: '',
deviceId: '',
deviceToken: '',
registrationToken: '',
transportType: ''
},
'push.state': ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/push/deviceRegistrations/:device_id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"clientId":"","deviceSecret":"","formFactor":"","id":"","metadata":{},"platform":"","push.recipient":{"clientId":"","deviceId":"","deviceToken":"","registrationToken":"","transportType":""},"push.state":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"clientId": @"",
@"deviceSecret": @"",
@"formFactor": @"",
@"id": @"",
@"metadata": @{ },
@"platform": @"",
@"push.recipient": @{ @"clientId": @"", @"deviceId": @"", @"deviceToken": @"", @"registrationToken": @"", @"transportType": @"" },
@"push.state": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/push/deviceRegistrations/:device_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}}/push/deviceRegistrations/:device_id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/push/deviceRegistrations/:device_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([
'clientId' => '',
'deviceSecret' => '',
'formFactor' => '',
'id' => '',
'metadata' => [
],
'platform' => '',
'push.recipient' => [
'clientId' => '',
'deviceId' => '',
'deviceToken' => '',
'registrationToken' => '',
'transportType' => ''
],
'push.state' => ''
]),
CURLOPT_HTTPHEADER => [
"content-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}}/push/deviceRegistrations/:device_id', [
'body' => '{
"clientId": "",
"deviceSecret": "",
"formFactor": "",
"id": "",
"metadata": {},
"platform": "",
"push.recipient": {
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
},
"push.state": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/push/deviceRegistrations/:device_id');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'clientId' => '',
'deviceSecret' => '',
'formFactor' => '',
'id' => '',
'metadata' => [
],
'platform' => '',
'push.recipient' => [
'clientId' => '',
'deviceId' => '',
'deviceToken' => '',
'registrationToken' => '',
'transportType' => ''
],
'push.state' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'clientId' => '',
'deviceSecret' => '',
'formFactor' => '',
'id' => '',
'metadata' => [
],
'platform' => '',
'push.recipient' => [
'clientId' => '',
'deviceId' => '',
'deviceToken' => '',
'registrationToken' => '',
'transportType' => ''
],
'push.state' => ''
]));
$request->setRequestUrl('{{baseUrl}}/push/deviceRegistrations/:device_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}}/push/deviceRegistrations/:device_id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"clientId": "",
"deviceSecret": "",
"formFactor": "",
"id": "",
"metadata": {},
"platform": "",
"push.recipient": {
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
},
"push.state": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/push/deviceRegistrations/:device_id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"clientId": "",
"deviceSecret": "",
"formFactor": "",
"id": "",
"metadata": {},
"platform": "",
"push.recipient": {
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
},
"push.state": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/push/deviceRegistrations/:device_id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/push/deviceRegistrations/:device_id"
payload = {
"clientId": "",
"deviceSecret": "",
"formFactor": "",
"id": "",
"metadata": {},
"platform": "",
"push.recipient": {
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
},
"push.state": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/push/deviceRegistrations/:device_id"
payload <- "{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\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}}/push/deviceRegistrations/:device_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 \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\n}"
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/push/deviceRegistrations/:device_id') do |req|
req.body = "{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\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}}/push/deviceRegistrations/:device_id";
let payload = json!({
"clientId": "",
"deviceSecret": "",
"formFactor": "",
"id": "",
"metadata": json!({}),
"platform": "",
"push.recipient": json!({
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
}),
"push.state": ""
});
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}}/push/deviceRegistrations/:device_id \
--header 'content-type: application/json' \
--data '{
"clientId": "",
"deviceSecret": "",
"formFactor": "",
"id": "",
"metadata": {},
"platform": "",
"push.recipient": {
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
},
"push.state": ""
}'
echo '{
"clientId": "",
"deviceSecret": "",
"formFactor": "",
"id": "",
"metadata": {},
"platform": "",
"push.recipient": {
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
},
"push.state": ""
}' | \
http PUT {{baseUrl}}/push/deviceRegistrations/:device_id \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "clientId": "",\n "deviceSecret": "",\n "formFactor": "",\n "id": "",\n "metadata": {},\n "platform": "",\n "push.recipient": {\n "clientId": "",\n "deviceId": "",\n "deviceToken": "",\n "registrationToken": "",\n "transportType": ""\n },\n "push.state": ""\n}' \
--output-document \
- {{baseUrl}}/push/deviceRegistrations/:device_id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"clientId": "",
"deviceSecret": "",
"formFactor": "",
"id": "",
"metadata": [],
"platform": "",
"push.recipient": [
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
],
"push.state": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/push/deviceRegistrations/:device_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()
PATCH
Update a device registration
{{baseUrl}}/push/deviceRegistrations/:device_id
QUERY PARAMS
device_id
BODY json
{
"clientId": "",
"deviceSecret": "",
"formFactor": "",
"id": "",
"metadata": {},
"platform": "",
"push.recipient": {
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
},
"push.state": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/push/deviceRegistrations/:device_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 \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/push/deviceRegistrations/:device_id" {:content-type :json
:form-params {:clientId ""
:deviceSecret ""
:formFactor ""
:id ""
:metadata {}
:platform ""
:push.recipient {:clientId ""
:deviceId ""
:deviceToken ""
:registrationToken ""
:transportType ""}
:push.state ""}})
require "http/client"
url = "{{baseUrl}}/push/deviceRegistrations/:device_id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\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}}/push/deviceRegistrations/:device_id"),
Content = new StringContent("{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/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/deviceRegistrations/:device_id");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/push/deviceRegistrations/:device_id"
payload := strings.NewReader("{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\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/push/deviceRegistrations/:device_id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 273
{
"clientId": "",
"deviceSecret": "",
"formFactor": "",
"id": "",
"metadata": {},
"platform": "",
"push.recipient": {
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
},
"push.state": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/push/deviceRegistrations/:device_id")
.setHeader("content-type", "application/json")
.setBody("{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/push/deviceRegistrations/:device_id"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/push/deviceRegistrations/:device_id")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/push/deviceRegistrations/:device_id")
.header("content-type", "application/json")
.body("{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\n}")
.asString();
const data = JSON.stringify({
clientId: '',
deviceSecret: '',
formFactor: '',
id: '',
metadata: {},
platform: '',
'push.recipient': {
clientId: '',
deviceId: '',
deviceToken: '',
registrationToken: '',
transportType: ''
},
'push.state': ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/push/deviceRegistrations/:device_id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/push/deviceRegistrations/:device_id',
headers: {'content-type': 'application/json'},
data: {
clientId: '',
deviceSecret: '',
formFactor: '',
id: '',
metadata: {},
platform: '',
'push.recipient': {
clientId: '',
deviceId: '',
deviceToken: '',
registrationToken: '',
transportType: ''
},
'push.state': ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/push/deviceRegistrations/:device_id';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"clientId":"","deviceSecret":"","formFactor":"","id":"","metadata":{},"platform":"","push.recipient":{"clientId":"","deviceId":"","deviceToken":"","registrationToken":"","transportType":""},"push.state":""}'
};
try {
const response = await 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/deviceRegistrations/:device_id',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "clientId": "",\n "deviceSecret": "",\n "formFactor": "",\n "id": "",\n "metadata": {},\n "platform": "",\n "push.recipient": {\n "clientId": "",\n "deviceId": "",\n "deviceToken": "",\n "registrationToken": "",\n "transportType": ""\n },\n "push.state": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/push/deviceRegistrations/:device_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/push/deviceRegistrations/:device_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({
clientId: '',
deviceSecret: '',
formFactor: '',
id: '',
metadata: {},
platform: '',
'push.recipient': {
clientId: '',
deviceId: '',
deviceToken: '',
registrationToken: '',
transportType: ''
},
'push.state': ''
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/push/deviceRegistrations/:device_id',
headers: {'content-type': 'application/json'},
body: {
clientId: '',
deviceSecret: '',
formFactor: '',
id: '',
metadata: {},
platform: '',
'push.recipient': {
clientId: '',
deviceId: '',
deviceToken: '',
registrationToken: '',
transportType: ''
},
'push.state': ''
},
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}}/push/deviceRegistrations/:device_id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
clientId: '',
deviceSecret: '',
formFactor: '',
id: '',
metadata: {},
platform: '',
'push.recipient': {
clientId: '',
deviceId: '',
deviceToken: '',
registrationToken: '',
transportType: ''
},
'push.state': ''
});
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}}/push/deviceRegistrations/:device_id',
headers: {'content-type': 'application/json'},
data: {
clientId: '',
deviceSecret: '',
formFactor: '',
id: '',
metadata: {},
platform: '',
'push.recipient': {
clientId: '',
deviceId: '',
deviceToken: '',
registrationToken: '',
transportType: ''
},
'push.state': ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/push/deviceRegistrations/:device_id';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"clientId":"","deviceSecret":"","formFactor":"","id":"","metadata":{},"platform":"","push.recipient":{"clientId":"","deviceId":"","deviceToken":"","registrationToken":"","transportType":""},"push.state":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"clientId": @"",
@"deviceSecret": @"",
@"formFactor": @"",
@"id": @"",
@"metadata": @{ },
@"platform": @"",
@"push.recipient": @{ @"clientId": @"", @"deviceId": @"", @"deviceToken": @"", @"registrationToken": @"", @"transportType": @"" },
@"push.state": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/push/deviceRegistrations/:device_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}}/push/deviceRegistrations/:device_id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/push/deviceRegistrations/:device_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([
'clientId' => '',
'deviceSecret' => '',
'formFactor' => '',
'id' => '',
'metadata' => [
],
'platform' => '',
'push.recipient' => [
'clientId' => '',
'deviceId' => '',
'deviceToken' => '',
'registrationToken' => '',
'transportType' => ''
],
'push.state' => ''
]),
CURLOPT_HTTPHEADER => [
"content-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}}/push/deviceRegistrations/:device_id', [
'body' => '{
"clientId": "",
"deviceSecret": "",
"formFactor": "",
"id": "",
"metadata": {},
"platform": "",
"push.recipient": {
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
},
"push.state": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/push/deviceRegistrations/:device_id');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'clientId' => '',
'deviceSecret' => '',
'formFactor' => '',
'id' => '',
'metadata' => [
],
'platform' => '',
'push.recipient' => [
'clientId' => '',
'deviceId' => '',
'deviceToken' => '',
'registrationToken' => '',
'transportType' => ''
],
'push.state' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'clientId' => '',
'deviceSecret' => '',
'formFactor' => '',
'id' => '',
'metadata' => [
],
'platform' => '',
'push.recipient' => [
'clientId' => '',
'deviceId' => '',
'deviceToken' => '',
'registrationToken' => '',
'transportType' => ''
],
'push.state' => ''
]));
$request->setRequestUrl('{{baseUrl}}/push/deviceRegistrations/:device_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}}/push/deviceRegistrations/:device_id' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"clientId": "",
"deviceSecret": "",
"formFactor": "",
"id": "",
"metadata": {},
"platform": "",
"push.recipient": {
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
},
"push.state": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/push/deviceRegistrations/:device_id' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"clientId": "",
"deviceSecret": "",
"formFactor": "",
"id": "",
"metadata": {},
"platform": "",
"push.recipient": {
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
},
"push.state": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/push/deviceRegistrations/:device_id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/push/deviceRegistrations/:device_id"
payload = {
"clientId": "",
"deviceSecret": "",
"formFactor": "",
"id": "",
"metadata": {},
"platform": "",
"push.recipient": {
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
},
"push.state": ""
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/push/deviceRegistrations/:device_id"
payload <- "{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\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}}/push/deviceRegistrations/:device_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 \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\n}"
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/push/deviceRegistrations/:device_id') do |req|
req.body = "{\n \"clientId\": \"\",\n \"deviceSecret\": \"\",\n \"formFactor\": \"\",\n \"id\": \"\",\n \"metadata\": {},\n \"platform\": \"\",\n \"push.recipient\": {\n \"clientId\": \"\",\n \"deviceId\": \"\",\n \"deviceToken\": \"\",\n \"registrationToken\": \"\",\n \"transportType\": \"\"\n },\n \"push.state\": \"\"\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}}/push/deviceRegistrations/:device_id";
let payload = json!({
"clientId": "",
"deviceSecret": "",
"formFactor": "",
"id": "",
"metadata": json!({}),
"platform": "",
"push.recipient": json!({
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
}),
"push.state": ""
});
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}}/push/deviceRegistrations/:device_id \
--header 'content-type: application/json' \
--data '{
"clientId": "",
"deviceSecret": "",
"formFactor": "",
"id": "",
"metadata": {},
"platform": "",
"push.recipient": {
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
},
"push.state": ""
}'
echo '{
"clientId": "",
"deviceSecret": "",
"formFactor": "",
"id": "",
"metadata": {},
"platform": "",
"push.recipient": {
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
},
"push.state": ""
}' | \
http PATCH {{baseUrl}}/push/deviceRegistrations/:device_id \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "clientId": "",\n "deviceSecret": "",\n "formFactor": "",\n "id": "",\n "metadata": {},\n "platform": "",\n "push.recipient": {\n "clientId": "",\n "deviceId": "",\n "deviceToken": "",\n "registrationToken": "",\n "transportType": ""\n },\n "push.state": ""\n}' \
--output-document \
- {{baseUrl}}/push/deviceRegistrations/:device_id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"clientId": "",
"deviceSecret": "",
"formFactor": "",
"id": "",
"metadata": [],
"platform": "",
"push.recipient": [
"clientId": "",
"deviceId": "",
"deviceToken": "",
"registrationToken": "",
"transportType": ""
],
"push.state": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/push/deviceRegistrations/:device_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Get the service time
{{baseUrl}}/time
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/time");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/time")
require "http/client"
url = "{{baseUrl}}/time"
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}}/time"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/time");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/time"
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/time HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/time")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/time"))
.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}}/time")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/time")
.asString();
const 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}}/time');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/time'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/time';
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}}/time',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/time")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/time',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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}}/time'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/time');
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}}/time'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/time';
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}}/time"]
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}}/time" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/time",
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}}/time');
echo $response->getBody();
setUrl('{{baseUrl}}/time');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/time');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/time' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/time' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/time")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/time"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/time"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/time")
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/time') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/time";
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}}/time
http GET {{baseUrl}}/time
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/time
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/time")! 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
Retrieve usage statistics for an application
{{baseUrl}}/stats
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/stats");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/stats")
require "http/client"
url = "{{baseUrl}}/stats"
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}}/stats"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/stats");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/stats"
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/stats HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/stats")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/stats"))
.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}}/stats")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/stats")
.asString();
const 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}}/stats');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/stats'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/stats';
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}}/stats',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/stats")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/stats',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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}}/stats'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/stats');
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}}/stats'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/stats';
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}}/stats"]
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}}/stats" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/stats",
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}}/stats');
echo $response->getBody();
setUrl('{{baseUrl}}/stats');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/stats');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/stats' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/stats' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/stats")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/stats"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/stats"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/stats")
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/stats') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/stats";
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}}/stats
http GET {{baseUrl}}/stats
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/stats
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/stats")! 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
Enumerate all active channels of the application
{{baseUrl}}/channels
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/channels");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/channels")
require "http/client"
url = "{{baseUrl}}/channels"
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"),
};
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.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/channels"
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 HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/channels")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/channels"))
.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")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/channels")
.asString();
const 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');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/channels'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/channels';
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',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/channels")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/channels',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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'};
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');
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'};
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: '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"]
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" in
Client.call `GET 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 => "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');
echo $response->getBody();
setUrl('{{baseUrl}}/channels');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/channels');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/channels' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/channels' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/channels")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/channels"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/channels"
response <- VERB("GET", url, content_type("application/octet-stream"))
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::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') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/channels";
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
http GET {{baseUrl}}/channels
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/channels
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/channels")! 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 metadata of a channel
{{baseUrl}}/channels/:channel_id
QUERY PARAMS
channel_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/channels/:channel_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/channels/:channel_id")
require "http/client"
url = "{{baseUrl}}/channels/:channel_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}}/channels/:channel_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/:channel_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/channels/:channel_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/channels/:channel_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/channels/:channel_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/channels/:channel_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}}/channels/:channel_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/channels/:channel_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}}/channels/:channel_id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/channels/:channel_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/channels/:channel_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}}/channels/:channel_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/channels/:channel_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/channels/:channel_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}}/channels/:channel_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}}/channels/:channel_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}}/channels/:channel_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/:channel_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}}/channels/:channel_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}}/channels/:channel_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/channels/:channel_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}}/channels/:channel_id');
echo $response->getBody();
setUrl('{{baseUrl}}/channels/:channel_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/channels/:channel_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/channels/:channel_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/channels/:channel_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/channels/:channel_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/channels/:channel_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/channels/:channel_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/channels/:channel_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/channels/:channel_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/channels/:channel_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}}/channels/:channel_id
http GET {{baseUrl}}/channels/:channel_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/channels/:channel_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/channels/:channel_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 presence of a channel
{{baseUrl}}/channels/:channel_id/presence
QUERY PARAMS
channel_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/channels/:channel_id/presence");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/channels/:channel_id/presence")
require "http/client"
url = "{{baseUrl}}/channels/:channel_id/presence"
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/:channel_id/presence"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/channels/:channel_id/presence");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/channels/:channel_id/presence"
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/:channel_id/presence HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/channels/:channel_id/presence")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/channels/:channel_id/presence"))
.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/:channel_id/presence")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/channels/:channel_id/presence")
.asString();
const 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/:channel_id/presence');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/channels/:channel_id/presence'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/channels/:channel_id/presence';
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/:channel_id/presence',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/channels/:channel_id/presence")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/channels/:channel_id/presence',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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/:channel_id/presence'
};
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/:channel_id/presence');
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/:channel_id/presence'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/channels/:channel_id/presence';
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/:channel_id/presence"]
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/:channel_id/presence" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/channels/:channel_id/presence",
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/:channel_id/presence');
echo $response->getBody();
setUrl('{{baseUrl}}/channels/:channel_id/presence');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/channels/:channel_id/presence');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/channels/:channel_id/presence' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/channels/:channel_id/presence' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/channels/:channel_id/presence")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/channels/:channel_id/presence"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/channels/:channel_id/presence"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/channels/:channel_id/presence")
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/:channel_id/presence') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/channels/:channel_id/presence";
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/:channel_id/presence
http GET {{baseUrl}}/channels/:channel_id/presence
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/channels/:channel_id/presence
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/channels/:channel_id/presence")! 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()