Ghosts
GET Get all ghosts
https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/ghosts
List all ghosts, paginated, sorted (by name), and searchable (by name).
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/ghosts \
-H "Content-Type: application/json" \
-u <email>:<password>
req, err := http.NewRequest(http.MethodGet,
"https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/ghosts")
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}/workspaces/{workspace_id}/ghosts')
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}/workspaces/{workspace_id}/ghosts", {
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}/workspaces/{workspace_id}/ghosts', 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}/workspaces/{workspace_id}/ghosts".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 |
|---|---|---|---|
| page | integer | false | page number |
| rows | integer | false | Number of items per page (default: 50, max: 100). |
| order_by | string | false | Field and direction to sort by, formatted as 'field,direction'. Fields: 'name' Defaults to 'name,asc' if not given. |
| search | string | false | Ghost name to search for. Is a contains-anywhere search |
| project_ids | []integer | false | Filter resp by given project ids that ghosts are assigned to |
| task_ids | []integer | false | Filter resp by given task ids that ghosts are assigned to |
| team_ids | []integer | false | Filter resp by given team ids that ghosts are assigned to |
| ghost_ids | []integer | false | Filter resp by given ghost ids |
| include_embodied | boolean | false | Include ghosts that have been embodied (default: false) |
Response
200
| Name | Type | Description |
|---|---|---|
| data | Array of object | - |
| page | integer | - |
| rows | integer | - |
| total | integer | - |
data
| Name | Type | Description |
|---|---|---|
| assigned | object | - |
| created_at | string | - |
| deleted_at | string | - |
| description | string | - |
| embodied_at | string | - |
| id | integer | - |
| name | string | - |
| updated_at | string | - |
| user_id | integer | - |
assigned
| Name | Type | Description |
|---|---|---|
| projects | Array of object | - |
| tasks | Array of object | - |
| team_ids | Array of integer | - |
projects
| Name | Type | Description |
|---|---|---|
| color | string | - |
| id | integer | - |
| name | string | - |
| private | boolean | - |
tasks
| Name | Type | Description |
|---|---|---|
| color | string | - |
| id | integer | - |
| name | string | - |
400
Invalid request
500
Internal Server Error
POST Create ghost
https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/ghosts
Create a new ghost.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X POST https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/ghosts \
-H "Content-Type: application/json" \
-d '\{"assign_projects":[\{\}],"assign_tasks":[\{\}],"assign_teams":[\{\}],"description":"string","name":"string"\}' \
-u <email>:<password>
bytes, err := json.Marshal('\{"assign_projects":[\{\}],"assign_tasks":[\{\}],"assign_teams":[\{\}],"description":"string","name":"string"\}')
if err != nil {
print(err)
}
req, err := http.NewRequest(http.MethodPost,
"https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/ghosts", 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}/workspaces/{workspace_id}/ghosts')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Post.new(uri.path)
req['Content-Type'] = "application/json"
req.body = \{"assign_projects":[\{\}],"assign_tasks":[\{\}],"assign_teams":[\{\}],"description":"string","name":"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}/workspaces/{workspace_id}/ghosts", {
method: "POST",
body: \{"assign_projects":[\{\}],"assign_tasks":[\{\}],"assign_teams":[\{\}],"description":"string","name":"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}/workspaces/{workspace_id}/ghosts', json=\{"assign_projects":[\{\}],"assign_tasks":[\{\}],"assign_teams":[\{\}],"description":"string","name":"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}/workspaces/{workspace_id}/ghosts".to_string())
.json(&serde_json::json!(\{"assign_projects":[\{\}],"assign_tasks":[\{\}],"assign_teams":[\{\}],"description":"string","name":"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 |
Body
| Name | Type | Description |
|---|---|---|
| assign_projects | Array of integer | - |
| assign_tasks | Array of integer | - |
| assign_teams | Array of integer | - |
| description | string | - |
| name | string | - |
Response
201
ghost created successfully
400
Invalid request
403
Forbidden
500
Internal Server Error
POST Bulk create ghosts
https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/ghosts/bulk_create
Create multiple new ghosts.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X POST https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/ghosts/bulk_create \
-H "Content-Type: application/json" \
-d '[\{"assign_projects":[\{\}],"assign_tasks":[\{\}],"assign_teams":[\{\}],"description":"string","name":"string"\}]' \
-u <email>:<password>
bytes, err := json.Marshal('[\{"assign_projects":[\{\}],"assign_tasks":[\{\}],"assign_teams":[\{\}],"description":"string","name":"string"\}]')
if err != nil {
print(err)
}
req, err := http.NewRequest(http.MethodPost,
"https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/ghosts/bulk_create", 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}/workspaces/{workspace_id}/ghosts/bulk_create')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Post.new(uri.path)
req['Content-Type'] = "application/json"
req.body = [\{"assign_projects":[\{\}],"assign_tasks":[\{\}],"assign_teams":[\{\}],"description":"string","name":"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}/workspaces/{workspace_id}/ghosts/bulk_create", {
method: "POST",
body: [\{"assign_projects":[\{\}],"assign_tasks":[\{\}],"assign_teams":[\{\}],"description":"string","name":"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}/workspaces/{workspace_id}/ghosts/bulk_create', json=[\{"assign_projects":[\{\}],"assign_tasks":[\{\}],"assign_teams":[\{\}],"description":"string","name":"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}/workspaces/{workspace_id}/ghosts/bulk_create".to_string())
.json(&serde_json::json!([\{"assign_projects":[\{\}],"assign_tasks":[\{\}],"assign_teams":[\{\}],"description":"string","name":"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 |
Body
| Name | Type | Description |
|---|---|---|
| items | Array of object | - |
items
| Name | Type | Description |
|---|---|---|
| assign_projects | Array of integer | - |
| assign_tasks | Array of integer | - |
| assign_teams | Array of integer | - |
| description | string | - |
| name | string | - |
Response
201
ghosts created successfully
400
Invalid request
403
Forbidden
500
Internal Server Error
PATCH Bulk update ghosts
https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/ghosts/bulk_update
Update multiple ghosts.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X PATCH https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/ghosts/bulk_update \
-H "Content-Type: application/json" \
-d '[\{"assign_action":"string","assign_projects":[\{\}],"assign_tasks":[\{\}],"assign_teams":[\{\}],"description":"string","id":"integer","name":"string"\}]' \
-u <email>:<password>
bytes, err := json.Marshal('[\{"assign_action":"string","assign_projects":[\{\}],"assign_tasks":[\{\}],"assign_teams":[\{\}],"description":"string","id":"integer","name":"string"\}]')
if err != nil {
print(err)
}
req, err := http.NewRequest(http.MethodGet,
"https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/ghosts/bulk_update", 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}/workspaces/{workspace_id}/ghosts/bulk_update')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Patch.new(uri.path)
req['Content-Type'] = "application/json"
req.body = [\{"assign_action":"string","assign_projects":[\{\}],"assign_tasks":[\{\}],"assign_teams":[\{\}],"description":"string","id":"integer","name":"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}/workspaces/{workspace_id}/ghosts/bulk_update", {
method: "PATCH",
body: [\{"assign_action":"string","assign_projects":[\{\}],"assign_tasks":[\{\}],"assign_teams":[\{\}],"description":"string","id":"integer","name":"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.patch('https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/ghosts/bulk_update', json=[\{"assign_action":"string","assign_projects":[\{\}],"assign_tasks":[\{\}],"assign_teams":[\{\}],"description":"string","id":"integer","name":"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::PATCH, "https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/ghosts/bulk_update".to_string())
.json(&serde_json::json!([\{"assign_action":"string","assign_projects":[\{\}],"assign_tasks":[\{\}],"assign_teams":[\{\}],"description":"string","id":"integer","name":"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 |
Body
| Name | Type | Description |
|---|---|---|
| items | Array of object | - |
items
| Name | Type | Description |
|---|---|---|
| assign_action | string | - |
| assign_projects | Array of integer | - |
| assign_tasks | Array of integer | - |
| assign_teams | Array of integer | - |
| description | string | - |
| id | integer | - |
| name | string | - |
Response
200
ghosts updated successfully
| Name | Type | Description |
|---|---|---|
| items | Array of object | - |
items
| Name | Type | Description |
|---|---|---|
| assigned | object | - |
| created_at | string | - |
| deleted_at | string | - |
| description | string | - |
| embodied_at | string | - |
| id | integer | - |
| name | string | - |
| updated_at | string | - |
| user_id | integer | - |
assigned
| Name | Type | Description |
|---|---|---|
| projects | Array of object | - |
| tasks | Array of object | - |
| team_ids | Array of integer | - |
projects
| Name | Type | Description |
|---|---|---|
| color | string | - |
| id | integer | - |
| name | string | - |
| private | boolean | - |
tasks
| Name | Type | Description |
|---|---|---|
| color | string | - |
| id | integer | - |
| name | string | - |
400
Invalid request
403
Forbidden
500
Internal Server Error
GET Get a single ghost
https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/ghosts/{ghost_id}
Retrieve a single ghost by the ghost id.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/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}/workspaces/{workspace_id}/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}/workspaces/{workspace_id}/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}/workspaces/{workspace_id}/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}/workspaces/{workspace_id}/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}/workspaces/{workspace_id}/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 | ghost ID |
Response
200
| Name | Type | Description |
|---|---|---|
| assigned | object | - |
| created_at | string | - |
| deleted_at | string | - |
| description | string | - |
| embodied_at | string | - |
| id | integer | - |
| name | string | - |
| updated_at | string | - |
| user_id | integer | - |
assigned
| Name | Type | Description |
|---|---|---|
| projects | Array of object | - |
| tasks | Array of object | - |
| team_ids | Array of integer | - |
projects
| Name | Type | Description |
|---|---|---|
| color | string | - |
| id | integer | - |
| name | string | - |
| private | boolean | - |
tasks
| Name | Type | Description |
|---|---|---|
| color | string | - |
| id | integer | - |
| name | string | - |
400
Invalid request
403
Forbidden
404
Not found
500
Internal Server Error
DELETE Delete ghost
https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/ghosts/{ghost_id}
Delete an existing new ghost.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X DELETE https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/ghosts/{ghost_id} \
-H "Content-Type: application/json" \
-u <email>:<password>
req, err := http.NewRequest(http.MethodPut,
"https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/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}/workspaces/{workspace_id}/ghosts/{ghost_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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/ghosts/{ghost_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://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/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::DELETE, "https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/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 | ghost ID |
Response
204
No Content
400
Invalid request
403
Forbidden
500
Internal Server Error
PATCH Update ghost
https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/ghosts/{ghost_id}
Update an existing new ghost. All fields are optional, but at least one must be provided.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X PATCH https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/ghosts/{ghost_id} \
-H "Content-Type: application/json" \
-d '\{"assign_action":"string","assign_projects":[\{\}],"assign_tasks":[\{\}],"assign_teams":[\{\}],"description":"string","id":"integer","name":"string"\}' \
-u <email>:<password>
bytes, err := json.Marshal('\{"assign_action":"string","assign_projects":[\{\}],"assign_tasks":[\{\}],"assign_teams":[\{\}],"description":"string","id":"integer","name":"string"\}')
if err != nil {
print(err)
}
req, err := http.NewRequest(http.MethodGet,
"https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/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}/workspaces/{workspace_id}/ghosts/{ghost_id}')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Patch.new(uri.path)
req['Content-Type'] = "application/json"
req.body = \{"assign_action":"string","assign_projects":[\{\}],"assign_tasks":[\{\}],"assign_teams":[\{\}],"description":"string","id":"integer","name":"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}/workspaces/{workspace_id}/ghosts/{ghost_id}", {
method: "PATCH",
body: \{"assign_action":"string","assign_projects":[\{\}],"assign_tasks":[\{\}],"assign_teams":[\{\}],"description":"string","id":"integer","name":"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.patch('https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/ghosts/{ghost_id}', json=\{"assign_action":"string","assign_projects":[\{\}],"assign_tasks":[\{\}],"assign_teams":[\{\}],"description":"string","id":"integer","name":"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::PATCH, "https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/ghosts/{ghost_id}".to_string())
.json(&serde_json::json!(\{"assign_action":"string","assign_projects":[\{\}],"assign_tasks":[\{\}],"assign_teams":[\{\}],"description":"string","id":"integer","name":"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 |
|---|---|---|
| assign_action | string | - |
| assign_projects | Array of integer | - |
| assign_tasks | Array of integer | - |
| assign_teams | Array of integer | - |
| description | string | - |
| id | integer | - |
| name | string | - |
Response
200
ghost updated successfully
| Name | Type | Description |
|---|---|---|
| assigned | object | - |
| created_at | string | - |
| deleted_at | string | - |
| description | string | - |
| embodied_at | string | - |
| id | integer | - |
| name | string | - |
| updated_at | string | - |
| user_id | integer | - |
assigned
| Name | Type | Description |
|---|---|---|
| projects | Array of object | - |
| tasks | Array of object | - |
| team_ids | Array of integer | - |
projects
| Name | Type | Description |
|---|---|---|
| color | string | - |
| id | integer | - |
| name | string | - |
| private | boolean | - |
tasks
| Name | Type | Description |
|---|---|---|
| color | string | - |
| id | integer | - |
| name | string | - |
400
Invalid request
403
Forbidden
404
Ghost not found
500
Internal Server Error
PATCH Embody ghost
https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/ghosts/{ghost_id}/embody
Embody an existing with the given user id.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X PATCH https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/ghosts/{ghost_id}/embody \
-H "Content-Type: application/json" \
-d '\{"recipient_org_user_id":"integer","recipient_user_account_id":"integer","role_id":"integer"\}' \
-u <email>:<password>
bytes, err := json.Marshal('\{"recipient_org_user_id":"integer","recipient_user_account_id":"integer","role_id":"integer"\}')
if err != nil {
print(err)
}
req, err := http.NewRequest(http.MethodGet,
"https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/ghosts/{ghost_id}/embody", 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}/workspaces/{workspace_id}/ghosts/{ghost_id}/embody')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Patch.new(uri.path)
req['Content-Type'] = "application/json"
req.body = \{"recipient_org_user_id":"integer","recipient_user_account_id":"integer","role_id":"integer"\}.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}/workspaces/{workspace_id}/ghosts/{ghost_id}/embody", {
method: "PATCH",
body: \{"recipient_org_user_id":"integer","recipient_user_account_id":"integer","role_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.patch('https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/ghosts/{ghost_id}/embody', json=\{"recipient_org_user_id":"integer","recipient_user_account_id":"integer","role_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::PATCH, "https://focus.toggl.com/api/organizations/{organization_id}/workspaces/{workspace_id}/ghosts/{ghost_id}/embody".to_string())
.json(&serde_json::json!(\{"recipient_org_user_id":"integer","recipient_user_account_id":"integer","role_id":"integer"\}))
.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 |
|---|---|---|
| recipient_org_user_id | integer | should come directly from accounts invite response recipient_org_user_id field. |
| recipient_user_account_id | integer | should come directly from accounts invite response recipient_user_account_id field. |
| role_id | integer | - |
Response
200
ghost embodied successfully
| Name | Type | Description |
|---|---|---|
| assigned | object | - |
| created_at | string | - |
| deleted_at | string | - |
| description | string | - |
| embodied_at | string | - |
| id | integer | - |
| name | string | - |
| updated_at | string | - |
| user_id | integer | - |
assigned
| Name | Type | Description |
|---|---|---|
| projects | Array of object | - |
| tasks | Array of object | - |
| team_ids | Array of integer | - |
projects
| Name | Type | Description |
|---|---|---|
| color | string | - |
| id | integer | - |
| name | string | - |
| private | boolean | - |
tasks
| Name | Type | Description |
|---|---|---|
| color | string | - |
| id | integer | - |
| name | string | - |
400
Invalid request
403
Forbidden
404
Ghost not found
409
Ghost already embodied
500
Internal Server Error