billecta 1.14.0

Generated Billecta API
Documentation


# Billecta-rs

Wrapper around the [Billecta](https://docs.billecta.com/reference) API.


# Creating a new client


Create a client using a URL and a token.
See section Authentication in [Getting Started](https://docs.billecta.com/api)


## Using environment variables

A client can be created using the environment variables:
* `BILLECTA_URL` 
* `BILLECTA_TOKEN`


```rust

let client = billecta::Client::from_env();

```

## Creating a SecureToken

### 1. Retreive SecureToken

To begin, encode your username and password as follows:

```sh
$ echo -n "<username>:<password>" | base64
```

`$ base64 <<< "<username>:<password>"` cannot be used since it adds a newline.


### 2. Retreive your SecureToken
Send the encoded b64-string to Billecta with the b64-string you just created in
the Authorization Header as such: `Authorization: Basic <b64string>`


```sh
curl -X "POST" https://api.billecta.com/v1/authentication/apiauthenticate -H "Content-Length:0" -H "Authorization: Basic <b64 string>" -H "Accept: application/json"
```

### 3. Encode the SecureToken
Snatch the SecureToken from the returned data and encode it as b64 once more:

```sh
$ base64 <<< <SecureTokenString>
```

### 4. Do API things
To try it out try to fetch all Creditor with the b64 encode SecureToken in the
Authorization header

```sh
curl -X "POST" https://api.billecta.com/v1/creditors/creditors -H "Authorization: SecureToken <SecureTokenB64>"
```