Milestones
GET List milestones
https://focus.toggl.com/api/workspaces/{workspace_id}/milestones
Returns a list of milestones based on the provided workspace ID and filter params.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl https://focus.toggl.com/api/workspaces/{workspace_id}/milestones \
-H "Content-Type: application/json" \
-u <email>:<password>
req, err := http.NewRequest(http.MethodGet,
"https://focus.toggl.com/api/workspaces/{workspace_id}/milestones")
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/workspaces/{workspace_id}/milestones')
req = Net::HTTP::Get.new(uri)
req['Content-Type'] = "application/json"
req.basic_auth '<email>', '<password>'
res = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http|
http.request(req)
end
puts JSON.parse(res.body)
fetch("https://focus.toggl.com/api/workspaces/{workspace_id}/milestones", {
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/workspaces/{workspace_id}/milestones', 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/workspaces/{workspace_id}/milestones".to_string())
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Parameters
Path
| name | type | required | description |
|---|---|---|---|
| workspace_id | integer | true | workspace ID |
Query
| name | type | required | description |
|---|---|---|---|
| page | integer | false | page number |
| per_page | integer | false | results per page |
| order_by | []string | false | order by |
| due_date_from | string | false | filter by due date from |
| due_date_to | string | false | filter by due date to |
| project_id | []integer | false | filter by project id |
| team_id | []integer | false | filter by team id |
Response
200
| Name | Type | Description |
|---|---|---|
| data | Array of object | - |
| page | integer | - |
| per_page | integer | - |
data
| Name | Type | Description |
|---|---|---|
| color | string | - |
| completed_at | string | - |
| created_at | string | - |
| deleted_at | string | - |
| due_date | string | - |
| id | integer | - |
| name | string | - |
| project_ids | Array of integer | - |
| team_ids | Array of integer | - |
| updated_at | string | - |
| workspace_id | integer | - |
400
Invalid request
500
Internal Server Error
POST Create milestone
https://focus.toggl.com/api/workspaces/{workspace_id}/milestones
Creates a new milestone.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X POST https://focus.toggl.com/api/workspaces/{workspace_id}/milestones \
-H "Content-Type: application/json" \
-d '\{"color":"string","completed_at":"string","due_date":"string","name":"string","project_ids":[\{\}],"team_ids":[\{\}]\}' \
-u <email>:<password>
bytes, err := json.Marshal('\{"color":"string","completed_at":"string","due_date":"string","name":"string","project_ids":[\{\}],"team_ids":[\{\}]\}')
if err != nil {
print(err)
}
req, err := http.NewRequest(http.MethodPost,
"https://focus.toggl.com/api/workspaces/{workspace_id}/milestones", 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/workspaces/{workspace_id}/milestones')
req = Net::HTTP::Post.new(uri)
req['Content-Type'] = "application/json"
req.body = \{"color":"string","completed_at":"string","due_date":"string","name":"string","project_ids":[\{\}],"team_ids":[\{\}]\}.to_json
req.basic_auth '<email>', '<password>'
res = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http|
http.request(req)
end
puts JSON.parse(res.body)
fetch("https://focus.toggl.com/api/workspaces/{workspace_id}/milestones", {
method: "POST",
body: \{"color":"string","completed_at":"string","due_date":"string","name":"string","project_ids":[\{\}],"team_ids":[\{\}]\},
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/workspaces/{workspace_id}/milestones', json=\{"color":"string","completed_at":"string","due_date":"string","name":"string","project_ids":[\{\}],"team_ids":[\{\}]\}, 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/workspaces/{workspace_id}/milestones".to_string())
.json(&serde_json::json!(\{"color":"string","completed_at":"string","due_date":"string","name":"string","project_ids":[\{\}],"team_ids":[\{\}]\}))
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Parameters
Path
| name | type | required | description |
|---|---|---|---|
| workspace_id | integer | true | workspace ID |
Body
| Name | Type | Description |
|---|---|---|
| color | string | - |
| completed_at | string | nolint:lll |
| due_date | string | nolint:lll |
| name | string | - |
| project_ids | Array of integer | - |
| team_ids | Array of integer | - |
Response
201
Successful operation
400
Invalid request
402
Milestone limit reached; upgrade required
500
Internal Server Error
GET List milestones
https://focus.toggl.com/api/workspaces/{workspace_id}/milestones/stream
Returns a list of milestones based on the provided workspace ID and filter params.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl https://focus.toggl.com/api/workspaces/{workspace_id}/milestones/stream \
-H "Content-Type: application/json" \
-u <email>:<password>
req, err := http.NewRequest(http.MethodGet,
"https://focus.toggl.com/api/workspaces/{workspace_id}/milestones/stream")
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/workspaces/{workspace_id}/milestones/stream')
req = Net::HTTP::Get.new(uri)
req['Content-Type'] = "application/json"
req.basic_auth '<email>', '<password>'
res = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http|
http.request(req)
end
puts JSON.parse(res.body)
fetch("https://focus.toggl.com/api/workspaces/{workspace_id}/milestones/stream", {
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/workspaces/{workspace_id}/milestones/stream', 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/workspaces/{workspace_id}/milestones/stream".to_string())
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Parameters
Path
| name | type | required | description |
|---|---|---|---|
| workspace_id | integer | true | workspace ID |
Query
| name | type | required | description |
|---|---|---|---|
| order_by | []string | false | order by |
| due_date_from | string | false | filter by due date from |
| due_date_to | string | false | filter by due date to |
| project_id | []integer | false | filter by project id |
| team_id | []integer | false | filter by team id |