Introduction
The Huski API is for partners and customers wanting to integrate their system with Huski's inventory and order system.
Notes on how to use the API
You will need to request an API key from us at [email protected]
The API URL is https://api.hu.ski/v1/
. To call any API endpoint (method) you must append the endpoint name and parameters to the API URL. eg: https://api.hu.ski/v1/orders
The API accepts only JSON data format.
Never assume that the API is actually online at any time. Always queue requests to the API so that you can retry the request in the event of a network failure: even if our server is up 24/7 forever, the network will not be. Consider what happens in the case of a network interruption. You should always plan to add all requests to a queue so that they can be tried again in the event of any failure.
Full documentation of each endpoint is available on that endpoint's help section below. This includes the operations supported and the full list of available fields with:
- Name
- Type
- Length
- Required values
You can see examples of each data object.
In the event of errors, the API will return an appropriate HTML status code, and an error message. You will need to read both the status code and the error message to establish the cause. Typical error messages are shown on the API status codes page.
Connecting to the API
To use the API you will need your Application key which can be requested from Huski. You API Application Key equivalent to a login and is unique to each partner. It must be kept secret and not shared in any way. If you suspect it has been shared please request a new key.
Each request to the API must include this key value sent as an HTTP header: api-auth-key
API Status Codes
Status Codes
Status Code | Description |
---|---|
200 OK |
Operation was successful |
400 Bad Request |
The request was not in a correct form, or the posted data failed a validation test. Check the error returned to see what was wrong with the request. |
403 Forbidden |
Method authentication failed |
404 Not found |
Endpoint does not exist (eg using /Products instead of /Product) |
405 Not allowed |
The method used is not allowed (eg PUT, DELETE) |
500 Internal Server Error |
The object passed to the API could not be parsed or some unexpected error occurred while processing API request |
503 Service Unavailable |
You reached 60 calls per minute API limit |
Sale Orders
Create Sale Order POST
Sale Order - Request Fields
Property
Type
Length
Required
Notes
Contact
String
256
Yes
Contact name (partner's customer)
Phone
String
50
Yes
Contact phone
Email
String
256
Yes
Contact email
ShippingAddressLine1
String
256
Yes
Sale Shipping address line 1
ShippingAddressLine2
String
256
Sale Shipping address line 2
City
String
256
Yes
City
Postcode
String
256
Yes
Post code
Country
String
256
Defaults to France if left blank
Reference
String
256
Reference number used by customer to identify this sale.
Note
String
1024
Custom Sale note
ShipBy
Date
Yes
Date when shipment is due. Needs to be in the form YYYY-MM-DD
Lines
[] Sale Order Line Model
Yes
Sale Order Line - Request Fields
Property
Type
Length
Required
Notes
SKU
String
50
Yes
Product SKU code
Quantity
Integer
Yes
Quantity of products
POST Request (PHP Example)
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.hu.ski/v1/orders");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, {
\"Contact\": \"John Smith\",
\"Phone\": \"+441909123456\",
\"Email\": \"[email protected]\",
\"ShippingAddressLine1\": \"2 Rue d'Eglise\",
\"ShippingAddressLine2\": \"Courchevel 1850\",
\"City\": \"Courchevel\",
\"Postcode\": \"73120\",
\"Country\": \"France\",
\"Reference\": \"EXAMPLE-12356\",
\"Note\": \"Deliver after 17:00. Building door code is B1234. Very cold beer please\",
\"ShipBy\": \"2019-11-01\",
\"Lines\": [
{
\"SKU\": \"C-VLAS-1\",
\"Quantity\": 2,
},
{
\"SKU\": \"D-PSBB-1-33\",
\"Quantity\": 6,
}
],
});
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Content-Type: application/json",
"api-auth-key: 12345678-1234-1234-1234-1234567489012"
));
$response = curl_exec($ch);
curl_close($ch);
var_dump($response);
}
Sale Order - Response Fields
Property
Type
Length
Required
Notes
SaleOrderNumber
String
8
Order number e.g. SO-12345
Tax
Float
2 DP
Tax in Euros
Total
Float
2 DP
Total Price with Tax in Euros
POST 200 Response (Example)
{
"SaleOrderNumber": "SO-12345",
"Tax": "4.33",
"Total": "37"
}
Products
List Products GET
GET Request (PHP Example)
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.hu.ski/v1/products");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Content-Type: application/json",
"api-auth-key: 12345678-1234-1234-1234-1234567489012"
));
$response = curl_exec($ch);
curl_close($ch);
var_dump($response);
}
Products - Response Fields
Property
Type
Length
Required
Notes
SKU
String
20
Product SKU code
Name
String
100
Product name
Category
String
100
Category name
Description
Blob
Product Description
PriceTTC
Decimal
2 DP
Sale Price with Tax in Euros
TaxRate
Decimal
2 DP
Percentage product tax
UOM
String
20
Name of unit type
Serves
Integer
5
Number of unit servings
Tags
String
100
Descriptive product tags
Image1
String
100
URL of image
Image2
String
100
URL of image
Image3
String
100
URL of image
DietaryTags
String
500
Dietary requirements
CookingTags
String
500
Info about cooking
Allergens
String
200
Listed allergens
Ingredients
Blob
Listed Ingredients
CookingInstructions
Blob
Cooking Instructions
GET 200 Response (Example)
[
{
"SKU": "A-GLFR-2",
"Name": "Gluten Free Menu",
"Category": "Menus",
"Description": "",
"PriceTTC": "25.00",
"TaxRate": "5.50",
"UOM": "people",
"Serves": "2",
"Tags": "",
"Image1": "https://hu.ski/wp-content/uploads/Three-Day-Gluten-Free-Menu-for-1.png",
"Image2": "",
"Image3": "",
"DietaryTags": "Gluten Free",
"CookingTags": "",
"Allergens": "",
"Ingredients": "",
"CookingInstructions": ""
},
{
"SKU": "A-SA2V-2",
"Name": "Savoyard Vegetarian 2 Course Menu",
"Category": "Menus",
"Description": "",
"PriceTTC": "41.60",
"TaxRate": "5.50",
"UOM": "people",
"Serves": "2",
"Tags": "savoyard,local,french",
"Image1": "https://hu.ski/wp-content/uploads/6-Day-Veggie-Menu.jpg",
"Image2": "",
"Image3": "",
"DietaryTags": "Vegetarian",
"CookingTags": "",
"Allergens": "",
"Ingredients": "",
"CookingInstructions": ""
}
]
Sale Order - Request Fields
Property | Type | Length | Required | Notes |
---|---|---|---|---|
Contact |
String | 256 | Yes | Contact name (partner's customer) |
Phone |
String | 50 | Yes | Contact phone |
Email |
String | 256 | Yes | Contact email |
ShippingAddressLine1 |
String | 256 | Yes | Sale Shipping address line 1 |
ShippingAddressLine2 |
String | 256 | Sale Shipping address line 2 | |
City |
String | 256 | Yes | City |
Postcode |
String | 256 | Yes | Post code |
Country |
String | 256 | Defaults to France if left blank | |
Reference |
String | 256 | Reference number used by customer to identify this sale. | |
Note |
String | 1024 | Custom Sale note | |
ShipBy |
Date | Yes | Date when shipment is due. Needs to be in the form YYYY-MM-DD |
|
Lines |
[] Sale Order Line Model | Yes |
Sale Order Line - Request Fields
Property | Type | Length | Required | Notes |
---|---|---|---|---|
SKU |
String | 50 | Yes | Product SKU code |
Quantity |
Integer | Yes | Quantity of products |
POST Request (PHP Example)
<?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://api.hu.ski/v1/orders"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_HEADER, FALSE); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_POSTFIELDS, { \"Contact\": \"John Smith\", \"Phone\": \"+441909123456\", \"Email\": \"[email protected]\", \"ShippingAddressLine1\": \"2 Rue d'Eglise\", \"ShippingAddressLine2\": \"Courchevel 1850\", \"City\": \"Courchevel\", \"Postcode\": \"73120\", \"Country\": \"France\", \"Reference\": \"EXAMPLE-12356\", \"Note\": \"Deliver after 17:00. Building door code is B1234. Very cold beer please\", \"ShipBy\": \"2019-11-01\", \"Lines\": [ { \"SKU\": \"C-VLAS-1\", \"Quantity\": 2, }, { \"SKU\": \"D-PSBB-1-33\", \"Quantity\": 6, } ], }); curl_setopt($ch, CURLOPT_HTTPHEADER, array( "Content-Type: application/json", "api-auth-key: 12345678-1234-1234-1234-1234567489012" )); $response = curl_exec($ch); curl_close($ch); var_dump($response); }
Sale Order - Response Fields
Property | Type | Length | Required | Notes |
---|---|---|---|---|
SaleOrderNumber |
String | 8 | Order number e.g. SO-12345 | |
Tax |
Float | 2 DP | Tax in Euros | |
Total |
Float | 2 DP | Total Price with Tax in Euros |
POST 200 Response (Example)
{ "SaleOrderNumber": "SO-12345", "Tax": "4.33", "Total": "37" }
List Products GET
GET Request (PHP Example)
<?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://api.hu.ski/v1/products"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_HEADER, FALSE); curl_setopt($ch, CURLOPT_HTTPHEADER, array( "Content-Type: application/json", "api-auth-key: 12345678-1234-1234-1234-1234567489012" )); $response = curl_exec($ch); curl_close($ch); var_dump($response); }
Products - Response Fields
Property | Type | Length | Required | Notes |
---|---|---|---|---|
SKU |
String | 20 | Product SKU code | |
Name |
String | 100 | Product name | |
Category |
String | 100 | Category name | |
Description |
Blob | Product Description | ||
PriceTTC |
Decimal | 2 DP | Sale Price with Tax in Euros | |
TaxRate |
Decimal | 2 DP | Percentage product tax | |
UOM |
String | 20 | Name of unit type | |
Serves |
Integer | 5 | Number of unit servings | |
Tags |
String | 100 | Descriptive product tags | |
Image1 |
String | 100 | URL of image | |
Image2 |
String | 100 | URL of image | |
Image3 |
String | 100 | URL of image | |
DietaryTags |
String | 500 | Dietary requirements | |
CookingTags |
String | 500 | Info about cooking | |
Allergens |
String | 200 | Listed allergens | |
Ingredients |
Blob | Listed Ingredients | ||
CookingInstructions |
Blob | Cooking Instructions |
GET 200 Response (Example)
[ { "SKU": "A-GLFR-2", "Name": "Gluten Free Menu", "Category": "Menus", "Description": "", "PriceTTC": "25.00", "TaxRate": "5.50", "UOM": "people", "Serves": "2", "Tags": "", "Image1": "https://hu.ski/wp-content/uploads/Three-Day-Gluten-Free-Menu-for-1.png", "Image2": "", "Image3": "", "DietaryTags": "Gluten Free", "CookingTags": "", "Allergens": "", "Ingredients": "", "CookingInstructions": "" }, { "SKU": "A-SA2V-2", "Name": "Savoyard Vegetarian 2 Course Menu", "Category": "Menus", "Description": "", "PriceTTC": "41.60", "TaxRate": "5.50", "UOM": "people", "Serves": "2", "Tags": "savoyard,local,french", "Image1": "https://hu.ski/wp-content/uploads/6-Day-Veggie-Menu.jpg", "Image2": "", "Image3": "", "DietaryTags": "Vegetarian", "CookingTags": "", "Allergens": "", "Ingredients": "", "CookingInstructions": "" } ]