curl --request POST \
--url 'https://api.edgeful.com/v1/settings/custom-sessions' \
--header 'Authorization: Bearer <api-key>' \
--header 'Content-Type: application/json' \
--data '{"name": "power hour", "start_time": "15:00", "end_time": "16:00", "timezone": "America/New_York"}'import requests
url = "https://api.edgeful.com/v1/settings/custom-sessions"
headers = {"Authorization": "Bearer <api-key>"}
payload = {'name': 'power hour', 'start_time': '15:00', 'end_time': '16:00', 'timezone': 'America/New_York'}
response = requests.post(url, headers=headers, json=payload)
print(response.json())const url = "https://api.edgeful.com/v1/settings/custom-sessions";
const options = {
method: "POST",
headers: { Authorization: "Bearer <api-key>", "Content-Type": "application/json" },
body: JSON.stringify({"name": "power hour", "start_time": "15:00", "end_time": "16:00", "timezone": "America/New_York"}),
};
const response = await fetch(url, options);
const data = await response.json();
console.log(data);<?php
$ch = curl_init("https://api.edgeful.com/v1/settings/custom-sessions");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Authorization: Bearer <api-key>", "Content-Type: application/json"]);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"name": "power hour", "start_time": "15:00", "end_time": "16:00", "timezone": "America/New_York"}');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
req, _ := http.NewRequest("POST", "https://api.edgeful.com/v1/settings/custom-sessions", strings.NewReader(`{"name": "power hour", "start_time": "15:00", "end_time": "16:00", "timezone": "America/New_York"}`))
req.Header.Set("Authorization", "Bearer <api-key>")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.edgeful.com/v1/settings/custom-sessions"))
.header("Authorization", "Bearer <api-key>")
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\"name\": \"power hour\", \"start_time\": \"15:00\", \"end_time\": \"16:00\", \"timezone\": \"America/New_York\"}"))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());require "net/http"
require "uri"
uri = URI("https://api.edgeful.com/v1/settings/custom-sessions")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer <api-key>"
request["Content-Type"] = "application/json"
request.body = '{"name": "power hour", "start_time": "15:00", "end_time": "16:00", "timezone": "America/New_York"}'
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
http.request(request)
end
puts response.body{
"status": "<string>",
"session": {
"id": "<string>",
"name": "<string>",
"start_time": "<string>",
"end_time": "<string>",
"timezone": "<string>",
"excludedDataTypes": [
"<string>"
]
},
"custom_sessions": [
{
"id": "<string>",
"name": "<string>",
"start_time": "<string>",
"end_time": "<string>",
"timezone": "<string>",
"excludedDataTypes": [
"<string>"
]
}
],
"changed": {
"saved": [
"<string>"
],
"removed": [
"<string>"
]
}
}save custom session
create a custom session, or update the one whose id is given. start_time and end_time are HH:MM in the IANA timezone and must differ; other sessions stay untouched. returns the saved session and the full list. this changes your account, and Edgeful shows the change after a reload. requires the key’s write permission.
curl --request POST \
--url 'https://api.edgeful.com/v1/settings/custom-sessions' \
--header 'Authorization: Bearer <api-key>' \
--header 'Content-Type: application/json' \
--data '{"name": "power hour", "start_time": "15:00", "end_time": "16:00", "timezone": "America/New_York"}'import requests
url = "https://api.edgeful.com/v1/settings/custom-sessions"
headers = {"Authorization": "Bearer <api-key>"}
payload = {'name': 'power hour', 'start_time': '15:00', 'end_time': '16:00', 'timezone': 'America/New_York'}
response = requests.post(url, headers=headers, json=payload)
print(response.json())const url = "https://api.edgeful.com/v1/settings/custom-sessions";
const options = {
method: "POST",
headers: { Authorization: "Bearer <api-key>", "Content-Type": "application/json" },
body: JSON.stringify({"name": "power hour", "start_time": "15:00", "end_time": "16:00", "timezone": "America/New_York"}),
};
const response = await fetch(url, options);
const data = await response.json();
console.log(data);<?php
$ch = curl_init("https://api.edgeful.com/v1/settings/custom-sessions");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Authorization: Bearer <api-key>", "Content-Type: application/json"]);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"name": "power hour", "start_time": "15:00", "end_time": "16:00", "timezone": "America/New_York"}');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
req, _ := http.NewRequest("POST", "https://api.edgeful.com/v1/settings/custom-sessions", strings.NewReader(`{"name": "power hour", "start_time": "15:00", "end_time": "16:00", "timezone": "America/New_York"}`))
req.Header.Set("Authorization", "Bearer <api-key>")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.edgeful.com/v1/settings/custom-sessions"))
.header("Authorization", "Bearer <api-key>")
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\"name\": \"power hour\", \"start_time\": \"15:00\", \"end_time\": \"16:00\", \"timezone\": \"America/New_York\"}"))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());require "net/http"
require "uri"
uri = URI("https://api.edgeful.com/v1/settings/custom-sessions")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer <api-key>"
request["Content-Type"] = "application/json"
request.body = '{"name": "power hour", "start_time": "15:00", "end_time": "16:00", "timezone": "America/New_York"}'
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
http.request(request)
end
puts response.body{
"status": "<string>",
"session": {
"id": "<string>",
"name": "<string>",
"start_time": "<string>",
"end_time": "<string>",
"timezone": "<string>",
"excludedDataTypes": [
"<string>"
]
},
"custom_sessions": [
{
"id": "<string>",
"name": "<string>",
"start_time": "<string>",
"end_time": "<string>",
"timezone": "<string>",
"excludedDataTypes": [
"<string>"
]
}
],
"changed": {
"saved": [
"<string>"
],
"removed": [
"<string>"
]
}
}Authorizations
Send your Edgeful API key in the Authorization header as Bearer <api-key> (for example, Bearer ef_live_<random>).
Body
session name, trimmed.
1 - 80start of the session as HH:MM in the timezone.
^([01]\d|2[0-3]):[0-5]\d$end of the session as HH:MM in the timezone; must differ from start_time.
^([01]\d|2[0-3]):[0-5]\d$IANA timezone the clocks are read in.
1 - 80id of the custom session to update; omit to create one.
1 - 80Response
Successful Response
updated or unchanged.
the saved session.
Show child attributes
Show child attributes
every custom session after this write.
Show child attributes
Show child attributes
what this write changed.
Show child attributes
Show child attributes
Was this page helpful?