Crates.io | json_pusher |
lib.rs | json_pusher |
version | 0.1.1 |
source | src |
created_at | 2024-08-28 17:39:00.222179 |
updated_at | 2024-08-28 17:41:20.433653 |
description | A tool to push JSON data to an endpoint |
homepage | |
repository | https://github.com/th0jensen/json_pusher |
max_upload_size | |
id | 1354967 |
size | 45,978 |
JSON Pusher is a simple command-line tool written in Rust that reads a JSON file, iterates over the objects within, and pushes each object to a specified API endpoint. The tool allows you to specify the API URL, request method (e.g., POST, PUT), and an optional bearer token for authorization.
Supports POST and PUT requests: Push JSON data using the HTTP method of your choice.
Bearer Token Support: Easily include a bearer token for authentication.
Iterates Over JSON Objects: Handles JSON arrays by sending each object as a separate request.
Cross Platform
Ensure you have Rust installed on your machine. If not, you can install it via rustup.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
git clone https://github.com/th0jensen/json_pusher.git
cd json_pusher
To build the project, navigate to the project directory and run:
cargo build --release
The compiled binary will be located in the target/release/ directory.
cargo install --path .
You can run the JSON Pusher using the following command:
json_pusher --json <path_to_json_file> --url <api_endpoint_url> --method <http_method> [--token <path_to_token_file>]
json_pusher --json ./data/input.json --url https://api.example.com/endpoint --method POST --token ./data/token.txt
This command will:
Here’s an example of what your JSON file might look like:
[
{ "id": 1, "name": "Object 1" },
{ "id": 2, "name": "Object 2" }
]
Each object in the array will be sent as a separate request to the specified API endpoint.
Contributions are welcome! If you find a bug or have a feature request, please open an issue or submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for more details.