Skip to content

Soneritics/BolRetailerAPI

Repository files navigation

Build Status License

BolRetailerAPI v10

Bol.com Retailer API NuGet package.

Bol.com retailer references

Documentation for the Bol.com retailer API can be found here:

NuGet package

The API can be included in your project by installing the NuGet package: BolRetailerAPI (Make sure to install the correct version.)

Example usage

// Preferably inject via DI
var bolApi = new BolRetailerApi(clientId, clientSecret, testMode);

// List all orders
var orders = await bolApi.OrdersService.GetOpenOrdersAsync();

// Get all the info of a specific order
var order = await bolApi.OrdersService.GetOrderAsync(orders.First().OrderId);

// Set shipment for a complete order
var shippedOrder = await api.OrdersService.ShipOrderAsync(
    order.OrderId,
    TransporterCode.Tnt,
    "3SABCD000000001"
);

// Get a list of shipment details
var shippedOrderDetails = await bolApi.ShipmentService.GetShipmentListForOrderAsync(order.OrderId);

// Get full details of a shipment
var shipmentDetails = await api.ShipmentService.GetShipmentByIdAsync(shipmentId);

For use in an Azure function, use the following code in your Startup:

public override void Configure(IFunctionsHostBuilder builder)
{
    builder
        .Services
        .AddHttpClient()
        .AddScoped<IBolRetailerApi>(sp =>
            new BolRetailerApi(
                Environment.GetEnvironmentVariable("ClientId"),
                Environment.GetEnvironmentVariable("ClientSecret"),
                sp.GetRequiredService<HttpClient>(),
                Environment.GetEnvironmentVariable("TestMode") == "1"
            )
        );
}

Example project

Checkout the repo for an example project on how to use the API. Create an appsettings.json file in the example project with the following settings if you don't want to enter them manually:

{
  "clientId": "",
  "clientSecret":  ""
}

The example project uses the test endpoints, so no production data is altered.

Current implementation status

The following has been implemented:

  • Orders
    • Get all (open) orders
    • Get a single order's details
    • Cancel an order (item)
    • Ship an order (item)
  • Shipments
    • Get shipment list~~~~
    • Get a single shipment's details

About

Bol.com Retailer API NuGet package

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages