public async Task <OfferListContainer> GetLVBOrFBBInventory(int page = 1, StockType stockType = StockType.None, StockAmount stockAmount = StockAmount.None, string quantityRange = null, string query = null) { var queryParameters = new Dictionary <string, string>() { { "page", page.ToString() } }; if (stockType != StockType.None) { queryParameters.Add("state", stockType.ToString().ToUpper()); } if (stockAmount != StockAmount.None) { queryParameters.Add("stock", stockAmount.ToString().ToUpper()); } if (quantityRange != null) { queryParameters.Add("quantity", quantityRange); } if (query != null) { queryParameters.Add("query", query); } var response = await Get("/inventory", queryParameters).ConfigureAwait(false); return(await BolApiHelper.GetContentFromResponse <OfferListContainer>(response).ConfigureAwait(false)); }
/// <summary> /// V4 BETA: Send test push notification for subscriptions /// Send a test push notification to all subscriptions for the provided event. /// </summary> /// <returns></returns> public async Task <StatusResponse> SendTestPushNotification() { using (var content = BolApiHelper.BuildContentFromObject(new object { }, AcceptHeaders.V5Json)) { var response = await Post("/subscriptions/test", content, acceptHeader : AcceptHeaders.V5Json).ConfigureAwait(false); return(await BolApiHelper.GetContentFromResponse <StatusResponse>(response).ConfigureAwait(false)); } }
/// <summary> /// V4 BETA: Update push notification subscription /// Update an existing push notification subscription with the supplied id. The configured URL has to support https scheme. /// </summary> /// <param name="subscriptionId">A unique identifier for the subscription</param> /// <param name="notificationSubscription"></param> /// <returns></returns> public async Task <StatusResponse> UpdatePushNotificationSubscription(int subscriptionId, CreateNotificationSubscription notificationSubscription) { using (var content = BolApiHelper.BuildContentFromObject(notificationSubscription, AcceptHeaders.V5Json)) { var response = await Put($"/subscriptions/{subscriptionId}", content, acceptHeader : AcceptHeaders.V5Json).ConfigureAwait(false); return(await BolApiHelper.GetContentFromResponse <StatusResponse>(response).ConfigureAwait(false)); } }
/// <summary> /// Ship a single order item within a customer order by providing shipping information. /// In case you purchased a shipping label you can add the shippingLabelCode to this message. /// In that case the transport element must be left empty. /// If you ship the item(s) using your own transporter method you must omit the shippingLabelCode entirely. /// </summary> /// <param name="orderItemId">The order item being confirmed.</param> /// <param name="shippingInfo"></param> /// <returns></returns> public async Task <StatusResponse> ShipOrderItem(ShippingInfo shippingInfo) { using (var content = BolApiHelper.BuildContentFromObject(shippingInfo)) { var response = await Put($"/orders/shipment", content).ConfigureAwait(false); return(await BolApiHelper.GetContentFromResponse <StatusResponse>(response).ConfigureAwait(false)); } }
/// <summary> /// Gets all commissions and possible reductions by EAN, condition and optionally price. /// No more than 100 EAN`s can be sent in a single request. /// </summary> /// <param name="queries">Object that holds properties which get queried</param> /// <returns></returns> public async Task <CommissionsContainer> GetCommissions(CommissionQueriesContainer queries) { using (var content = BolApiHelper.BuildContentFromObject(queries)) { var response = await Post("/commission", content); return(await BolApiHelper.GetContentFromResponse <CommissionsContainer>(response).ConfigureAwait(false)); } }
public async Task <StatusResponse> AddTransportInformation(string transportId, Transport transport) { using (var content = BolApiHelper.BuildContentFromObject(transport)) { var response = await Put($"/transports/{transportId}", content).ConfigureAwait(false); return(await BolApiHelper.GetContentFromResponse <StatusResponse>(response).ConfigureAwait(false)); } }
/// <summary> /// This endpoint can be used to either confirm a cancellation request by the customer or to cancel an order you yourself are unable to fulfil. /// </summary> /// <param name="orderItems">Items to cancel (use CancelReason enum)</param> /// <returns></returns> public async Task <StatusResponse> CancelOrderByOrderItemId(OrderItemCancellationContainer orderItemsContainer) { using (var content = BolApiHelper.BuildContentFromObject(orderItemsContainer)) { var response = await Put($"/orders/cancellation", content).ConfigureAwait(false); return(await BolApiHelper.GetContentFromResponse <StatusResponse>(response).ConfigureAwait(false)); } }
/// <summary> /// Update stock for offer by id. /// </summary> /// <param name="offerId">Unique identifier for an offer.</param> /// <param name="stock">New stock for the offer.</param> /// <returns></returns> public async Task <StatusResponse> UpdateOfferStock(string offerId, Stock stock) { using (var content = BolApiHelper.BuildContentFromObject(stock)) { var response = await Put($"/offers/{offerId}/stock", content).ConfigureAwait(false); return(await BolApiHelper.GetContentFromResponse <StatusResponse>(response).ConfigureAwait(false)); } }
/// <summary> /// Use this endpoint to send an offer update. This endpoint returns a process status. /// </summary> /// <param name="offerId">Unique identifier for an offer.</param> /// <param name="updateOffer">Offer update container.</param> /// <returns></returns> public async Task <StatusResponse> UpdateOffer(string offerId, UpdateOffer updateOffer) { using (var content = BolApiHelper.BuildContentFromObject(updateOffer)) { var response = await Put("/offers/" + offerId, content).ConfigureAwait(false); return(await BolApiHelper.GetContentFromResponse <StatusResponse>(response).ConfigureAwait(false)); } }
/// <summary> /// Creates a new offer, and adds it to the catalog. After creation, status information can be retrieved to review if the offer is valid and published to the shop. /// </summary> /// <param name="offer">The offer to create</param> /// <returns></returns> public async Task <StatusResponse> CreateNewOffer(CreateOffer offer) { using (var content = BolApiHelper.BuildContentFromObject(offer)) { var response = await Post("/offers", content).ConfigureAwait(false); return(await BolApiHelper.GetContentFromResponse <StatusResponse>(response).ConfigureAwait(false)); } }
/// <summary> /// Allows the user to handle a return. /// This can be to either handle an open return, or change the handlingResult of an already handled return. /// The latter is only possible in limited scenarios, please check the returns documentation for a complete list. /// </summary> /// <param name="rmaId">The RMA (Return Merchandise Authorization) id that identifies this particular return.</param> /// <param name="handleReturnContainer">An object that holds the handling result and quantity of the returned product.</param> /// <returns></returns> public async Task <StatusResponse> HandleReturn(int rmaId, HandleReturnContainer handleReturnContainer) { using (var content = BolApiHelper.BuildContentFromObject(handleReturnContainer)) { var response = await Put($"/returns/" + rmaId.ToString(), content).ConfigureAwait(false); return(await BolApiHelper.GetContentFromResponse <StatusResponse>(response).ConfigureAwait(false)); } }
public async Task <SalesForeCast> GetSalesForeCast(string offerId, string weeksAhead) { var queryParameters = new Dictionary <string, string>() { { "offer-id", offerId }, { "weeks-ahead", weeksAhead } }; var response = await Get("/insights/sales-forecast", queryParameters).ConfigureAwait(false); return(await BolApiHelper.GetContentFromResponse <SalesForeCast>(response).ConfigureAwait(false)); }
/// <summary> /// Update price for offer by id. The flow is designed to facilitate the planned offering of bundle discounts. This is not yet available. Therefore, the ‘quantity’ field should always contain the value ‘1’, and the price should represent the single unit price. /// </summary> /// <param name="offerId">Unique identifier for an offer.</param> /// <param name="pricing">New pricing for the offer.</param> /// <returns></returns> public async Task <StatusResponse> UpdateOfferPrice(string offerId, PricingContainer pricing) { var pricingContainer = new UpdatePriceContainer(pricing); using (var content = BolApiHelper.BuildContentFromObject(pricingContainer)) { var response = await Put($"/offers/{offerId}/price", content).ConfigureAwait(false); return(await BolApiHelper.GetContentFromResponse <StatusResponse>(response).ConfigureAwait(false)); } }
/// <summary> /// Gets a paginated list of all open orders sorted by date in descending order. /// </summary> /// <param name="page">The requested page number with a pagesize of 50</param> /// <param name="fulFilmentType">The fulfilment method. Fulfilled by the retailer (FBR) or fulfilled by bol.com (FBB).</param> /// <returns></returns> public async Task <OrdersResponse> GetOpenOrders(int page = 1, FulFilmentMethod fulFilmentType = FulFilmentMethod.FBR) { var queryParameters = new Dictionary <string, string> { { "page", page.ToString() }, { "fulfilment-method", fulFilmentType.ToString() } }; var response = await Get("/orders", queryParameters).ConfigureAwait(false); return(await BolApiHelper.GetContentFromResponse <OrdersResponse>(response).ConfigureAwait(false)); }
/// <summary> /// Get a paginated list of all returns, which are sorted by date in descending order. /// </summary> /// <param name="page">The requested page number with a pagesize of 50</param> /// <param name="handled">The status of the returns you wish to see, shows either handled or unhandled returns.</param> /// <param name="fulfilmentMethod">The fulfilment method. Fulfilled by the retailer (FBR) or fulfilled by bol.com (FBB).</param> /// <returns></returns> public async Task <ReturnsResponse> GetReturns(int page = 1, bool handled = false, FulFilmentMethod fulfilmentMethod = FulFilmentMethod.FBR) { var queryParameters = new Dictionary <string, string>() { { "page", page.ToString() }, { "handled", handled.ToString() }, { "fulfilment-method", fulfilmentMethod.ToString() }, }; var response = await Get($"/returns", queryParameters).ConfigureAwait(false); return(await BolApiHelper.GetContentFromResponse <ReturnsResponse>(response).ConfigureAwait(false)); }
/// <summary> /// A paginated list to retrieve all your shipments up to 3 months old. The shipments will be sorted by date in descending order. /// </summary> /// <param name="orderId">The page to get with a page size of 50.</param> /// <param name="page">The fulfilment method. Fulfilled by the retailer (FBR) or fulfilled by bol.com (FBB).</param> /// <param name="fulFilmentType">The id of the order. Only valid without fulfilment-method. The default fulfilment-method is ignored.</param> /// <returns></returns> public async Task <ShipmentsContainer> GetShipmentList(int page = 1, string orderId = "", FulFilmentMethod fulFilmentType = FulFilmentMethod.FBR) { var queryParameters = new Dictionary <string, string> { { "page", page.ToString() }, { "fulfilment-method", fulFilmentType.ToString() }, { "order-id", orderId } }; var response = await Get($"/shipments", queryParameters).ConfigureAwait(false); return(await BolApiHelper.GetContentFromResponse <ShipmentsContainer>(response).ConfigureAwait(false)); }
/// <summary> /// Retrieve a list of process statuses, which shows information regarding previously executed PUT/POST requests in descending order. /// You need to supply an entity id and event type. /// </summary> /// <param name="entityId">The entity id is not unique so you need to provide an event type. The entity id can either be order item id, transport id, return number or inbound reference.</param> /// <param name="eventType">The event type can only be used in combination with the entity id.</param> /// <param name="page">The requested page number with a pagesize of 50</param> /// <returns></returns> public async Task <ProcessStatusesContainer> GetProcessStatusByEntityAndEvent(string entityId, ProcessEventType eventType, int page = 1) { var queryParameters = new Dictionary <string, string> { { "entity-id", entityId }, { "event-type", eventType.ToString() }, { "page", page.ToString() } }; var response = await Get("/process-status", queryParameters).ConfigureAwait(false); return(await BolApiHelper.GetContentFromResponse <ProcessStatusesContainer>(response).ConfigureAwait(false)); }
/// <summary> /// Request an offer export file containing all offers. /// </summary> /// <param name="exportConfiguration">The file format in which to return the export. Defaults to "CSV"</param> /// <returns></returns> public async Task <StatusResponse> RequestOfferExportFile(OfferExportConfiguration exportConfiguration = null) { if (exportConfiguration == null) { exportConfiguration = new OfferExportConfiguration(); } using (var content = BolApiHelper.BuildContentFromObject(exportConfiguration)) { var response = await Post("/offers/export", content).ConfigureAwait(false); return(await BolApiHelper.GetContentFromResponse <StatusResponse>(response).ConfigureAwait(false)); } }
/// <summary> /// Request an unpublished offer report containing all unpublished offers and reasons. /// </summary> /// <param name="fileFormatContainer">File format container defaults to "CSV"</param> public async Task <StatusResponse> RequestUnpublishedOfferReport(FileFormatContainer fileFormatContainer = null) { if (fileFormatContainer == null) { fileFormatContainer = new FileFormatContainer("CSV"); } using (var content = BolApiHelper.BuildContentFromObject(fileFormatContainer, AcceptHeaders.V5Json)) { var response = await Post($"/offers/unpublished", content, acceptHeader : AcceptHeaders.V5Json).ConfigureAwait(false); return(await BolApiHelper.GetContentFromResponse <StatusResponse>(response).ConfigureAwait(false)); } }
public async Task <SearchTerms> GetSearchTerms(string searchTerm, EPeriod period, int numberOfPeriods, bool relatedSearchTerms = false) { var queryParameters = new Dictionary <string, string>() { { "search-term", searchTerm }, { "period", period.ToString() }, { "number-of-periods", numberOfPeriods.ToString() }, { "related-search-terms", relatedSearchTerms.ToString() } }; var response = await Get("/insights/search-terms", queryParameters).ConfigureAwait(false); return(await BolApiHelper.GetContentFromResponse <SearchTerms>(response).ConfigureAwait(false)); }
/// <summary> /// Commissions can be filtered by condition, which defaults to NEW. /// If price is provided, the exact commission amount will also be calculated. /// </summary> /// <param name="ean">The EAN number associated with this product.</param> /// <param name="condition">The condition of the offer.</param> /// <param name="unitPrice">The price of the product with a period as a decimal separator. The price should always have two decimals precision.</param> /// <returns></returns> public async Task <Commission> GetCommissionByEAN(string ean, string condition = null, decimal?unitPrice = null) { using (var client = new HttpClient()) { var parameters = new Dictionary <string, string>(); if (condition != null) { parameters.Add(nameof(condition), condition); } if (unitPrice != null) { parameters.Add("unit-price", ((decimal)unitPrice).ToString("0.00", System.Globalization.CultureInfo.InvariantCulture)); } var response = await Get($"/commission/{ean}", parameters); return(await BolApiHelper.GetContentFromResponse <Commission>(response).ConfigureAwait(false)); } }
/// <summary> /// Retrieve a list of process statuses, which shows information regarding previously executed PUT/POST/DELETE requests. /// No more than 1000 process status id's can be sent in a single request. /// </summary> /// <param name="processStatusIds">Array of objects (ProcessStatusId)</param> /// <returns></returns> public async Task <ProcessStatusesContainer> GetProcessStatusesByIds(string[] processStatusIds) { var processStatusQueries = new ProcessStatusQuery[processStatusIds.Length]; for (int i = 0; i < processStatusIds.Length; i++) { processStatusQueries[i] = new ProcessStatusQuery() { ProcessStatusId = processStatusIds[i] }; } var newObject = new { processStatusQueries = processStatusQueries }; using (var content = BolApiHelper.BuildContentFromObject(newObject)) { var response = await Post("/process-status", content).ConfigureAwait(false); return(await BolApiHelper.GetContentFromResponse <ProcessStatusesContainer>(response).ConfigureAwait(false)); } }
public async Task <PerformanceIndicatorsContainer> GetPerformanceIndicators(PerformanceName[] performanceNames, int year, int week) { if (performanceNames.Length == 0) { throw new BolRetailerApiException("performanceNames list was empty"); } var performanceNamesString = ""; int i = 0; foreach (var performanceName in performanceNames) { performanceNamesString += (i > 0 ? "," : "") + performanceName; i++; } var queryParameters = new Dictionary <string, string>() { { "name", performanceNamesString }, { "year", year.ToString() }, { "week", week.ToString() } }; var response = await Get("/insights/performance/indicator", queryParameters).ConfigureAwait(false); return(await BolApiHelper.GetContentFromResponse <PerformanceIndicatorsContainer>(response).ConfigureAwait(false)); }
/// <summary> /// Retrieve a specific process-status, which shows information regarding a previously executed PUT/POST request. /// All PUT/POST requests on the other endpoints will supply a process-status-id in the related response. /// You can use this id to retrieve a status by using the endpoint below. /// </summary> /// <param name="processStatusId">The id of the process status being requested. This id is supplied in every response to a PUT/POST request on the other endpoints.</param> /// <returns></returns> public async Task <ProcessStatus> GetStatusByProcessId(string processStatusId) { var response = await Get("/process-status/" + processStatusId.ToString()).ConfigureAwait(false); return(await BolApiHelper.GetContentFromResponse <ProcessStatus>(response).ConfigureAwait(false)); }
/// <summary> /// Delete an offer by id. /// </summary> /// <param name="offerId">Unique identifier for an offer.</param> /// <returns></returns> public async Task <StatusResponse> DeleteOffer(string offerId) { var response = await Delete("/offers/" + offerId).ConfigureAwait(false); return(await BolApiHelper.GetContentFromResponse <StatusResponse>(response).ConfigureAwait(false)); }
public async Task <string[]> GetShippingLabelByTransportId(string transportId) { var response = await Get($"/transports/{transportId}/shipping-label", acceptHeader : AcceptHeaders.V5Pdf).ConfigureAwait(false); return(await BolApiHelper.GetContentFromResponse <string[]>(response).ConfigureAwait(false)); }
/// <summary> /// Gets an order by order id. /// </summary> /// <param name="orderId">The id of the order to get.</param> /// <returns></returns> public async Task <OrderDetails> GetOrder(string orderId) { var response = await Get("/orders/" + orderId).ConfigureAwait(false); return(await BolApiHelper.GetContentFromResponse <OrderDetails>(response).ConfigureAwait(false)); }
//retailer/purchasable-shippinglabels/{order-item-id} public async Task <PurchasableShippingLabelContainer> GetShippingLabelOrderItemId(string orderItemId) { var response = await Get($"/shipping-labels/{orderItemId}").ConfigureAwait(false); return(await BolApiHelper.GetContentFromResponse <PurchasableShippingLabelContainer>(response).ConfigureAwait(false)); }
/// <summary> /// Retrieve a return based on the rma id. /// </summary> /// <param name="rmaId">The RMA (Return Merchandise Authorization) id that identifies this particular return.</param> /// <returns></returns> public async Task <ReturnsResponse> GetReturnByRMAId(int rmaId) { var response = await Get($"/returns/" + rmaId.ToString()).ConfigureAwait(false); return(await BolApiHelper.GetContentFromResponse <ReturnsResponse>(response).ConfigureAwait(false)); }
/// <summary> /// V4 BETA: Delete push notification subscription /// Delete a push notification subscription with the provided id. /// </summary> /// <param name="subscriptionId">A unique identifier for the subscription</param> /// <returns></returns> public async Task <StatusResponse> DeletePushNotificationSubscription(int subscriptionId) { var response = await Delete($"/subscriptions/{subscriptionId}", acceptHeader : AcceptHeaders.V5Json).ConfigureAwait(false); return(await BolApiHelper.GetContentFromResponse <StatusResponse>(response).ConfigureAwait(false)); }