Madics API to retrieve Stock, Customer and Price information
Minimal Alive Test
http://xxx.xxx.xxx.xxx:port/hello
To retrieve a stock item description
http://xxx.xxx.xxx.xxx:port/descr/itemcode
To retrieve Free Stock for one given stock item location
http://xxx.xxx.xxx.xxx:port/stock/itemcode/location
To retrieve Stock for multiple locations
http://xxx.xxx.xxx.xxx:port/multistock/itemcode
(More details further down)
To retrieve a stock item base price
http://xxx.xxx.xxx.xxx:port/price/itemcode
To retrieve customer specific price.
http://xxx.xxx.xxx.xxx:port/cuspri/itemcode/customercode/quantity
To retrieve a pack price (including customer specific price)
http://xxx.xxx.xxx.xxx:port/packprice/itemcode/customercode
(More details further down)
To retrieve a detailed customer specific price returning in a JSON file.
http://xxx.xxx.xxx.xxx:port/detailpricing/itemcode/customercode/quantity
(More details further down)
To retrieve a detailed price list for multiple items in a JSON file.
http://xxx.xxx.xxx.xxx:port/multipleitems/
(More details further down)
To retrieve a detailed price list of all customer specials for a single customer:
http://xxx.xxx.xxx.xxx:port/allcustpricing
(More details further down)
To retrieve a list of Web Categories (and sub categories/recursive)
http://xxx.xxx.xxx.xxx:port/catlist/web category/customer
(More details further down)
To retrieve a list of Web Categories (sub categories/recursive) with stock Item list.
http://xxx.xxx.xxx.xxx:port/catitems/web category/customer
(More details further down)
Please see HERE for the Sales Order API
Minimal Alive Test
http://xxx.xxx.xxx.xxx:port/hello
Returns "API online and available". This makes a call to Madics so i not jsut returning static text.
API Stats
http://xxx.xxx.xxx.xxx:port/apistats
Returns a JSON containing some basic stats on how often the various API calls have been made.
Pack Price - Individual item and Customer
http://xxx.xxx.xxx.xxx:port/packprice/itemcode/customercode
This returns a pack price this being: pack price = ( price / price_per ) * qty_per_box
Customer code is optional, but if passed the customer price is used instead.
Detailed Pricing - Individual item and Customer
This retrieves a JSON file returning the customer price plus detailed Madics pricing make up that includes the product and/or customer specific pricing rules.
For one item GET the following:
http://xxx.xxx.xxx.xxx:port/detailpricing/itemcode/customercode/quantity
- If the customer code is "NOCUST" then the standard pricing rules are returned that are not related to one specific customer
- Quantity must not be blank (pass 1 (one) by default)
The "price type" returned are are followed::
0 = Standard Price (no specific rules)
1 = % discount on base price.
2 = Specific special product price.
3 = % uplift on standard cost value
4 = Qty breaks
5 = Split pack charge only
Example JSON reply for type 0- Standard Price when no specific prices exist.
{
"item": "EVO132504",
"customer": "",
"qty": "1",
"standard price": "5.62",
"price list name": "BASE PRICE",
"customer price": "5.62",
"unit of measure": "Each",
"price per": "1",
"price type": "0",
"groupfielditem":"EVO12222",
"price type description": "Standard Price"
}
Example JSON reply for type 1- % discount on base price
This includes the two discount % fields.
{
"item": "LEGS",
"customer": "DAD000",
"qty": "15",
"standard price": "20",
"price list name": "BASE PRICE",
"customer price": "16.15",
"discount": "15",
"discount2": "5",
"price type": "1",
"unit of measure":"Each",
"groupfielditem":"115SMT624120",
"price per":"1",
"price type description": "% discount on standard price"
}
Madics will show:
BASE PRICE 20.00 LESS 15.00% LESS 5.00%
Example JSON reply for type 2- Specific product price:
{
"item": "STEVETEST",
"customer": "STEVE1",
"qty": "15",
"standard price": "10.34",
"price list name": "BASE PRICE",
"customer price": "5.59",
"price type": "2",
"unit of measure":"Each",
"price per":"1",
"price type description": "special product price"
}
Example JSON reply for type 4 - qty breaks
There are two types of qty breaks:
break type 1 for Qty breaks discounts
break type 2 for Qty breaks set prices
For Type 4 (break type 1) it will return a breaks array with in the JSON these contain:
QTY FROM , QTY TO , Price , Discount%
In Madics an example screen could show this as :
---- FROM - TO ---- DISC % ---- FROM - TO ---- DISC %
0 59 0% 360 719 60%
60 119 50% 720 1439 62.5%
120 239 55% 1440 99999999 65%
240 359 57.5%
For Type 4 (break type 2) it will return a breaks array with in the JSON these contain:
QTY FROM , QTY TO , Price
In Madics an example screen could show this as :
---- FROM - TO ---- PRICE ---- FROM - TO ---- PRICE
0 9 70.41 40 99999999 64.67
10 19 68.98 BASE PRICE
20 29 67.54 71.85
30 39 66.10
JSON Example:
{
"item":"SUMOGRIPC"
,"customer":"1CLA03"
,"qty":"1"
,"standard_price":"8.95"
,"price_list_name":""
,"customer_price":"8.95"
,"unit_of_measure":"Each"
,"price_per":"1"
,"groupfielditem":""
,"price_type":"4"
,"break type":"1"
,"price_type_description":"Qty breaks discount"
,"breaks": {
"break1": ["0","59","8.95","0"]
,"break2": ["60","119","4.48","50"]
,"break3": ["120","239","4.03","55"]
,"break4": ["240","359","3.8","57.5"]
,"break5": ["360","719","3.58","60"]
,"break6": ["720","1439","3.36","62.5"]
,"break7": ["1440","99999999","3.13","65"]
}
}
Where the Breaks[1-7] are: FROM QTY , TO QTY , PRICE , DISCOUNT%
Detailed Pricing - passing multiple items and customers.
For multiply items (and customers) POST the following JSON file containing the items (and quantities) required using :
http://xxx.xxx.xxx.xxx:port/multipleitems/ This will be a slower call due to the initial processing required.
- If there are multiple items return there is also a lowesthighest JSON section that will contain the lowest price and highest price from the list of items returned.
The JSON format expected from the caller is:
{
"CUST01": { "ITEMS": [{"485972FES": 1000},
{"485972FES": 1001},
{"485972FES": 1002},
{"485972FES": 1003}],
"SORTORDER": "PRICE-ASC",
"MINPRICE": -1,
"MAXPRICE": -1
}
}
"SORTORDER" is optional. Valid values are "ITEM-ASC" or "ITEM-DES" or "PRICE-ASC" or "PRICE-DES" .
The default is "ITEM-ASC"
"MINPRICE" and "MAXPRICE" are optional. MAX should be large than MIN . The default is -1 (i.e no effect)
The Madics API will return multiple items:
Example for one customer (max 100 items at a time)
{
"prices": [{
"item": "BIKE",
"customer": "DAD000",
"qty": "25",
"standard price": "19.99",
"price list name": "BASE PRICE",
"customer price": "7",
"price type": "4",
"unit of measure": "Each",
"price per": "1",
"price type description": "Qty breaks set price",
"breaks": {
"break1": ["0", "11", "200.49"],
"break2": ["12", "99999999", "7"]
}
}, {
"item": "STEVETEST",
"customer": "DAD000",
"qty": "45",
"standard price": "10.34",
"price list name": "BASE PRICE",
"customer price": "8.27",
"price type": "4",
"unit of measure": "Each",
"price per": "1",
"price type description": "Qty breaks discount",
"breaks": {
"break1": ["0", "9", "5.17"],
"break2": ["10", "19", "6.2"],
"break3": ["20", "39", "7.24"],
"break4": ["40", "49", "8.27"],
"break5": ["50", "59", "8.48"],
"break6": ["60", "69", "8.69"],
"break7": ["70", "99999999", "8.89"]
}
}, {
"item": "T08100",
"customer": "DAD000",
"qty": "10",
"standard price": "71.85",
"price list name": "BASE PRICE",
"customer price": "51.19",
"discount": "25",
"discount2": "5",
"price type": "1",
"unit of measure": "Each",
"price per": "1",
"price type description": "% discount on standard price"
}],
"lowesthighest": {
"lowestprice": "7",
"lowestitem": "BIKE",
"highestprice": "51.19",
"highestitem": "T08100"
}
}
Detailed Pricing - passing just a Web Category
To retrieve a list of stock item codes and price information based on a web category code:
http://xxx.xxx.xxx.xxx:port/webcat/webcategory/customercode
For example:
http://xxx.xxx.xxx.xxx:port/webcat/34K10/NOCUST
There are 3 optional parts to the url that can be added in turn:
Sort order that can have 4 values:
ITEM-ASC
ITEM-DESC
PRICE-ASC
PRICE-DESC
Minimum Price:
value or -1
-1 is for "no minimum"
Maximum Price:
value or -1
-1 is for "no maximum"
Note that you can't request minimums or maximums without specifying a sort order.
Extended examples:
http://xxx.xxx.xxx.xxx:port/webcat/34K10/NOCUST/PRICE-DESC/-1/50 - This asks for descending price order with no minimum and a max of 50
http://xxx.xxx.xxx.xxx:port/webcat/34K10/NOCUST/10/100 - This is probably an error as it will have default sort order ("10") and a minmum price of 150 and no maximum
Will return:
(In this example no customer code is passed so standard product pricing is returned)
{
"prices": [{
"item": "EYC110LA2LPAN",
"customer": "",
"qty": "1",
"standard price": "139",
"price list name": "",
"customer price": "139",
"price type": "0",
"price type description": "Standard Price"
}, {
"item": "CLX202AJMAK",
"customer": "",
"qty": "1",
"standard price": "139",
"price list name": "",
"customer price": "139",
"price type": "0",
"price type description": "Standard Price"
}, {
"item": "CLX201AJMAK",
"customer": "",
"qty": "1",
"standard price": "179",
"price list name": "",
"customer price": "179",
"price type": "0",
"price type description": "Standard Price"
}, {
"item": "CLX203AJX1MAK",
"customer": "",
"qty": "1",
"standard price": "149",
"price list name": "",
"customer price": "149",
"price type": "0",
"price type description": "Standard Price"
}],
"lowesthighest": {
"lowestprice": "139",
"lowestitem": "EYC110LA2LPAN",
"highestprice": "179",
"highestitem": "CLX201AJMAK"
}
}
Detailed Pricing - all special prices for a single customer
This retrieves a JSON file returning all customer special prices for one customer
GET the following:
http://xxx.xxx.xxx.xxx:port/allcustpricing/customercode
- If the customer code is "NOCUST" then the "Standard Qty Breaks" will be returned.
Multiple Location Stock
This retrieves a JSON file with the stock for a list of locations in MADWEB.INI
For one item GET the following:
http://xxx.xxx.xxx.xxx:port/multistock/itemcode
Will return example with "Location" : "Stock Qty" for each location
{
"item": "ABCDE1234",
"stock": { "01": "12",
"02": "12",
"03": "32",
"04": "10",
"05": "12",
"FG": "2542"
}
}
Web Category List (recursive)
Pass in a top level Web Category and retrieves a JSON file containing a category list (recursive) and the highest/lowest price of items with in them.
(Please note PACK PRICES are returned - See packprice API for more information)
http://xxx.xxx.xxx.xxx:port/catlist/web category/customer
(Customer code optional)
Returned JSON example:
{
"Category": "38PAA",
"Customer": "",
"Categories": {
"CatList": ["38PAA", "38ACA", "38ACAF", "38ACAV", "38AFD", "38AMD", "38AR", "38ASM", "38ASNB", "38ASS", "38CASM", "38CAVS", "38ACG", "38ACD", "38ACGB", "38ACGD", "38AGD", "38ANW", "38NWCB", "38NWCD", "38NWCM", "38NWCR", "38NWCW", "38NWRD", "38ATCT", "38TCTI", "38TCTS", "38AWB"]
},
"lowesthighest": {
"lowestprice": "1.17",
"highestprice": "325.93"
}
}
Web Category Items (recursive)
Very much the same as the above "Web Category List" call but in addition also passes back a list of the actual stock items and prices found with in the categories.
(Please note PACK PRICES are returned - See packprice API for more information)
http://xxx.xxx.xxx.xxx:port/catitems/web category/customer
(Customer code optional)
Returned JSON example:
{
"Category": "38PAA",
"Customer": "",
"Categories": {
"CatList": ["38PAA", "38ACA", "38ACAF", "38ACAV", "38AFD", "38AMD", "38AR", "38ASM", "38ASNB", "38ASS", "38CASM", "38CAVS", "38ACG", "38ACD", "38ACGB", "38ACGD", "38AGD", "38ANW", "38NWCB", "38NWCD", "38NWCM", "38NWCR", "38NWCW", "38NWRD", "38ATCT", "38TCTI", "38TCTS", "38AWB"]
},
"lowesthighest": {
"lowestprice": "10.67",
"highestprice": "52.37"
},
"Itemlist": {
"TESTITEMA": [{
"Cat": "38ACAF",
"Price": 52.37
}],
"TESTITEMB": [{
"Cat": "38ACAF",
"Price": 21.98
}],
"TESTITEMC": [{
"Cat": "38AWB",
"Price": 10.67
}]
}
}