Crates.io | rest-json-client |
lib.rs | rest-json-client |
version | 0.2.3 |
source | src |
created_at | 2023-09-28 09:52:06.878536 |
updated_at | 2024-03-27 15:26:56.440006 |
description | Utility library for easing http json api request |
homepage | |
repository | https://github.com/paulusminus/rest-api-client |
max_upload_size | |
id | 985753 |
size | 11,107 |
Library to simplify calls to a RESTful API using a JSON file as the data source. GET, POST, PUT and DELETE methods are supported.
Getting a list of posts from Json Placeholder
# use rest_json_client::{ApiClientBuilder, Authentication, Error};
# use json_placeholder_data::posts::Post;
#
# tokio_test::block_on(async {
let base = "https://jsonplaceholder.typicode.com/";
let posts = ApiClientBuilder::new(base)
.build()?
.get::<Vec<Post>>("posts")
.await?;
# assert_eq!(posts.len(), 100);
# Ok::<(), Error>(())
# });