“Organizations” Endpoint - PUT Change assignments of users within a workspace

https://api.track.toggl.com/api/v9/organizations/{organization_id}/workspaces/{workspace_id}/assignments

Assign or remove users to/from a workspace or to/from groups belonging to said 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::PUT, "https://api.track.toggl.com/api/v9/organizations/{organization_id}/workspaces/{workspace_id}/assignments".to_string()).json(&serde_json::json!(\{"group_id":"integer","joined":"boolean","operation":"string","user_id":"integer"\}))  .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
workspace_id integer true Numeric ID of the workspace within the organization

Body

Name Type Description
group_id integer -
joined boolean -
operation string -
user_id integer -

Response

200

OK

400

Possible error messages:

  • Invalid JSON input
  • Invalid organization ID.
  • Nothing to change.
  • Field operation can contain only ‘add’ or ‘remove’.
  • Cannot send user_id and group_id in the same element.
  • One of user_id or group_id is required.
  • Invalid user_id.
  • Cannot remove workspace owner.
  • Cannot remove paying user.
  • Cannot remove organization admin.
  • Invalid group_id.
  • Invalid workspace ID.

403

Forbidden