Create subscription
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({webhookId: '<string>', eventType: '<string>', filters: {}})
};
fetch('https://api.example.com/v1/regions/global/webhooks/subscriptions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/regions/global/webhooks/subscriptions"
payload := strings.NewReader("{\n \"webhookId\": \"<string>\",\n \"eventType\": \"<string>\",\n \"filters\": {}\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(string(body))
}curl --request POST \
--url https://api.example.com/v1/regions/global/webhooks/subscriptions \
--header 'Content-Type: application/json' \
--data '
{
"webhookId": "<string>",
"eventType": "<string>",
"filters": {}
}
'import requests
url = "https://api.example.com/v1/regions/global/webhooks/subscriptions"
payload = {
"webhookId": "<string>",
"eventType": "<string>",
"filters": {}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"success": true,
"data": {
"id": "<string>",
"webhookId": "<string>",
"eventType": "<string>",
"filters": {},
"active": true,
"createdAt": "2023-11-07T05:31:56Z"
}
}Webhook Subscriptions
Create subscription
Create a new webhook subscription
POST
/
v1
/
regions
/
global
/
webhooks
/
subscriptions
Create subscription
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({webhookId: '<string>', eventType: '<string>', filters: {}})
};
fetch('https://api.example.com/v1/regions/global/webhooks/subscriptions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/regions/global/webhooks/subscriptions"
payload := strings.NewReader("{\n \"webhookId\": \"<string>\",\n \"eventType\": \"<string>\",\n \"filters\": {}\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(string(body))
}curl --request POST \
--url https://api.example.com/v1/regions/global/webhooks/subscriptions \
--header 'Content-Type: application/json' \
--data '
{
"webhookId": "<string>",
"eventType": "<string>",
"filters": {}
}
'import requests
url = "https://api.example.com/v1/regions/global/webhooks/subscriptions"
payload = {
"webhookId": "<string>",
"eventType": "<string>",
"filters": {}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"success": true,
"data": {
"id": "<string>",
"webhookId": "<string>",
"eventType": "<string>",
"filters": {},
"active": true,
"createdAt": "2023-11-07T05:31:56Z"
}
}Was this page helpful?