curl --request POST \
--url https://api.prets.app/v1/events/destinations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Production",
"url": "https://example.com/prets/events",
"destinationId": "<string>"
}
'import requests
url = "https://api.prets.app/v1/events/destinations"
payload = {
"name": "Production",
"url": "https://example.com/prets/events",
"destinationId": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Production',
url: 'https://example.com/prets/events',
destinationId: '<string>'
})
};
fetch('https://api.prets.app/v1/events/destinations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.prets.app/v1/events/destinations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Production',
'url' => 'https://example.com/prets/events',
'destinationId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.prets.app/v1/events/destinations"
payload := strings.NewReader("{\n \"name\": \"Production\",\n \"url\": \"https://example.com/prets/events\",\n \"destinationId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.prets.app/v1/events/destinations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Production\",\n \"url\": \"https://example.com/prets/events\",\n \"destinationId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.prets.app/v1/events/destinations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Production\",\n \"url\": \"https://example.com/prets/events\",\n \"destinationId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"destinationId": "<string>",
"name": "Production",
"url": "https://example.com/prets/events",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"bearerSecret": "whsec_3XvK2nQ8mB7pR1sT4uW6yZ0aE5gH9jLcV2bN1xM4qP8"
}Create an event destination
curl --request POST \
--url https://api.prets.app/v1/events/destinations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Production",
"url": "https://example.com/prets/events",
"destinationId": "<string>"
}
'import requests
url = "https://api.prets.app/v1/events/destinations"
payload = {
"name": "Production",
"url": "https://example.com/prets/events",
"destinationId": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Production',
url: 'https://example.com/prets/events',
destinationId: '<string>'
})
};
fetch('https://api.prets.app/v1/events/destinations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.prets.app/v1/events/destinations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Production',
'url' => 'https://example.com/prets/events',
'destinationId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.prets.app/v1/events/destinations"
payload := strings.NewReader("{\n \"name\": \"Production\",\n \"url\": \"https://example.com/prets/events\",\n \"destinationId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.prets.app/v1/events/destinations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Production\",\n \"url\": \"https://example.com/prets/events\",\n \"destinationId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.prets.app/v1/events/destinations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Production\",\n \"url\": \"https://example.com/prets/events\",\n \"destinationId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"destinationId": "<string>",
"name": "Production",
"url": "https://example.com/prets/events",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"bearerSecret": "whsec_3XvK2nQ8mB7pR1sT4uW6yZ0aE5gH9jLcV2bN1xM4qP8"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Human-readable label for this destination within the organization.
1 - 128"Production"
Public HTTPS endpoint that will receive event deliveries. Plain HTTP is rejected.
2048^((%[0-9A-Fa-f]{2}|[-()_.!~*';/?:@&=+$,A-Za-z0-9])+)([).!';/?:,])?$"https://example.com/prets/events"
Optional client-supplied id. Server-generated when omitted.
^whk_[0-9A-HJKMNP-TV-Z]{26}$Response
Event destination created. bearerSecret is returned cleartext exactly once.
^whk_[0-9A-HJKMNP-TV-Z]{26}$Human-readable label for this destination within the organization.
1 - 128"Production"
Public HTTPS endpoint that will receive event deliveries. Plain HTTP is rejected.
2048^((%[0-9A-Fa-f]{2}|[-()_.!~*';/?:@&=+$,A-Za-z0-9])+)([).!';/?:,])?$"https://example.com/prets/events"
Bearer secret returned cleartext exactly once when minted. Sent on every delivery as Authorization: Bearer {secret}. Cannot be retrieved later.
^whsec_[A-Za-z0-9_-]{43}$"whsec_3XvK2nQ8mB7pR1sT4uW6yZ0aE5gH9jLcV2bN1xM4qP8"
Was this page helpful?