https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/rates
Creates a new rate.
- 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/api/v9/workspaces/{workspace_id}/rates".to_string()).json(&serde_json::json!(\{"amount":"number","level":"string","level_id":"integer","mode":"string","start":"string","type":"string"\})) .header(CONTENT_TYPE, "application/json") .send() .await? .json() .await?; println!("{:#?}", json); Ok(())}
Parameters
Path
name | type | required | description |
---|---|---|---|
workspace_id | integer | true | Numeric ID of the workspace |
Body
Name | Type | Description |
---|---|---|
amount | number | Amount of the rate, required, must be greater than 0 |
level | string | Level of the rate, required, must be one of: ‘workspace’, ‘workspace_user’, ‘project’, ‘project_user’, ‘task’ |
level_id | integer | Identifier of the level, required |
mode | string | Mode of the rate, required if Start is not informed, must be one of: ‘override-all’, ‘override-current’, ‘start-today’ |
start | string | Start date time of the rate, required if Mode is not informed, must be a valid date time |
type | string | Type of the rate, required, must be one of ‘billable_rates’, ‘labor_rates’ |
Response
201
Successfully created.
400
Possible error messages:
- Request payload must be informed
- Invalid workspace ID
402
Billable rates are available for Starter and higher plans.
403
User cannot access billable rate(s).
500
Internal Server Error