bizowie-api (Rust)
Async Rust client for Bizowie's ERP API. Port of the
Perl WWW::Bizowie::API module.
- Async, built on
reqwestwithrustls - Supports both the v1 and v2 API endpoints
- Two runtime dependencies:
reqwestandserde_json
Requirements
- Rust 1.70 or newer
- A Tokio runtime (any flavor)
Install
[]
= "0.5"
= { = "1", = ["macros", "rt-multi-thread"] }
= "1"
Quick start
use BizowieAPI;
use json;
async
API
BizowieAPI::new(api_key, secret_key, site)
Creates a client with the required credentials. All three arguments accept
anything that implements Into<String> (e.g., &str or String).
Optional builder methods:
| Method | Description |
|---|---|
.v2(bool) |
Route calls through the v2 endpoint (/bz/apiv2/call/). |
.api_version("1.00") |
API version sent with each v2 request. Defaults to "1.00" when unset. |
.debug(bool) |
Log the raw HTTP body to stderr when the response can't be parsed as JSON. |
async fn call(&self, method: &str, params: Option<&Value>) -> Result<BizowieAPIResponse, Error>
Makes an API call.
method— path to the API method (everything after/bz/api/for v1 or/bz/apiv2/call/for v2). ReturnsError::MissingMethodif empty.params— optional&serde_json::Valueof parameters. In v2 mode,api_key/secret_key/api_versionare injected automatically — don't include them.
BizowieAPIResponse
success—1on success,0otherwise. Pulled from the response body'ssuccessfield.data— decoded JSON response (withsuccessremoved). On a non-JSON response this is{ "unprocessed": 1 }.
Error
call does not return an error for HTTP-level failures (4xx/5xx).
Those are surfaced via success: 0 and whatever the server returned in
data. Only network-level failures (DNS, connection refused, TLS) become
Error::Http.
v1 vs v2
| Aspect | v1 (default) | v2 (.v2(true)) |
|---|---|---|
| Endpoint | https://{site}/bz/api/{method} |
https://{site}/bz/apiv2/call/{method} |
| Auth | Sent as separate multipart form fields | Injected into the JSON request body |
| Body | multipart/form-data with a request JSON field |
Raw JSON body with Content-Type: form-data |
api_version |
not sent | sent (defaults to "1.00") |
v2 is recommended for new integrations.
TLS
Uses rustls (no system OpenSSL needed). Verification is on by default.
For self-signed dev hosts, install the cert into your trust store rather
than disabling verification.
License
Dual-licensed under the Artistic License 1.0 or the GPL 1.0+, matching the original Perl module.