#json #http-request #json-api #data #post #api-request

rest-json-client

Utility library for easing http json api request

5 releases

0.2.3 Mar 27, 2024
0.2.2 Mar 22, 2024
0.2.1 Sep 28, 2023
0.2.0 Sep 28, 2023
0.1.0 Sep 28, 2023

#235 in HTTP client

Download history 1/week @ 2024-07-28 6/week @ 2024-09-22 3/week @ 2024-09-29

191 downloads per month

MIT license

12KB
152 lines

Library to simplify calls to a RESTful API using a JSON file as the data source. GET, POST, PUT and DELETE methods are supported.

Example

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>(())
# });

Dependencies

~4–16MB
~199K SLoC