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')
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/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')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Post.new(uri.path)
req['Content-Type'] = "application/json"
req.body = \{"color":"string","completed_at":"string","due_date":"string","name":"string","project_ids":[\{\}],"team_ids":[\{\}]\}.to_json
request.basic_auth '<email>', '<password>'
res = http.request(req)
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
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')
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/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 |
Response
200
| Name | Type | Description |
|---|---|---|
| items | Array of object | - |
items
| 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
GET Get milestone
https://focus.toggl.com/api/workspaces/{workspace_id}/milestones/{milestone_id}
Get an existing milestone
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl https://focus.toggl.com/api/workspaces/{workspace_id}/milestones/{milestone_id} \
-H "Content-Type: application/json" \
-u <email>:<password>
req, err := http.NewRequest(http.MethodGet,
"https://focus.toggl.com/api/workspaces/{workspace_id}/milestones/{milestone_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/workspaces/{workspace_id}/milestones/{milestone_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/workspaces/{workspace_id}/milestones/{milestone_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/workspaces/{workspace_id}/milestones/{milestone_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/workspaces/{workspace_id}/milestones/{milestone_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 | workspace ID |
| milestone_id | integer | true | milestone ID |
Response
200
| 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
PUT Update milestone
https://focus.toggl.com/api/workspaces/{workspace_id}/milestones/{milestone_id}
Update an existing milestone
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X PUT https://focus.toggl.com/api/workspaces/{workspace_id}/milestones/{milestone_id} \
-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.MethodPut,
"https://focus.toggl.com/api/workspaces/{workspace_id}/milestones/{milestone_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/workspaces/{workspace_id}/milestones/{milestone_id}')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Put.new(uri.path)
req['Content-Type'] = "application/json"
req.body = \{"color":"string","completed_at":"string","due_date":"string","name":"string","project_ids":[\{\}],"team_ids":[\{\}]\}.to_json
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://focus.toggl.com/api/workspaces/{workspace_id}/milestones/{milestone_id}", {
method: "PUT",
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.put('https://focus.toggl.com/api/workspaces/{workspace_id}/milestones/{milestone_id}', 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::PUT, "https://focus.toggl.com/api/workspaces/{workspace_id}/milestones/{milestone_id}".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 |
| milestone_id | integer | true | milestone 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
204
No Content
400
Invalid request
500
Internal Server Error
DELETE Delete milestone
https://focus.toggl.com/api/workspaces/{workspace_id}/milestones/{milestone_id}
Delete an existing milestone
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X DELETE https://focus.toggl.com/api/workspaces/{workspace_id}/milestones/{milestone_id} \
-H "Content-Type: application/json" \
-u <email>:<password>
req, err := http.NewRequest(http.MethodPut,
"https://focus.toggl.com/api/workspaces/{workspace_id}/milestones/{milestone_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/workspaces/{workspace_id}/milestones/{milestone_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/workspaces/{workspace_id}/milestones/{milestone_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/workspaces/{workspace_id}/milestones/{milestone_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/workspaces/{workspace_id}/milestones/{milestone_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 | workspace ID |
| milestone_id | integer | true | milestone ID |
Response
204
No Content
400
Invalid request
500
Internal Server Error
PATCH Partial update milestone
https://focus.toggl.com/api/workspaces/{workspace_id}/milestones/{milestone_id}
Partial update an existing milestone
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X PATCH https://focus.toggl.com/api/workspaces/{workspace_id}/milestones/{milestone_id} \
-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.MethodGet,
"https://focus.toggl.com/api/workspaces/{workspace_id}/milestones/{milestone_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/workspaces/{workspace_id}/milestones/{milestone_id}')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Patch.new(uri.path)
req['Content-Type'] = "application/json"
req.body = \{"color":"string","completed_at":"string","due_date":"string","name":"string","project_ids":[\{\}],"team_ids":[\{\}]\}.to_json
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://focus.toggl.com/api/workspaces/{workspace_id}/milestones/{milestone_id}", {
method: "PATCH",
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.patch('https://focus.toggl.com/api/workspaces/{workspace_id}/milestones/{milestone_id}', 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::PATCH, "https://focus.toggl.com/api/workspaces/{workspace_id}/milestones/{milestone_id}".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 |
| milestone_id | integer | true | milestone ID |
Body
| Name | Type | Description |
|---|---|---|
| color | string | null |
| completed_at | string | null |
| due_date | string | nolint:lll |
| name | string | nolint:lll |
| project_ids | Array of integer | nolint:lll |
| team_ids | Array of integer | nolint:lll |
Response
204
No Content
400
Invalid request
500
Internal Server Error
PATCH Restore milestone
https://focus.toggl.com/api/workspaces/{workspace_id}/milestones/{milestone_id}/restore
Restore a deleted milestone
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X PATCH https://focus.toggl.com/api/workspaces/{workspace_id}/milestones/{milestone_id}/restore \
-H "Content-Type: application/json" \
-u <email>:<password>
req, err := http.NewRequest(http.MethodGet,
"https://focus.toggl.com/api/workspaces/{workspace_id}/milestones/{milestone_id}/restore")
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/{milestone_id}/restore')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Patch.new(uri.path)
req['Content-Type'] = "application/json"
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://focus.toggl.com/api/workspaces/{workspace_id}/milestones/{milestone_id}/restore", {
method: "PATCH",
headers: {
"Content-Type": "application/json",
"Authorization": `Basic ${base64.encode(<email>:<password>)}`
},
})
.then((resp) => resp.json())
.then((json) => {
console.log(json);
})
.catch(err => console.error(err));
import requests
from base64 import b64encode
data = requests.patch('https://focus.toggl.com/api/workspaces/{workspace_id}/milestones/{milestone_id}/restore', 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/workspaces/{workspace_id}/milestones/{milestone_id}/restore".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 |
| milestone_id | integer | true | milestone ID |
Response
204
No Content
400
Invalid request
500
Internal Server Error