Groups
GET List of groups in organization with user and workspace assignments​
https://api.track.toggl.com/api/v9/organizations/{organization_id}/groups
Returns list of groups in organization based on set of url parameters. List is sorted by name.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl https://api.track.toggl.com/api/v9/organizations/{organization_id}/groups \
-H "Content-Type: application/json" \
-u <email>:<password>
req, err := http.NewRequest(http.MethodGet,
"https://api.track.toggl.com/api/v9/organizations/{organization_id}/groups")
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/api/v9/organizations/{organization_id}/groups')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Get.new(uri.path)
req['Content-Type'] = "application/json"
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://api.track.toggl.com/api/v9/organizations/{organization_id}/groups", {
method: "GET",
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.get('https://api.track.toggl.com/api/v9/organizations/{organization_id}/groups', 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::GET, "https://api.track.toggl.com/api/v9/organizations/{organization_id}/groups".to_string())
.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 |
Query​
name | type | required | description |
---|---|---|---|
name | string | false | Returns records where name contains this string |
workspace | string | false | ID of workspace. Returns groups assigned to this workspace |
Response​
200​
Array of:
name | type | description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
at | string | - | |||||||||||||||
group_id | integer | - | |||||||||||||||
name | string | - | |||||||||||||||
users | Array of
| - | |||||||||||||||
workspaces | Array of integer | - |
400​
Invalid number ...
POST Create group​
https://api.track.toggl.com/api/v9/organizations/{organization_id}/groups
Creates a group in the specified organization
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X POST https://api.track.toggl.com/api/v9/organizations/{organization_id}/groups \
-H "Content-Type: application/json" \
-d '{"name":"string","users":["integer"],"workspaces":["integer"]}' \
-u <email>:<password>
bytes, err := json.Marshal('{"name":"string","users":["integer"],"workspaces":["integer"]}')
if err != nil {
print(err)
}
req, err := http.NewRequest(http.MethodPost,
"https://api.track.toggl.com/api/v9/organizations/{organization_id}/groups", 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/api/v9/organizations/{organization_id}/groups')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Post.new(uri.path)
req['Content-Type'] = "application/json"
req.body = {"name":"string","users":["integer"],"workspaces":["integer"]}.to_json
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://api.track.toggl.com/api/v9/organizations/{organization_id}/groups", {
method: "POST",
body: {"name":"string","users":["integer"],"workspaces":["integer"]},
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/api/v9/organizations/{organization_id}/groups', json='{"name":"string","users":["integer"],"workspaces":["integer"]}', 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/api/v9/organizations/{organization_id}/groups".to_string())
.json(&serde_json::json!({"name":"string","users":["integer"],"workspaces":["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. |
Body​
name | type | description |
---|---|---|
name | string | Group name |
users | Array of integer | Group users, optional |
workspaces | Array of integer | Group workspaces, optional |
Response​
200​
Returns the created group data.
name | type | description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
at | string | - | |||||||||||||||
group_id | integer | - | |||||||||||||||
name | string | - | |||||||||||||||
users | Array of
| - | |||||||||||||||
workspaces | Array of 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
PUT Edit group​
https://api.track.toggl.com/api/v9/organizations/{organization_id}/groups/{group_id}
Edits a group in the specified organization
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X PUT https://api.track.toggl.com/api/v9/organizations/{organization_id}/groups/{group_id} \
-H "Content-Type: application/json" \
-d '{"name":"string","users":["integer"],"workspaces":["integer"]}' \
-u <email>:<password>
bytes, err := json.Marshal('{"name":"string","users":["integer"],"workspaces":["integer"]}')
if err != nil {
print(err)
}
req, err := http.NewRequest(http.MethodPut,
"https://api.track.toggl.com/api/v9/organizations/{organization_id}/groups/{group_id}", 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/api/v9/organizations/{organization_id}/groups/{group_id}')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Put.new(uri.path)
req['Content-Type'] = "application/json"
req.body = {"name":"string","users":["integer"],"workspaces":["integer"]}.to_json
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://api.track.toggl.com/api/v9/organizations/{organization_id}/groups/{group_id}", {
method: "PUT",
body: {"name":"string","users":["integer"],"workspaces":["integer"]},
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.put('https://api.track.toggl.com/api/v9/organizations/{organization_id}/groups/{group_id}', json='{"name":"string","users":["integer"],"workspaces":["integer"]}', 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::PUT, "https://api.track.toggl.com/api/v9/organizations/{organization_id}/groups/{group_id}".to_string())
.json(&serde_json::json!({"name":"string","users":["integer"],"workspaces":["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. |
Body​
name | type | description |
---|---|---|
name | string | Group name |
users | Array of integer | Group users, optional |
workspaces | Array of integer | Group workspaces, optional |
Response​
200​
Returns the created group data.
name | type | description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
at | string | - | |||||||||||||||
group_id | integer | - | |||||||||||||||
name | string | - | |||||||||||||||
users | Array of
| - | |||||||||||||||
workspaces | Array of 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​
Forbidden
404​
Invalid group ID.
DELETE Deletes group​
https://api.track.toggl.com/api/v9/organizations/{organization_id}/groups/{group_id}
Deletes a group from the specified organization
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X DELETE https://api.track.toggl.com/api/v9/organizations/{organization_id}/groups/{group_id} \
-H "Content-Type: application/json" \
-u <email>:<password>
req, err := http.NewRequest(http.MethodPut,
"https://api.track.toggl.com/api/v9/organizations/{organization_id}/groups/{group_id}")
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/api/v9/organizations/{organization_id}/groups/{group_id}')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Delete.new(uri.path)
req['Content-Type'] = "application/json"
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://api.track.toggl.com/api/v9/organizations/{organization_id}/groups/{group_id}", {
method: "DELETE",
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.delete('https://api.track.toggl.com/api/v9/organizations/{organization_id}/groups/{group_id}', 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::DELETE, "https://api.track.toggl.com/api/v9/organizations/{organization_id}/groups/{group_id}".to_string())
.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. |
group_id | integer | true | Numeric ID of the group. |
Response​
200​
OK
403​
User does not have access to this resource
404​
Invalid group ID.
PATCH Patch group​
https://api.track.toggl.com/api/v9/organizations/{organization_id}/groups/{group_id}
Patches a group in the specified organization. Patches are applied individually.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X PATCH https://api.track.toggl.com/api/v9/organizations/{organization_id}/groups/{group_id} \
-H "Content-Type: application/json" \
-u <email>:<password>
req, err := http.NewRequest(http.MethodGet,
"https://api.track.toggl.com/api/v9/organizations/{organization_id}/groups/{group_id}")
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/api/v9/organizations/{organization_id}/groups/{group_id}')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Patch.new(uri.path)
req['Content-Type'] = "application/json"
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://api.track.toggl.com/api/v9/organizations/{organization_id}/groups/{group_id}", {
method: "PATCH",
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.patch('https://api.track.toggl.com/api/v9/organizations/{organization_id}/groups/{group_id}', 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::PATCH, "https://api.track.toggl.com/api/v9/organizations/{organization_id}/groups/{group_id}".to_string())
.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. |
group_id | integer | true | Numeric ID of the group. |
Response​
200​
Returns the result of the requested operations.
name | type | description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
failure | Array of
| - | ||||||||||||
success | Array of
| - |
400​
Possible error messages:
* Invalid JSON input
* Empty or invalid patch operation
* Empty or invalid patch path
* Unknown group at organization
* Too many patches_Too many values per patch_
403​
Forbidden
404​
Invalid group ID.
GET List of groups in a workspace within an organization with user assignments.​
https://api.track.toggl.com/api/v9/organizations/{organization_id}/workspaces/{workspace_id}/groups
Returns list of groups in a workspace based on set of url parameters. List is sorted by name.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl https://api.track.toggl.com/api/v9/organizations/{organization_id}/workspaces/{workspace_id}/groups \
-H "Content-Type: application/json" \
-u <email>:<password>
req, err := http.NewRequest(http.MethodGet,
"https://api.track.toggl.com/api/v9/organizations/{organization_id}/workspaces/{workspace_id}/groups")
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/api/v9/organizations/{organization_id}/workspaces/{workspace_id}/groups')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Get.new(uri.path)
req['Content-Type'] = "application/json"
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://api.track.toggl.com/api/v9/organizations/{organization_id}/workspaces/{workspace_id}/groups", {
method: "GET",
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.get('https://api.track.toggl.com/api/v9/organizations/{organization_id}/workspaces/{workspace_id}/groups', 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::GET, "https://api.track.toggl.com/api/v9/organizations/{organization_id}/workspaces/{workspace_id}/groups".to_string())
.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 |
Response​
200​
Array of:
name | type | description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
at | string | - | |||||||||||||||
group_id | integer | - | |||||||||||||||
name | string | - | |||||||||||||||
users | Array of
| - | |||||||||||||||
workspaces | Array of integer | - |
403​
Forbidden
404​
Resource can not be found
GET Get workspace project groups.​
https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/project_groups
Get project groups for given workspace.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/project_groups \
-H "Content-Type: application/json" \
-u <email>:<password>
req, err := http.NewRequest(http.MethodGet,
"https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/project_groups")
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/api/v9/workspaces/{workspace_id}/project_groups')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Get.new(uri.path)
req['Content-Type'] = "application/json"
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/project_groups", {
method: "GET",
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.get('https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/project_groups', 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::GET, "https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/project_groups".to_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 |
Query​
name | type | required | description |
---|---|---|---|
project_ids | string | true | Project IDs separated by comma. |
Response​
200​
Array of:
name | type | description |
---|---|---|
group_id | integer | - |
id | integer | - |
pid | integer | - |
wid | integer | - |
403​
User does not have access to this resource.
500​
Internal Server Error
POST Adds group to project.​
https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/project_groups
Adds group to project for given workspace.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X POST https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/project_groups \
-H "Content-Type: application/json" \
-d '{"group_id":"integer","project_id":"integer"}' \
-u <email>:<password>
bytes, err := json.Marshal('{"group_id":"integer","project_id":"integer"}')
if err != nil {
print(err)
}
req, err := http.NewRequest(http.MethodPost,
"https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/project_groups", 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/api/v9/workspaces/{workspace_id}/project_groups')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Post.new(uri.path)
req['Content-Type'] = "application/json"
req.body = {"group_id":"integer","project_id":"integer"}.to_json
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/project_groups", {
method: "POST",
body: {"group_id":"integer","project_id":"integer"},
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/api/v9/workspaces/{workspace_id}/project_groups', json='{"group_id":"integer","project_id":"integer"}', 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/api/v9/workspaces/{workspace_id}/project_groups".to_string())
.json(&serde_json::json!({"group_id":"integer","project_id":"integer"}))
.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 |
---|---|---|
group_id | integer | Group ID |
project_id | integer | Project ID |
Response​
200​
Successful operation.
403​
User does not have access to this resource.
500​
Internal Server Error
DELETE Remove project group.​
https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/project_groups/{project_group_id}
Remove project group for a given workspace.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X DELETE https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/project_groups/{project_group_id} \
-H "Content-Type: application/json" \
-u <email>:<password>
req, err := http.NewRequest(http.MethodPut,
"https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/project_groups/{project_group_id}")
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/api/v9/workspaces/{workspace_id}/project_groups/{project_group_id}')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Delete.new(uri.path)
req['Content-Type'] = "application/json"
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/project_groups/{project_group_id}", {
method: "DELETE",
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.delete('https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/project_groups/{project_group_id}', 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::DELETE, "https://api.track.toggl.com/api/v9/workspaces/{workspace_id}/project_groups/{project_group_id}".to_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 |
project_group_id | integer | true | Numeric ID of the project group |
Response​
200​
Successful operation.
403​
User does not have access to this resource.
500​
Internal Server Error