Billbee.Api.Client
1.0.1.1
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Billbee.Api.Client --version 1.0.1.1
NuGet\Install-Package Billbee.Api.Client -Version 1.0.1.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Billbee.Api.Client" Version="1.0.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Billbee.Api.Client --version 1.0.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Billbee.Api.Client, 1.0.1.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Billbee.Api.Client as a Cake Addin #addin nuget:?package=Billbee.Api.Client&version=1.0.1.1 // Install Billbee.Api.Client as a Cake Tool #tool nuget:?package=Billbee.Api.Client&version=1.0.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Billbee API
With this package you can implement the official Billbee API in your C# application.
Prerequisites
- For accessing the Billbee API you need an API Key. To get an API key, send a mail to support@billbee.de and send us a short note about what you are building.
- The API module must be activated in the account (https://app.billbee.io/de/settings/api)
Install
Just install this package und follow the demo instructions.
Official API Documentation
https://app.billbee.io/swagger/ui/index
Usage
Use the client api package by using the demo statements below. Ich you want further examples, use the demo project from our git repository.
Demo
Initialization
// Creating an individual logger, that implements ILogger
ILogger logger = new Logger();
// Creating new instance of ApiClient
string configPath = "config.json";
ApiClient client = null;
// from naual given config
client = new ApiClient(logger: logger);
/ Enter your api key here. If you don't have an api key. Please contact support@billbee.de with a description on what you would like to do, to get one.
client.Configuration.ApiKey = "";
// Enter the username of your main account here.
client.Configuration.Username = "";
// Enter the password of your api here.
client.Configuration.Password = "";
// Test the configuration
if (client.TestConfiguration())
{
logger.LogMsg("Api test successful", LogSeverity.Info);
}
else
{
logger.LogMsg("Api test failed. Please control your configuration", LogSeverity.Error);
Console.WriteLine("Press any key to continue");
Console.ReadKey();
return 1;
}
Some Demo Calls
// Calls that can possibly harm your data should be commented out, while testing with a real account.
#region webhooks
// Getting all available webhook filters
var webhookFilters = client.Webhooks.GetFilters();
// Requesting webhooks
var webHooks = client.Webhooks.GetWebhooks();
// Requesting a specific webhook
if (webHooks.Count > 0)
{
var webhook = client.Webhooks.GetWebhook(webHooks.FirstOrDefault().Id);
}
#endregion
#region custom fields
// Requesting Custom Product fields
var customFields = client.Products.GetCustomFields(1, 50);
if (customFields.Data.Count > 0)
{
var firstCustomField = client.Products.GetCustomField(customFields.Data.First().Id.Value);
}
#endregion
#region products
var products = client.Products.GetProducts(1, 50);
var patchableFields = client.Products.GetPatchableProductFields();
// Doing some stock manipulations
Console.WriteLine(
"Please enter one SKU of an article to update it's stock. Be aware, that these changes are permanent, so better use a demo article. Leave blank to skip.");
var sku = Console.ReadLine();
if (!string.IsNullOrWhiteSpace(sku))
{
var updateStockCodeResult =
client.Products.UpdateStockCode(
new UpdateStockCode { Sku = sku, StockCode = "Testlager" });
var updateStockResult = client.Products.UpdateStock(
new UpdateStock
{
Sku = sku,
NewQuantity = 15,
Reason = "Change due to api tests."
});
var updateStockMultipleResult = client.Products.UpdateStockMultiple(
new List<UpdateStock>
{
new UpdateStock {Sku = sku, NewQuantity = 15},
new UpdateStock {Sku = "4712", NewQuantity = 23}
});
}
#endregion
#region product images
if (products.Data.Count > 0)
{
var articleId = products.Data.First().Id.Value;
var articleImages = client.Products.GetArticleImages(articleId);
var newArticleImage = client.Products.AddArticleImage(new ArticleImage { ArticleId = articleId, Id = 0, IsDefault = false, Url = "http://static.bbc.co.uk/history/img/ic/640/images/resources/histories/titanic.jpg" });
client.Products.DeleteArticleImage(newArticleImage.Data.Id);
}
#endregion
#region customer
var customers = client.Customer.GetCustomerList(1, 50);
if (customers.Data.Count > 0)
{
var customer = client.Customer.GetCustomer(customers.Data.First().Id.Value);
customer.Data.Name = "Tobias Tester";
var customerOrder = client.Customer.GetOrdersForCustomer(customer.Data.Id.Value, 1, 50);
var customerAddresses = client.Customer.GetAddressesForCustomer(customer.Data.Id.Value, 1, 50);
}
#endregion
#region search
client.Search.SearchTerm(new Search { Term = "4711", Type = new List<string> { "order", "product", "customer" } });
#endregion
#region events
// Getting events for this account
var events = client.Events.GetEvents();
// Artificial brake to prevent throttling
Thread.Sleep(1000);
#endregion
#region shipping
// Getting my shipping providers
var shippingProvider = client.Shipment.GetShippingProvider();
// Artificial brake to prevent throttling
Thread.Sleep(1000);
#endregion
#region miscellaneous
// Requesting the urls of the terms and conditions for the usage of billbee.
var termsAndConditions = client.AutomaticProvision.TermsInfo();
#endregion
#region orders
// Getting a list of all orders with order state 'confirmed'
var orders = client.Orders.GetOrderList(page: 1, pageSize: 20,
orderStateId: new List<OrderStateEnum> { OrderStateEnum.Bestaetigt });
Console.WriteLine(
"Please enter one order number for further test manipulations. Be aware, that these changes are permanent. Please use an demo order. Leave blank to skip.");
var orderId = Console.ReadLine();
int orderIdInt;
if (!string.IsNullOrWhiteSpace(orderId) && int.TryParse(orderId, out orderIdInt))
{
// Remove all old tags and add the given ones.
var updateTagsResult = client.Orders.UpdateTags(new List<string>() { "Test C", "Test D" }, orderIdInt);
// Add new tags.
var addTagsResult = client.Orders.AddTags(new List<string>() { "Test A", "Test B" }, orderIdInt);
// client.Orders.AddShipment(new OrderShipment { Comment = "Test", OrderId = orderIdInt, ShippingId = shippingId, ShippingProviderId = providerId, ShippingProviderProductId = productId });
// Getting documents
var deliveryNoteResult = client.Orders.CreateDeliveryNote(orderIdInt, true);
var invoiceResult = client.Orders.CreateInvoice(orderIdInt, true);
}
#endregion
Contributing
Feel free to fork the repository and create pull-requests
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net461 is compatible. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
- Newtonsoft.Json (>= 10.0.3)
- RestSharp (>= 106.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.