Create deployment event
curl --request POST \
--url https://app.launchdarkly.com/api/v2/engineering-insights/deployment-events \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"projectKey": "default",
"environmentKey": "production",
"applicationKey": "billing-service",
"version": "a90a8a2",
"eventType": "started",
"applicationName": "Billing Service",
"applicationKind": "server",
"versionName": "v1.0.0",
"eventTime": "1706701522000",
"eventMetadata": {
"buildSystemVersion": "v1.2.3"
},
"deploymentMetadata": {
"buildNumber": "1234"
}
}
'import requests
url = "https://app.launchdarkly.com/api/v2/engineering-insights/deployment-events"
payload = {
"projectKey": "default",
"environmentKey": "production",
"applicationKey": "billing-service",
"version": "a90a8a2",
"eventType": "started",
"applicationName": "Billing Service",
"applicationKind": "server",
"versionName": "v1.0.0",
"eventTime": "1706701522000",
"eventMetadata": { "buildSystemVersion": "v1.2.3" },
"deploymentMetadata": { "buildNumber": "1234" }
}
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({
projectKey: 'default',
environmentKey: 'production',
applicationKey: 'billing-service',
version: 'a90a8a2',
eventType: 'started',
applicationName: 'Billing Service',
applicationKind: 'server',
versionName: 'v1.0.0',
eventTime: '1706701522000',
eventMetadata: {buildSystemVersion: 'v1.2.3'},
deploymentMetadata: {buildNumber: '1234'}
})
};
fetch('https://app.launchdarkly.com/api/v2/engineering-insights/deployment-events', 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/engineering-insights/deployment-events",
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([
'projectKey' => 'default',
'environmentKey' => 'production',
'applicationKey' => 'billing-service',
'version' => 'a90a8a2',
'eventType' => 'started',
'applicationName' => 'Billing Service',
'applicationKind' => 'server',
'versionName' => 'v1.0.0',
'eventTime' => '1706701522000',
'eventMetadata' => [
'buildSystemVersion' => 'v1.2.3'
],
'deploymentMetadata' => [
'buildNumber' => '1234'
]
]),
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/engineering-insights/deployment-events"
payload := strings.NewReader("{\n \"projectKey\": \"default\",\n \"environmentKey\": \"production\",\n \"applicationKey\": \"billing-service\",\n \"version\": \"a90a8a2\",\n \"eventType\": \"started\",\n \"applicationName\": \"Billing Service\",\n \"applicationKind\": \"server\",\n \"versionName\": \"v1.0.0\",\n \"eventTime\": \"1706701522000\",\n \"eventMetadata\": {\n \"buildSystemVersion\": \"v1.2.3\"\n },\n \"deploymentMetadata\": {\n \"buildNumber\": \"1234\"\n }\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/engineering-insights/deployment-events")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"projectKey\": \"default\",\n \"environmentKey\": \"production\",\n \"applicationKey\": \"billing-service\",\n \"version\": \"a90a8a2\",\n \"eventType\": \"started\",\n \"applicationName\": \"Billing Service\",\n \"applicationKind\": \"server\",\n \"versionName\": \"v1.0.0\",\n \"eventTime\": \"1706701522000\",\n \"eventMetadata\": {\n \"buildSystemVersion\": \"v1.2.3\"\n },\n \"deploymentMetadata\": {\n \"buildNumber\": \"1234\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.launchdarkly.com/api/v2/engineering-insights/deployment-events")
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 \"projectKey\": \"default\",\n \"environmentKey\": \"production\",\n \"applicationKey\": \"billing-service\",\n \"version\": \"a90a8a2\",\n \"eventType\": \"started\",\n \"applicationName\": \"Billing Service\",\n \"applicationKind\": \"server\",\n \"versionName\": \"v1.0.0\",\n \"eventTime\": \"1706701522000\",\n \"eventMetadata\": {\n \"buildSystemVersion\": \"v1.2.3\"\n },\n \"deploymentMetadata\": {\n \"buildNumber\": \"1234\"\n }\n}"
response = http.request(request)
puts response.read_body{
"code": "invalid_request",
"message": "validation failed",
"errors": [
{
"attribute": "projectKey",
"reason": "must be present"
}
]
}{
"code": "unauthorized",
"message": "Invalid access token"
}{
"code": "forbidden",
"message": "Forbidden. Access to the requested resource was denied."
}{
"code": "not_found",
"message": "Invalid resource identifier"
}{
"code": "rate_limited",
"message": "You've exceeded the API rate limit. Try again later."
}Create deployment event
Create deployment event
POST
/
api
/
v2
/
engineering-insights
/
deployment-events
Create deployment event
curl --request POST \
--url https://app.launchdarkly.com/api/v2/engineering-insights/deployment-events \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"projectKey": "default",
"environmentKey": "production",
"applicationKey": "billing-service",
"version": "a90a8a2",
"eventType": "started",
"applicationName": "Billing Service",
"applicationKind": "server",
"versionName": "v1.0.0",
"eventTime": "1706701522000",
"eventMetadata": {
"buildSystemVersion": "v1.2.3"
},
"deploymentMetadata": {
"buildNumber": "1234"
}
}
'import requests
url = "https://app.launchdarkly.com/api/v2/engineering-insights/deployment-events"
payload = {
"projectKey": "default",
"environmentKey": "production",
"applicationKey": "billing-service",
"version": "a90a8a2",
"eventType": "started",
"applicationName": "Billing Service",
"applicationKind": "server",
"versionName": "v1.0.0",
"eventTime": "1706701522000",
"eventMetadata": { "buildSystemVersion": "v1.2.3" },
"deploymentMetadata": { "buildNumber": "1234" }
}
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({
projectKey: 'default',
environmentKey: 'production',
applicationKey: 'billing-service',
version: 'a90a8a2',
eventType: 'started',
applicationName: 'Billing Service',
applicationKind: 'server',
versionName: 'v1.0.0',
eventTime: '1706701522000',
eventMetadata: {buildSystemVersion: 'v1.2.3'},
deploymentMetadata: {buildNumber: '1234'}
})
};
fetch('https://app.launchdarkly.com/api/v2/engineering-insights/deployment-events', 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/engineering-insights/deployment-events",
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([
'projectKey' => 'default',
'environmentKey' => 'production',
'applicationKey' => 'billing-service',
'version' => 'a90a8a2',
'eventType' => 'started',
'applicationName' => 'Billing Service',
'applicationKind' => 'server',
'versionName' => 'v1.0.0',
'eventTime' => '1706701522000',
'eventMetadata' => [
'buildSystemVersion' => 'v1.2.3'
],
'deploymentMetadata' => [
'buildNumber' => '1234'
]
]),
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/engineering-insights/deployment-events"
payload := strings.NewReader("{\n \"projectKey\": \"default\",\n \"environmentKey\": \"production\",\n \"applicationKey\": \"billing-service\",\n \"version\": \"a90a8a2\",\n \"eventType\": \"started\",\n \"applicationName\": \"Billing Service\",\n \"applicationKind\": \"server\",\n \"versionName\": \"v1.0.0\",\n \"eventTime\": \"1706701522000\",\n \"eventMetadata\": {\n \"buildSystemVersion\": \"v1.2.3\"\n },\n \"deploymentMetadata\": {\n \"buildNumber\": \"1234\"\n }\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/engineering-insights/deployment-events")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"projectKey\": \"default\",\n \"environmentKey\": \"production\",\n \"applicationKey\": \"billing-service\",\n \"version\": \"a90a8a2\",\n \"eventType\": \"started\",\n \"applicationName\": \"Billing Service\",\n \"applicationKind\": \"server\",\n \"versionName\": \"v1.0.0\",\n \"eventTime\": \"1706701522000\",\n \"eventMetadata\": {\n \"buildSystemVersion\": \"v1.2.3\"\n },\n \"deploymentMetadata\": {\n \"buildNumber\": \"1234\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.launchdarkly.com/api/v2/engineering-insights/deployment-events")
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 \"projectKey\": \"default\",\n \"environmentKey\": \"production\",\n \"applicationKey\": \"billing-service\",\n \"version\": \"a90a8a2\",\n \"eventType\": \"started\",\n \"applicationName\": \"Billing Service\",\n \"applicationKind\": \"server\",\n \"versionName\": \"v1.0.0\",\n \"eventTime\": \"1706701522000\",\n \"eventMetadata\": {\n \"buildSystemVersion\": \"v1.2.3\"\n },\n \"deploymentMetadata\": {\n \"buildNumber\": \"1234\"\n }\n}"
response = http.request(request)
puts response.read_body{
"code": "invalid_request",
"message": "validation failed",
"errors": [
{
"attribute": "projectKey",
"reason": "must be present"
}
]
}{
"code": "unauthorized",
"message": "Invalid access token"
}{
"code": "forbidden",
"message": "Forbidden. Access to the requested resource was denied."
}{
"code": "not_found",
"message": "Invalid resource identifier"
}{
"code": "rate_limited",
"message": "You've exceeded the API rate limit. Try again later."
}Body
application/json
The application key. This defines the granularity at which you want to view your insights metrics. Typically it is the name of one of the GitHub repositories that you use in this project.
LaunchDarkly automatically creates a new application each time you send a unique application key.
Example:
"billing-service"
The application version. You can set the application version to any string that includes only letters, numbers, periods (.), hyphens (-), or underscores (_).
We recommend setting the application version to at least the first seven characters of the SHA or to the tag of the GitHub commit for this deployment.
Example:
"a90a8a2"
Response
Created