User Tools

Site Tools


This script uses reqwest. Add the following to your `Cargo.toml`:

reqwest = "0.9.9"

The looks like this:

  extern crate reqwest;
  use std::collections::HashMap;
  fn main() -> Result<(), Box<std::error::Error>> {
      let mut jrpc = HashMap::new();
      jrpc.insert("id", "1");
      jrpc.insert("method", "backend_info");
      jrpc.insert("params", "");
      let client = reqwest::Client::new();
      let mut response ="https://YOURSERVER.NAME.TLD:4447/rpc")
          .basic_auth("YOUR_USERNAME_HERE", Some("PASSW0RDZ_HERE"))
      println!("Headers: {:#?}", response);
      let content = response.text()?;
      println!("Body: {:#?}", content);
userspace/webservice_corner/rust-rpc.txt · Last modified: 2021/08/23 08:37 (external edit)