curl --request POST \
--url https://api.honeycomb.io/2/teams/{teamSlug}/groups/{ID}/relationships/environments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/vnd.api+json' \
--data '
{
"data": [
{
"type": "environments",
"id": "hcxen_01hznmeqrcq8rz533xrvtc6mk0"
}
]
}
'import requests
url = "https://api.honeycomb.io/2/teams/{teamSlug}/groups/{ID}/relationships/environments"
payload = { "data": [
{
"type": "environments",
"id": "hcxen_01hznmeqrcq8rz533xrvtc6mk0"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/vnd.api+json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/vnd.api+json'},
body: JSON.stringify({data: [{type: 'environments', id: 'hcxen_01hznmeqrcq8rz533xrvtc6mk0'}]})
};
fetch('https://api.honeycomb.io/2/teams/{teamSlug}/groups/{ID}/relationships/environments', 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.honeycomb.io/2/teams/{teamSlug}/groups/{ID}/relationships/environments",
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([
'data' => [
[
'type' => 'environments',
'id' => 'hcxen_01hznmeqrcq8rz533xrvtc6mk0'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/vnd.api+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.honeycomb.io/2/teams/{teamSlug}/groups/{ID}/relationships/environments"
payload := strings.NewReader("{\n \"data\": [\n {\n \"type\": \"environments\",\n \"id\": \"hcxen_01hznmeqrcq8rz533xrvtc6mk0\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/vnd.api+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://api.honeycomb.io/2/teams/{teamSlug}/groups/{ID}/relationships/environments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/vnd.api+json")
.body("{\n \"data\": [\n {\n \"type\": \"environments\",\n \"id\": \"hcxen_01hznmeqrcq8rz533xrvtc6mk0\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.honeycomb.io/2/teams/{teamSlug}/groups/{ID}/relationships/environments")
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/vnd.api+json'
request.body = "{\n \"data\": [\n {\n \"type\": \"environments\",\n \"id\": \"hcxen_01hznmeqrcq8rz533xrvtc6mk0\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"status": 400,
"type": "https://api.honeycomb.io/problems/unparseable",
"title": "The request body could not be parsed.",
"error": "invalid gzip data"
}{
"error": "unknown API key - check your credentials"
}{
"error": "Your team has been denied access to Management APIs, please contact support to be unblocked."
}{
"error": "dataset not found"
}{
"status": 413,
"type": "https://api.honeycomb.io/problems/payload-too-large",
"title": "Request body is too large.",
"error": "Body size is larger than maximum size of 100000 bytes"
}{
"errors": [
{
"id": "<string>",
"code": "<string>",
"status": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"header": "<string>",
"parameter": "<string>"
}
}
]
}{
"status": 422,
"type": "https://api.honeycomb.io/problems/validation-failed",
"error": "The provided input is invalid.",
"title": "The provided input is invalid",
"type_detail": [
{
"field": "type",
"code": "invalid",
"description": "type: must be a valid value"
}
]
}{
"error": "Rate Limited"
}{
"error": "something went wrong!",
"status": 123,
"type": "<string>",
"title": "<string>",
"detail": "<string>",
"instance": "<string>"
}Grant a Group access to Environments
Grants a Group access to Environments. The members of the Group can then read every dataset in each Environment, including datasets that are added later. Environments that the Group already has access to do not change.
An Environment does not have to be restricted to be granted. In an Environment that is not restricted, the grant gives access to the restricted datasets in it.
To restrict an Environment and keep the access of a Group, grant the Group access first. Then restrict the Environment.
The key needs the groups:write and environments:read scopes.
If any Environment cannot be found on the Team, nothing changes. The response is a 422
with one error for each unknown Environment, and each error points at its entry in data.
curl --request POST \
--url https://api.honeycomb.io/2/teams/{teamSlug}/groups/{ID}/relationships/environments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/vnd.api+json' \
--data '
{
"data": [
{
"type": "environments",
"id": "hcxen_01hznmeqrcq8rz533xrvtc6mk0"
}
]
}
'import requests
url = "https://api.honeycomb.io/2/teams/{teamSlug}/groups/{ID}/relationships/environments"
payload = { "data": [
{
"type": "environments",
"id": "hcxen_01hznmeqrcq8rz533xrvtc6mk0"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/vnd.api+json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/vnd.api+json'},
body: JSON.stringify({data: [{type: 'environments', id: 'hcxen_01hznmeqrcq8rz533xrvtc6mk0'}]})
};
fetch('https://api.honeycomb.io/2/teams/{teamSlug}/groups/{ID}/relationships/environments', 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.honeycomb.io/2/teams/{teamSlug}/groups/{ID}/relationships/environments",
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([
'data' => [
[
'type' => 'environments',
'id' => 'hcxen_01hznmeqrcq8rz533xrvtc6mk0'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/vnd.api+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.honeycomb.io/2/teams/{teamSlug}/groups/{ID}/relationships/environments"
payload := strings.NewReader("{\n \"data\": [\n {\n \"type\": \"environments\",\n \"id\": \"hcxen_01hznmeqrcq8rz533xrvtc6mk0\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/vnd.api+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://api.honeycomb.io/2/teams/{teamSlug}/groups/{ID}/relationships/environments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/vnd.api+json")
.body("{\n \"data\": [\n {\n \"type\": \"environments\",\n \"id\": \"hcxen_01hznmeqrcq8rz533xrvtc6mk0\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.honeycomb.io/2/teams/{teamSlug}/groups/{ID}/relationships/environments")
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/vnd.api+json'
request.body = "{\n \"data\": [\n {\n \"type\": \"environments\",\n \"id\": \"hcxen_01hznmeqrcq8rz533xrvtc6mk0\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"status": 400,
"type": "https://api.honeycomb.io/problems/unparseable",
"title": "The request body could not be parsed.",
"error": "invalid gzip data"
}{
"error": "unknown API key - check your credentials"
}{
"error": "Your team has been denied access to Management APIs, please contact support to be unblocked."
}{
"error": "dataset not found"
}{
"status": 413,
"type": "https://api.honeycomb.io/problems/payload-too-large",
"title": "Request body is too large.",
"error": "Body size is larger than maximum size of 100000 bytes"
}{
"errors": [
{
"id": "<string>",
"code": "<string>",
"status": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"header": "<string>",
"parameter": "<string>"
}
}
]
}{
"status": 422,
"type": "https://api.honeycomb.io/problems/validation-failed",
"error": "The provided input is invalid.",
"title": "The provided input is invalid",
"type_detail": [
{
"field": "type",
"code": "invalid",
"description": "type: must be a valid value"
}
]
}{
"error": "Rate Limited"
}{
"error": "something went wrong!",
"status": 123,
"type": "<string>",
"title": "<string>",
"detail": "<string>",
"instance": "<string>"
}Authorizations
Authenticate using a Honeycomb Management Key.
Pass the Management Key as a Bearer token in the Authorization header:
Authorization: Bearer hcxmk_12345678901234567890123456:12345678901234567890123456789012
Construct the key value by joining the Key ID and Secret with a colon (:).
To learn how to create a Management Key, visit Manage Team API Keys. To learn more about authenticating requests, visit API Authentication.
Body
Response
No Content