Subscriptions
GET Retrieves existing subscriptions for the requested workspace ID.
https://api.track.toggl.com/webhooks/api/v1/subscriptions/{workspace_id}
Retrieves existing subscriptions for the requested workspace ID.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl https://api.track.toggl.com/webhooks/api/v1/subscriptions/{workspace_id} \
-H "Content-Type: application/json"
req, err := http.NewRequest(http.MethodGet,
"https://api.track.toggl.com/webhooks/api/v1/subscriptions/{workspace_id}")
if err != nil {
print(err)
}
req.Header.Set("Content-Type", "application/json; charset=utf-8")
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/webhooks/api/v1/subscriptions/{workspace_id}')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Get.new(uri.path)
req['Content-Type'] = "application/json"
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://api.track.toggl.com/webhooks/api/v1/subscriptions/{workspace_id}", {
method: "GET",
headers: {
"Content-Type": "application/json"
},
})
.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/webhooks/api/v1/subscriptions/{workspace_id}', headers={'content-type': 'application/json'})
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();
let json = client.request(Method::GET, "https://api.track.toggl.com/webhooks/api/v1/subscriptions/{workspace_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 |
Response
200
Name | Type | Description |
---|---|---|
items | Array of object | - |
items
Name | Type | Description |
---|---|---|
created_at | string | - |
deleted_at | string | - |
description | string | - |
enabled | boolean | - |
event_filters | Array of SubscriptionEventFilter | - |
has_pending_events | boolean | - |
secret | string | - |
subscription_id | integer | - |
updated_at | string | - |
url_callback | string | - |
user_id | integer | - |
validated_at | string | - |
workspace_id | integer | - |
403
User not found/accessible for workspace
500
Internal Server Error
POST Creates a subscription.
https://api.track.toggl.com/webhooks/api/v1/subscriptions/{workspace_id}
Creates a subscription for the requested workspace ID.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X POST https://api.track.toggl.com/webhooks/api/v1/subscriptions/{workspace_id} \
-H "Content-Type: application/json" \
-d '\{"created_at":"string","deleted_at":"string","description":"string","enabled":"boolean","event_filters":[\{\}],"has_pending_events":"boolean","secret":"string","subscription_id":"integer","updated_at":"string","url_callback":"string","user_id":"integer","validated_at":"string","workspace_id":"integer"\}'
bytes, err := json.Marshal('\{"created_at":"string","deleted_at":"string","description":"string","enabled":"boolean","event_filters":[\{\}],"has_pending_events":"boolean","secret":"string","subscription_id":"integer","updated_at":"string","url_callback":"string","user_id":"integer","validated_at":"string","workspace_id":"integer"\}')
if err != nil {
print(err)
}
req, err := http.NewRequest(http.MethodPost,
"https://api.track.toggl.com/webhooks/api/v1/subscriptions/{workspace_id}", bytes.NewBuffer(bytes))
if err != nil {
print(err)
}
req.Header.Set("Content-Type", "application/json; charset=utf-8")
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/webhooks/api/v1/subscriptions/{workspace_id}')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Post.new(uri.path)
req['Content-Type'] = "application/json"
req.body = \{"created_at":"string","deleted_at":"string","description":"string","enabled":"boolean","event_filters":[\{\}],"has_pending_events":"boolean","secret":"string","subscription_id":"integer","updated_at":"string","url_callback":"string","user_id":"integer","validated_at":"string","workspace_id":"integer"\}.to_json
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://api.track.toggl.com/webhooks/api/v1/subscriptions/{workspace_id}", {
method: "POST",
body: \{"created_at":"string","deleted_at":"string","description":"string","enabled":"boolean","event_filters":[\{\}],"has_pending_events":"boolean","secret":"string","subscription_id":"integer","updated_at":"string","url_callback":"string","user_id":"integer","validated_at":"string","workspace_id":"integer"\},
headers: {
"Content-Type": "application/json"
},
})
.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/webhooks/api/v1/subscriptions/{workspace_id}', json=\{"created_at":"string","deleted_at":"string","description":"string","enabled":"boolean","event_filters":[\{\}],"has_pending_events":"boolean","secret":"string","subscription_id":"integer","updated_at":"string","url_callback":"string","user_id":"integer","validated_at":"string","workspace_id":"integer"\}, headers={'content-type': 'application/json'})
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();
let json = client.request(Method::POST, "https://api.track.toggl.com/webhooks/api/v1/subscriptions/{workspace_id}".to_string())
.json(&serde_json::json!(\{"created_at":"string","deleted_at":"string","description":"string","enabled":"boolean","event_filters":[\{\}],"has_pending_events":"boolean","secret":"string","subscription_id":"integer","updated_at":"string","url_callback":"string","user_id":"integer","validated_at":"string","workspace_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 |
---|---|---|
created_at | string | - |
deleted_at | string | - |
description | string | - |
enabled | boolean | - |
event_filters | Array of SubscriptionEventFilter | - |
has_pending_events | boolean | - |
secret | string | - |
subscription_id | integer | - |
updated_at | string | - |
url_callback | string | - |
user_id | integer | - |
validated_at | string | - |
workspace_id | integer | - |
Response
200
Name | Type | Description |
---|---|---|
created_at | string | - |
deleted_at | string | - |
description | string | - |
enabled | boolean | - |
event_filters | Array of SubscriptionEventFilter | - |
has_pending_events | boolean | - |
secret | string | - |
subscription_id | integer | - |
updated_at | string | - |
url_callback | string | - |
user_id | integer | - |
validated_at | string | - |
workspace_id | integer | - |
400
Possible error messages:
- URL endpoint {url_callback} responded with status {HTTP status code} instead of 200
- URL endpoint {url_callback} request failed with error: {HTTP error}
- User {user_id} already reached the limit of {allowed limit} enabled subscriptions for workspace {workspace_id}
- Subscription description must not be empty
- Subscription description '{description}' is already in use for workspace {workspace_id}
- The list of event filters must not be empty
- The limit of {allowed limit} event filters for your subscription has been exceeded as you're trying to set {number of filters} filters
- The following event filter appears more than once for your subscription: {subscription_id}
- The entity field for each subscription event filter must be non-empty
- The value '{entity}' for the filter entity can only contain letters, numbers and '_' or be '*' to match all entities
- The action field for each subscription event filter must be non-empty
- The value '{action}' for the filter action can only contain letters, numbers and '_' or be '*' to match all actions
- Invalid value '{action}' for event filter action
403
User not found/accessible for workspace
500
Internal Server Error
PUT Update existing subscription.
https://api.track.toggl.com/webhooks/api/v1/subscriptions/{workspace_id}/{subscription_id}
Updates existing subscription given its ID and workspace ID.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X PUT https://api.track.toggl.com/webhooks/api/v1/subscriptions/{workspace_id}/{subscription_id} \
-H "Content-Type: application/json" \
-d '\{"created_at":"string","deleted_at":"string","description":"string","enabled":"boolean","event_filters":[\{\}],"has_pending_events":"boolean","secret":"string","subscription_id":"integer","updated_at":"string","url_callback":"string","user_id":"integer","validated_at":"string","workspace_id":"integer"\}'
bytes, err := json.Marshal('\{"created_at":"string","deleted_at":"string","description":"string","enabled":"boolean","event_filters":[\{\}],"has_pending_events":"boolean","secret":"string","subscription_id":"integer","updated_at":"string","url_callback":"string","user_id":"integer","validated_at":"string","workspace_id":"integer"\}')
if err != nil {
print(err)
}
req, err := http.NewRequest(http.MethodPut,
"https://api.track.toggl.com/webhooks/api/v1/subscriptions/{workspace_id}/{subscription_id}", bytes.NewBuffer(bytes))
if err != nil {
print(err)
}
req.Header.Set("Content-Type", "application/json; charset=utf-8")
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/webhooks/api/v1/subscriptions/{workspace_id}/{subscription_id}')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Put.new(uri.path)
req['Content-Type'] = "application/json"
req.body = \{"created_at":"string","deleted_at":"string","description":"string","enabled":"boolean","event_filters":[\{\}],"has_pending_events":"boolean","secret":"string","subscription_id":"integer","updated_at":"string","url_callback":"string","user_id":"integer","validated_at":"string","workspace_id":"integer"\}.to_json
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://api.track.toggl.com/webhooks/api/v1/subscriptions/{workspace_id}/{subscription_id}", {
method: "PUT",
body: \{"created_at":"string","deleted_at":"string","description":"string","enabled":"boolean","event_filters":[\{\}],"has_pending_events":"boolean","secret":"string","subscription_id":"integer","updated_at":"string","url_callback":"string","user_id":"integer","validated_at":"string","workspace_id":"integer"\},
headers: {
"Content-Type": "application/json"
},
})
.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/webhooks/api/v1/subscriptions/{workspace_id}/{subscription_id}', json=\{"created_at":"string","deleted_at":"string","description":"string","enabled":"boolean","event_filters":[\{\}],"has_pending_events":"boolean","secret":"string","subscription_id":"integer","updated_at":"string","url_callback":"string","user_id":"integer","validated_at":"string","workspace_id":"integer"\}, headers={'content-type': 'application/json'})
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();
let json = client.request(Method::PUT, "https://api.track.toggl.com/webhooks/api/v1/subscriptions/{workspace_id}/{subscription_id}".to_string())
.json(&serde_json::json!(\{"created_at":"string","deleted_at":"string","description":"string","enabled":"boolean","event_filters":[\{\}],"has_pending_events":"boolean","secret":"string","subscription_id":"integer","updated_at":"string","url_callback":"string","user_id":"integer","validated_at":"string","workspace_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 |
subscription_id | integer | true | Numeric ID of the subscription |
Body
Name | Type | Description |
---|---|---|
created_at | string | - |
deleted_at | string | - |
description | string | - |
enabled | boolean | - |
event_filters | Array of SubscriptionEventFilter | - |
has_pending_events | boolean | - |
secret | string | - |
subscription_id | integer | - |
updated_at | string | - |
url_callback | string | - |
user_id | integer | - |
validated_at | string | - |
workspace_id | integer | - |
Response
200
Name | Type | Description |
---|---|---|
created_at | string | - |
deleted_at | string | - |
description | string | - |
enabled | boolean | - |
event_filters | Array of SubscriptionEventFilter | - |
has_pending_events | boolean | - |
secret | string | - |
subscription_id | integer | - |
updated_at | string | - |
url_callback | string | - |
user_id | integer | - |
validated_at | string | - |
workspace_id | integer | - |
400
Possible error messages:
- URL endpoint {url_callback} responded with status {HTTP status code} instead of 2xx
- URL endpoint {url_callback} request failed with error: {HTTP error}
- User {user_id} already reached the limit of {allowed limit} enabled subscriptions for workspace {workspace_id}
- Subscription description must not be empty
- Subscription description '{description}' is already in use for workspace {workspace_id}
- The list of event filters must not be empty
- The limit of {allowed limit} event filters for your subscription has been exceeded as you're trying to set {number of filters} filters
- The following event filter appears more than once for your subscription: {event_filter}
- The entity field for each subscription event filter must be non-empty
- The value '{entity}' for the filter entity can only contain letters, numbers and '_' or be '*' to match all entities
- The action field for each subscription event filter must be non-empty
- The value '{action}' for the filter action can only contain letters, numbers and '_' or be '*' to match all actions
- Invalid value '{action}' for event filter action
403
User not found/accessible for workspace
404
subscription {subscription_id} for workspace {workspace_id} was not found
500
Internal Server Error
DELETE Remove existing subscription.
https://api.track.toggl.com/webhooks/api/v1/subscriptions/{workspace_id}/{subscription_id}
Remove existing subscription given its ID and workspace ID.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X DELETE https://api.track.toggl.com/webhooks/api/v1/subscriptions/{workspace_id}/{subscription_id} \
-H "Content-Type: application/json"
req, err := http.NewRequest(http.MethodPut,
"https://api.track.toggl.com/webhooks/api/v1/subscriptions/{workspace_id}/{subscription_id}")
if err != nil {
print(err)
}
req.Header.Set("Content-Type", "application/json; charset=utf-8")
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/webhooks/api/v1/subscriptions/{workspace_id}/{subscription_id}')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Delete.new(uri.path)
req['Content-Type'] = "application/json"
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://api.track.toggl.com/webhooks/api/v1/subscriptions/{workspace_id}/{subscription_id}", {
method: "DELETE",
headers: {
"Content-Type": "application/json"
},
})
.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/webhooks/api/v1/subscriptions/{workspace_id}/{subscription_id}', headers={'content-type': 'application/json'})
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();
let json = client.request(Method::DELETE, "https://api.track.toggl.com/webhooks/api/v1/subscriptions/{workspace_id}/{subscription_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 |
subscription_id | integer | true | Numeric ID of the subscription |
Response
200
Name | Type | Description |
---|---|---|
created_at | string | - |
deleted_at | string | - |
description | string | - |
enabled | boolean | - |
event_filters | Array of SubscriptionEventFilter | - |
has_pending_events | boolean | - |
secret | string | - |
subscription_id | integer | - |
updated_at | string | - |
url_callback | string | - |
user_id | integer | - |
validated_at | string | - |
workspace_id | integer | - |
403
User not found/accessible for workspace
404
subscription {subscription_id} for workspace {workspace_id} was not found
500
Internal Server Error
PATCH Updates an existing subscription enabled status given its ID and workspace ID.
https://api.track.toggl.com/webhooks/api/v1/subscriptions/{workspace_id}/{subscription_id}
Updates existing subscription enabled status.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X PATCH https://api.track.toggl.com/webhooks/api/v1/subscriptions/{workspace_id}/{subscription_id} \
-H "Content-Type: application/json" \
-d '\{"enabled":"boolean"\}'
bytes, err := json.Marshal('\{"enabled":"boolean"\}')
if err != nil {
print(err)
}
req, err := http.NewRequest(http.MethodGet,
"https://api.track.toggl.com/webhooks/api/v1/subscriptions/{workspace_id}/{subscription_id}", bytes.NewBuffer(bytes))
if err != nil {
print(err)
}
req.Header.Set("Content-Type", "application/json; charset=utf-8")
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/webhooks/api/v1/subscriptions/{workspace_id}/{subscription_id}')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Patch.new(uri.path)
req['Content-Type'] = "application/json"
req.body = \{"enabled":"boolean"\}.to_json
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://api.track.toggl.com/webhooks/api/v1/subscriptions/{workspace_id}/{subscription_id}", {
method: "PATCH",
body: \{"enabled":"boolean"\},
headers: {
"Content-Type": "application/json"
},
})
.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/webhooks/api/v1/subscriptions/{workspace_id}/{subscription_id}', json=\{"enabled":"boolean"\}, headers={'content-type': 'application/json'})
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();
let json = client.request(Method::PATCH, "https://api.track.toggl.com/webhooks/api/v1/subscriptions/{workspace_id}/{subscription_id}".to_string())
.json(&serde_json::json!(\{"enabled":"boolean"\}))
.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 |
subscription_id | integer | true | Numeric ID of the subscription |
Body
Name | Type | Description |
---|---|---|
enabled | boolean | Controls whether the subscription will be enabled or disabled |
Response
200
Name | Type | Description |
---|---|---|
created_at | string | - |
deleted_at | string | - |
description | string | - |
enabled | boolean | - |
event_filters | Array of SubscriptionEventFilter | - |
has_pending_events | boolean | - |
secret | string | - |
subscription_id | integer | - |
updated_at | string | - |
url_callback | string | - |
user_id | integer | - |
validated_at | string | - |
workspace_id | integer | - |
400
Possible error messages:
- URL endpoint {url_callback} responded with status {HTTP status code} instead of 200
- URL endpoint {url_callback} request failed with error: {HTTP error}
- User {user_id} already reached the limit of {allowed limit} enabled subscriptions for workspace {workspace_id}
403
User not found/accessible for workspace
404
subscription {subscription_id} for workspace {workspace_id} was not found
500
Internal Server Error