Webservices Media orders B2C
CB Media Interface Description
Revisions
Date | Description |
---|---|
| Added extra information authorisation: “Basic ”||"Base64 encoding of username and password joined by a single colon : " |
| Media Order B2C: Yaml file version 1.3.0 Changelog version 1.2.0 to version 1.3.0:
MediaShipment: Yaml file version 1.0.0 version 1.1.0 Changelog version 1.0.0 to version 1.1.0:
|
| Authentication notify services, CB supports:
|
| Test and order simulation added |
| Add Tag matrix for Green and Standard option |
| Update yaml file MediaOrderNotify v.1.0.2.yaml |
| Update generic error messages |
| Align with updated order notifications |
| Update yaml file MediaOrderB2C v1.2.0.yaml |
| Update MediaOrderB2C version Correct resource for notifyOrder and notityShipment |
| Update yaml versions |
| Add volume limits and error messages; Correct typo in process flow diagrams |
| Add flows and sequence diagrams |
| Add operations |
| Initial document |
Introduction
This document contains a description of the standard interfaces for implementation of data exchange with CB via webservices.
The entire set for the standard data exchange with CB consists of the following documents and files: | |
The mapping from file based to webservice based messages | |
Tag matrix for Green and Standard option | |
CB has two options for submitting e-commerce orders:
| |
yaml definition files | An OpenAPI Specification file (yaml) for each resource |
https://services.cb.nl/rest/api/v1/mediaorderb2c/swagger.yaml Contains PUT (cancel), GET (status) and POST (place order) | |
Overview webservices
This chapter gives an overview of the available interaction patterns for data exchange with CB. The figure below gives an high level overview of the CB system landscape and the available webservice operations.
CB provides REST based webservices. In REST operations define the available activities.
The webservices provide online creation and cancelation of media orders at CB. Changes to an order (other than cancel) are not available. Resending an order is possible only when the order was not accepted by CB earlier.
Webservices are available 24 hours a day, 7 days a week, however order handling is restricted to warehouse working hours. Our regular maintenance window is on Saturday from 08:00 hours until 14:00 hours. The webservice operations are available during this time, but received requests are stored only (i.e. not validated nor processed at that moment) when our ERP systems are not available. Processing will resume as soon as our ERP systems are available again..
File versus Webservice
Communication about orders is based on the receiving channel, i.e. file base communication is used for orders received via file based interfaces and webservice communication is used for orders received via the webservice.
Orders are processed independent from the receiving channel.
Mapping batch files versus webservice operations | |
---|---|
OPDNAW | placeOrder |
ANNOPD | cancelOrder |
UITOPD | notifyOrder / getOrderStatus + notifyShipment / getShippingUnit |
NUITOP | notifyOrder / getOrderStatus |
Timing
Webservice requests are processed realtime, i.e. an order is registered immediately when the webservice call is executed. Order processing at CB is based on scheduled processes and not primarily triggered by the webservice request.
Responses to the requester are send in Near-Realtime (NRT) with an average delay of 2 to 3 minutes. The regular maximum delay is 5 minutes, in exceptions running up to 10 minutes. During this timeframe the orderstatus has reached a status that is not yet reported to the requestor.
Volume
Webservice requests are limited to a maximum of 10 requests per service per second per requestor.
Performance
The media webservices comply with the generic CB webservice performance requirements:
- Average response time within 2 seconds during prime-time (08:00-01:00 CET)
- Response within 3 seconds for 99,95% of the requests during prime-time
- Response within 6 seconds for 99% of the requests outside prime-time
MediaOrderB2C
Webservice name: | MediaOrderB2C |
Definition: | MediaOrderB2C.yaml |
Resource: | Orders |
Operations provided by CB: | |
placeOrder | Send one (1) order to CB |
cancelOrderLine | Cancel one (1) orderline |
getOrderStatus | Retrieve the status of one (1) order |
MediaOrderNotify
Webservice name: | MediaOrderNotify |
Definition: | MediaOrderNotify.yaml |
Resource: | Notifications |
Operations provided by you: | |
notifyOrder | CB calls your webservice to inform you about status updates of an order |
Authentication mode | CB supports:
|
MediaShipment
Webservice name: | MediaShipment |
Definition: | MediaShipment.yaml |
Resource: | ShippingUnits |
Operations provided by CB: | |
getShippingUnit | Retrieve the shipment information for a shipping unit |
MediaShipmentNotify
Webservice name: | MediaShipmentNotify |
Definition: | MediaShipmentNotify.yaml |
Resource: | Notifications |
Operations provided by you: | |
notifyShipment | CB calls your webservice to inform you about a shipment for your order |
Authentication mode | CB supports:
|
Process flows
This chapter contains the identified flows when using webservices to order physical books at CB. The most common and regular scenario is describes in the happy flow. In addition 7 frequent scenarios are described in alternative flows.
Happy Flow
The customer orders one or more products, stock is available and the order is shipped in one shipment.
Flow description:
- The customer puts one or more products in the shopping basket
- The shop forwards the order to CB with the operation placeOrder
- CB verifies and accepts the order, the shop is notified with the operation notifyOrder and status event In Progress
- CB assigns stock to the order
- CB prepares for logistic processing of the order. Cancellation of the order is not possible anymore, the shop is notified with the operation notifyOrder and status event ProductionReady
- The shop can retrieve the order process status to see which orderlines are ready for production and cannot be cancelled anymore
- CB executes pick and pack for the order and creates a shipment. The shop is notified with the operation notifyShipment and status event Processed
- The shop can retrieve the shipment details (including tracking number and a list of products) per shipping unit and can inform the customer.
Alternative Flow 1 – multiple shipments
The customer orders multiple products and stock is available for all products. At pick and pack multiple shipping units are created. The order is shipped in multiple shipments.
Flow description:
- The customer puts multiple products in the shopping basket
- The shop forwards the order to CB with the operation placeOrder
- CB verifies and accepts the order, the shop is notified with the operation notifyOrder and status event In Progress
- CB prepares for logistic processing of the order. The shop is notified with the operation notifyOrder and status event ProductionReady
- The shop can retrieve the order process status to see which orderline(s) are ready for production and cannot be cancelled anymore
- CB executes pick and pack for orderline 1 and creates a shipment. The shop is notified with the operation notifyShipment and status event Processed
- The shop can retrieve the shipment details (including tracking number and a list of products) per shipping unit and can inform the customer
- CB executes pick and pack for orderline 2 and creates a shipment. The shop is notified with the operation notifyShipment and status event Processed
- The shop can retrieve the shipment details (including tracking number and a list of products) per shipping unit and can inform the customer
Alternative Flow 2 – multiple shipments due to partial backorder
The customer orders multiple products and stock is available for at least one product. Also at least one product is in backorder. The order is shipped in multiple shipments.
Flow description:
- The customer puts multiple products in the shopping basket
- The shop forwards the order to CB with the operation placeOrder
- CB verifies and accepts the order, the shop is notified with the operation notifyOrder and status event In Progress
- CB prepares for logistic processing of orderline 1. The shop is notified with the operation notifyOrder and status event ProductionReady
- The shop can retrieve the order process status to see which orderline(s) are ready for production and cannot be cancelled anymore
- CB executes pick and pack for orderline 1 and creates a shipment. The shop is notified with the operation notifyShipment and status event Processed
- The shop can retrieve the shipment details (including tracking number and a list of products) per shipping unit and can inform the customer
- CB received stock for orderline 2, assigns stock and prepares for logistic processing of orderline The shop is notified with the operation notifyOrder and status event ProductionReady
- The shop can retrieve the order process status to see which orderline(s) are ready for production and cannot be cancelled anymore
- CB executes pick and pack for orderline 2 and creates a shipment. The shop is notified with the operation notifyShipment and status event Processed
- The shop can retrieve the shipment details (including tracking number and a list of products) per shipping unit and can inform the customer.
Alternative Flow 3 – customer cancellation
The customer orders one or more products, but decides to cancel the order shortly after ordering.
Flow description:
- The customer puts one or more products in the shopping basket
- The shop forwards the order to CB with the operation placeOrder. The operation confirms acceptance of the order
- CB verifies the order, the shop is notified with the operation notifyOrder and status event In Progress
- The customer decides to cancel the order at the shop
- The shop forwards the cancel request per orderline to CB with the operation cancelOrderLine. The operation confirms acceptance of the cancellation
- CB informs the shop that the complete order is cancelled with the operation notifyOrder and status event Cancelled
- The shop confirms the cancellation to the customer.
Alternative Flow 4 – partial customer cancellation
The customer orders multiple products, but decides to cancel at least one of the orderlines but not all shortly after ordering.
Flow description:
- The customer puts multiple products in the shopping basket
- The shop forwards the order to CB with the operation placeOrder. The operation confirms acceptance of the order
- CB verifies the order, the shop is notified with the operation notifyOrder and status event In Progress
- The customer decides to cancel orderline 1 in the shop
- The shop forwards the cancel request for orderline 1 to CB with the operation cancelOrderLine.The operation confirms acceptance of the cancellation
- CB informs the shop that an orderline is cancelled with the operation notifyOrder and status event Cancelled
- The shop confirms the cancellation to the customer
- CB prepares for logistic processing of orderline 2. The shop is notified with the operation notifyOrder and status event ProductionReady
- CB executes pick and pack for orderline 2 and creates a shipment. The shop is notified with the operation notifyShipment and status event Processed
- The shop can retrieve the shipment details (including tracking number and a list of products) per shipping unit and can inform the customer.
Alternative Flow 5 – CB order reject
The customer orders one or more products, but the order is not accepted by CB due to unknown products.
Flow description:
- The customer puts multiple products in the shopping basket
- The shop forwards the order to CB with the operation placeOrder. The operation confirms rejection of the order
Alternative Flow 6 – partial CB cancellation
The customer orders multiple products and stock is available for at least one product. Also stock is not available for at least one product and backlog is not allowed.
Flow description:
- The customer puts multiple products in the shopping basket
- The shop forwards the order to CB with the operation placeOrder. The operation confirms acceptance of the order
- CB verifies the order and identifies that orderline 1 is not available, the shop is notified with the operation notifyOrder and status event Cancelled
- CB identifies that orderline 2 is available, the shop is notified with the operation notifyOrder and status event InProgress
- The shop retrieves the order process status to see which orderline(s) are not available
- CB prepares for logistic processing of orderline 2. The shop is notified with the operation notifyOrder and status event ProductionReady
- CB executes pick and pack for orderline 2 and creates a shipment. The shop is notified with the operation notifyShipment and status event Processed
- The shop can retrieve the shipment details (including tracking number and a list of products) per shipping unit and can inform the customer
Alternative Flow 7 – order during service window
The customer orders one or more products during the service window. Stock is available for all products.
Flow description:
- The customer puts one or more products in the shopping basket
- The shop forwards the order to CB with the operation placeOrder. The operation confirms receipt of the order during the service window
- CB verifies the order, the shop is notified with the operation notifyOrder and status event InProgress
- CB prepares for logistic processing of the order. The shop is notified with the operation notifyOrder and status event ProductionReady
- The shop can retrieve the order process status with operation getOrderStatus to see which orderline(s) are ready for production and cannot be cancelled anymore
- CB executes pick and pack for the order and creates a shipment. The shop is notified with the operation notifyShipment and status event Processed
- The shop can retrieve the shipment details (including tracking number and a list of products) per shipping unit and can inform the customer
Alternative Flow 8 – cancel during service window
The customer orders one or more products, but decides to cancel the order during the service window.
Flow description:
- The customer puts multiple products in the shopping basket
- The shop forwards the order to CB with the operation placeOrder. The operation confirms acceptance of the order
- CB verifies the order, the shop is notified with the operation notifyOrder and status event In Progress
- The customer decides to cancel the order in the shop
- The shop forwards the cancel request per orderline to CB with the operation cancelOrderLine. The operation confirms receipt of the cancellation request during the service window
- CB confirms a successful cancellation of the order after the service window ended. The shop is notified with the operation notifyOrder and status event Cancelled
- The shop confirms the cancellation to the customer
Webservice operations
This chapter describes the operations including some special remarks. Webservices are defined in the English language, available values in enumerations are also in human readable English (if possible).
Responses
The operations reply with a http response code as indication of the result. Regular http codes 200 and 204 indicate a successful request, codes like 400 and 404 indicate a failure.
Error messages
When the request is not successful the response includes an error message to identify the reason. Error codes are grouped into:
- WXX The request does not comply with the yaml definition;
- WMS Authorization failures;
- WMO The request encountered a mapping error, mainly due to incorrect shipment date(s);
- WSP No body supplied;
- OMS A supplied value encountered a functional error, like unknown SKU.
The list of error codes within these groups may change in time without notice
Generic error messages
- WXX-00001 Reported field does not comply with yaml definition
- WXX-00002 Reported field is not recognized
- WMS-00001 Invalid length for password
- WMS-00002 Invalid username/password combination
- WMS-00003 Invalid service
- WMS-00004 Not authorized to use this service
- WMS-00005 No username and/or password provided by the caller
- WMS-00006 Unable to authenticate
- WMS-00007 Unable to authorize
- WSP-00013 Empty body
Order
placeOrder
The operation placeOrder supports sending one order for a customer. An order can contain multiple orderlines, each for a specific title. Confirmation of the operation is provided with a http-response-code.
Check order identification (Requestor Order Id)
The identification of an order is used to check if an order already exists in the CB systems. If this is the case the new order is rejected. Only open orders are taken into account, so closed/cancelled orders are ignored.
Order type
The operation is available for order types ShipBuyer (LNAFN), ShipOwner (LNEIG) and ShipSecundaryOwner (LMEONE).
Sender and Owner
In the common scenario for media orders the sender requests CB to ship titles owned by a publisher to a consumer. This scenario identifies the publisher as owner, the sender (shop) as buyer from the owner and the consumer as receiver (and buying from the shop). An alternative scenario is secondary ownership, in this alternative scenario the sender (shop) already purchased titles from the publisher and requests CB to ship from its own stock.
Party
Because parties where goods have to be delivered are not known by CB the PartyType “ReceiverAddress,” is mandatory and all name and address information must be provided.
Values added services (VAS)
VAS activities can be controlled by means of special handling instructions for the order.
Examples of instructions:
- Wrap the books in gift paper
- Add leaflet to the package
Available special handling instructions must be agreed upon in advance by requestor and CB.
Specific error messages
OMS-01097 Unknown SKU
OMS-01099 Duplicate OrderId
OMS-01100 Unknown ShipmentCode
OMS-01107 Unknown CountryCode
OMS-01202 Unknown RelationId
OMS-01315 Unknown SKU
OMS-01338 Unknown document
cancelOrderLine
The operation cancelOrderLine supports cancellation of one orderline. Cancellation is available until the orderline is released for production (“vrijgegeven”). Confirmation of the operation is provided with a http-response-code. The operation requires the OrderId and OrderLineId as input and is available for orders entered via webservices only.
Specific error messages
OMS-01201 Unable to map sending party
OMS-01216 Unable to map OrderId
OMS-01251 Unable to map OrderLineId
OMS-01269 Unable to cancel. Orderline already processed
getOrderStatus
When the status of an order or orderline is changed a notifyOrder message is sent. This is the preferred trigger to call the operation getOrderStatus.
The operation getOrderStatus provides the status summary of the requested order. An order can contain multiple orderlines, each for a specific title. The status of every orderline is reported separately. An orderline can also be reported in multiple statuses, for instance when part of the quantity is available and ready for production and the remaining quantity is in backorder.
If (a part of) the order is not delivered, the status includes an explanation why.
The operation requires the OrderId as input and available for orders entered via webservices only.
Available statuses for notifyOrder:
- New Order is accepted after being received during the service window
- InProgress Order(line) passed validation
- ProductionReady Order(line) is ready for pick/pack in warehouse
- Warning Order processing started with an issue for at least one orderline
- Processed Order is finished with shipment
- Cancelled Order is finished without shipment
Shipment
getShippingUnit
When a shipment is ready to be shipped a notifyShipment message is sent per available shipping unit. The operation getShippingUnit provides the contents of the shipping unit and the relation to order and orderlines. An order can be shipped in multiple shipping units.
The operation requires the ShippingUnitId as input.
Available statuses for notifyShipment:
- Processed ShippingUnit is ready for shipping
General webservice information
Content-Type
The content/body in the request and the response has to be / will be in json format.
Content-Type | application/json |
Servers | |
---|---|
Production | https://services.cb.nl |
Test | https://testservices.cb.nl |
Supported SSL/TLS protocols | |
---|---|
TLS Protocols | TLS1.2 |
TLS1.3 |
Authentication
CB uses message level authentication based on header parameters “UserName” and “Password”. These will be provided when you sign up for this service at CB.
Response messages
If a webservice is technical able to process, it will respond with a HTTP status 200. The response can contain a message with additional information. It can be an error (MessageType “E”) in case it wasn’t possible to supply a functional answer or additional explanation/information about the answer (MessageType “I”).
A message contains of:
A message contains of: | |
---|---|
MessageType | E or I |
MessageCode | format XXX-99999 |
MessageText | Textual information/reason |
The following generic error (E) messages are defined: | |
---|---|
WMS-00002 | Invalid username/password combination |
WMS-00004 | Not authorized to use this service |
WMS-00005 | No username and/or password provided by the caller |
EBS-11000 | Something went wrong in processing the request |
EBS-11001 | Something went wrong in processing the request |
Optional parameter
For any optional attribute one of the following options applies:
- be filled with the correct value
- be left out
- be filled with “” (read empty)
An optional parameter may therefore never be filled with the value null.
Test environment
Order simulation for test purpose
In order to test the web service independently as much as possible, a test order based on a few characteristics, that the customer provides, must be processed fully automatically. The functionality described here is available on CB's test environment, but not on the production environment.
Operation of order simulation web service MediaOrderB2C
The order simulation functionality is built into the order handling and processing.
Simulation characteristic
An order is included in the order simulation on the basis of a test characteristic in the order. The attribute identifier is:
Test attribute
$CB*TST
The attribute is 7 positions long. The maximum length of command reference fields supported is 10 positions. The remaining 3 positions are reserved for additional command instructions.
The customer can specify this attribute in one of the two order reference fields:
- BuyerReference
- OwnerReference
The customer can choose which field is used for the characteristic. The other field remains available for the customer's reference. A customer who wants to use both order reference fields in production for his own references must, in order to apply the order simulation, choose which of the two fields is “sacrificed” for the characteristic.
Order Instructions
By default one ShippingUnitID is created for each order, independent of the number of order lines, ordered copies and dimensions of the items. We simulate that everything fits into one ShippingUnitID, which gives the customer a clear expectation of the result of the order. In practice, not everything fits in a ShippingUnitID, so the customer can indicate in the order how many ShippingUnitID's CB need to create.
Test characteristic addition for more than one ShippingUnitID
This is optional and is placed after the test attribute with:
Cnn
Where nn stands for the number of ShippingUnitID's (2 to 99). For instance:
- $CB*TSTC3 => Test feature + request for 3 ShippingUnitID's
- $CB*TSTC05 => Test feature + request for 5 ShippingUnitID's
- $CB*TSTC15 => Test feature + request for 15 ShippingUnitID's
The maximum number of ShippingUnitID's to be made is equal to the number of copies ordered (i.e. 1 copy per ShippingUnitID). If more ShippingUnitID's are requested than there are ordered copies in an order, a ShippingUnitID is created for each ordered copy. No error message or warning is given.
Orderline instruction
By default, for each OrderLine, the number of copies ordered is also included in the ShippingUnitID as delivered. In practice, various scenarios are possible, as a result of which a different number of copies is delivered. The order simulation supports one scenario, a shortage ('manco') situation. The customer can indicate at the Orderline how many copies are reported missing.
Scenario 'Shortage' situation
This is optional and comes with the shortage attribute:
$MANCO;n
The customer can specify this attribute in one of the two order reference fields at Orderline level:
- BuyerReference
- OwnerReference
Where n stands for the number of ShippingUnitID's (2 to 99). For instance:
- $MANCO;1 => Request for 1 copy shortage with this order line
- $MANCO;5 => Request for 5 copy shortage with this order line
The maximum number of shortages is the number of copies ordered. If more shortages are requested than there are ordered copies in a OrderLine, then 0 (null) copies delivered are reported. No error message or warning is given. No new OrderLine for the missing copies is created. The intended situation is to deliver less than requested. Backordering is not supported in order simulation.
Test articles
Articles available for test | ||||
ISBN | Titel | DiscountCode | ProductAvailability | Stock YES/NO |
---|---|---|---|---|
9789029511537 | MediaOrderB2C Title 1 | A | Reprint/Herdruk | NO |
9789029585071 | MediaOrderB2C Title 2 | A | Announced/Aangekondigd | NO |
9789063055998 | MediaOrderB2C Title 3 | O | Not available/Uitverkocht | NO |
9789045119731 | MediaOrderB2C Title 4 | S | In stock/Verschenen | YES |
9789045119755 | MediaOrderB2C Title 5 | A | In stock/Verschenen | YES |
9789025307349 | MediaOrderB2C Title 6 | A | In stock/Verschenen | YES |
9789025308339 | MediaOrderB2C Title 7 | A | In stock/Verschenen | YES |
9789025309640 | MediaOrderB2C Title 8 | A | In stock/Verschenen | YES |
9789025309954 | MediaOrderB2C Title 9 | A | In stock/Verschenen | YES |
9789029505598 | MediaOrderB2C Title 10 | A | In stock/Verschenen | YES |
9789029506182 | MediaOrderB2C Title 11 | A | In stock/Verschenen | YES |
9789029506335 | MediaOrderB2C Title 12 | A | In stock/Verschenen | YES |
9789029506885 | MediaOrderB2C Title 13 | A | In stock/Verschenen | YES |
ONIX file with Product records: Testarticles-ini-1van1_onx.xml |
Results for customer
The customer is informed almost immediately when the order status is changed. The diagram below shows which stages are defined and which web service operations are used to communicate or make information available to the customer.
Description:
- The customer places one or more items in the shopping cart of a shop
- The webshop submits the order to CB
- CB checks the order and if accepted, CB sends an order notification with status event “In Progress”
- CB reserves stock and releases the order (line) for logistics. The order line cannot be cancelled from that moment on. CB sends an order notification with status event “ProductionReady”
- The webshop can retrieve the status of the order to see which order lines have been released
- CB performs the order simulation and sends a shipment notification per shipment unit with status event “Processed”
- The webhop can retrieve the details of each shipment unit and thus inform the customer.
Addendum
Migration strategy from batch file to webservice
Suggested migration strategy from batch file to webservice:
- Verify technical and functional process with a live connection to the CB test environment.
- Arrange for shadow-run(s) in a combination of production and test environments,, i.e. send an OPDNAW message to the CB production environment, extract a few orders and send them via the webservice to the CB test environment. CB can verify the received data in the test environment against the production data from the OPDNAW.
- Arrange for go-live date
- Send a limited number of orders via the webservice to the CB production environment. CB can monitor the processing of these orders.
- Verify the information in the order status and shipping unit operations.
- Step-by-step increase the webservice load until the required level is reached.
- If applicable then disable the file based flow.