Developer documentation
POST
Add users to an account
{{baseUrl}}/accounts/users/add
BODY json
{
"account": {
"accountId": "",
"domain": ""
},
"users": [
{
"identification": {
"email": "",
"userId": ""
}
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/accounts/users/add");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"users\": [\n {\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/accounts/users/add" {:content-type :json
:form-params {:account {:accountId ""
:domain ""}
:users [{:identification {:email ""
:userId ""}}]}})
require "http/client"
url = "{{baseUrl}}/accounts/users/add"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"users\": [\n {\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n }\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}}/accounts/users/add"),
Content = new StringContent("{\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"users\": [\n {\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/accounts/users/add");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"users\": [\n {\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/accounts/users/add"
payload := strings.NewReader("{\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"users\": [\n {\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n }\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/accounts/users/add HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 166
{
"account": {
"accountId": "",
"domain": ""
},
"users": [
{
"identification": {
"email": "",
"userId": ""
}
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/accounts/users/add")
.setHeader("content-type", "application/json")
.setBody("{\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"users\": [\n {\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/accounts/users/add"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"users\": [\n {\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"users\": [\n {\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/accounts/users/add")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/accounts/users/add")
.header("content-type", "application/json")
.body("{\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"users\": [\n {\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n }\n ]\n}")
.asString();
const data = JSON.stringify({
account: {
accountId: '',
domain: ''
},
users: [
{
identification: {
email: '',
userId: ''
}
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/accounts/users/add');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/accounts/users/add',
headers: {'content-type': 'application/json'},
data: {
account: {accountId: '', domain: ''},
users: [{identification: {email: '', userId: ''}}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/accounts/users/add';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"account":{"accountId":"","domain":""},"users":[{"identification":{"email":"","userId":""}}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/accounts/users/add',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "account": {\n "accountId": "",\n "domain": ""\n },\n "users": [\n {\n "identification": {\n "email": "",\n "userId": ""\n }\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"users\": [\n {\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/accounts/users/add")
.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/accounts/users/add',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
account: {accountId: '', domain: ''},
users: [{identification: {email: '', userId: ''}}]
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/accounts/users/add',
headers: {'content-type': 'application/json'},
body: {
account: {accountId: '', domain: ''},
users: [{identification: {email: '', userId: ''}}]
},
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}}/accounts/users/add');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
account: {
accountId: '',
domain: ''
},
users: [
{
identification: {
email: '',
userId: ''
}
}
]
});
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}}/accounts/users/add',
headers: {'content-type': 'application/json'},
data: {
account: {accountId: '', domain: ''},
users: [{identification: {email: '', userId: ''}}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/accounts/users/add';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"account":{"accountId":"","domain":""},"users":[{"identification":{"email":"","userId":""}}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"account": @{ @"accountId": @"", @"domain": @"" },
@"users": @[ @{ @"identification": @{ @"email": @"", @"userId": @"" } } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/accounts/users/add"]
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}}/accounts/users/add" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"users\": [\n {\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/accounts/users/add",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'account' => [
'accountId' => '',
'domain' => ''
],
'users' => [
[
'identification' => [
'email' => '',
'userId' => ''
]
]
]
]),
CURLOPT_HTTPHEADER => [
"content-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}}/accounts/users/add', [
'body' => '{
"account": {
"accountId": "",
"domain": ""
},
"users": [
{
"identification": {
"email": "",
"userId": ""
}
}
]
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/accounts/users/add');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'account' => [
'accountId' => '',
'domain' => ''
],
'users' => [
[
'identification' => [
'email' => '',
'userId' => ''
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'account' => [
'accountId' => '',
'domain' => ''
],
'users' => [
[
'identification' => [
'email' => '',
'userId' => ''
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/accounts/users/add');
$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}}/accounts/users/add' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"account": {
"accountId": "",
"domain": ""
},
"users": [
{
"identification": {
"email": "",
"userId": ""
}
}
]
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/accounts/users/add' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"account": {
"accountId": "",
"domain": ""
},
"users": [
{
"identification": {
"email": "",
"userId": ""
}
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"users\": [\n {\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n }\n ]\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/accounts/users/add", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/accounts/users/add"
payload = {
"account": {
"accountId": "",
"domain": ""
},
"users": [{ "identification": {
"email": "",
"userId": ""
} }]
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/accounts/users/add"
payload <- "{\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"users\": [\n {\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n }\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}}/accounts/users/add")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"users\": [\n {\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/accounts/users/add') do |req|
req.body = "{\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"users\": [\n {\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/accounts/users/add";
let payload = json!({
"account": json!({
"accountId": "",
"domain": ""
}),
"users": (json!({"identification": json!({
"email": "",
"userId": ""
})}))
});
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}}/accounts/users/add \
--header 'content-type: application/json' \
--data '{
"account": {
"accountId": "",
"domain": ""
},
"users": [
{
"identification": {
"email": "",
"userId": ""
}
}
]
}'
echo '{
"account": {
"accountId": "",
"domain": ""
},
"users": [
{
"identification": {
"email": "",
"userId": ""
}
}
]
}' | \
http POST {{baseUrl}}/accounts/users/add \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "account": {\n "accountId": "",\n "domain": ""\n },\n "users": [\n {\n "identification": {\n "email": "",\n "userId": ""\n }\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/accounts/users/add
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"account": [
"accountId": "",
"domain": ""
],
"users": [["identification": [
"email": "",
"userId": ""
]]]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/accounts/users/add")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Create or update account
{{baseUrl}}/accounts/upsert
BODY json
{
"identification": {
"accountId": "",
"domain": ""
},
"properties": {}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/accounts/upsert");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"identification\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"properties\": {}\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/accounts/upsert" {:content-type :json
:form-params {:identification {:accountId ""
:domain ""}
:properties {}}})
require "http/client"
url = "{{baseUrl}}/accounts/upsert"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"identification\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"properties\": {}\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}}/accounts/upsert"),
Content = new StringContent("{\n \"identification\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"properties\": {}\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/accounts/upsert");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"identification\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"properties\": {}\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/accounts/upsert"
payload := strings.NewReader("{\n \"identification\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"properties\": {}\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/accounts/upsert HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 87
{
"identification": {
"accountId": "",
"domain": ""
},
"properties": {}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/accounts/upsert")
.setHeader("content-type", "application/json")
.setBody("{\n \"identification\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"properties\": {}\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/accounts/upsert"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"identification\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"properties\": {}\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"identification\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"properties\": {}\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/accounts/upsert")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/accounts/upsert")
.header("content-type", "application/json")
.body("{\n \"identification\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"properties\": {}\n}")
.asString();
const data = JSON.stringify({
identification: {
accountId: '',
domain: ''
},
properties: {}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/accounts/upsert');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/accounts/upsert',
headers: {'content-type': 'application/json'},
data: {identification: {accountId: '', domain: ''}, properties: {}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/accounts/upsert';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"identification":{"accountId":"","domain":""},"properties":{}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/accounts/upsert',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "identification": {\n "accountId": "",\n "domain": ""\n },\n "properties": {}\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"identification\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"properties\": {}\n}")
val request = Request.Builder()
.url("{{baseUrl}}/accounts/upsert")
.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/accounts/upsert',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({identification: {accountId: '', domain: ''}, properties: {}}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/accounts/upsert',
headers: {'content-type': 'application/json'},
body: {identification: {accountId: '', domain: ''}, properties: {}},
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}}/accounts/upsert');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
identification: {
accountId: '',
domain: ''
},
properties: {}
});
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}}/accounts/upsert',
headers: {'content-type': 'application/json'},
data: {identification: {accountId: '', domain: ''}, properties: {}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/accounts/upsert';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"identification":{"accountId":"","domain":""},"properties":{}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"identification": @{ @"accountId": @"", @"domain": @"" },
@"properties": @{ } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/accounts/upsert"]
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}}/accounts/upsert" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"identification\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"properties\": {}\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/accounts/upsert",
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([
'identification' => [
'accountId' => '',
'domain' => ''
],
'properties' => [
]
]),
CURLOPT_HTTPHEADER => [
"content-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}}/accounts/upsert', [
'body' => '{
"identification": {
"accountId": "",
"domain": ""
},
"properties": {}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/accounts/upsert');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'identification' => [
'accountId' => '',
'domain' => ''
],
'properties' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'identification' => [
'accountId' => '',
'domain' => ''
],
'properties' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/accounts/upsert');
$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}}/accounts/upsert' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"identification": {
"accountId": "",
"domain": ""
},
"properties": {}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/accounts/upsert' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"identification": {
"accountId": "",
"domain": ""
},
"properties": {}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"identification\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"properties\": {}\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/accounts/upsert", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/accounts/upsert"
payload = {
"identification": {
"accountId": "",
"domain": ""
},
"properties": {}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/accounts/upsert"
payload <- "{\n \"identification\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"properties\": {}\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}}/accounts/upsert")
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 \"identification\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"properties\": {}\n}"
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/accounts/upsert') do |req|
req.body = "{\n \"identification\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"properties\": {}\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/accounts/upsert";
let payload = json!({
"identification": json!({
"accountId": "",
"domain": ""
}),
"properties": json!({})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/accounts/upsert \
--header 'content-type: application/json' \
--data '{
"identification": {
"accountId": "",
"domain": ""
},
"properties": {}
}'
echo '{
"identification": {
"accountId": "",
"domain": ""
},
"properties": {}
}' | \
http POST {{baseUrl}}/accounts/upsert \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "identification": {\n "accountId": "",\n "domain": ""\n },\n "properties": {}\n}' \
--output-document \
- {{baseUrl}}/accounts/upsert
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"identification": [
"accountId": "",
"domain": ""
],
"properties": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/accounts/upsert")! 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 account
{{baseUrl}}/accounts
BODY json
{
"identification": {
"accountId": "",
"domain": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/accounts");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"identification\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/accounts" {:content-type :json
:form-params {:identification {:accountId ""
:domain ""}}})
require "http/client"
url = "{{baseUrl}}/accounts"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"identification\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n }\n}"
response = HTTP::Client.delete url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/accounts"),
Content = new StringContent("{\n \"identification\": {\n \"accountId\": \"\",\n \"domain\": \"\"\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}}/accounts");
var request = new RestRequest("", Method.Delete);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"identification\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/accounts"
payload := strings.NewReader("{\n \"identification\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n }\n}")
req, _ := http.NewRequest("DELETE", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/accounts HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 67
{
"identification": {
"accountId": "",
"domain": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/accounts")
.setHeader("content-type", "application/json")
.setBody("{\n \"identification\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/accounts"))
.header("content-type", "application/json")
.method("DELETE", HttpRequest.BodyPublishers.ofString("{\n \"identification\": {\n \"accountId\": \"\",\n \"domain\": \"\"\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 \"identification\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/accounts")
.delete(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/accounts")
.header("content-type", "application/json")
.body("{\n \"identification\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
identification: {
accountId: '',
domain: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/accounts');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/accounts',
headers: {'content-type': 'application/json'},
data: {identification: {accountId: '', domain: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/accounts';
const options = {
method: 'DELETE',
headers: {'content-type': 'application/json'},
body: '{"identification":{"accountId":"","domain":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/accounts',
method: 'DELETE',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "identification": {\n "accountId": "",\n "domain": ""\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 \"identification\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/accounts")
.delete(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/accounts',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({identification: {accountId: '', domain: ''}}));
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/accounts',
headers: {'content-type': 'application/json'},
body: {identification: {accountId: '', domain: ''}},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/accounts');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
identification: {
accountId: '',
domain: ''
}
});
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}}/accounts',
headers: {'content-type': 'application/json'},
data: {identification: {accountId: '', domain: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/accounts';
const options = {
method: 'DELETE',
headers: {'content-type': 'application/json'},
body: '{"identification":{"accountId":"","domain":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"identification": @{ @"accountId": @"", @"domain": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/accounts"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/accounts" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"identification\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n }\n}" in
Client.call ~headers ~body `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/accounts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_POSTFIELDS => json_encode([
'identification' => [
'accountId' => '',
'domain' => ''
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/accounts', [
'body' => '{
"identification": {
"accountId": "",
"domain": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/accounts');
$request->setMethod(HTTP_METH_DELETE);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'identification' => [
'accountId' => '',
'domain' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'identification' => [
'accountId' => '',
'domain' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/accounts');
$request->setRequestMethod('DELETE');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/accounts' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '{
"identification": {
"accountId": "",
"domain": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/accounts' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '{
"identification": {
"accountId": "",
"domain": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"identification\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("DELETE", "/baseUrl/accounts", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/accounts"
payload = { "identification": {
"accountId": "",
"domain": ""
} }
headers = {"content-type": "application/json"}
response = requests.delete(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/accounts"
payload <- "{\n \"identification\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n }\n}"
encode <- "json"
response <- VERB("DELETE", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/accounts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"identification\": {\n \"accountId\": \"\",\n \"domain\": \"\"\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.delete('/baseUrl/accounts') do |req|
req.body = "{\n \"identification\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n }\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/accounts";
let payload = json!({"identification": json!({
"accountId": "",
"domain": ""
})});
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("DELETE").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/accounts \
--header 'content-type: application/json' \
--data '{
"identification": {
"accountId": "",
"domain": ""
}
}'
echo '{
"identification": {
"accountId": "",
"domain": ""
}
}' | \
http DELETE {{baseUrl}}/accounts \
content-type:application/json
wget --quiet \
--method DELETE \
--header 'content-type: application/json' \
--body-data '{\n "identification": {\n "accountId": "",\n "domain": ""\n }\n}' \
--output-document \
- {{baseUrl}}/accounts
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["identification": [
"accountId": "",
"domain": ""
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/accounts")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as 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
Remove user from account
{{baseUrl}}/accounts/users/remove
BODY json
{
"account": {
"accountId": "",
"domain": ""
},
"users": [
{
"identification": {
"email": "",
"userId": ""
}
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/accounts/users/remove");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"users\": [\n {\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/accounts/users/remove" {:content-type :json
:form-params {:account {:accountId ""
:domain ""}
:users [{:identification {:email ""
:userId ""}}]}})
require "http/client"
url = "{{baseUrl}}/accounts/users/remove"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"users\": [\n {\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n }\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}}/accounts/users/remove"),
Content = new StringContent("{\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"users\": [\n {\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/accounts/users/remove");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"users\": [\n {\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/accounts/users/remove"
payload := strings.NewReader("{\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"users\": [\n {\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n }\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/accounts/users/remove HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 166
{
"account": {
"accountId": "",
"domain": ""
},
"users": [
{
"identification": {
"email": "",
"userId": ""
}
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/accounts/users/remove")
.setHeader("content-type", "application/json")
.setBody("{\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"users\": [\n {\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/accounts/users/remove"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"users\": [\n {\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"users\": [\n {\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/accounts/users/remove")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/accounts/users/remove")
.header("content-type", "application/json")
.body("{\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"users\": [\n {\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n }\n ]\n}")
.asString();
const data = JSON.stringify({
account: {
accountId: '',
domain: ''
},
users: [
{
identification: {
email: '',
userId: ''
}
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/accounts/users/remove');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/accounts/users/remove',
headers: {'content-type': 'application/json'},
data: {
account: {accountId: '', domain: ''},
users: [{identification: {email: '', userId: ''}}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/accounts/users/remove';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"account":{"accountId":"","domain":""},"users":[{"identification":{"email":"","userId":""}}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/accounts/users/remove',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "account": {\n "accountId": "",\n "domain": ""\n },\n "users": [\n {\n "identification": {\n "email": "",\n "userId": ""\n }\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"users\": [\n {\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/accounts/users/remove")
.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/accounts/users/remove',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
account: {accountId: '', domain: ''},
users: [{identification: {email: '', userId: ''}}]
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/accounts/users/remove',
headers: {'content-type': 'application/json'},
body: {
account: {accountId: '', domain: ''},
users: [{identification: {email: '', userId: ''}}]
},
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}}/accounts/users/remove');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
account: {
accountId: '',
domain: ''
},
users: [
{
identification: {
email: '',
userId: ''
}
}
]
});
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}}/accounts/users/remove',
headers: {'content-type': 'application/json'},
data: {
account: {accountId: '', domain: ''},
users: [{identification: {email: '', userId: ''}}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/accounts/users/remove';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"account":{"accountId":"","domain":""},"users":[{"identification":{"email":"","userId":""}}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"account": @{ @"accountId": @"", @"domain": @"" },
@"users": @[ @{ @"identification": @{ @"email": @"", @"userId": @"" } } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/accounts/users/remove"]
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}}/accounts/users/remove" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"users\": [\n {\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/accounts/users/remove",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'account' => [
'accountId' => '',
'domain' => ''
],
'users' => [
[
'identification' => [
'email' => '',
'userId' => ''
]
]
]
]),
CURLOPT_HTTPHEADER => [
"content-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}}/accounts/users/remove', [
'body' => '{
"account": {
"accountId": "",
"domain": ""
},
"users": [
{
"identification": {
"email": "",
"userId": ""
}
}
]
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/accounts/users/remove');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'account' => [
'accountId' => '',
'domain' => ''
],
'users' => [
[
'identification' => [
'email' => '',
'userId' => ''
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'account' => [
'accountId' => '',
'domain' => ''
],
'users' => [
[
'identification' => [
'email' => '',
'userId' => ''
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/accounts/users/remove');
$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}}/accounts/users/remove' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"account": {
"accountId": "",
"domain": ""
},
"users": [
{
"identification": {
"email": "",
"userId": ""
}
}
]
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/accounts/users/remove' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"account": {
"accountId": "",
"domain": ""
},
"users": [
{
"identification": {
"email": "",
"userId": ""
}
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"users\": [\n {\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n }\n ]\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/accounts/users/remove", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/accounts/users/remove"
payload = {
"account": {
"accountId": "",
"domain": ""
},
"users": [{ "identification": {
"email": "",
"userId": ""
} }]
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/accounts/users/remove"
payload <- "{\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"users\": [\n {\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n }\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}}/accounts/users/remove")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"users\": [\n {\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/accounts/users/remove') do |req|
req.body = "{\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"users\": [\n {\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/accounts/users/remove";
let payload = json!({
"account": json!({
"accountId": "",
"domain": ""
}),
"users": (json!({"identification": json!({
"email": "",
"userId": ""
})}))
});
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}}/accounts/users/remove \
--header 'content-type: application/json' \
--data '{
"account": {
"accountId": "",
"domain": ""
},
"users": [
{
"identification": {
"email": "",
"userId": ""
}
}
]
}'
echo '{
"account": {
"accountId": "",
"domain": ""
},
"users": [
{
"identification": {
"email": "",
"userId": ""
}
}
]
}' | \
http POST {{baseUrl}}/accounts/users/remove \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "account": {\n "accountId": "",\n "domain": ""\n },\n "users": [\n {\n "identification": {\n "email": "",\n "userId": ""\n }\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/accounts/users/remove
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"account": [
"accountId": "",
"domain": ""
],
"users": [["identification": [
"email": "",
"userId": ""
]]]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/accounts/users/remove")! 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 events
{{baseUrl}}/events
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/events");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/events")
require "http/client"
url = "{{baseUrl}}/events"
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}}/events"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/events");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/events"
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/events HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/events")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/events"))
.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}}/events")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/events")
.asString();
const 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}}/events');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/events'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/events';
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}}/events',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/events")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/events',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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}}/events'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/events');
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}}/events'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/events';
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}}/events"]
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}}/events" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/events",
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}}/events');
echo $response->getBody();
setUrl('{{baseUrl}}/events');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/events');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/events' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/events' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/events")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/events"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/events"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/events")
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/events') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/events";
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}}/events
http GET {{baseUrl}}/events
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/events
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/events")! 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
Track event
{{baseUrl}}/events
BODY json
{
"identification": {
"account": {
"accountId": "",
"domain": ""
},
"user": {
"email": "",
"userId": ""
}
},
"metadata": {},
"name": "",
"triggeredAt": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/events");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"identification\": {\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"user\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n },\n \"metadata\": {},\n \"name\": \"\",\n \"triggeredAt\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/events" {:content-type :json
:form-params {:identification {:account {:accountId ""
:domain ""}
:user {:email ""
:userId ""}}
:metadata {}
:name ""
:triggeredAt ""}})
require "http/client"
url = "{{baseUrl}}/events"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"identification\": {\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"user\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n },\n \"metadata\": {},\n \"name\": \"\",\n \"triggeredAt\": \"\"\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}}/events"),
Content = new StringContent("{\n \"identification\": {\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"user\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n },\n \"metadata\": {},\n \"name\": \"\",\n \"triggeredAt\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/events");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"identification\": {\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"user\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n },\n \"metadata\": {},\n \"name\": \"\",\n \"triggeredAt\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/events"
payload := strings.NewReader("{\n \"identification\": {\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"user\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n },\n \"metadata\": {},\n \"name\": \"\",\n \"triggeredAt\": \"\"\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/events HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 206
{
"identification": {
"account": {
"accountId": "",
"domain": ""
},
"user": {
"email": "",
"userId": ""
}
},
"metadata": {},
"name": "",
"triggeredAt": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/events")
.setHeader("content-type", "application/json")
.setBody("{\n \"identification\": {\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"user\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n },\n \"metadata\": {},\n \"name\": \"\",\n \"triggeredAt\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/events"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"identification\": {\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"user\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n },\n \"metadata\": {},\n \"name\": \"\",\n \"triggeredAt\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"identification\": {\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"user\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n },\n \"metadata\": {},\n \"name\": \"\",\n \"triggeredAt\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/events")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/events")
.header("content-type", "application/json")
.body("{\n \"identification\": {\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"user\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n },\n \"metadata\": {},\n \"name\": \"\",\n \"triggeredAt\": \"\"\n}")
.asString();
const data = JSON.stringify({
identification: {
account: {
accountId: '',
domain: ''
},
user: {
email: '',
userId: ''
}
},
metadata: {},
name: '',
triggeredAt: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/events');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/events',
headers: {'content-type': 'application/json'},
data: {
identification: {account: {accountId: '', domain: ''}, user: {email: '', userId: ''}},
metadata: {},
name: '',
triggeredAt: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/events';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"identification":{"account":{"accountId":"","domain":""},"user":{"email":"","userId":""}},"metadata":{},"name":"","triggeredAt":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/events',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "identification": {\n "account": {\n "accountId": "",\n "domain": ""\n },\n "user": {\n "email": "",\n "userId": ""\n }\n },\n "metadata": {},\n "name": "",\n "triggeredAt": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"identification\": {\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"user\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n },\n \"metadata\": {},\n \"name\": \"\",\n \"triggeredAt\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/events")
.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/events',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
identification: {account: {accountId: '', domain: ''}, user: {email: '', userId: ''}},
metadata: {},
name: '',
triggeredAt: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/events',
headers: {'content-type': 'application/json'},
body: {
identification: {account: {accountId: '', domain: ''}, user: {email: '', userId: ''}},
metadata: {},
name: '',
triggeredAt: ''
},
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}}/events');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
identification: {
account: {
accountId: '',
domain: ''
},
user: {
email: '',
userId: ''
}
},
metadata: {},
name: '',
triggeredAt: ''
});
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}}/events',
headers: {'content-type': 'application/json'},
data: {
identification: {account: {accountId: '', domain: ''}, user: {email: '', userId: ''}},
metadata: {},
name: '',
triggeredAt: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/events';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"identification":{"account":{"accountId":"","domain":""},"user":{"email":"","userId":""}},"metadata":{},"name":"","triggeredAt":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"identification": @{ @"account": @{ @"accountId": @"", @"domain": @"" }, @"user": @{ @"email": @"", @"userId": @"" } },
@"metadata": @{ },
@"name": @"",
@"triggeredAt": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/events"]
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}}/events" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"identification\": {\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"user\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n },\n \"metadata\": {},\n \"name\": \"\",\n \"triggeredAt\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/events",
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([
'identification' => [
'account' => [
'accountId' => '',
'domain' => ''
],
'user' => [
'email' => '',
'userId' => ''
]
],
'metadata' => [
],
'name' => '',
'triggeredAt' => ''
]),
CURLOPT_HTTPHEADER => [
"content-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}}/events', [
'body' => '{
"identification": {
"account": {
"accountId": "",
"domain": ""
},
"user": {
"email": "",
"userId": ""
}
},
"metadata": {},
"name": "",
"triggeredAt": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/events');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'identification' => [
'account' => [
'accountId' => '',
'domain' => ''
],
'user' => [
'email' => '',
'userId' => ''
]
],
'metadata' => [
],
'name' => '',
'triggeredAt' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'identification' => [
'account' => [
'accountId' => '',
'domain' => ''
],
'user' => [
'email' => '',
'userId' => ''
]
],
'metadata' => [
],
'name' => '',
'triggeredAt' => ''
]));
$request->setRequestUrl('{{baseUrl}}/events');
$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}}/events' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"identification": {
"account": {
"accountId": "",
"domain": ""
},
"user": {
"email": "",
"userId": ""
}
},
"metadata": {},
"name": "",
"triggeredAt": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/events' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"identification": {
"account": {
"accountId": "",
"domain": ""
},
"user": {
"email": "",
"userId": ""
}
},
"metadata": {},
"name": "",
"triggeredAt": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"identification\": {\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"user\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n },\n \"metadata\": {},\n \"name\": \"\",\n \"triggeredAt\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/events", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/events"
payload = {
"identification": {
"account": {
"accountId": "",
"domain": ""
},
"user": {
"email": "",
"userId": ""
}
},
"metadata": {},
"name": "",
"triggeredAt": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/events"
payload <- "{\n \"identification\": {\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"user\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n },\n \"metadata\": {},\n \"name\": \"\",\n \"triggeredAt\": \"\"\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}}/events")
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 \"identification\": {\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"user\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n },\n \"metadata\": {},\n \"name\": \"\",\n \"triggeredAt\": \"\"\n}"
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/events') do |req|
req.body = "{\n \"identification\": {\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"user\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n },\n \"metadata\": {},\n \"name\": \"\",\n \"triggeredAt\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/events";
let payload = json!({
"identification": json!({
"account": json!({
"accountId": "",
"domain": ""
}),
"user": json!({
"email": "",
"userId": ""
})
}),
"metadata": json!({}),
"name": "",
"triggeredAt": ""
});
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}}/events \
--header 'content-type: application/json' \
--data '{
"identification": {
"account": {
"accountId": "",
"domain": ""
},
"user": {
"email": "",
"userId": ""
}
},
"metadata": {},
"name": "",
"triggeredAt": ""
}'
echo '{
"identification": {
"account": {
"accountId": "",
"domain": ""
},
"user": {
"email": "",
"userId": ""
}
},
"metadata": {},
"name": "",
"triggeredAt": ""
}' | \
http POST {{baseUrl}}/events \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "identification": {\n "account": {\n "accountId": "",\n "domain": ""\n },\n "user": {\n "email": "",\n "userId": ""\n }\n },\n "metadata": {},\n "name": "",\n "triggeredAt": ""\n}' \
--output-document \
- {{baseUrl}}/events
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"identification": [
"account": [
"accountId": "",
"domain": ""
],
"user": [
"email": "",
"userId": ""
]
],
"metadata": [],
"name": "",
"triggeredAt": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/events")! 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 account properties
{{baseUrl}}/properties/accounts
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/properties/accounts");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/properties/accounts")
require "http/client"
url = "{{baseUrl}}/properties/accounts"
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}}/properties/accounts"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/properties/accounts");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/properties/accounts"
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/properties/accounts HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/properties/accounts")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/properties/accounts"))
.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}}/properties/accounts")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/properties/accounts")
.asString();
const 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}}/properties/accounts');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/properties/accounts'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/properties/accounts';
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}}/properties/accounts',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/properties/accounts")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/properties/accounts',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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}}/properties/accounts'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/properties/accounts');
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}}/properties/accounts'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/properties/accounts';
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}}/properties/accounts"]
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}}/properties/accounts" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/properties/accounts",
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}}/properties/accounts');
echo $response->getBody();
setUrl('{{baseUrl}}/properties/accounts');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/properties/accounts');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/properties/accounts' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/properties/accounts' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/properties/accounts")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/properties/accounts"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/properties/accounts"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/properties/accounts")
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/properties/accounts') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/properties/accounts";
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}}/properties/accounts
http GET {{baseUrl}}/properties/accounts
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/properties/accounts
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/properties/accounts")! 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 user properties
{{baseUrl}}/properties/users
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/properties/users");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/properties/users")
require "http/client"
url = "{{baseUrl}}/properties/users"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/properties/users"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/properties/users");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/properties/users"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/properties/users HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/properties/users")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/properties/users"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/properties/users")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/properties/users")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/properties/users');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/properties/users'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/properties/users';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/properties/users',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/properties/users")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/properties/users',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/properties/users'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/properties/users');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/properties/users'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/properties/users';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/properties/users"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/properties/users" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/properties/users",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/properties/users');
echo $response->getBody();
setUrl('{{baseUrl}}/properties/users');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/properties/users');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/properties/users' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/properties/users' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/properties/users")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/properties/users"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/properties/users"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/properties/users")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/properties/users') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/properties/users";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/properties/users
http GET {{baseUrl}}/properties/users
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/properties/users
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/properties/users")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Get account segments
{{baseUrl}}/segments/accounts
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/segments/accounts");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/segments/accounts")
require "http/client"
url = "{{baseUrl}}/segments/accounts"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/segments/accounts"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/segments/accounts");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/segments/accounts"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/segments/accounts HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/segments/accounts")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/segments/accounts"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/segments/accounts")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/segments/accounts")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/segments/accounts');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/segments/accounts'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/segments/accounts';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/segments/accounts',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/segments/accounts")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/segments/accounts',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/segments/accounts'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/segments/accounts');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/segments/accounts'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/segments/accounts';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/segments/accounts"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/segments/accounts" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/segments/accounts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/segments/accounts');
echo $response->getBody();
setUrl('{{baseUrl}}/segments/accounts');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/segments/accounts');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/segments/accounts' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/segments/accounts' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/segments/accounts")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/segments/accounts"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/segments/accounts"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/segments/accounts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/segments/accounts') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/segments/accounts";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/segments/accounts
http GET {{baseUrl}}/segments/accounts
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/segments/accounts
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/segments/accounts")! 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 user segments
{{baseUrl}}/segments/users
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/segments/users");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/segments/users")
require "http/client"
url = "{{baseUrl}}/segments/users"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/segments/users"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/segments/users");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/segments/users"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/segments/users HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/segments/users")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/segments/users"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/segments/users")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/segments/users")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/segments/users');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/segments/users'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/segments/users';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/segments/users',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/segments/users")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/segments/users',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/segments/users'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/segments/users');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/segments/users'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/segments/users';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/segments/users"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/segments/users" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/segments/users",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/segments/users');
echo $response->getBody();
setUrl('{{baseUrl}}/segments/users');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/segments/users');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/segments/users' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/segments/users' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/segments/users")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/segments/users"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/segments/users"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/segments/users")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/segments/users') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/segments/users";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/segments/users
http GET {{baseUrl}}/segments/users
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/segments/users
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/segments/users")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Track event (POST)
{{baseUrl}}/track
BODY json
{
"identification": {
"account": {
"accountId": "",
"domain": ""
},
"user": {
"email": "",
"userId": ""
}
},
"metadata": {},
"name": "",
"triggeredAt": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/track");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"identification\": {\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"user\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n },\n \"metadata\": {},\n \"name\": \"\",\n \"triggeredAt\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/track" {:content-type :json
:form-params {:identification {:account {:accountId ""
:domain ""}
:user {:email ""
:userId ""}}
:metadata {}
:name ""
:triggeredAt ""}})
require "http/client"
url = "{{baseUrl}}/track"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"identification\": {\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"user\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n },\n \"metadata\": {},\n \"name\": \"\",\n \"triggeredAt\": \"\"\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}}/track"),
Content = new StringContent("{\n \"identification\": {\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"user\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n },\n \"metadata\": {},\n \"name\": \"\",\n \"triggeredAt\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/track");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"identification\": {\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"user\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n },\n \"metadata\": {},\n \"name\": \"\",\n \"triggeredAt\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/track"
payload := strings.NewReader("{\n \"identification\": {\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"user\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n },\n \"metadata\": {},\n \"name\": \"\",\n \"triggeredAt\": \"\"\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/track HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 206
{
"identification": {
"account": {
"accountId": "",
"domain": ""
},
"user": {
"email": "",
"userId": ""
}
},
"metadata": {},
"name": "",
"triggeredAt": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/track")
.setHeader("content-type", "application/json")
.setBody("{\n \"identification\": {\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"user\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n },\n \"metadata\": {},\n \"name\": \"\",\n \"triggeredAt\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/track"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"identification\": {\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"user\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n },\n \"metadata\": {},\n \"name\": \"\",\n \"triggeredAt\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"identification\": {\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"user\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n },\n \"metadata\": {},\n \"name\": \"\",\n \"triggeredAt\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/track")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/track")
.header("content-type", "application/json")
.body("{\n \"identification\": {\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"user\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n },\n \"metadata\": {},\n \"name\": \"\",\n \"triggeredAt\": \"\"\n}")
.asString();
const data = JSON.stringify({
identification: {
account: {
accountId: '',
domain: ''
},
user: {
email: '',
userId: ''
}
},
metadata: {},
name: '',
triggeredAt: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/track');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/track',
headers: {'content-type': 'application/json'},
data: {
identification: {account: {accountId: '', domain: ''}, user: {email: '', userId: ''}},
metadata: {},
name: '',
triggeredAt: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/track';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"identification":{"account":{"accountId":"","domain":""},"user":{"email":"","userId":""}},"metadata":{},"name":"","triggeredAt":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/track',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "identification": {\n "account": {\n "accountId": "",\n "domain": ""\n },\n "user": {\n "email": "",\n "userId": ""\n }\n },\n "metadata": {},\n "name": "",\n "triggeredAt": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"identification\": {\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"user\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n },\n \"metadata\": {},\n \"name\": \"\",\n \"triggeredAt\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/track")
.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/track',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
identification: {account: {accountId: '', domain: ''}, user: {email: '', userId: ''}},
metadata: {},
name: '',
triggeredAt: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/track',
headers: {'content-type': 'application/json'},
body: {
identification: {account: {accountId: '', domain: ''}, user: {email: '', userId: ''}},
metadata: {},
name: '',
triggeredAt: ''
},
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}}/track');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
identification: {
account: {
accountId: '',
domain: ''
},
user: {
email: '',
userId: ''
}
},
metadata: {},
name: '',
triggeredAt: ''
});
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}}/track',
headers: {'content-type': 'application/json'},
data: {
identification: {account: {accountId: '', domain: ''}, user: {email: '', userId: ''}},
metadata: {},
name: '',
triggeredAt: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/track';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"identification":{"account":{"accountId":"","domain":""},"user":{"email":"","userId":""}},"metadata":{},"name":"","triggeredAt":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"identification": @{ @"account": @{ @"accountId": @"", @"domain": @"" }, @"user": @{ @"email": @"", @"userId": @"" } },
@"metadata": @{ },
@"name": @"",
@"triggeredAt": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/track"]
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}}/track" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"identification\": {\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"user\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n },\n \"metadata\": {},\n \"name\": \"\",\n \"triggeredAt\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/track",
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([
'identification' => [
'account' => [
'accountId' => '',
'domain' => ''
],
'user' => [
'email' => '',
'userId' => ''
]
],
'metadata' => [
],
'name' => '',
'triggeredAt' => ''
]),
CURLOPT_HTTPHEADER => [
"content-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}}/track', [
'body' => '{
"identification": {
"account": {
"accountId": "",
"domain": ""
},
"user": {
"email": "",
"userId": ""
}
},
"metadata": {},
"name": "",
"triggeredAt": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/track');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'identification' => [
'account' => [
'accountId' => '',
'domain' => ''
],
'user' => [
'email' => '',
'userId' => ''
]
],
'metadata' => [
],
'name' => '',
'triggeredAt' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'identification' => [
'account' => [
'accountId' => '',
'domain' => ''
],
'user' => [
'email' => '',
'userId' => ''
]
],
'metadata' => [
],
'name' => '',
'triggeredAt' => ''
]));
$request->setRequestUrl('{{baseUrl}}/track');
$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}}/track' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"identification": {
"account": {
"accountId": "",
"domain": ""
},
"user": {
"email": "",
"userId": ""
}
},
"metadata": {},
"name": "",
"triggeredAt": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/track' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"identification": {
"account": {
"accountId": "",
"domain": ""
},
"user": {
"email": "",
"userId": ""
}
},
"metadata": {},
"name": "",
"triggeredAt": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"identification\": {\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"user\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n },\n \"metadata\": {},\n \"name\": \"\",\n \"triggeredAt\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/track", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/track"
payload = {
"identification": {
"account": {
"accountId": "",
"domain": ""
},
"user": {
"email": "",
"userId": ""
}
},
"metadata": {},
"name": "",
"triggeredAt": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/track"
payload <- "{\n \"identification\": {\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"user\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n },\n \"metadata\": {},\n \"name\": \"\",\n \"triggeredAt\": \"\"\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}}/track")
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 \"identification\": {\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"user\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n },\n \"metadata\": {},\n \"name\": \"\",\n \"triggeredAt\": \"\"\n}"
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/track') do |req|
req.body = "{\n \"identification\": {\n \"account\": {\n \"accountId\": \"\",\n \"domain\": \"\"\n },\n \"user\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n },\n \"metadata\": {},\n \"name\": \"\",\n \"triggeredAt\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/track";
let payload = json!({
"identification": json!({
"account": json!({
"accountId": "",
"domain": ""
}),
"user": json!({
"email": "",
"userId": ""
})
}),
"metadata": json!({}),
"name": "",
"triggeredAt": ""
});
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}}/track \
--header 'content-type: application/json' \
--data '{
"identification": {
"account": {
"accountId": "",
"domain": ""
},
"user": {
"email": "",
"userId": ""
}
},
"metadata": {},
"name": "",
"triggeredAt": ""
}'
echo '{
"identification": {
"account": {
"accountId": "",
"domain": ""
},
"user": {
"email": "",
"userId": ""
}
},
"metadata": {},
"name": "",
"triggeredAt": ""
}' | \
http POST {{baseUrl}}/track \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "identification": {\n "account": {\n "accountId": "",\n "domain": ""\n },\n "user": {\n "email": "",\n "userId": ""\n }\n },\n "metadata": {},\n "name": "",\n "triggeredAt": ""\n}' \
--output-document \
- {{baseUrl}}/track
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"identification": [
"account": [
"accountId": "",
"domain": ""
],
"user": [
"email": "",
"userId": ""
]
],
"metadata": [],
"name": "",
"triggeredAt": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/track")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Create or update user
{{baseUrl}}/users/upsert
BODY json
{
"identification": {
"email": "",
"userId": ""
},
"properties": {}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/users/upsert");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n },\n \"properties\": {}\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/users/upsert" {:content-type :json
:form-params {:identification {:email ""
:userId ""}
:properties {}}})
require "http/client"
url = "{{baseUrl}}/users/upsert"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n },\n \"properties\": {}\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/users/upsert"),
Content = new StringContent("{\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n },\n \"properties\": {}\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/users/upsert");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n },\n \"properties\": {}\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/users/upsert"
payload := strings.NewReader("{\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n },\n \"properties\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/users/upsert HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 83
{
"identification": {
"email": "",
"userId": ""
},
"properties": {}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/users/upsert")
.setHeader("content-type", "application/json")
.setBody("{\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n },\n \"properties\": {}\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/users/upsert"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n },\n \"properties\": {}\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n },\n \"properties\": {}\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/users/upsert")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/users/upsert")
.header("content-type", "application/json")
.body("{\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n },\n \"properties\": {}\n}")
.asString();
const data = JSON.stringify({
identification: {
email: '',
userId: ''
},
properties: {}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/users/upsert');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/users/upsert',
headers: {'content-type': 'application/json'},
data: {identification: {email: '', userId: ''}, properties: {}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/users/upsert';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"identification":{"email":"","userId":""},"properties":{}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/users/upsert',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "identification": {\n "email": "",\n "userId": ""\n },\n "properties": {}\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n },\n \"properties\": {}\n}")
val request = Request.Builder()
.url("{{baseUrl}}/users/upsert")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/users/upsert',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({identification: {email: '', userId: ''}, properties: {}}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/users/upsert',
headers: {'content-type': 'application/json'},
body: {identification: {email: '', userId: ''}, properties: {}},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/users/upsert');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
identification: {
email: '',
userId: ''
},
properties: {}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/users/upsert',
headers: {'content-type': 'application/json'},
data: {identification: {email: '', userId: ''}, properties: {}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/users/upsert';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"identification":{"email":"","userId":""},"properties":{}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"identification": @{ @"email": @"", @"userId": @"" },
@"properties": @{ } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/users/upsert"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/users/upsert" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n },\n \"properties\": {}\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/users/upsert",
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([
'identification' => [
'email' => '',
'userId' => ''
],
'properties' => [
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/users/upsert', [
'body' => '{
"identification": {
"email": "",
"userId": ""
},
"properties": {}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/users/upsert');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'identification' => [
'email' => '',
'userId' => ''
],
'properties' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'identification' => [
'email' => '',
'userId' => ''
],
'properties' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/users/upsert');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/users/upsert' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"identification": {
"email": "",
"userId": ""
},
"properties": {}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/users/upsert' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"identification": {
"email": "",
"userId": ""
},
"properties": {}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n },\n \"properties\": {}\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/users/upsert", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/users/upsert"
payload = {
"identification": {
"email": "",
"userId": ""
},
"properties": {}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/users/upsert"
payload <- "{\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n },\n \"properties\": {}\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/users/upsert")
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 \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n },\n \"properties\": {}\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/users/upsert') do |req|
req.body = "{\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n },\n \"properties\": {}\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/users/upsert";
let payload = json!({
"identification": json!({
"email": "",
"userId": ""
}),
"properties": json!({})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/users/upsert \
--header 'content-type: application/json' \
--data '{
"identification": {
"email": "",
"userId": ""
},
"properties": {}
}'
echo '{
"identification": {
"email": "",
"userId": ""
},
"properties": {}
}' | \
http POST {{baseUrl}}/users/upsert \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "identification": {\n "email": "",\n "userId": ""\n },\n "properties": {}\n}' \
--output-document \
- {{baseUrl}}/users/upsert
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"identification": [
"email": "",
"userId": ""
],
"properties": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/users/upsert")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
Delete user
{{baseUrl}}/users
BODY json
{
"identification": {
"email": "",
"userId": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/users");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/users" {:content-type :json
:form-params {:identification {:email ""
:userId ""}}})
require "http/client"
url = "{{baseUrl}}/users"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n}"
response = HTTP::Client.delete url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/users"),
Content = new StringContent("{\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/users");
var request = new RestRequest("", Method.Delete);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/users"
payload := strings.NewReader("{\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n}")
req, _ := http.NewRequest("DELETE", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/users HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 63
{
"identification": {
"email": "",
"userId": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/users")
.setHeader("content-type", "application/json")
.setBody("{\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/users"))
.header("content-type", "application/json")
.method("DELETE", HttpRequest.BodyPublishers.ofString("{\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\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 \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/users")
.delete(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/users")
.header("content-type", "application/json")
.body("{\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
identification: {
email: '',
userId: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/users');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/users',
headers: {'content-type': 'application/json'},
data: {identification: {email: '', userId: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/users';
const options = {
method: 'DELETE',
headers: {'content-type': 'application/json'},
body: '{"identification":{"email":"","userId":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/users',
method: 'DELETE',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "identification": {\n "email": "",\n "userId": ""\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 \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/users")
.delete(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/users',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({identification: {email: '', userId: ''}}));
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/users',
headers: {'content-type': 'application/json'},
body: {identification: {email: '', userId: ''}},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/users');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
identification: {
email: '',
userId: ''
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/users',
headers: {'content-type': 'application/json'},
data: {identification: {email: '', userId: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/users';
const options = {
method: 'DELETE',
headers: {'content-type': 'application/json'},
body: '{"identification":{"email":"","userId":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"identification": @{ @"email": @"", @"userId": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/users"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/users" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n}" in
Client.call ~headers ~body `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/users",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_POSTFIELDS => json_encode([
'identification' => [
'email' => '',
'userId' => ''
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/users', [
'body' => '{
"identification": {
"email": "",
"userId": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/users');
$request->setMethod(HTTP_METH_DELETE);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'identification' => [
'email' => '',
'userId' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'identification' => [
'email' => '',
'userId' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/users');
$request->setRequestMethod('DELETE');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/users' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '{
"identification": {
"email": "",
"userId": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/users' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '{
"identification": {
"email": "",
"userId": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("DELETE", "/baseUrl/users", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/users"
payload = { "identification": {
"email": "",
"userId": ""
} }
headers = {"content-type": "application/json"}
response = requests.delete(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/users"
payload <- "{\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n}"
encode <- "json"
response <- VERB("DELETE", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/users")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\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.delete('/baseUrl/users') do |req|
req.body = "{\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/users";
let payload = json!({"identification": json!({
"email": "",
"userId": ""
})});
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("DELETE").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/users \
--header 'content-type: application/json' \
--data '{
"identification": {
"email": "",
"userId": ""
}
}'
echo '{
"identification": {
"email": "",
"userId": ""
}
}' | \
http DELETE {{baseUrl}}/users \
content-type:application/json
wget --quiet \
--method DELETE \
--header 'content-type: application/json' \
--body-data '{\n "identification": {\n "email": "",\n "userId": ""\n }\n}' \
--output-document \
- {{baseUrl}}/users
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["identification": [
"email": "",
"userId": ""
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/users")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as 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
Link web activity to user
{{baseUrl}}/link
BODY json
{
"deviceId": "",
"identification": {
"email": "",
"userId": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/link");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"deviceId\": \"\",\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/link" {:content-type :json
:form-params {:deviceId ""
:identification {:email ""
:userId ""}}})
require "http/client"
url = "{{baseUrl}}/link"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"deviceId\": \"\",\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\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}}/link"),
Content = new StringContent("{\n \"deviceId\": \"\",\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\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}}/link");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"deviceId\": \"\",\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/link"
payload := strings.NewReader("{\n \"deviceId\": \"\",\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\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/link HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 81
{
"deviceId": "",
"identification": {
"email": "",
"userId": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/link")
.setHeader("content-type", "application/json")
.setBody("{\n \"deviceId\": \"\",\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/link"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"deviceId\": \"\",\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\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 \"deviceId\": \"\",\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/link")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/link")
.header("content-type", "application/json")
.body("{\n \"deviceId\": \"\",\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
deviceId: '',
identification: {
email: '',
userId: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/link');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/link',
headers: {'content-type': 'application/json'},
data: {deviceId: '', identification: {email: '', userId: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/link';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"deviceId":"","identification":{"email":"","userId":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/link',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "deviceId": "",\n "identification": {\n "email": "",\n "userId": ""\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 \"deviceId\": \"\",\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/link")
.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/link',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({deviceId: '', identification: {email: '', userId: ''}}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/link',
headers: {'content-type': 'application/json'},
body: {deviceId: '', identification: {email: '', userId: ''}},
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}}/link');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
deviceId: '',
identification: {
email: '',
userId: ''
}
});
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}}/link',
headers: {'content-type': 'application/json'},
data: {deviceId: '', identification: {email: '', userId: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/link';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"deviceId":"","identification":{"email":"","userId":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"deviceId": @"",
@"identification": @{ @"email": @"", @"userId": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/link"]
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}}/link" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"deviceId\": \"\",\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/link",
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([
'deviceId' => '',
'identification' => [
'email' => '',
'userId' => ''
]
]),
CURLOPT_HTTPHEADER => [
"content-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}}/link', [
'body' => '{
"deviceId": "",
"identification": {
"email": "",
"userId": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/link');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'deviceId' => '',
'identification' => [
'email' => '',
'userId' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'deviceId' => '',
'identification' => [
'email' => '',
'userId' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/link');
$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}}/link' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"deviceId": "",
"identification": {
"email": "",
"userId": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/link' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"deviceId": "",
"identification": {
"email": "",
"userId": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"deviceId\": \"\",\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/link", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/link"
payload = {
"deviceId": "",
"identification": {
"email": "",
"userId": ""
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/link"
payload <- "{\n \"deviceId\": \"\",\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\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}}/link")
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 \"deviceId\": \"\",\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\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/link') do |req|
req.body = "{\n \"deviceId\": \"\",\n \"identification\": {\n \"email\": \"\",\n \"userId\": \"\"\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/link";
let payload = json!({
"deviceId": "",
"identification": json!({
"email": "",
"userId": ""
})
});
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}}/link \
--header 'content-type: application/json' \
--data '{
"deviceId": "",
"identification": {
"email": "",
"userId": ""
}
}'
echo '{
"deviceId": "",
"identification": {
"email": "",
"userId": ""
}
}' | \
http POST {{baseUrl}}/link \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "deviceId": "",\n "identification": {\n "email": "",\n "userId": ""\n }\n}' \
--output-document \
- {{baseUrl}}/link
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"deviceId": "",
"identification": [
"email": "",
"userId": ""
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/link")! 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
Validate API key
{{baseUrl}}/validate
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/validate");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/validate")
require "http/client"
url = "{{baseUrl}}/validate"
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}}/validate"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/validate");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/validate"
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/validate HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/validate")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/validate"))
.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}}/validate")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/validate")
.asString();
const 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}}/validate');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/validate'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/validate';
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}}/validate',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/validate")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/validate',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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}}/validate'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/validate');
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}}/validate'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/validate';
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}}/validate"]
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}}/validate" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/validate",
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}}/validate');
echo $response->getBody();
setUrl('{{baseUrl}}/validate');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/validate');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/validate' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/validate' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/validate")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/validate"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/validate"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/validate")
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/validate') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/validate";
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}}/validate
http GET {{baseUrl}}/validate
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/validate
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/validate")! 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 snippet for a website
{{baseUrl}}/tracking/snippet
QUERY PARAMS
domain
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/tracking/snippet?domain=");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/tracking/snippet" {:query-params {:domain ""}})
require "http/client"
url = "{{baseUrl}}/tracking/snippet?domain="
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}}/tracking/snippet?domain="),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/tracking/snippet?domain=");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/tracking/snippet?domain="
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/tracking/snippet?domain= HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/tracking/snippet?domain=")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/tracking/snippet?domain="))
.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}}/tracking/snippet?domain=")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/tracking/snippet?domain=")
.asString();
const 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}}/tracking/snippet?domain=');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/tracking/snippet',
params: {domain: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/tracking/snippet?domain=';
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}}/tracking/snippet?domain=',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/tracking/snippet?domain=")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/tracking/snippet?domain=',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.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}}/tracking/snippet',
qs: {domain: ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/tracking/snippet');
req.query({
domain: ''
});
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}}/tracking/snippet',
params: {domain: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/tracking/snippet?domain=';
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}}/tracking/snippet?domain="]
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}}/tracking/snippet?domain=" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/tracking/snippet?domain=",
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}}/tracking/snippet?domain=');
echo $response->getBody();
setUrl('{{baseUrl}}/tracking/snippet');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'domain' => ''
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/tracking/snippet');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'domain' => ''
]));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/tracking/snippet?domain=' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/tracking/snippet?domain=' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/tracking/snippet?domain=")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/tracking/snippet"
querystring = {"domain":""}
response = requests.get(url, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/tracking/snippet"
queryString <- list(domain = "")
response <- VERB("GET", url, query = queryString, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/tracking/snippet?domain=")
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/tracking/snippet') do |req|
req.params['domain'] = ''
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/tracking/snippet";
let querystring = [
("domain", ""),
];
let client = reqwest::Client::new();
let response = client.get(url)
.query(&querystring)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url '{{baseUrl}}/tracking/snippet?domain='
http GET '{{baseUrl}}/tracking/snippet?domain='
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/tracking/snippet?domain='
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/tracking/snippet?domain=")! 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()