This database schema and therefore the API is based on IDs and KEYS. IDs are just integers which always act as an internal and unique identifier for any record. However, as optimal as integer IDs are, they are very difficult to work with when a database schema is dynamic as with EAV and make APIs equally obtuse. Where appropriate and only so, if an ID can benefit from a readable KEY name then one will be assigned.

This overhead is minimal and all data-integrity will be maintained at the API level, so should you ever change a key-name which in effect would be the same as changing a field-name, data-integrity will be preserved.

All documentation web-pages are only partially responsive and desktop-designed.

Shopping Cart [Orders]

https://vshop.vadoo.co.uk/api/cart/new/{customer-no}

fetch('https://vshop.vadoo.co.uk/api/cart/new/{customer-no}')
    .then( response => response.json() )
    .then( response => {
        // Returns response.id [id=0 if invalid customer or null if API fails]
        // _.isEmpty(response) [#lodash] is useful
    })

JSON | New Cart ID Response

.. Will return a new order-no [cart-id if you prefer] for a customer.
If the customer ID is zero [or just not-found] the cart is still created with a customer_id of -1

https://vshop.vadoo.co.uk/api/cart/new/{customer-no}

https://vshop.vadoo.co.uk/api/cart/get/{cart-no}

fetch('https://vshop.vadoo.co.uk/api/cart/get/{cart-no}')
    .then( response => response.json() )
    .then( response => {
        // Returns structured `cart` object or null if API fails]

    })

JSON | Get Cart

.. Will return the cart with order-no [cart-id if you prefer].

https://vshop.vadoo.co.uk/api/cart/get/{cart-no}

https://vshop.vadoo.co.uk/api/cart/delete/{cart-no}

fetch('https://vshop.vadoo.co.uk/api/cart/delete/{cart-no}')
    .then( response => response.json() )
    .then( response => {
        // Returns TRUE or null if API fails]

    })

Delete Order or Empty + Remove Cart

.. Will return TRUE as a JSON object.

https://vshop.vadoo.co.uk/api/cart/delete/{cart-no}

https://vshop.vadoo.co.uk/api/cart/update with POST keywords-values

// jQuery Example -> see across
_data = { id: $('#UPDATE_CART_ID').val(), key: $('#CART_KEY').val(), value: $('#NEW_VALUE').val()};
fetch('https://vshop.vadoo.co.uk/api/cart/update', {
      method: "post",
      headers: { "Content-Type": "application/json; charset=utf-8" },
      body: JSON.stringify(_data)}
    )
    .then( response => response.json() )
    .then( cart => {
        // Returns `cart` = structured cart-object with products
    })

JSON | Update cart `header` values

.. Will return the cart

https://vshop.vadoo.co.uk/api/cart/update where {_data} is...

Allowed Key Values

https://vshop.vadoo.co.uk/api/cart/updateshipto with POST keywords-values

// jQuery Example -> see across
_data = { id: $('#UPDATE_CART_ID').val(), address_key: 'key_value', postcode_key: 'key_value'};
fetch('https://vshop.vadoo.co.uk/api/cart/updateshipto', {
      method: "post",
      headers: { "Content-Type": "application/json; charset=utf-8" },
      body: JSON.stringify(_data)}
    )
    .then( response => response.json() )
    .then( cart => {
        // Returns `cart` = structured cart-object with products
    })

JSON | Update cart `header` values for the ship-to address & postcode KEYS

.. Will return the cart

This API is really a duplicate of /api/cart/update [see above],
but makes two table updates in one call. Note that we only change KEY values here;
never hard-data as those are attributes of the customer.

https://vshop.vadoo.co.uk/api/cart/add with POST keywords-values

// jQuery Example -> see across
_data = { cart_id: $('#ADD_CART_ID').val(), product_id: $('#ADD_CART_PRODUCT_ID').val(),
quantity: $('#ADD_CART_QUANTITY').val(), bundle: $('#ADD_BUNDLE_TRUE').val(),
options: [array_of_attribute_options]};

fetch('https://vshop.vadoo.co.uk/api/cart/add', {
      method: "post",
      headers: { "Content-Type": "application/json; charset=utf-8" },
      body: JSON.stringify(_data)}
    )
    .then( response => response.json() )
    .then( cart => {
        // Returns `cart` = structured cart-object with products
    })

JSON | Add a product to an existing cart

.. Will return the cart

https://vshop.vadoo.co.uk/api/cart/add where {_data} is...

Is the Product ID a bundle ?

https://vshop.vadoo.co.uk/api/cart/deleteItem/{cart-item-id}

fetch('https://vshop.vadoo.co.uk/api/cart/deleteItem/{cart-item-id}')
    .then( response => response.json() )
    .then( response => {
        // Returns `cart` = structured cart-object with products

    })

JSON | Delete an order line from the Order/Cart

.. .. Will return the new cart

https://vshop.vadoo.co.uk/api/cart/deleteItem/{cart-item-no}

https://vshop.vadoo.co.uk/api/cart/updateItem with POST keywords-values

// jQuery Example -> see across
_data = { id: $('#UPDATE_CART_ITEM_ID').val(), quantity: $('#NEW_ITEM_VALUE').val() };
fetch('https://vshop.vadoo.co.uk/api/cart/updateItem', {
      method: "post",
      headers: { "Content-Type": "application/json; charset=utf-8" },
      body: JSON.stringify(_data)}
    )
    .then( response => response.json() )
    .then( cart => {
        // Returns `cart` = structured cart-object with products
    })

JSON | Updates an order line value

.. Will return the new cart

https://vshop.vadoo.co.uk/api/cart/updateItem where {_data} is...

Allowed Key Values