Chats
GET List chats
https://focus.toggl.com/api/workspaces/{workspace_id}/chats
Returns a list of chats based on the provided workspace ID and filter params.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl https://focus.toggl.com/api/workspaces/{workspace_id}/chats \
-H "Content-Type: application/json" \
-u <email>:<password>
req, err := http.NewRequest(http.MethodGet,
"https://focus.toggl.com/api/workspaces/{workspace_id}/chats")
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}/chats')
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}/chats", {
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}/chats', 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}/chats".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 |
| name | string | false | filter by chat name |
| order_by | []string | false | order by |
Response
200
| Name | Type | Description |
|---|---|---|
| data | Array of object | - |
| page | integer | - |
| per_page | integer | - |
data
| Name | Type | Description |
|---|---|---|
| created_at | string | - |
| deleted_at | string | - |
| id | integer | - |
| message_count | integer | - |
| name | string | - |
| toggl_user_id | integer | - |
| updated_at | string | - |
| workspace_id | integer | - |
400
Invalid request
500
Internal Server Error
POST Create a new chat
https://focus.toggl.com/api/workspaces/{workspace_id}/chats
Creates a new chat with the provided name and workspace ID.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X POST https://focus.toggl.com/api/workspaces/{workspace_id}/chats \
-H "Content-Type: application/json" \
-d '\{"name":"string"\}' \
-u <email>:<password>
bytes, err := json.Marshal('\{"name":"string"\}')
if err != nil {
print(err)
}
req, err := http.NewRequest(http.MethodPost,
"https://focus.toggl.com/api/workspaces/{workspace_id}/chats", 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}/chats')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Post.new(uri.path)
req['Content-Type'] = "application/json"
req.body = \{"name":"string"\}.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}/chats", {
method: "POST",
body: \{"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/workspaces/{workspace_id}/chats', json=\{"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/workspaces/{workspace_id}/chats".to_string())
.json(&serde_json::json!(\{"name":"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 |
Body
| Name | Type | Description |
|---|---|---|
| name | string | - |
Response
201
chat created successfully
400
Invalid request
500
Internal Server Error
GET get chat by id
https://focus.toggl.com/api/workspaces/{workspace_id}/chats/{chat_id}
Returns chat by id
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl https://focus.toggl.com/api/workspaces/{workspace_id}/chats/{chat_id} \
-H "Content-Type: application/json" \
-u <email>:<password>
req, err := http.NewRequest(http.MethodGet,
"https://focus.toggl.com/api/workspaces/{workspace_id}/chats/{chat_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}/chats/{chat_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}/chats/{chat_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}/chats/{chat_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}/chats/{chat_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 |
| chat_id | integer | true | chat ID |
Response
200
| Name | Type | Description |
|---|---|---|
| created_at | string | - |
| deleted_at | string | - |
| id | integer | - |
| message_count | integer | - |
| name | string | - |
| toggl_user_id | integer | - |
| updated_at | string | - |
| workspace_id | integer | - |
400
Invalid request
404
chat does not exist
500
Internal Server Error
PUT Update chat
https://focus.toggl.com/api/workspaces/{workspace_id}/chats/{chat_id}
Update an existing chat
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X PUT https://focus.toggl.com/api/workspaces/{workspace_id}/chats/{chat_id} \
-H "Content-Type: application/json" \
-d '\{"name":"string"\}'
bytes, err := json.Marshal('\{"name":"string"\}')
if err != nil {
print(err)
}
req, err := http.NewRequest(http.MethodPut,
"https://focus.toggl.com/api/workspaces/{workspace_id}/chats/{chat_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://focus.toggl.com/api/workspaces/{workspace_id}/chats/{chat_id}')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Put.new(uri.path)
req['Content-Type'] = "application/json"
req.body = \{"name":"string"\}.to_json
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://focus.toggl.com/api/workspaces/{workspace_id}/chats/{chat_id}", {
method: "PUT",
body: \{"name":"string"\},
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://focus.toggl.com/api/workspaces/{workspace_id}/chats/{chat_id}', json=\{"name":"string"\}, 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://focus.toggl.com/api/workspaces/{workspace_id}/chats/{chat_id}".to_string())
.json(&serde_json::json!(\{"name":"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 |
| chat_id | integer | true | chat ID |
Body
| Name | Type | Description |
|---|---|---|
| name | string | - |
Response
204
No Content
400
Invalid request
404
chat does not exist
500
Internal Server Error
DELETE Delete a chat by ID
https://focus.toggl.com/api/workspaces/{workspace_id}/chats/{chat_id}
Deletes a chat by the provided ID.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X DELETE https://focus.toggl.com/api/workspaces/{workspace_id}/chats/{chat_id} \
-H "Content-Type: application/json" \
-u <email>:<password>
req, err := http.NewRequest(http.MethodPut,
"https://focus.toggl.com/api/workspaces/{workspace_id}/chats/{chat_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}/chats/{chat_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}/chats/{chat_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}/chats/{chat_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}/chats/{chat_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 |
| chat_id | integer | true | chat ID |
Response
204
No Content
400
Invalid request
404
chat does not exist
500
Internal Server Error
GET List chat messages
https://focus.toggl.com/api/workspaces/{workspace_id}/chats/{chat_id}/messages
Returns a list of chat messages based on the provided workspace ID, chat ID and filter params.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl https://focus.toggl.com/api/workspaces/{workspace_id}/chats/{chat_id}/messages \
-H "Content-Type: application/json" \
-u <email>:<password>
req, err := http.NewRequest(http.MethodGet,
"https://focus.toggl.com/api/workspaces/{workspace_id}/chats/{chat_id}/messages")
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}/chats/{chat_id}/messages')
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}/chats/{chat_id}/messages", {
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}/chats/{chat_id}/messages', 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}/chats/{chat_id}/messages".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 |
| chat_id | integer | true | chat ID |
Query
| name | type | required | description |
|---|---|---|---|
| page | integer | false | page number |
| per_page | integer | false | results per page |
| order_by | []string | false | order by |
Response
200
| Name | Type | Description |
|---|---|---|
| data | Array of object | - |
| page | integer | - |
| per_page | integer | - |
data
| Name | Type | Description |
|---|---|---|
| chat_id | integer | - |
| content | object | - |
| created_at | string | - |
| feedback_message | string | - |
| feedback_type | object | - |
| id | integer | - |
| role | object | - |
| updated_at | string | - |
| workspace_id | integer | - |
content
400
Invalid request
500
Internal Server Error
GET List chat messages (stream)
https://focus.toggl.com/api/workspaces/{workspace_id}/chats/{chat_id}/messages/stream
Returns a list of chat messages based on the provided workspace ID, chat ID and filter params.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl https://focus.toggl.com/api/workspaces/{workspace_id}/chats/{chat_id}/messages/stream \
-H "Content-Type: application/json" \
-u <email>:<password>
req, err := http.NewRequest(http.MethodGet,
"https://focus.toggl.com/api/workspaces/{workspace_id}/chats/{chat_id}/messages/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}/chats/{chat_id}/messages/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}/chats/{chat_id}/messages/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}/chats/{chat_id}/messages/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}/chats/{chat_id}/messages/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 |
| chat_id | integer | true | chat ID |
Query
| name | type | required | description |
|---|---|---|---|
| order_by | []string | false | order by |
Response
200
| Name | Type | Description |
|---|---|---|
| items | Array of object | - |
items
| Name | Type | Description |
|---|---|---|
| chat_id | integer | - |
| content | object | - |
| created_at | string | - |
| feedback_message | string | - |
| feedback_type | object | - |
| id | integer | - |
| role | object | - |
| updated_at | string | - |
| workspace_id | integer | - |
content
400
Invalid request
500
Internal Server Error
PATCH Partial update chat message
https://focus.toggl.com/api/workspaces/{workspace_id}/chats/{chat_id}/messages/{chat_message_id}
Partial update chat message
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X PATCH https://focus.toggl.com/api/workspaces/{workspace_id}/chats/{chat_id}/messages/{chat_message_id} \
-H "Content-Type: application/json" \
-d '\{"content":\{\},"feedback_message":"string","feedback_type":"string"\}' \
-u <email>:<password>
bytes, err := json.Marshal('\{"content":\{\},"feedback_message":"string","feedback_type":"string"\}')
if err != nil {
print(err)
}
req, err := http.NewRequest(http.MethodGet,
"https://focus.toggl.com/api/workspaces/{workspace_id}/chats/{chat_id}/messages/{chat_message_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}/chats/{chat_id}/messages/{chat_message_id}')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Patch.new(uri.path)
req['Content-Type'] = "application/json"
req.body = \{"content":\{\},"feedback_message":"string","feedback_type":"string"\}.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}/chats/{chat_id}/messages/{chat_message_id}", {
method: "PATCH",
body: \{"content":\{\},"feedback_message":"string","feedback_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.patch('https://focus.toggl.com/api/workspaces/{workspace_id}/chats/{chat_id}/messages/{chat_message_id}', json=\{"content":\{\},"feedback_message":"string","feedback_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::PATCH, "https://focus.toggl.com/api/workspaces/{workspace_id}/chats/{chat_id}/messages/{chat_message_id}".to_string())
.json(&serde_json::json!(\{"content":\{\},"feedback_message":"string","feedback_type":"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 |
| chat_id | integer | true | chat ID |
| chat_message_id | integer | true | message ID |
Body
| Name | Type | Description |
|---|---|---|
| content | object | - |
| feedback_message | string | null |
| feedback_type | string | null |
content
Response
204
No Content
400
Invalid request
500
Internal Server Error
PATCH Restore a chat by ID
https://focus.toggl.com/api/workspaces/{workspace_id}/chats/{chat_id}/restore
Restores a chat by the provided ID.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X PATCH https://focus.toggl.com/api/workspaces/{workspace_id}/chats/{chat_id}/restore \
-H "Content-Type: application/json" \
-u <email>:<password>
req, err := http.NewRequest(http.MethodGet,
"https://focus.toggl.com/api/workspaces/{workspace_id}/chats/{chat_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}/chats/{chat_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}/chats/{chat_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}/chats/{chat_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}/chats/{chat_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 |
| chat_id | integer | true | chat ID |
Response
204
No Content
400
Invalid request
404
chat does not exist
500
Internal Server Error