Update Webhook
curl --request PUT \
--url https://api.agentwallex.com/api/v1/webhooks/{id} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"events": [
"payment.completed",
"payment.failed",
"policy.violated",
"agent.frozen"
]
}
'import requests
url = "https://api.agentwallex.com/api/v1/webhooks/{id}"
payload = { "events": ["payment.completed", "payment.failed", "policy.violated", "agent.frozen"] }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
events: ['payment.completed', 'payment.failed', 'policy.violated', 'agent.frozen']
})
};
fetch('https://api.agentwallex.com/api/v1/webhooks/{id}', 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.agentwallex.com/api/v1/webhooks/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'events' => [
'payment.completed',
'payment.failed',
'policy.violated',
'agent.frozen'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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.agentwallex.com/api/v1/webhooks/{id}"
payload := strings.NewReader("{\n \"events\": [\n \"payment.completed\",\n \"payment.failed\",\n \"policy.violated\",\n \"agent.frozen\"\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-API-Key", "<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.agentwallex.com/api/v1/webhooks/{id}")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"events\": [\n \"payment.completed\",\n \"payment.failed\",\n \"policy.violated\",\n \"agent.frozen\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.agentwallex.com/api/v1/webhooks/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"events\": [\n \"payment.completed\",\n \"payment.failed\",\n \"policy.violated\",\n \"agent.frozen\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"url": "<string>",
"events": [
"<string>"
],
"created_at": "2023-11-07T05:31:56Z"
}{
"code": "invalid_request",
"type": "invalid_request_error",
"message": "The request body is missing required fields."
}{
"code": "authentication_failed",
"type": "authentication_error",
"message": "The provided API key is invalid or expired."
}{
"code": "insufficient_permissions",
"type": "authorization_error",
"message": "You do not have permission to perform this action."
}{
"code": "resource_not_found",
"type": "not_found_error",
"message": "The requested resource was not found."
}{
"code": "rate_limit_exceeded",
"type": "rate_limit_error",
"message": "Too many requests. Please retry after a short delay."
}{
"code": "server_error",
"type": "internal_error",
"message": "An unexpected error occurred. Please try again later."
}Webhook
Cập nhật Webhook
Cập nhật URL, sự kiện hoặc khóa bí mật của Webhook.
PUT
/
api
/
v1
/
webhooks
/
{id}
Update Webhook
curl --request PUT \
--url https://api.agentwallex.com/api/v1/webhooks/{id} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"events": [
"payment.completed",
"payment.failed",
"policy.violated",
"agent.frozen"
]
}
'import requests
url = "https://api.agentwallex.com/api/v1/webhooks/{id}"
payload = { "events": ["payment.completed", "payment.failed", "policy.violated", "agent.frozen"] }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
events: ['payment.completed', 'payment.failed', 'policy.violated', 'agent.frozen']
})
};
fetch('https://api.agentwallex.com/api/v1/webhooks/{id}', 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.agentwallex.com/api/v1/webhooks/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'events' => [
'payment.completed',
'payment.failed',
'policy.violated',
'agent.frozen'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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.agentwallex.com/api/v1/webhooks/{id}"
payload := strings.NewReader("{\n \"events\": [\n \"payment.completed\",\n \"payment.failed\",\n \"policy.violated\",\n \"agent.frozen\"\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-API-Key", "<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.agentwallex.com/api/v1/webhooks/{id}")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"events\": [\n \"payment.completed\",\n \"payment.failed\",\n \"policy.violated\",\n \"agent.frozen\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.agentwallex.com/api/v1/webhooks/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"events\": [\n \"payment.completed\",\n \"payment.failed\",\n \"policy.violated\",\n \"agent.frozen\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"url": "<string>",
"events": [
"<string>"
],
"created_at": "2023-11-07T05:31:56Z"
}{
"code": "invalid_request",
"type": "invalid_request_error",
"message": "The request body is missing required fields."
}{
"code": "authentication_failed",
"type": "authentication_error",
"message": "The provided API key is invalid or expired."
}{
"code": "insufficient_permissions",
"type": "authorization_error",
"message": "You do not have permission to perform this action."
}{
"code": "resource_not_found",
"type": "not_found_error",
"message": "The requested resource was not found."
}{
"code": "rate_limit_exceeded",
"type": "rate_limit_error",
"message": "Too many requests. Please retry after a short delay."
}{
"code": "server_error",
"type": "internal_error",
"message": "An unexpected error occurred. Please try again later."
}Tham số đường dẫn
string
bắt buộc
ID Webhook cần cập nhật (ví dụ:
whk_abc123).Nội dung yêu cầu
string
URL HTTPS endpoint Webhook đã cập nhật.
string[]
Danh sách loại sự kiện đăng ký đã cập nhật.
string
Khóa ký đã cập nhật. Phải bắt đầu bằng
whsec_.Ví dụ
curl -X PUT https://api.agentwallex.com/api/v1/webhooks/whk_abc123 \
-H "X-API-Key: awx_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"events": ["payment.completed", "payment.failed", "policy.violated", "agent.frozen"]
}'
Ủy quyền
ApiKeyAuthBearerAuth
API key authentication. Keys are prefixed with awx_.
Tham số đường dẫn
The webhook ID to update (e.g., whk_abc123).
Nội dung
application/json
Phản hồi
Webhook updated successfully.
A registered webhook endpoint for receiving real-time event notifications.
⌘I