Désabonner des événements de webhook
curl --request PUT \
--url https://api.crowdchange.dev/v2/private/webhooks/{id}/events/unsubscribe \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"events": [
"<string>"
]
}
'import requests
url = "https://api.crowdchange.dev/v2/private/webhooks/{id}/events/unsubscribe"
payload = { "events": ["<string>"] }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({events: ['<string>']})
};
fetch('https://api.crowdchange.dev/v2/private/webhooks/{id}/events/unsubscribe', 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.crowdchange.dev/v2/private/webhooks/{id}/events/unsubscribe",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'events' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.crowdchange.dev/v2/private/webhooks/{id}/events/unsubscribe"
payload := strings.NewReader("{\n \"events\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.put("https://api.crowdchange.dev/v2/private/webhooks/{id}/events/unsubscribe")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"events\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.crowdchange.dev/v2/private/webhooks/{id}/events/unsubscribe")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"events\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": 1,
"url": "https://demo.crowdchange.test/webhooks/handle",
"signing_secret": "whsec_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ab",
"language": "en",
"created_at": "2024-01-01 16:00:03",
"events": [
{
"id": 1,
"name": "fundraiser_created",
"created_at": "string"
}
]
}
Webhooks
Désabonner des événements de webhook
Retirez des événements système CrowdChange spécifiques d’un abonnement de webhook existant pour que l’URL cible cesse de recevoir ces événements.
PUT
/
v2
/
private
/
webhooks
/
{id}
/
events
/
unsubscribe
Désabonner des événements de webhook
curl --request PUT \
--url https://api.crowdchange.dev/v2/private/webhooks/{id}/events/unsubscribe \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"events": [
"<string>"
]
}
'import requests
url = "https://api.crowdchange.dev/v2/private/webhooks/{id}/events/unsubscribe"
payload = { "events": ["<string>"] }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({events: ['<string>']})
};
fetch('https://api.crowdchange.dev/v2/private/webhooks/{id}/events/unsubscribe', 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.crowdchange.dev/v2/private/webhooks/{id}/events/unsubscribe",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'events' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.crowdchange.dev/v2/private/webhooks/{id}/events/unsubscribe"
payload := strings.NewReader("{\n \"events\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.put("https://api.crowdchange.dev/v2/private/webhooks/{id}/events/unsubscribe")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"events\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.crowdchange.dev/v2/private/webhooks/{id}/events/unsubscribe")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"events\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": 1,
"url": "https://demo.crowdchange.test/webhooks/handle",
"signing_secret": "whsec_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ab",
"language": "en",
"created_at": "2024-01-01 16:00:03",
"events": [
{
"id": 1,
"name": "fundraiser_created",
"created_at": "string"
}
]
}
Paramètres de chemin
integer
requis
ID du webhook.
Corps
string[]
requis
Événements à désabonner.
Réponse
integer
ID du webhook.
string
URL du webhook.
string
Secret propre au webhook utilisé pour vérifier
CrowdChange-Webhook-Signature sur les livraisons sortantes. Conservez cette valeur en lieu sûr.string
Langue du webhook. Valeurs autorisées :
en, frstring
Date de création du webhook.
object[]
| Statut | Description |
|---|---|
400 | Requête invalide |
401 | Non autorisé |
403 | Accès interdit |
{
"id": 1,
"url": "https://demo.crowdchange.test/webhooks/handle",
"signing_secret": "whsec_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ab",
"language": "en",
"created_at": "2024-01-01 16:00:03",
"events": [
{
"id": 1,
"name": "fundraiser_created",
"created_at": "string"
}
]
}
Cette page vous a-t-elle été utile ?
⌘I