"Insights" Endpoints - POST Load projects data trends

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

Returns the data trends for projects from a workspace.

  • 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}/data_trends/projects".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

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 filtered projects

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

402

Workspace needs to have the {feature} feature enabled

403

Possible error messages:

  • Workspace not found/accessible
  • Admin permissions required

500

Internal Server Error