summaryrefslogtreecommitdiff
path: root/src/requests/device.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/requests/device.rs')
-rw-r--r--src/requests/device.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/requests/device.rs b/src/requests/device.rs
index 7583406..2606579 100644
--- a/src/requests/device.rs
+++ b/src/requests/device.rs
@@ -7,7 +7,7 @@ pub async fn put(
7 broadcast_addr: String, 7 broadcast_addr: String,
8 ip: String, 8 ip: String,
9) -> Result<(), Error> { 9) -> Result<(), Error> {
10 let url = format_url(config, "device", &Protocols::Http); 10 let url = format_url(config, "device", &Protocols::Http, None);
11 println!("{url}"); 11 println!("{url}");
12 let res = reqwest::Client::new() 12 let res = reqwest::Client::new()
13 .put(url) 13 .put(url)
@@ -25,9 +25,8 @@ pub async fn put(
25 25
26pub async fn get(config: &Config, id: String) -> Result<(), Error> { 26pub async fn get(config: &Config, id: String) -> Result<(), Error> {
27 let res = reqwest::Client::new() 27 let res = reqwest::Client::new()
28 .get(format_url(config, "device", &Protocols::Http)) 28 .get(format_url(config, "device", &Protocols::Http, Some(&id)))
29 .headers(default_headers(config)?) 29 .headers(default_headers(config)?)
30 .body(format!(r#"{{"id": "{id}"}}"#))
31 .send() 30 .send()
32 .await?; 31 .await?;
33 32
@@ -44,7 +43,7 @@ pub async fn post(
44 ip: String, 43 ip: String,
45) -> Result<(), Error> { 44) -> Result<(), Error> {
46 let res = reqwest::Client::new() 45 let res = reqwest::Client::new()
47 .post(format_url(config, "device", &Protocols::Http)) 46 .post(format_url(config, "device", &Protocols::Http, None))
48 .headers(default_headers(config)?) 47 .headers(default_headers(config)?)
49 .body(format!( 48 .body(format!(
50 r#"{{"id": "{id}", "mac": "{mac}", "broadcast_addr": "{broadcast_addr}", "ip": "{ip}"}}"#, 49 r#"{{"id": "{id}", "mac": "{mac}", "broadcast_addr": "{broadcast_addr}", "ip": "{ip}"}}"#,