curl --request POST \
--url https://cloud.laravel.com/api/environments/{environment}/webhook-endpoints \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>",
"events": [],
"enabled": true
}
'import requests
url = "https://cloud.laravel.com/api/environments/{environment}/webhook-endpoints"
payload = {
"url": "<string>",
"events": [],
"enabled": True
}
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({url: '<string>', events: [], enabled: true})
};
fetch('https://cloud.laravel.com/api/environments/{environment}/webhook-endpoints', 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://cloud.laravel.com/api/environments/{environment}/webhook-endpoints",
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([
'url' => '<string>',
'events' => [
],
'enabled' => true
]),
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://cloud.laravel.com/api/environments/{environment}/webhook-endpoints"
payload := strings.NewReader("{\n \"url\": \"<string>\",\n \"events\": [],\n \"enabled\": true\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://cloud.laravel.com/api/environments/{environment}/webhook-endpoints")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"events\": [],\n \"enabled\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud.laravel.com/api/environments/{environment}/webhook-endpoints")
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 \"url\": \"<string>\",\n \"events\": [],\n \"enabled\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"type": "webhook_endpoints",
"attributes": {
"url": "<string>",
"events": [
"deployment.live"
],
"enabled": true,
"last_delivery_at": "2023-11-07T05:31:56Z",
"last_outcome": "pending",
"created_at": "2023-11-07T05:31:56Z",
"secret": "<string>"
},
"relationships": {
"subscribables": {
"data": [
{
"type": "<string>",
"id": "<string>"
}
]
}
}
},
"included": [
{
"id": "<string>",
"type": "<string>"
}
]
}{
"message": "<string>",
"code": "idempotency_key_invalid"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"code": "idempotency_key_in_use"
}{
"message": "<string>",
"errors": {}
}{
"message": "<string>"
}Create webhook endpoint
Create a webhook endpoint. Cloud sends a signed POST request to the URL for each selected deployment event and retries failed deliveries. Each request has the X-Cloud-Event, X-Cloud-Event-Id, X-Cloud-Delivery, X-Cloud-Timestamp and X-Cloud-Signature headers. The signature is sha256= followed by the hex HMAC-SHA256 of {timestamp}.{body}, keyed with the endpoint’s signing secret. The secret is returned only in this response and when you rotate it. An environment can have up to 5 webhook endpoints.
curl --request POST \
--url https://cloud.laravel.com/api/environments/{environment}/webhook-endpoints \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>",
"events": [],
"enabled": true
}
'import requests
url = "https://cloud.laravel.com/api/environments/{environment}/webhook-endpoints"
payload = {
"url": "<string>",
"events": [],
"enabled": True
}
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({url: '<string>', events: [], enabled: true})
};
fetch('https://cloud.laravel.com/api/environments/{environment}/webhook-endpoints', 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://cloud.laravel.com/api/environments/{environment}/webhook-endpoints",
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([
'url' => '<string>',
'events' => [
],
'enabled' => true
]),
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://cloud.laravel.com/api/environments/{environment}/webhook-endpoints"
payload := strings.NewReader("{\n \"url\": \"<string>\",\n \"events\": [],\n \"enabled\": true\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://cloud.laravel.com/api/environments/{environment}/webhook-endpoints")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"events\": [],\n \"enabled\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud.laravel.com/api/environments/{environment}/webhook-endpoints")
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 \"url\": \"<string>\",\n \"events\": [],\n \"enabled\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"type": "webhook_endpoints",
"attributes": {
"url": "<string>",
"events": [
"deployment.live"
],
"enabled": true,
"last_delivery_at": "2023-11-07T05:31:56Z",
"last_outcome": "pending",
"created_at": "2023-11-07T05:31:56Z",
"secret": "<string>"
},
"relationships": {
"subscribables": {
"data": [
{
"type": "<string>",
"id": "<string>"
}
]
}
}
},
"included": [
{
"id": "<string>",
"type": "<string>"
}
]
}{
"message": "<string>",
"code": "idempotency_key_invalid"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"code": "idempotency_key_in_use"
}{
"message": "<string>",
"errors": {}
}{
"message": "<string>"
}environment.editHeaders
A unique value, such as a UUID, that identifies this operation. When you send the same request again with the same key, Laravel Cloud returns the first successful response from the last 24 hours instead of performing the action again. See Idempotent requests.
1 - 255Body
Was this page helpful?

