https://api.track.toggl.com/api/v9/organizations/{organization_id}/groups
Creates a group in the specified organization
- 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/organizations/{organization_id}/groups".to_string()).json(&serde_json::json!(\{"name":"string","users":[\{\}],"workspaces":[\{\}]\})) .header(CONTENT_TYPE, "application/json") .send() .await? .json() .await?; println!("{:#?}", json); Ok(())}
Parameters
Path
| name | type | required | description |
|---|---|---|---|
| organization_id | integer | true | Numeric ID of the organization. |
Body
| Name | Type | Description |
|---|---|---|
| name | string | Group name |
| users | Array of integer | Group users, optional |
| workspaces | Array of integer | Group workspaces |
Response
200
Returns the created group data.
| Name | Type | Description |
|---|---|---|
| at | string | - |
| group_id | integer | - |
| name | string | - |
| permissions | string | - |
| users | Array of object | - |
| workspaces | Array of integer | - |
users
| Name | Type | Description |
|---|---|---|
| avatar_url | string | - |
| inactive | boolean | - |
| joined | boolean | - |
| name | string | - |
| user_id | integer | - |
400
Possible error messages:
- Invalid JSON input
- Group name must be present
- Group name too long, maximum length is 200
- Name has already been taken
- User {user} not exists in the organization {org}
- Workspace {ws} not exists in the organization {org}
403
User does not have access to this resource