curl --request GET \
--url https://app.onlysocial.io/os/api/{workspace}/analytics/best-times \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.onlysocial.io/os/api/{workspace}/analytics/best-times"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.onlysocial.io/os/api/{workspace}/analytics/best-times', 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.onlysocial.io/os/api/{workspace}/analytics/best-times",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.onlysocial.io/os/api/{workspace}/analytics/best-times"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://app.onlysocial.io/os/api/{workspace}/analytics/best-times")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.onlysocial.io/os/api/{workspace}/analytics/best-times")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"timezone": "<string>",
"times": [
{
"account_id": 123,
"account_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"date": "2023-12-25",
"time": "13:00"
}
]
}{
"message": "The date range may span at most 366 days.",
"errors": {
"date_to": [
"The date range may span at most 366 days."
]
}
}Get the next best time for each account
Each account is scored on its own history, as in Get the best times to post, and its next best time is the soonest of its best slots after from. That is always within a week, and never in the past. Accounts with no best slot yet are left out of times.
Read-only. Personal access tokens may call it with any workspace role, viewers included.
Required permission: publishing:analytics:read
curl --request GET \
--url https://app.onlysocial.io/os/api/{workspace}/analytics/best-times \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.onlysocial.io/os/api/{workspace}/analytics/best-times"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.onlysocial.io/os/api/{workspace}/analytics/best-times', 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.onlysocial.io/os/api/{workspace}/analytics/best-times",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.onlysocial.io/os/api/{workspace}/analytics/best-times"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://app.onlysocial.io/os/api/{workspace}/analytics/best-times")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.onlysocial.io/os/api/{workspace}/analytics/best-times")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"timezone": "<string>",
"times": [
{
"account_id": 123,
"account_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"date": "2023-12-25",
"time": "13:00"
}
]
}{
"message": "The date range may span at most 366 days.",
"errors": {
"date_to": [
"The date range may span at most 366 days."
]
}
}Authorizations
A workspace API key: Authorization: Bearer osk_...
Path Parameters
Your workspace UUID. Must match the API key's workspace.
Query Parameters
Account UUIDs. Defaults to every account in the workspace.
A day in timezone to look from. Defaults to now; a day in the past counts as now.
IANA timezone the weekdays, hours and times are in. Defaults to the timezone setting of the key's creator (or the token's user), then UTC.
"Europe/Berlin"
