Time
GET Get time offs of organization users
https://focus.toggl.com/api/organizations/{organization_id}/timeoff
Returns time offs of organization users
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl https://focus.toggl.com/api/organizations/{organization_id}/timeoff \
-H "Content-Type: application/json" \
-u <email>:<password>
req, err := http.NewRequest(http.MethodGet,
"https://focus.toggl.com/api/organizations/{organization_id}/timeoff")
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://focus.toggl.com/api/organizations/{organization_id}/timeoff')
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://focus.toggl.com/api/organizations/{organization_id}/timeoff", {
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://focus.toggl.com/api/organizations/{organization_id}/timeoff', 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://focus.toggl.com/api/organizations/{organization_id}/timeoff".to_string())
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Parameters
Path
| name | type | required | description |
|---|---|---|---|
| organization_id | integer | true | Organization ID |
Query
| name | type | required | description |
|---|---|---|---|
| user_id | []integer | true | User IDs |
| start_date | string | true | From date (YYYY-MM-DD) |
| end_date | string | true | To date (YYYY-MM-DD) |
Response
200
| Name | Type | Description |
|---|---|---|
| items | Array of object | - |
items
| Name | Type | Description |
|---|---|---|
| end_time | string | - |
| ghost_id | integer | - |
| start_time | string | - |
| timeoff_id | integer | - |
| user_id | integer | - |
400
Invalid parameters
403
Forbidden
500
Internal Server Error
GET Get time off for organization user
https://focus.toggl.com/api/organizations/{organization_id}/timeoff/users/{user_id}
Returns time off for organization user
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl https://focus.toggl.com/api/organizations/{organization_id}/timeoff/users/{user_id} \
-H "Content-Type: application/json" \
-u <email>:<password>
req, err := http.NewRequest(http.MethodGet,
"https://focus.toggl.com/api/organizations/{organization_id}/timeoff/users/{user_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://focus.toggl.com/api/organizations/{organization_id}/timeoff/users/{user_id}')
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://focus.toggl.com/api/organizations/{organization_id}/timeoff/users/{user_id}", {
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://focus.toggl.com/api/organizations/{organization_id}/timeoff/users/{user_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::GET, "https://focus.toggl.com/api/organizations/{organization_id}/timeoff/users/{user_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 | Organization ID |
| user_id | integer | true | User ID |
Query
| name | type | required | description |
|---|---|---|---|
| from | string | true | From date (YYYY-MM-DD) |
| to | string | true | To date (YYYY-MM-DD) |
Response
200
| Name | Type | Description |
|---|---|---|
| items | Array of object | - |
items
| Name | Type | Description |
|---|---|---|
| created_at | string | - |
| end_time | string | - |
| organization_id | integer | - |
| start_time | string | - |
| timeoff_id | integer | - |
| type | string | - |
| updated_at | string | - |
| user_id | integer | - |
400
Invalid parameters
403
Forbidden
500
Internal Server Error
PUT Update time off for the specified user
https://focus.toggl.com/api/organizations/{organization_id}/timeoff/users/{user_id}
Updates time off for the specified user
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X PUT https://focus.toggl.com/api/organizations/{organization_id}/timeoff/users/{user_id} \
-H "Content-Type: application/json" \
-d '[\{"end_time":"string","start_time":"string","timeoff_id":"integer","type":"string"\}]' \
-u <email>:<password>
bytes, err := json.Marshal('[\{"end_time":"string","start_time":"string","timeoff_id":"integer","type":"string"\}]')
if err != nil {
print(err)
}
req, err := http.NewRequest(http.MethodPut,
"https://focus.toggl.com/api/organizations/{organization_id}/timeoff/users/{user_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://focus.toggl.com/api/organizations/{organization_id}/timeoff/users/{user_id}')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Put.new(uri.path)
req['Content-Type'] = "application/json"
req.body = [\{"end_time":"string","start_time":"string","timeoff_id":"integer","type":"string"\}].to_json
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://focus.toggl.com/api/organizations/{organization_id}/timeoff/users/{user_id}", {
method: "PUT",
body: [\{"end_time":"string","start_time":"string","timeoff_id":"integer","type":"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.put('https://focus.toggl.com/api/organizations/{organization_id}/timeoff/users/{user_id}', json=[\{"end_time":"string","start_time":"string","timeoff_id":"integer","type":"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::PUT, "https://focus.toggl.com/api/organizations/{organization_id}/timeoff/users/{user_id}".to_string())
.json(&serde_json::json!([\{"end_time":"string","start_time":"string","timeoff_id":"integer","type":"string"\}]))
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Parameters
Path
| name | type | required | description |
|---|---|---|---|
| organization_id | integer | true | Organization ID |
| user_id | integer | true | User ID |
Body
| Name | Type | Description |
|---|---|---|
| items | Array of object | - |
items
| Name | Type | Description |
|---|---|---|
| end_time | string | - |
| start_time | string | - |
| timeoff_id | integer | - |
| type | string | - |
Response
200
| Name | Type | Description |
|---|---|---|
| items | Array of object | - |
items
| Name | Type | Description |
|---|---|---|
| created_at | string | - |
| end_time | string | - |
| organization_id | integer | - |
| start_time | string | - |
| timeoff_id | integer | - |
| type | string | - |
| updated_at | string | - |
| user_id | integer | - |
400
Invalid parameters
403
Forbidden
500
Internal Server Error
POST Create time off for the specified user
https://focus.toggl.com/api/organizations/{organization_id}/timeoff/users/{user_id}
Creates time off for the specified user
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X POST https://focus.toggl.com/api/organizations/{organization_id}/timeoff/users/{user_id} \
-H "Content-Type: application/json" \
-d '[\{"end_time":"string","start_time":"string","type":"string"\}]' \
-u <email>:<password>
bytes, err := json.Marshal('[\{"end_time":"string","start_time":"string","type":"string"\}]')
if err != nil {
print(err)
}
req, err := http.NewRequest(http.MethodPost,
"https://focus.toggl.com/api/organizations/{organization_id}/timeoff/users/{user_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://focus.toggl.com/api/organizations/{organization_id}/timeoff/users/{user_id}')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Post.new(uri.path)
req['Content-Type'] = "application/json"
req.body = [\{"end_time":"string","start_time":"string","type":"string"\}].to_json
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://focus.toggl.com/api/organizations/{organization_id}/timeoff/users/{user_id}", {
method: "POST",
body: [\{"end_time":"string","start_time":"string","type":"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://focus.toggl.com/api/organizations/{organization_id}/timeoff/users/{user_id}', json=[\{"end_time":"string","start_time":"string","type":"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://focus.toggl.com/api/organizations/{organization_id}/timeoff/users/{user_id}".to_string())
.json(&serde_json::json!([\{"end_time":"string","start_time":"string","type":"string"\}]))
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Parameters
Path
| name | type | required | description |
|---|---|---|---|
| organization_id | integer | true | Organization ID |
| user_id | integer | true | User ID |
Body
| Name | Type | Description |
|---|---|---|
| items | Array of object | - |
items
| Name | Type | Description |
|---|---|---|
| end_time | string | - |
| start_time | string | - |
| type | string | - |
Response
200
| Name | Type | Description |
|---|---|---|
| items | Array of object | - |
items
| Name | Type | Description |
|---|---|---|
| created_at | string | - |
| end_time | string | - |
| organization_id | integer | - |
| start_time | string | - |
| timeoff_id | integer | - |
| type | string | - |
| updated_at | string | - |
| user_id | integer | - |
400
Invalid parameters
403
Forbidden
500
Internal Server Error
DELETE Delete time off for the specified user
https://focus.toggl.com/api/organizations/{organization_id}/timeoff/users/{user_id}
Deletes time off for the specified user
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X DELETE https://focus.toggl.com/api/organizations/{organization_id}/timeoff/users/{user_id} \
-H "Content-Type: application/json" \
-d '[\{\}]' \
-u <email>:<password>
bytes, err := json.Marshal('[\{\}]')
if err != nil {
print(err)
}
req, err := http.NewRequest(http.MethodPut,
"https://focus.toggl.com/api/organizations/{organization_id}/timeoff/users/{user_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://focus.toggl.com/api/organizations/{organization_id}/timeoff/users/{user_id}')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Delete.new(uri.path)
req['Content-Type'] = "application/json"
req.body = [\{\}].to_json
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://focus.toggl.com/api/organizations/{organization_id}/timeoff/users/{user_id}", {
method: "DELETE",
body: [\{\}],
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://focus.toggl.com/api/organizations/{organization_id}/timeoff/users/{user_id}', json=[\{\}], 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://focus.toggl.com/api/organizations/{organization_id}/timeoff/users/{user_id}".to_string())
.json(&serde_json::json!([\{\}]))
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Parameters
Path
| name | type | required | description |
|---|---|---|---|
| organization_id | integer | true | Organization ID |
| user_id | integer | true | User ID |
Body
| Name | Type | Description |
|---|---|---|
| items | Array of integer | - |
Response
204
No Content
400
Invalid parameters
403
Forbidden
500
Internal Server Error
GET Get time offs of organization ghosts
https://focus.toggl.com/api/organizations/{organization_id}/{workspace_id}/timeoff
Returns time offs of organization ghosts
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl https://focus.toggl.com/api/organizations/{organization_id}/{workspace_id}/timeoff \
-H "Content-Type: application/json" \
-u <email>:<password>
req, err := http.NewRequest(http.MethodGet,
"https://focus.toggl.com/api/organizations/{organization_id}/{workspace_id}/timeoff")
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://focus.toggl.com/api/organizations/{organization_id}/{workspace_id}/timeoff')
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://focus.toggl.com/api/organizations/{organization_id}/{workspace_id}/timeoff", {
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://focus.toggl.com/api/organizations/{organization_id}/{workspace_id}/timeoff', 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://focus.toggl.com/api/organizations/{organization_id}/{workspace_id}/timeoff".to_string())
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Parameters
Path
| name | type | required | description |
|---|---|---|---|
| organization_id | integer | true | Organization ID |
| workspace_id | integer | true | Workspace ID |
Query
| name | type | required | description |
|---|---|---|---|
| ghost_ids | []integer | true | Ghost IDs |
| start_date | string | true | From date (YYYY-MM-DD) |
| end_date | string | true | To date (YYYY-MM-DD) |
Response
200
| Name | Type | Description |
|---|---|---|
| items | Array of object | - |
items
| Name | Type | Description |
|---|---|---|
| created_at | string | - |
| end_time | string | - |
| organization_id | integer | - |
| start_time | string | - |
| timeoff_id | integer | - |
| type | string | - |
| updated_at | string | - |
| user_id | integer | - |
400
Invalid parameters
403
Forbidden
500
Internal Server Error
GET Get time off for a ghost
https://focus.toggl.com/api/organizations/{organization_id}/{workspace_id}/timeoff/ghosts/{ghost_id}
Returns time off for a ghost
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl https://focus.toggl.com/api/organizations/{organization_id}/{workspace_id}/timeoff/ghosts/{ghost_id} \
-H "Content-Type: application/json" \
-u <email>:<password>
req, err := http.NewRequest(http.MethodGet,
"https://focus.toggl.com/api/organizations/{organization_id}/{workspace_id}/timeoff/ghosts/{ghost_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://focus.toggl.com/api/organizations/{organization_id}/{workspace_id}/timeoff/ghosts/{ghost_id}')
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://focus.toggl.com/api/organizations/{organization_id}/{workspace_id}/timeoff/ghosts/{ghost_id}", {
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://focus.toggl.com/api/organizations/{organization_id}/{workspace_id}/timeoff/ghosts/{ghost_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::GET, "https://focus.toggl.com/api/organizations/{organization_id}/{workspace_id}/timeoff/ghosts/{ghost_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 | Organization ID |
| workspace_id | integer | true | Workspace ID |
| ghost_id | integer | true | User ID |
Query
| name | type | required | description |
|---|---|---|---|
| from | string | true | From date (YYYY-MM-DD) |
| to | string | true | To date (YYYY-MM-DD) |
Response
200
| Name | Type | Description |
|---|---|---|
| items | Array of object | - |
items
| Name | Type | Description |
|---|---|---|
| created_at | string | - |
| end_time | string | - |
| organization_id | integer | - |
| start_time | string | - |
| timeoff_id | integer | - |
| type | string | - |
| updated_at | string | - |
| user_id | integer | - |
400
Invalid parameters
403
Forbidden
500
Internal Server Error
PUT Update time off for the specified ghost
https://focus.toggl.com/api/organizations/{organization_id}/{workspace_id}/timeoff/ghosts/{ghost_id}
Updates time off for the specified ghost
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X PUT https://focus.toggl.com/api/organizations/{organization_id}/{workspace_id}/timeoff/ghosts/{ghost_id} \
-H "Content-Type: application/json" \
-d '[\{"end_time":"string","start_time":"string","timeoff_id":"integer","type":"string"\}]' \
-u <email>:<password>
bytes, err := json.Marshal('[\{"end_time":"string","start_time":"string","timeoff_id":"integer","type":"string"\}]')
if err != nil {
print(err)
}
req, err := http.NewRequest(http.MethodPut,
"https://focus.toggl.com/api/organizations/{organization_id}/{workspace_id}/timeoff/ghosts/{ghost_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://focus.toggl.com/api/organizations/{organization_id}/{workspace_id}/timeoff/ghosts/{ghost_id}')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Put.new(uri.path)
req['Content-Type'] = "application/json"
req.body = [\{"end_time":"string","start_time":"string","timeoff_id":"integer","type":"string"\}].to_json
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://focus.toggl.com/api/organizations/{organization_id}/{workspace_id}/timeoff/ghosts/{ghost_id}", {
method: "PUT",
body: [\{"end_time":"string","start_time":"string","timeoff_id":"integer","type":"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.put('https://focus.toggl.com/api/organizations/{organization_id}/{workspace_id}/timeoff/ghosts/{ghost_id}', json=[\{"end_time":"string","start_time":"string","timeoff_id":"integer","type":"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::PUT, "https://focus.toggl.com/api/organizations/{organization_id}/{workspace_id}/timeoff/ghosts/{ghost_id}".to_string())
.json(&serde_json::json!([\{"end_time":"string","start_time":"string","timeoff_id":"integer","type":"string"\}]))
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Parameters
Path
| name | type | required | description |
|---|---|---|---|
| organization_id | integer | true | Organization ID |
| workspace_id | integer | true | Workspace ID |
| ghost_id | integer | true | Ghost ID |
Body
| Name | Type | Description |
|---|---|---|
| items | Array of object | - |
items
| Name | Type | Description |
|---|---|---|
| end_time | string | - |
| start_time | string | - |
| timeoff_id | integer | - |
| type | string | - |
Response
200
| Name | Type | Description |
|---|---|---|
| items | Array of object | - |
items
| Name | Type | Description |
|---|---|---|
| created_at | string | - |
| end_time | string | - |
| organization_id | integer | - |
| start_time | string | - |
| timeoff_id | integer | - |
| type | string | - |
| updated_at | string | - |
| user_id | integer | - |
400
Invalid parameters
403
Forbidden
500
Internal Server Error
POST Create time off for the specified ghost
https://focus.toggl.com/api/organizations/{organization_id}/{workspace_id}/timeoff/ghosts/{ghost_id}
Creates time off for the specified ghost
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X POST https://focus.toggl.com/api/organizations/{organization_id}/{workspace_id}/timeoff/ghosts/{ghost_id} \
-H "Content-Type: application/json" \
-d '[\{"end_time":"string","start_time":"string","type":"string"\}]' \
-u <email>:<password>
bytes, err := json.Marshal('[\{"end_time":"string","start_time":"string","type":"string"\}]')
if err != nil {
print(err)
}
req, err := http.NewRequest(http.MethodPost,
"https://focus.toggl.com/api/organizations/{organization_id}/{workspace_id}/timeoff/ghosts/{ghost_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://focus.toggl.com/api/organizations/{organization_id}/{workspace_id}/timeoff/ghosts/{ghost_id}')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Post.new(uri.path)
req['Content-Type'] = "application/json"
req.body = [\{"end_time":"string","start_time":"string","type":"string"\}].to_json
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://focus.toggl.com/api/organizations/{organization_id}/{workspace_id}/timeoff/ghosts/{ghost_id}", {
method: "POST",
body: [\{"end_time":"string","start_time":"string","type":"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://focus.toggl.com/api/organizations/{organization_id}/{workspace_id}/timeoff/ghosts/{ghost_id}', json=[\{"end_time":"string","start_time":"string","type":"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://focus.toggl.com/api/organizations/{organization_id}/{workspace_id}/timeoff/ghosts/{ghost_id}".to_string())
.json(&serde_json::json!([\{"end_time":"string","start_time":"string","type":"string"\}]))
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Parameters
Path
| name | type | required | description |
|---|---|---|---|
| organization_id | integer | true | Organization ID |
| workspace_id | integer | true | Workspace ID |
| ghost_id | integer | true | Ghost ID |
Body
| Name | Type | Description |
|---|---|---|
| items | Array of object | - |
items
| Name | Type | Description |
|---|---|---|
| end_time | string | - |
| start_time | string | - |
| type | string | - |
Response
200
| Name | Type | Description |
|---|---|---|
| items | Array of object | - |
items
| Name | Type | Description |
|---|---|---|
| created_at | string | - |
| end_time | string | - |
| organization_id | integer | - |
| start_time | string | - |
| timeoff_id | integer | - |
| type | string | - |
| updated_at | string | - |
| user_id | integer | - |
400
Invalid parameters
403
Forbidden
500
Internal Server Error
DELETE Delete time off for the specified ghost
https://focus.toggl.com/api/organizations/{organization_id}/{workspace_id}/timeoff/ghosts/{ghost_id}
Deletes time off for the specified ghost
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X DELETE https://focus.toggl.com/api/organizations/{organization_id}/{workspace_id}/timeoff/ghosts/{ghost_id} \
-H "Content-Type: application/json" \
-d '[\{\}]' \
-u <email>:<password>
bytes, err := json.Marshal('[\{\}]')
if err != nil {
print(err)
}
req, err := http.NewRequest(http.MethodPut,
"https://focus.toggl.com/api/organizations/{organization_id}/{workspace_id}/timeoff/ghosts/{ghost_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://focus.toggl.com/api/organizations/{organization_id}/{workspace_id}/timeoff/ghosts/{ghost_id}')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Delete.new(uri.path)
req['Content-Type'] = "application/json"
req.body = [\{\}].to_json
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://focus.toggl.com/api/organizations/{organization_id}/{workspace_id}/timeoff/ghosts/{ghost_id}", {
method: "DELETE",
body: [\{\}],
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://focus.toggl.com/api/organizations/{organization_id}/{workspace_id}/timeoff/ghosts/{ghost_id}', json=[\{\}], 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://focus.toggl.com/api/organizations/{organization_id}/{workspace_id}/timeoff/ghosts/{ghost_id}".to_string())
.json(&serde_json::json!([\{\}]))
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Parameters
Path
| name | type | required | description |
|---|---|---|---|
| organization_id | integer | true | Organization ID |
| workspace_id | integer | true | Workspace ID |
| ghost_id | integer | true | Ghost ID |
Body
| Name | Type | Description |
|---|---|---|
| items | Array of integer | - |
Response
204
No Content
400
Invalid parameters
403
Forbidden
500
Internal Server Error