API > Examples

Examples

GET all data for a product using SKU:

https://{USERNAME}.vendo.co.nz/api/product?api_key=YOUR_API_KEY&sku=ABC123

GET the price, sale price and stock for a product using SKU:

https://{USERNAME}.vendo.co.nz/api/product?api_key=YOUR_API_KEY&sku=ABC123&fields=price,sale_price,stock

GET all data for all products:

https://{USERNAME}.vendo.co.nz/api/products?api_key=YOUR_API_KEY

GET all data for all categories:

https://{USERNAME}.vendo.co.nz/api/categories?api_key=YOUR_API_KEY

Use GET to update a price

product_id or sku is required for update—if no sku or product_id, and name is supplied, a new record is created.

https://{USERNAME}.vendo.co.nz/api/product?api_key=YOUR_API_KEY&sku=ABC123&price=12.95

Use GET to add an image

product_id or sku is required (image_title is optional)

https://{USERNAME}.vendo.co.nz/api/product?api_key=YOUR_API_KEY&sku=ABC123&image_url=http://www.mywebsite.com/images/abc.jpg&image_title=Small%20Red

Use GET to update product status to out of stock*

*See Status IDshttps://{USERNAME}.vendo.co.nz/api/product?api_key=YOUR_API_KEY&sku=ABC123&status_id=4

Using POST method to update a product

<form method="post" action="https://{USERNAME}.vendo.co.nz/api/product">
 <input type="hidden" name="api_key" value="YOUR_API_KEY">
 <input type="hidden" name="product_id" value="123">
 <input type="hidden" name="price" value="123">
 <input type="hidden" name="status_id" value="0">
 <input type="hidden" name="stock" value="5">
 <input type="hidden" name="image_url" value="http://www.mywebsite.com/images/abc.jpg">
 <input type="hidden" name="image_title" value="Small / Red">
</form>

Use POST to update products:

<form method="post" action="https://{USERNAME}.vendo.co.nz/api/products">
 <input type="hidden" name="api_key" value="YOUR_API_KEY">
 
 <!-- update 4 products (product_id or sku is required) -->
 
 <input type="text" name="product_id[1]" value="13">
 <input type="text" name="price[1]" value="12.30">
 <input type="text" name="status_id[1]" value="0">
 <input type="text" name="stock[1]" value="5">
 
 <input type="text" name="product_id[2]" value="25">
 <input type="text" name="price[2]" value="45.65">
 <input type="text" name="status_id[2]" value="0">
 <input type="text" name="stock[2]" value="5">
 
 <input type="text" name="product_id[3]" value="3">
 <input type="text" name="price[3]" value="72.90">
 <input type="text" name="status_id[3]" value="0">
 <input type="text" name="stock[3]" value="5">
 
 <input type="text" name="product_id[4]" value="109">
 <input type="text" name="price[4]" value="98.50">
 <input type="text" name="status_id[4]" value="0">
 <input type="text" name="stock[4]" value="5">
 
</form>

Use POST to insert products:

<form method="post" action="https://{USERNAME}.vendo.co.nz/api/products">
 <input type="hidden" name="api_key" value="YOUR_API_KEY">
 
 <!-- insert 3 products (name is required) -->
 
 <input type="text" name="product_id[11]" value=""> *
 <input type="text" name="name[11]" value="Sports Shoes">
 <input type="text" name="price[11]" value="99.95">
 <input type="text" name="status_id[11]" value="0">
 <input type="text" name="category_id[11]" value="17">
 <input type="text" name="stock[11]" value=""> **
 
 <input type="text" name="product_id[12]" value="1245"> +
 <input type="text" name="name[12]" value="Jogging Shoes">
 <input type="text" name="price[12]" value="79.95">
 <input type="text" name="status_id[12]" value="0">
 <input type="text" name="category_id[12]" value=""> 
 <input type="text" name="stock[12]" value="">
 
 <input type="text" name="product_id[13]" value="">
 <input type="text" name="name[13]" value="Casual Shoes">
 <input type="text" name="price[13]" value="49.95">
 <input type="text" name="status_id[13]" value="0">
 <input type="text" name="category_id[13]" value="Footwear"> 
 <input type="text" name="stock[13]" value="5">
 
</form>

When updating or inserting, Vendo API will attempt to match an existing product with the product_id, (or an existing category with the category_id etc) or sku. If no product_id or sku is found or supplied, a new product is created.

* To update a product, the product_id parameter is required, although its value can be empty. The index, in this case 11, can be used as the product_id if value is empty.For product_id[11] if the product_id of 11 is not in the database a new product is inserted.
** Set stock to no value for no stock limit.
+ In this example a value for product_id is included "1245", if there is an existing product with product_id 1245 it will be updated, if not, a new product is created with product_id 1245

When category_id is empty or not supplied, product is inserted into "none" category.
When category_id is not a number Vendo will attempt to match the name, then url of an existing category to identify the category_id. If not found a new category is created.

The SKU may also be used instead of the product_id. (If there is no existing matching SKU a new product is created).

<form method="post" action="https://{USERNAME}.vendo.co.nz/api/products">
 <input type="hidden" name="api_key" value="YOUR_API_KEY">
 
 <!-- insert 1 products (name is required) -->
 
 <input type="text" name="sku[11]" value="F1109DE">
 <input type="text" name="name[11]" value="Sports Shoes">
 <input type="text" name="price[11]" value="99.95">
 <input type="text" name="status_id[11]" value="0">
 <input type="text" name="category_id[11]" value="17">
 <input type="text" name="stock[11]" value="">
 
</form>

The index may be blank when only one product is posted.

<form method="post" action="https://{USERNAME}.vendo.co.nz/api/products">
 <input type="hidden" name="api_key" value="YOUR_API_KEY">
 
 <!-- update 1 product -->
 
 <input type="text" name="sku[]" value="F1109DE">
 <input type="text" name="price[]" value="99.95">
 <input type="text" name="sale_price[]" value="89.00">
 
</form>

The index must be different for each product:

<form method="post" action="https://{USERNAME}.vendo.co.nz/api/products">
 <input type="hidden" name="api_key" value="YOUR_API_KEY">
 
 <input type="text" name="product_id[1]" value="">
 <input type="text" name="name[1]" value="Sports Shoes">
 <input type="text" name="price[1]" value="99.95">
 
 This is wrong, index 1 already used!
 
 <input type="text" name="product_id[1]" value="">
 <input type="text" name="name[1]" value="Ladies Dress">
 <input type="text" name="price[1]" value="59.95">
 
 This is ok, index xyz and 135 are unique, product_id is 1245 and 1278
 
 <input type="text" name="product_id[xyz]" value="1245">
 <input type="text" name="name[xyz]" value="Ladies Dress">
 <input type="text" name="price[xyz]" value="59.95">
 
 <input type="text" name="product_id[135]" value="1278">
 <input type="text" name="name[135]" value="Ladies Hat">
 <input type="text" name="price[135]" value="29.95">
 
</form>

×