curl --request POST \
--url https://app.launchdarkly.com/api/v2/webhooks \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "apidocs test webhook",
"on": true,
"sign": false,
"statements": [
{
"actions": [
"*"
],
"effect": "allow",
"resources": [
"proj/test"
]
}
],
"tags": [
"example-tag"
],
"url": "https://example.com"
}
'import requests
url = "https://app.launchdarkly.com/api/v2/webhooks"
payload = {
"name": "apidocs test webhook",
"on": True,
"sign": False,
"statements": [
{
"actions": ["*"],
"effect": "allow",
"resources": ["proj/test"]
}
],
"tags": ["example-tag"],
"url": "https://example.com"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'apidocs test webhook',
on: true,
sign: false,
statements: [{actions: ['*'], effect: 'allow', resources: ['proj/test']}],
tags: ['example-tag'],
url: 'https://example.com'
})
};
fetch('https://app.launchdarkly.com/api/v2/webhooks', 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://app.launchdarkly.com/api/v2/webhooks",
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' => 'apidocs test webhook',
'on' => true,
'sign' => false,
'statements' => [
[
'actions' => [
'*'
],
'effect' => 'allow',
'resources' => [
'proj/test'
]
]
],
'tags' => [
'example-tag'
],
'url' => 'https://example.com'
]),
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://app.launchdarkly.com/api/v2/webhooks"
payload := strings.NewReader("{\n \"name\": \"apidocs test webhook\",\n \"on\": true,\n \"sign\": false,\n \"statements\": [\n {\n \"actions\": [\n \"*\"\n ],\n \"effect\": \"allow\",\n \"resources\": [\n \"proj/test\"\n ]\n }\n ],\n \"tags\": [\n \"example-tag\"\n ],\n \"url\": \"https://example.com\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://app.launchdarkly.com/api/v2/webhooks")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"apidocs test webhook\",\n \"on\": true,\n \"sign\": false,\n \"statements\": [\n {\n \"actions\": [\n \"*\"\n ],\n \"effect\": \"allow\",\n \"resources\": [\n \"proj/test\"\n ]\n }\n ],\n \"tags\": [\n \"example-tag\"\n ],\n \"url\": \"https://example.com\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.launchdarkly.com/api/v2/webhooks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"apidocs test webhook\",\n \"on\": true,\n \"sign\": false,\n \"statements\": [\n {\n \"actions\": [\n \"*\"\n ],\n \"effect\": \"allow\",\n \"resources\": [\n \"proj/test\"\n ]\n }\n ],\n \"tags\": [\n \"example-tag\"\n ],\n \"url\": \"https://example.com\"\n}"
response = http.request(request)
puts response.read_body{
"_links": {},
"_id": "57be1db38b75bf0772d11384",
"url": "http://www.example.com",
"on": true,
"tags": [
"examples"
],
"name": "Example hook",
"secret": "frobozz",
"statements": [
{
"effect": "allow",
"resources": [
"proj/*:env/*;qa_*:/flag/*"
],
"notResources": [
"<string>"
],
"actions": [
"*"
],
"notActions": [
"<string>"
]
}
],
"_access": {
"denied": [
{
"action": "<string>",
"reason": {
"effect": "allow",
"resources": [
"proj/*:env/*;qa_*:/flag/*"
],
"notResources": [
"<string>"
],
"actions": [
"*"
],
"notActions": [
"<string>"
],
"role_name": "<string>"
}
}
],
"allowed": [
{
"action": "<string>",
"reason": {
"effect": "allow",
"resources": [
"proj/*:env/*;qa_*:/flag/*"
],
"notResources": [
"<string>"
],
"actions": [
"*"
],
"notActions": [
"<string>"
],
"role_name": "<string>"
}
}
]
}
}{
"code": "invalid_request",
"message": "Invalid request body"
}{
"code": "unauthorized",
"message": "Invalid access token"
}{
"code": "forbidden",
"message": "Forbidden. Access to the requested resource was denied."
}{
"code": "rate_limited",
"message": "You've exceeded the API rate limit. Try again later."
}Creates a webhook
Create a new webhook.
curl --request POST \
--url https://app.launchdarkly.com/api/v2/webhooks \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "apidocs test webhook",
"on": true,
"sign": false,
"statements": [
{
"actions": [
"*"
],
"effect": "allow",
"resources": [
"proj/test"
]
}
],
"tags": [
"example-tag"
],
"url": "https://example.com"
}
'import requests
url = "https://app.launchdarkly.com/api/v2/webhooks"
payload = {
"name": "apidocs test webhook",
"on": True,
"sign": False,
"statements": [
{
"actions": ["*"],
"effect": "allow",
"resources": ["proj/test"]
}
],
"tags": ["example-tag"],
"url": "https://example.com"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'apidocs test webhook',
on: true,
sign: false,
statements: [{actions: ['*'], effect: 'allow', resources: ['proj/test']}],
tags: ['example-tag'],
url: 'https://example.com'
})
};
fetch('https://app.launchdarkly.com/api/v2/webhooks', 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://app.launchdarkly.com/api/v2/webhooks",
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' => 'apidocs test webhook',
'on' => true,
'sign' => false,
'statements' => [
[
'actions' => [
'*'
],
'effect' => 'allow',
'resources' => [
'proj/test'
]
]
],
'tags' => [
'example-tag'
],
'url' => 'https://example.com'
]),
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://app.launchdarkly.com/api/v2/webhooks"
payload := strings.NewReader("{\n \"name\": \"apidocs test webhook\",\n \"on\": true,\n \"sign\": false,\n \"statements\": [\n {\n \"actions\": [\n \"*\"\n ],\n \"effect\": \"allow\",\n \"resources\": [\n \"proj/test\"\n ]\n }\n ],\n \"tags\": [\n \"example-tag\"\n ],\n \"url\": \"https://example.com\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://app.launchdarkly.com/api/v2/webhooks")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"apidocs test webhook\",\n \"on\": true,\n \"sign\": false,\n \"statements\": [\n {\n \"actions\": [\n \"*\"\n ],\n \"effect\": \"allow\",\n \"resources\": [\n \"proj/test\"\n ]\n }\n ],\n \"tags\": [\n \"example-tag\"\n ],\n \"url\": \"https://example.com\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.launchdarkly.com/api/v2/webhooks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"apidocs test webhook\",\n \"on\": true,\n \"sign\": false,\n \"statements\": [\n {\n \"actions\": [\n \"*\"\n ],\n \"effect\": \"allow\",\n \"resources\": [\n \"proj/test\"\n ]\n }\n ],\n \"tags\": [\n \"example-tag\"\n ],\n \"url\": \"https://example.com\"\n}"
response = http.request(request)
puts response.read_body{
"_links": {},
"_id": "57be1db38b75bf0772d11384",
"url": "http://www.example.com",
"on": true,
"tags": [
"examples"
],
"name": "Example hook",
"secret": "frobozz",
"statements": [
{
"effect": "allow",
"resources": [
"proj/*:env/*;qa_*:/flag/*"
],
"notResources": [
"<string>"
],
"actions": [
"*"
],
"notActions": [
"<string>"
]
}
],
"_access": {
"denied": [
{
"action": "<string>",
"reason": {
"effect": "allow",
"resources": [
"proj/*:env/*;qa_*:/flag/*"
],
"notResources": [
"<string>"
],
"actions": [
"*"
],
"notActions": [
"<string>"
],
"role_name": "<string>"
}
}
],
"allowed": [
{
"action": "<string>",
"reason": {
"effect": "allow",
"resources": [
"proj/*:env/*;qa_*:/flag/*"
],
"notResources": [
"<string>"
],
"actions": [
"*"
],
"notActions": [
"<string>"
],
"role_name": "<string>"
}
}
]
}
}{
"code": "invalid_request",
"message": "Invalid request body"
}{
"code": "unauthorized",
"message": "Invalid access token"
}{
"code": "forbidden",
"message": "Forbidden. Access to the requested resource was denied."
}{
"code": "rate_limited",
"message": "You've exceeded the API rate limit. Try again later."
}Authorizations
Body
The URL of the remote webhook
"http://www.example.com"
If sign is false, the webhook does not include a signature header, and the secret can be omitted.
true
Whether or not this webhook is enabled.
true
A human-readable name for your webhook
"Example hook"
If sign is true, and the secret attribute is omitted, LaunchDarkly automatically generates a secret for you.
"frobozz"
Represents a Custom role policy, defining a resource kinds filter the webhook should respond to.
Show child attributes
Show child attributes
List of tags for this webhook
[]
Response
Webhook response
The location and content type of related resources
Show child attributes
Show child attributes
The ID of this webhook
"57be1db38b75bf0772d11384"
The URL to which LaunchDarkly sends an HTTP POST payload for this webhook
"http://www.example.com"
Whether or not this webhook is enabled
true
List of tags for this webhook
["examples"]
A human-readable name for this webhook
"Example hook"
The secret for this webhook
"frobozz"
Represents a Custom role policy, defining a resource kinds filter the webhook responds to.
Show child attributes
Show child attributes
Details on the allowed and denied actions for this webhook
Show child attributes
Show child attributes