chore: initial commit
This commit is contained in:
54
README.md
Normal file
54
README.md
Normal file
@@ -0,0 +1,54 @@
|
||||
# Novaloop.BexioApi - Accessing Bexio Api
|
||||
|
||||
**Novaloop.BexioApi** allows to access the bexio API within your .net projects.
|
||||
|
||||
## Disclaimer
|
||||
This library is an early state. Not a lot of api endpoints have been implemented. But it is set on solid grounds and hopefully will grow in the future.
|
||||
Don't shy away to open an issue or write a pull request for an endpoint you need.
|
||||
|
||||
## Implemented Methods
|
||||
|
||||
- Get all existing Contacts
|
||||
- Search for existing Contacts
|
||||
|
||||
## Getting Started
|
||||
|
||||
### Startup.cs
|
||||
|
||||
The api client is added with the following configuration inside `ConfigureServices`.
|
||||
See https://docs.bexio.com/#section/Authentication/API-Tokens for how to acquire an api key.
|
||||
|
||||
```csharp
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddBexioApi(options =>
|
||||
{
|
||||
options.ApiKey = "your-api-key";
|
||||
});
|
||||
services.AddControllers();
|
||||
}
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
Now the Api Services can be injected via dependency injection inside controllers / services:
|
||||
|
||||
```csharp
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class ExampleController : ControllerBase
|
||||
{
|
||||
private readonly IBexioContactsApiService _bexioContactsApiService;
|
||||
|
||||
public ExampleController(IBexioContactsApiService bexioContactsApiService)
|
||||
{
|
||||
_bexioContactsApiService = bexioContactsApiService;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> Get()
|
||||
{
|
||||
return Ok(await _bexioContactsApiService.GetAll());
|
||||
}
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user