Show spending per category against normal
curl --request GET \
--url https://app.sure.am/api/v1/spending_vs_normal \
--header 'X-Api-Key: <api-key>'import requests
url = "https://app.sure.am/api/v1/spending_vs_normal"
headers = {"X-Api-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Api-Key': '<api-key>'}};
fetch('https://app.sure.am/api/v1/spending_vs_normal', 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.sure.am/api/v1/spending_vs_normal",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-Api-Key: <api-key>"
],
]);
$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.sure.am/api/v1/spending_vs_normal"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Api-Key", "<api-key>")
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.sure.am/api/v1/spending_vs_normal")
.header("X-Api-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.sure.am/api/v1/spending_vs_normal")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-Api-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"currency": "<string>",
"period": {
"start_date": "2023-12-25",
"end_date": "2023-12-25"
},
"in_progress": true,
"baseline_period": {
"start_date": "2023-12-25",
"end_date": "2023-12-25"
},
"comparable": true,
"total": "<string>",
"normal_total": "<string>",
"categories": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"color": "<string>",
"filter_value": "<string>",
"total": "<string>",
"normal": "<string>",
"change": "<string>",
"ratio": "<string>",
"direct": true,
"subcategories": "<array>"
}
]
}{
"error": "<string>",
"message": "<string>",
"details": [
"<string>"
],
"errors": [
"<string>"
]
}{
"error": "<string>",
"message": "<string>",
"details": [
"<string>"
],
"errors": [
"<string>"
]
}Reports
Show spending per category against normal
Net spending per category in a period, compared with each category’s normal. For a finished period, normal is net spending over up to a year before the period, scaled to the period length. An unfinished period (in_progress) is cut to today and compared with the average of same-length windows starting on the corresponding date in each of up to 12 earlier months, counting only complete windows inside the available baseline. The data behind the Reports section “Spending vs normal”. Uses the authenticated user’s finance accounts and Sure reporting rules. Experimental: the section is a preview feature, and how normal is defined may still change.
GET
/
api
/
v1
/
spending_vs_normal
Show spending per category against normal
curl --request GET \
--url https://app.sure.am/api/v1/spending_vs_normal \
--header 'X-Api-Key: <api-key>'import requests
url = "https://app.sure.am/api/v1/spending_vs_normal"
headers = {"X-Api-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Api-Key': '<api-key>'}};
fetch('https://app.sure.am/api/v1/spending_vs_normal', 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.sure.am/api/v1/spending_vs_normal",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-Api-Key: <api-key>"
],
]);
$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.sure.am/api/v1/spending_vs_normal"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Api-Key", "<api-key>")
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.sure.am/api/v1/spending_vs_normal")
.header("X-Api-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.sure.am/api/v1/spending_vs_normal")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-Api-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"currency": "<string>",
"period": {
"start_date": "2023-12-25",
"end_date": "2023-12-25"
},
"in_progress": true,
"baseline_period": {
"start_date": "2023-12-25",
"end_date": "2023-12-25"
},
"comparable": true,
"total": "<string>",
"normal_total": "<string>",
"categories": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"color": "<string>",
"filter_value": "<string>",
"total": "<string>",
"normal": "<string>",
"change": "<string>",
"ratio": "<string>",
"direct": true,
"subcategories": "<array>"
}
]
}{
"error": "<string>",
"message": "<string>",
"details": [
"<string>"
],
"errors": [
"<string>"
]
}{
"error": "<string>",
"message": "<string>",
"details": [
"<string>"
],
"errors": [
"<string>"
]
}Authorizations
apiKeyAuthoauth2oauth2
Query Parameters
Response
comparison returned
Was this page helpful?