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.
https://vshop.vadoo.co.uk/api/product/get/{id}
fetch('https://vshop.vadoo.co.uk/api/product/get/' + _id) .then( response => response.json() ) .then( product => { // product.header.name is the product name // run the API yourself to see the object // another example might be product.image.PRIMARY_PHOTO })
JSON | Product [Object]
header {'id', 'name', 'description', 'category_key'} and attribute arrays
https://vshop.vadoo.co.uk/api/product/get/{id} with a {product-id} of your choosing.
Also works where {id} is the `name` of the product [SEO friendly]
https://vshop.vadoo.co.uk/api/product/getcategory/{key}. You can also use /all or just /
fetch('https://vshop.vadoo.co.uk/api/product/getcategory/' + _key) .then( response => response.json() ) .then( products => { // array of products in the above /get format products.forEach(function(product) { console.log('[API].. ' + product.header.id); }); })
JSON | Array of Products Objects
https://vshop.vadoo.co.uk/api/product/getcategory/{key} with a {key} of your choosingor use /all or / for all products
https://vshop.vadoo.co.uk/api/product/new
fetch('https://vshop.vadoo.co.uk/api/product/new') .then( response => response.json() ) .then( response => { // response.id is the new product ID })
JSON | Product ID
{'id'} ... You can click on this link to ADD a product https://vshop.vadoo.co.uk/api/product/new
response.id |
https://vshop.vadoo.co.uk/api/product/delete/{id}
fetch('https://vshop.vadoo.co.uk/api/product/delete/' + _id) .then( response => response.json() ) .then( response => { // response.id is the deleted product ID // ZERO if not found, but still 200 Return Code })
JSON | Product ID
{'id'} ... Will return id of ZERO if not found. You can click on this link to DELETE a product https://vshop.vadoo.co.uk/api/product/delete/{_id} where {product-id} is
response.id |
https://vshop.vadoo.co.uk/api/product/update/{id} with POST object
// jQuery Example -> see across _data = {name: $('#NEW_NAME').val(), description: $('#NEW_DESCRIPTION').val() }; fetch('https://vshop.vadoo.co.uk/api/product/update/' + _id, { method: "post", headers: { "Content-Type": "application/json; charset=utf-8" }, body: JSON.stringify(_data)} ) .then( response => response.json() ) .then( product => { // Returns full object [same as /get] // e.g. here product.header.id, .name, .description // _.isEmpty(response) [#lodash] is useful })
Updates a Product Header returns new [Object]
...same as /get. Will return null if this fails. You can click on this link to Update a product header https://vshop.vadoo.co.uk/api/product/update/{_id} where {product-id}, {name,description} are
product.header.id | |
product.header.name | |
product.header.description |
https://vshop.vadoo.co.uk/api/product/updatecategory/{id}/{key}
// jQuery Example -> see across fetch('https://vshop.vadoo.co.uk/api/product/updatecategory/' + _id + '/' + _key, { method: "post" ) .then( response => response.json() ) .then( product => { // Returns full object [same as /get] // e.g. here product.header.category_key // _.isEmpty(response) [#lodash] is useful })
Updates a Product Category Key returns new [Object]
...same as /get. Will return null if this fails. You can click on this link to Update a product category key https://vshop.vadoo.co.uk/api/product/updatecategory/{_id}/{_key} where {product-id}, {_key} are
product.header.id | |
product.header.category_key |
https://vshop.vadoo.co.uk/api/product/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/product/post/' + _id, { method: "post", headers: { "Content-Type": "application/json; charset=utf-8" }, body: JSON.stringify(_data)} ) .then( response => response.json() ) .then( product => { // Returns full object [same as /get] // _.isEmpty(response) [#lodash] is useful })
Update/Create a Product'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/product/post/{_id} where {product-id}, {key,value} are
product.header.id |
https://vshop.vadoo.co.uk/api/product/search with POST keywords-values
// jQuery Example -> see across _data = { keywords: $('#POST_KEYWORDS').val() }; fetch('https://vshop.vadoo.co.uk/api/product/search', { method: "post", headers: { "Content-Type": "application/json; charset=utf-8" }, body: JSON.stringify(_data)} ) .then( response => response.json() ) .then( products => { // Returns full object [same as /get] // _.isEmpty(response) [#lodash] is useful })
Search all Product Names, Descriptions and Attributes for partial-keywords: returns new product-list [Object]. This is an `AND` search so if two keywords are used they must both appear, but not necessarily together. This is by far the most asked for search algorithm.
...same as /get. Will return null if no matches https://vshop.vadoo.co.uk/api/product/search where {keywords} is
https://vshop.vadoo.co.uk/api/product/matches/{_id}.
fetch('https://vshop.vadoo.co.uk/api/product/matches/' + _id) .then( response => response.json() ) .then( products => { // array of products in the above /get format products.forEach(function(product) { console.log('[API].. ' + product.header.id); }); })
JSON | Array of `similiar` Products Objects
https://vshop.vadoo.co.uk/api/product/matches/{_id} with a product {_id} of your choosinghttps://vshop.vadoo.co.uk/api/product/reviews/get/{_id}.
fetch('https://vshop.vadoo.co.uk/api/product/reviews/get/' + _id) .then( response => response.json() ) .then( reviews => { // array of reviews reviews.forEach(function(review) { console.log('[API].. ' + review.review); }); })
JSON | Array of `user` Review Objects
https://vshop.vadoo.co.uk/api/product/reviews/get/{_id} with a product {_id} of your choosinghttps://vshop.vadoo.co.uk/api/product/review/new with POST keywords-values
// jQuery Example -> see across _data = { product_id: $('#NEW_REVIEW_PRODUCT_ID').val(), user_id: $('#NEW_REVIEW_USER_ID').val(), review: $('#NEW_REVIEW_TEXT').val(), stars: $('#NEW_REVIEW_STARS').val()}; fetch('https://vshop.vadoo.co.uk/api/product/review/new', { method: "post", headers: { "Content-Type": "application/json; charset=utf-8" }, body: JSON.stringify(_data)} ) .then( response => response.json() ) .then( response => { // Returns id of review as response.id })
Add a new product review https://vshop.vadoo.co.uk/api/product/review/new where {data} is...
Review Response ID |
https://vshop.vadoo.co.uk/api/product/featured.
fetch('https://vshop.vadoo.co.uk/api/product/featured) .then( response => response.json() ) .then( products => { // array of products in the above /get format products.forEach(function(product) { console.log('[API].. ' + product.header.id); }); })