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.

Customers [EAV]

https://vshop.vadoo.co.uk/api/customer/get/{id}

JSON | [Object]

{'id', 'email', '#password'}
https://vshop.vadoo.co.uk/api/customer/get/{id} with a {id} of your choosing. {$id} can be either the unique MySQL #ID or an eMail address.

https://vshop.vadoo.co.uk/api/customer/login

_data = {email: $(...).val(), password: $(...).val() };
fetch('https://vshop.vadoo.co.uk/api/customer/login', {
      method: "post",
      headers: { "Content-Type": "application/json; charset=utf-8" },
      body: JSON.stringify(_data)}
    )
    .then( response => response.json() )
    .then( response => {
        // Returns full object [same as /get]
        // e.g. here response.header.id, .email, .(hashed)password
        // _.isEmpty(response) [#lodash] is useful
    })

JSON | [Object] Existing Customer

..same as the above get but takes the user's email and [not hashed] password as post-data. Will return the customer object if valid or null if not.

https://vshop.vadoo.co.uk/api/customer/login
customer.header.id

https://vshop.vadoo.co.uk/api/customer/new

This will also populate the customer EAV with all the current attributes

JSON | [Object] New Customer

{'id', ....}
https://vshop.vadoo.co.uk/api/customer/new

https://vshop.vadoo.co.uk/api/customer/delete/{id}

fetch('https://vshop.vadoo.co.uk/api/customer/delete/' + _id)
    .then( response => response.json() )
    .then( response => {
        // response.success will be 0 or 1
    })

JSON | [Object] Deletes Customer and ALL attributes. ! CAREFUL !

{'success'}
https://vshop.vadoo.co.uk/api/customer/delete/{id} with a {id} of your choosing.

response.success

https://vshop.vadoo.co.uk/api/customer/update/{id} with POST object

// jQuery Example -> see across
_data = {email: $('#NEW_EMAIL').val(), password: $('#NEW_PASSWORD').val() };
fetch('https://vshop.vadoo.co.uk/api/customer/update/' + _id, {
      method: "post",
      headers: { "Content-Type": "application/json; charset=utf-8" },
      body: JSON.stringify(_data)}
    )
    .then( response => response.json() )
    .then( response => {
        // Returns full object [same as /get]
        // e.g. here response.header.id, .email, .(hashed)password
        // _.isEmpty(response) [#lodash] is useful
    })

Updates a Customer eMail/password returns new [Object]

...same as /get. Will return null if this fails. You can click on this link to Update a customer header https://vshop.vadoo.co.uk/api/customer/update/{_id} where {_id}, {email, password} are

customer.header.id
customer.header.email (updated)
customer.header.(hashed)password (updated)

https://vshop.vadoo.co.uk/api/customer/header/{id} with POST object

_data = {key: 'international', value: '1' };
fetch('https://vshop.vadoo.co.uk/api/customer/header/' + _id, {
      method: "post",
      headers: { "Content-Type": "application/json; charset=utf-8" },
      body: JSON.stringify(_data)}
    )
    .then( response => response.json() )
    .then( response => {
        // Returns full object [same as /get]

    })

Updates a single Customer `header-field` record, e.g. `international` | returns new [Object]

In the current release there are very few fixed-fields [ we prefer EAV ], but sometimes you have to commit and just insist on a field. `international` is one such example, as we need to know this for shipping. vShop is quite happy to accept future fixed fields for customers, e.g. `gender` or perhaps `terms_confirmed`.

Such an update could be part of bespoke install, which we do not recommend.

https://vshop.vadoo.co.uk/api/customer/post/{id} with POST key/value

// jQuery Example -> see across
_data = { key: $('#POST_KEY').val(), value: $('#POST_VALUE').val() };
fetch('https://vshop.vadoo.co.uk/api/customer/post/' + _id, {
      method: "post",
      headers: { "Content-Type": "application/json; charset=utf-8" },
      body: JSON.stringify(_data)}
    )
    .then( response => response.json() )
    .then( response => {
        // Returns full object [same as /get]
        // _.isEmpty(response) [#lodash] is useful
    })

Update/Create a Customer's Attribute Key/Value returns new [Object]

...same as /get. Will return null if this fails. You can click on this link to Update a key/value pair https://vshop.vadoo.co.uk/api/customer/post/{_id} where {_id}, {key,value} are

customer.header.id
customer.key
customer.key.value (updated)

https://vshop.vadoo.co.uk/api/customer/attributes

fetch('https://vshop.vadoo.co.uk/api/customer/attributes')
    .then( response => response.json() )
    .then( response => {
        // response: array of `user-editable` customer attributes
    })

JSON | [Object] of all customer [editable] attributes
https://vshop.vadoo.co.uk/api/customer/attributes



Addresses [EAV]

https://vshop.vadoo.co.uk/api/customer/addresses

fetch('https://vshop.vadoo.co.uk/api/customer/addresses')
    .then( response => response.json() )
    .then( response => {
        // response: array of `address` keys
    })

JSON | [Object] of all customer address keys
https://vshop.vadoo.co.uk/api/customer/addresses

https://vshop.vadoo.co.uk/api/customer/addresses/get/{customer_id}

fetch('https://vshop.vadoo.co.uk/api/customer/addresses/get/{customer_id}')
    .then( response => response.json() )
    .then( response => {
        // response: array of `addresses`
    })

JSON | [Object] of the customer's addresses
https://vshop.vadoo.co.uk/api/customer/addresses/get/{customer_id}

https://vshop.vadoo.co.uk/api/customer/addresses/new/{customer_id}

fetch('https://vshop.vadoo.co.uk/api/customer/addresses/new/{customer_id}')
    .then( response => response.json() )
    .then( response => {
        // response: new Customer Object
    })

JSON | Customer [Object] with `new` address
https://vshop.vadoo.co.uk/api/customer/addresses/new/{customer_id}