Exports
POST Export employee profitability insights
https://api.track.toggl.com/insights/api/v1/workspace/{workspace_id}/profitability/employees.{extension}
Downloads employee profitability insights in the specified format: csv or xlsx.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X POST https://api.track.toggl.com/insights/api/v1/workspace/{workspace_id}/profitability/employees.{extension} \
-H "Content-Type: application/json" \
-d '\{"currency":"string","end_date":"string","group_ids":[\{\}],"resolution":"string","rounding":"integer","rounding_minutes":"integer","start_date":"string","user_ids":[\{\}]\}' \
-u <email>:<password>
bytes, err := json.Marshal('\{"currency":"string","end_date":"string","group_ids":[\{\}],"resolution":"string","rounding":"integer","rounding_minutes":"integer","start_date":"string","user_ids":[\{\}]\}')
if err != nil {
print(err)
}
req, err := http.NewRequest(http.MethodPost,
"https://api.track.toggl.com/insights/api/v1/workspace/{workspace_id}/profitability/employees.{extension}", bytes.NewBuffer(bytes))
if err != nil {
print(err)
}
req.Header.Set("Content-Type", "application/json; charset=utf-8")
req.SetBasicAuth("<email>", "<password>")
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/insights/api/v1/workspace/{workspace_id}/profitability/employees.{extension}')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Post.new(uri.path)
req['Content-Type'] = "application/json"
req.body = \{"currency":"string","end_date":"string","group_ids":[\{\}],"resolution":"string","rounding":"integer","rounding_minutes":"integer","start_date":"string","user_ids":[\{\}]\}.to_json
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://api.track.toggl.com/insights/api/v1/workspace/{workspace_id}/profitability/employees.{extension}", {
method: "POST",
body: \{"currency":"string","end_date":"string","group_ids":[\{\}],"resolution":"string","rounding":"integer","rounding_minutes":"integer","start_date":"string","user_ids":[\{\}]\},
headers: {
"Content-Type": "application/json",
"Authorization": `Basic ${base64.encode(<email>:<password>)}`
},
})
.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/insights/api/v1/workspace/{workspace_id}/profitability/employees.{extension}', json=\{"currency":"string","end_date":"string","group_ids":[\{\}],"resolution":"string","rounding":"integer","rounding_minutes":"integer","start_date":"string","user_ids":[\{\}]\}, headers={'content-type': 'application/json', 'Authorization' : 'Basic %s' % b64encode(b"<email>:<password>").decode("ascii")})
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().basic_auth("<email>", "<password>");
let json = client.request(Method::POST, "https://api.track.toggl.com/insights/api/v1/workspace/{workspace_id}/profitability/employees.{extension}".to_string())
.json(&serde_json::json!(\{"currency":"string","end_date":"string","group_ids":[\{\}],"resolution":"string","rounding":"integer","rounding_minutes":"integer","start_date":"string","user_ids":[\{\}]\}))
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Parameters
Body
Name | Type | Description |
---|---|---|
currency | string | - |
end_date | string | - |
group_ids | Array of integer | - |
resolution | string | - |
rounding | integer | - |
rounding_minutes | integer | - |
start_date | string | - |
user_ids | Array of integer | - |
Response
200
A stream with the csv or xlsx for the report being exported
400
Invalid parameters
403
User has no access to workspace or is not admin
500
Internal Server Error
POST Export profitability project insights
https://api.track.toggl.com/insights/api/v1/workspace/{workspace_id}/profitability/projects.{extension}
Downloads profitability project insights in the specified format: csv or xlsx.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X POST https://api.track.toggl.com/insights/api/v1/workspace/{workspace_id}/profitability/projects.{extension} \
-H "Content-Type: application/json" \
-d '\{"billable":"boolean","client_ids":[\{\}],"currency":"string","end_date":"string","project_ids":[\{\}],"resolution":"string","rounding":"integer","rounding_minutes":"integer","start_date":"string"\}' \
-u <email>:<password>
bytes, err := json.Marshal('\{"billable":"boolean","client_ids":[\{\}],"currency":"string","end_date":"string","project_ids":[\{\}],"resolution":"string","rounding":"integer","rounding_minutes":"integer","start_date":"string"\}')
if err != nil {
print(err)
}
req, err := http.NewRequest(http.MethodPost,
"https://api.track.toggl.com/insights/api/v1/workspace/{workspace_id}/profitability/projects.{extension}", bytes.NewBuffer(bytes))
if err != nil {
print(err)
}
req.Header.Set("Content-Type", "application/json; charset=utf-8")
req.SetBasicAuth("<email>", "<password>")
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/insights/api/v1/workspace/{workspace_id}/profitability/projects.{extension}')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Post.new(uri.path)
req['Content-Type'] = "application/json"
req.body = \{"billable":"boolean","client_ids":[\{\}],"currency":"string","end_date":"string","project_ids":[\{\}],"resolution":"string","rounding":"integer","rounding_minutes":"integer","start_date":"string"\}.to_json
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://api.track.toggl.com/insights/api/v1/workspace/{workspace_id}/profitability/projects.{extension}", {
method: "POST",
body: \{"billable":"boolean","client_ids":[\{\}],"currency":"string","end_date":"string","project_ids":[\{\}],"resolution":"string","rounding":"integer","rounding_minutes":"integer","start_date":"string"\},
headers: {
"Content-Type": "application/json",
"Authorization": `Basic ${base64.encode(<email>:<password>)}`
},
})
.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/insights/api/v1/workspace/{workspace_id}/profitability/projects.{extension}', json=\{"billable":"boolean","client_ids":[\{\}],"currency":"string","end_date":"string","project_ids":[\{\}],"resolution":"string","rounding":"integer","rounding_minutes":"integer","start_date":"string"\}, headers={'content-type': 'application/json', 'Authorization' : 'Basic %s' % b64encode(b"<email>:<password>").decode("ascii")})
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().basic_auth("<email>", "<password>");
let json = client.request(Method::POST, "https://api.track.toggl.com/insights/api/v1/workspace/{workspace_id}/profitability/projects.{extension}".to_string())
.json(&serde_json::json!(\{"billable":"boolean","client_ids":[\{\}],"currency":"string","end_date":"string","project_ids":[\{\}],"resolution":"string","rounding":"integer","rounding_minutes":"integer","start_date":"string"\}))
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}