OCAPI flash 19.10

Flash is a property of documents and contains special information about the document.

Such information could be:

It is currently only used at the basket document. The presence of a flash indicates a reason why the basket cannot yet be submitted. See examples of basket resource.

In the Scripting API, flashes can be read from, added to or removed from a document using the methods addFlash, removeFlash and flashes or getFlashes(). Flashes can be added to any object within the structure of the document - for example a flash may be added to the baskets billing address with the path $.post_code or to one of the baskets product items with path $.adjusted_price. Before sending the response to the client, such flashes are aggregated to the document and their paths are adjusted appropriately, in our example to $.billing_address.post_code and $.product_items[0].adjusted_price.

Example usage showing addition, listing, and removal of flashes:

exports.validateBasket = function(basketResponse) {
       type: "MyType",
       message: "My message",
       path: "my_path",
       details: {
           "k1": "v1",
           "k2": "v2"
    var flashToRemove;
    for each(f in basketResponse.flashes) {
      if (f.type == "SomeOtherType") {
        flashToRemove = f;
    if (flashToRemove != null) {