Warehouse-aggregations
POST Regenerates aggregations for a given set of workspace IDs.
https://api.track.toggl.com/warehouse/aggregations/generate
Regenerates aggregations for a given set of workspace IDs. The type of aggregations to be regenerated will either be project-total-time or planed-task-total-time.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X POST https://api.track.toggl.com/warehouse/aggregations/generate \
-H "Content-Type: application/json" \
-d '{"aggregation":"string","batch_size":"integer","current_entity":"string","current_entity_id":"integer","entities":["string"],"project_ids":["integer"],"reset":"boolean","workspace_ids":["integer"]}'
bytes, err := json.Marshal('{"aggregation":"string","batch_size":"integer","current_entity":"string","current_entity_id":"integer","entities":["string"],"project_ids":["integer"],"reset":"boolean","workspace_ids":["integer"]}')
if err != nil {
print(err)
}
req, err := http.NewRequest(http.MethodPost,
"https://api.track.toggl.com/warehouse/aggregations/generate", bytes.NewBuffer(bytes))
if err != nil {
print(err)
}
req.Header.Set("Content-Type", "application/json; charset=utf-8")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
print(err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
print(err)
}
fmt.Print(string(body))
require 'net/http'
require 'uri'
require 'json'
uri = URI('https://api.track.toggl.com/warehouse/aggregations/generate')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Post.new(uri.path)
req['Content-Type'] = "application/json"
req.body = {"aggregation":"string","batch_size":"integer","current_entity":"string","current_entity_id":"integer","entities":["string"],"project_ids":["integer"],"reset":"boolean","workspace_ids":["integer"]}.to_json
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://api.track.toggl.com/warehouse/aggregations/generate", {
method: "POST",
body: {"aggregation":"string","batch_size":"integer","current_entity":"string","current_entity_id":"integer","entities":["string"],"project_ids":["integer"],"reset":"boolean","workspace_ids":["integer"]},
headers: {
"Content-Type": "application/json"
},
})
.then((resp) => resp.json())
.then((json) => {
console.log(json);
})
.catch(err => console.error(err));
import requests
from base64 import b64encode
data = requests.post('https://api.track.toggl.com/warehouse/aggregations/generate', json={"aggregation":"string","batch_size":"integer","current_entity":"string","current_entity_id":"integer","entities":["string"],"project_ids":["integer"],"reset":"boolean","workspace_ids":["integer"]}, headers={'content-type': 'application/json'})
print(data.json())
extern crate tokio;
extern crate serde_json;
use reqwest::{Client};
use reqwest::header::{CONTENT_TYPE};
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let client = Client::new();
let json = client.request(Method::POST, "https://api.track.toggl.com/warehouse/aggregations/generate".to_string())
.json(&serde_json::json!({"aggregation":"string","batch_size":"integer","current_entity":"string","current_entity_id":"integer","entities":["string"],"project_ids":["integer"],"reset":"boolean","workspace_ids":["integer"]}))
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Parameters
Body
name | type | description |
---|---|---|
aggregation | string | Aggregation type. |
batch_size | integer | Size of the batch for loop based generation processes |
current_entity | string | Current entity, to generate data from a point forward |
current_entity_id | integer | Current entity id, to generate data from a point forward |
entities | Array of string | List of entities to scan |
project_ids | Array of integer | ProjectIDs fetch time-entries that belong to any of these projects. |
reset | boolean | Drops existing aggregation data |
workspace_ids | Array of integer | WorkspaceIDs fetch time-entries that belong to any of these workspaces. |
Response
204
Aggregation generation process started.
400
Possible error messages:
* Invalid aggregation type.
* request body can't be empty
* unsupported aggregation type
500
Server Error