This s a documentation page for our shiny new REST API - you weren't meant to find it. This API isn't ready for public use yet. We're chopping and changing it a LOT as we grow it. So if you build something that uses it then it's very likely to break in a future update. Don't say you weren't warned!
URL: | https://api.kashflow.com/v2/products |
Method(s): | Get, Post |
Response Formats: | JSON, XML |
Description: | Returns a paginated list of products by nominal code, creates product |
Parameters
Name | Type | Description |
---|---|---|
Id | Numeric | Unique product id |
Code | String | Unique product code |
NominalCode | String | Code of the parent nominal for this product |
NominalId | Numeric | Unique id of the nominal |
Name | String | Product name |
Description | String | Product description |
AutoFillLineItem | Boolean | If true, then when the user selects this code they expect other form fields to be pre-filled with the information |
Price | Numeric | Auto-fill price value of the product |
WholeSalePrice | Numeric | If the customer for which the invoice is being created has wholesale pricing enabled then this price should be used for pre-filling form fields instead of the value in Price |
VATRate | Numeric | Auto-fill Vat rate of the product |
ManageStockLevel | Boolean | If true then the user wished to manage stock levels for this product |
QuantityInStock | Numeric | Indicates the quantity in stock. This is automatically decreased when lines of this item are added to a sales invoice |
StockWarningQuantity | Numeric | This is the warning threshold for the nominal code. The user wishes to be alerted if the quantity drops below this level |
IsDefault | Boolean | Indicates if the product is the default one to display |
InUse | Boolean | Indicates if product is in use and to be displayed in product list |
PurchaseNominalId | Numeric | The figure held for the Qty in Stock will be automatically incremented when the nominal code indicated is purchased |
PurchaseSubNominalId | Numeric | If present then only purchases matching both the nominal code above AND this product code will result in the stock levels being automatically incremented |
GET Operation
Returns a paginated list of products. To GET list of products-URL : /v2/nominals/{nominalcode}/products?page={page}&perpage={perpage}&sortcolumn={sortcolumn}&order={order}&filterbycharacter={filterbycharacter}&filterbyinuseonly={filterbyinuseonly}
A paginated list of products is returned (ordered by product id in ascending order).
Example response for GET of product list
{
"Data": [{
"AutoFillLineItem": true,
"Code": "AV201ACI",
"Description": "AV201ACI ACDC Black ice white L",
"InUse": true,
"IsDefault": false,
"ManageStockLevel": true,
"Name": "AV201ACI ACDC Black ice white L",
"NominalCode": 4914,
"Price": 13.85,
"PurchaseNominalId": 0,
"PurchaseSubNominalId": 0,
"QuantityInStock": 9,
"StockWarningQuantity": 10,
"VATExempt": false,
"VATRate": 0.0000,
"WholeSalePrice": 0.0000
}, {
"AutoFillLineItem": true,
"Code": "AV201ACI",
"Description": "AV201ACI ACDC Black ice white XL",
"InUse": true,
"IsDefault": false,
"ManageStockLevel": true,
"Name": "AV201ACI ACDC Black ice white XL",
"NominalCode": 4914,
"Price": 13.85,
"PurchaseNominalId": 0,
"PurchaseSubNominalId": 0,
"QuantityInStock": 9,
"StockWarningQuantity": 10,
"VATExempt": false,
"VATRate": 0.0000,
"WholeSalePrice": 0.0000
}, {
"AutoFillLineItem": true,
"Code": "AV201CHI",
"Description": "AV201CHI CHILLI PEPPERS WHITE S",
"InUse": true,
"IsDefault": false,
"ManageStockLevel": true,
"Name": "AV201CHI CHILLI PEPPERS WHITE S",
"NominalCode": 4914,
"Price": 13.85,
"PurchaseNominalId": 0,
"PurchaseSubNominalId": 0,
"QuantityInStock": 9,
"StockWarningQuantity": 10,
"VATExempt": false,
"VATRate": 0.0000,
"WholeSalePrice": 0.0000
}, {
"AutoFillLineItem": true,
"Code": "AV201CHI",
"Description": "AV201CHI CHILLI PEPPERS WHITE M",
"InUse": true,
"IsDefault": false,
"ManageStockLevel": true,
"Name": "AV201CHI CHILLI PEPPERS WHITE M",
"NominalCode": 4914,
"Price": 13.85,
"PurchaseNominalId": 0,
"PurchaseSubNominalId": 0,
"QuantityInStock": 9,
"StockWarningQuantity": 10,
"VATExempt": false,
"VATRate": 0.0000,
"WholeSalePrice": 0.0000
}, {
"AutoFillLineItem": true,
"Code": "AV201CHI",
"Description": "AV201CHI CHILLI PEPPERS WHITE L",
"InUse": true,
"IsDefault": false,
"ManageStockLevel": true,
"Name": "AV201CHI CHILLI PEPPERS WHITE L",
"NominalCode": 4914,
"Price": 13.85,
"PurchaseNominalId": 0,
"PurchaseSubNominalId": 0,
"QuantityInStock": 9,
"StockWarningQuantity": 10,
"VATExempt": false,
"VATRate": 0.0000,
"WholeSalePrice": 0.0000
}],
"MetaData": {
"FirstPageUrl": "http:\/\/securedwebapp.com\/RestApi\/\/nominals\/4914\/products?page=1&perpage=5&sortby=ProductCode&order=Asc",
"LastPageUrl": "http:\/\/securedwebapp.com\/RestApi\/\/nominals\/4914\/products?page=66&perpage=5&sortby=ProductCode&order=Asc",
"NextPageUrl": "http:\/\/securedwebapp.com\/RestApi\/\/nominals\/4914\/products?page=4&perpage=5&sortby=ProductCode&order=Asc",
"PreviousPageUrl": "http:\/\/securedwebapp.com\/RestApi\/\/nominals\/4914\/products?page=2&perpage=5&sortby=ProductCode&order=Asc",
"TotalRecords": 330
}
}
Request Parameters
Name | Description |
---|---|
page | The product page number |
perpage | Number of records to be fetched |
sortby | Index of the column on which sorting needs to be applied. The acceptable values for this parameter are: 1. ProductCode 2. ProductName 3. NominalCode |
order | Sort direction can be either Asc for ascending or Desc for descending. |
filterbycharacter | Filter product list that starts with given filter characters in product name. |
filterbyinuseonly | True fetches only products which are in use. False fetches products which are in use as well as not in use |
POST Operation
Product can be created by supplying Code, Name and NominalCode (of product’s parent)
Creates a new product record with the given data using following URL –
URL : /v2/products
Example request for POST of product.
//Any other property than the 3 mentioned in below request will be ignored and defaulted to what is in response.
{
"Code": "AV201CHI",
"Name": "CHILLI PEPPERS WHITE LARGE",
"NominalCode": 4914
}
Example response for POST of product
{
"AutoFillLineItem": false,
"Code": "AV201CHI",
"Description": "",
"InUse": true,
"IsDefault": false,
"ManageStockLevel": false,
"Name": "CHILLI PEPPERS WHITE LARGE",
"NominalCode": 4914,
"Price": 0,
"PurchaseNominalId": 0,
"PurchaseSubNominalId": 0,
"QuantityInStock": 0,
"StockWarningQuantity": 0,
"VATExempt": false,
"VATRate": 0.0000,
"WholeSalePrice": 0.0000
}