"Insights" Endpoints - POST Export projects data trends

https://api.track.toggl.com/insights/api/v1/workspace/{workspace_id}/trends/projects.{extension}

Downloads projects data trends in the specified format: csv or xlsx.

  • cURL
  • Go
  • Ruby
  • JavaScript
  • Python
  • Rust
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().basic_auth("<email>", "<password>");  let json = client.request(Method::POST, "https://api.track.toggl.com/insights/api/v1/workspace/{workspace_id}/trends/projects.{extension}".to_string()).json(&serde_json::json!(\{"billable":"boolean","end_date":"string","previous_period_start":"string","project_ids":[\{\}],"rounding":"integer","rounding_minutes":"integer","start_date":"string"\}))  .header(CONTENT_TYPE, "application/json")  .send()  .await?  .json()  .await?;    println!("{:#?}", json);  Ok(())}

Parameters

Path

name type required description
workspace_id integer true Workspace ID
extension string true csv,xlsx

Body

Name Type Description
billable boolean Whether the project is set as billable, optional, premium feature.
end_date string End date, example time.DateOnly. Should be greater than Start date.
previous_period_start string Previous start date, example time.DateOnly.
project_ids Array of integer Project IDs, optional.
rounding integer Rounding, optional, duration rounding settings, premium feature.
rounding_minutes integer RoundingMinutes, optional, duration rounding minutes settings, premium feature.
start_date string Start date, example time.DateOnly. Should be less than End date.

Response

200

Returns data projects data trends

Name Type Description
items Array of object -
items
Name Type Description
current_period_seconds Array of integer -
previous_period_seconds Array of integer -
project_id integer -
start string -
user_ids Array of integer -

400

Possible error messages:

  • At least one parameter must be set
  • Invalid workspace id
  • wrong format date
  • start should come after end

403

Possible error messages:

  • Workspace not found/accessible"
  • user has no required access to asked workspace

500

Internal Server Error