22 lines
694 B
Rust
22 lines
694 B
Rust
use std::ops::Add;
|
|
use reqwest::{Error, Response};
|
|
// use serde::{Deserialize, Serialize};
|
|
|
|
|
|
const API_ROOT:&str ="https://vrmapi.victronenergy.com/v2";
|
|
const USER_ID:&str = "55450";
|
|
const TOKEN:&str = "88b36e7226ff7fa7bf231d0f9f98e916f661923c84e494cd27b6bc795ec0074b";
|
|
|
|
pub async fn all_installations_request() -> Result<Response, Error> {
|
|
// use reqwest::header::AUTHORIZATION;
|
|
let client = reqwest::Client::new();
|
|
let res = client
|
|
.get(API_ROOT.to_owned().add("/users/").add(USER_ID).add("/installations"))
|
|
.header("Content-Type", "application/json")
|
|
.header("x-authorization","Token ".to_owned()+TOKEN)
|
|
.send()
|
|
.await;
|
|
return res;
|
|
}
|
|
|