This is documentation of the legacy ShopApi/v2 and is no longer recommended as it is will become obsolete.
Synchronizing Products
When creating a product in your application, this product also needs to be created in the ERP. The preferred workflow for this is to check if the product already exists first and, if not, create the product.
Searching for a product
For this action, we use the following URL: /product/search. Below is an example of this request, including the Authorization header.
Request:
POST /product/search HTTP/1.1
Host: shopapi.activeants.nl
Accept-encoding: gzip, deflate
Content-Type: application/json
User-Agent: Zend_Http_Client
Authorization: bearer O2uq0ZUcar4EKwnSI9LHIiXI
Content-Length: 33
{"Sku":"Rok","Barcode":null}
Add product
If the product does not exist in the ERP, it needs to be created:
Request:
POST /product/add HTTP/1.1
Host: shopapi.activeants.nl
Accept-encoding: gzip, deflate
Content-Type: application/json
User-Agent: Zend_Http_Client
Authorization: bearer O2uq0ZUcar4EKwnSI9LHIiXI
Content-Length: 102
{"Sku":"rk01","Weight":"1","Name":"Rok","Description":"Blauwe
rok","EncodedImage":0}
Modify product
When the product exists in the ERP, it needs to be modified:
Request:
POST /product/edit HTTP/1.1
Host: shopapi.activeants.nl
Accept-encoding: gzip, deflate
Content-Type: application/json
User-Agent: Zend_Http_Client
Authorization: bearer tWeaqixbORHZJpsrTJa3qFN
Content-Length: 102
{"Sku":"rk01","Weight":"1","Name":"Rokje","Description":"Blauwe
rok","EncodedImage":0}
5. Getting product stock from ERP
After creating or canceling an order, the stock of the order items changes. The stock information in the ERP is leading. That’s why it is possible to request the stock for a single product or get the stock for all the products where the stock has been changed.
Below is an example of getting the stock of a single product: Request:
GET stock/get/testtest HTTP/1.1
Host: shopapi.activeants.nl
Accept-encoding: gzip, deflate
User-Agent: Zend_Http_Client
Authorization: bearer 7jPO2uq0ZUcar4EKwnSI9LHIiXI
Response:
{
"messageCode": "OK",
"message": "Found stock for the provided information.",
"result": 155
}
The operation for getting bulk information is under construction and will be ready soon.
6. Creating orders with API
After an order has been created in your application, this order also needs to be created in the ERP. Before you can create the order, you first have to check if the order already exists to prevent duplicate orders. Costs other than the price of the products, like shipping or discount amounts, need to be manually created in our ERP. These products are changed by us to service products without stock. After that, you can use them as OrderItems.
Search for order
For this action, we use the following URL: /order/search. Below is an example of this request and its response.
Request:
POST /order/search HTTP/1.1
Host: shopapi.activeants.nl
Accept-encoding: gzip, deflate
Content-Type: application/json
User-Agent: Zend_Http_Client
Authorization: bearer bHzwCyC1M7jPO2uq0ZUcar4EKwnSI9LHIiXI
Content-Length: 35
{"ExternalOrderNumber":"100000053"}
Response:
{
"messageCode": "NOK",
"message": "Order not found.",
"result": null
}
Add order
If the order doesn’t exist in the ERP, it needs to be created:
Request:
POST /order/add HTTP/1.1
Host: shopapi.activeants.nl
Accept-encoding: gzip, deflate
Content-Type: application/json
User-Agent: Zend_Http_Client
Authorization: bearer 0wnkJrTllAE
Content-Length: 913
{
"ExternalOrderNumber": "100000053",
"PreferredShippingDate": "2015-03-12",
"Email": "jan@jansen.com",
"LanguageId": "?", // The mapped value from the settings
"OrderTypeId": "?", // The mapped value from the settings
"PaymentMethodId": "?", // The mapped value from the settings
"ShippingMethodId": "?", // The mapped value from the settings
"OrderItems": [
{
"Sku": "dre688",
"Name": "Snijset(688)",
"Price": "3.9800",
"Quantity": 1,
"Vat": 0.21
},
{
"Sku": "toover",
"Price": "4.9500",
"Quantity": 1,
"Vat": 0.17
}
],
"PhoneNumber": "0612912034",
"BillingAddressFirstName": "Jan",
"BillingAddressLastName": "Jansen",
"BillingAddressPostalCode": "7555KN",
"BillingAddressStreet": "teststraat",
"BillingAddressHouseNumber": "15",
"BillingAddressHouseNumberAddition": "C",
"BillingAddressCityName": "Groningen",
"BillingAddressCountryIso": "?", // The mapped value from the settings
"DeliveryAddressFirstName": "Jan",
"DeliveryAddressLastName": "Jansen",
"DeliveryAddressPostalCode": "7555KN",
"DeliveryAddressStreet": "teststraat",
"DeliveryAddressHouseNumber": "15",
"DeliveryAddressHouseNumberAddition": "C",
"DeliveryAddressCityName": "Groningen",
"DeliveryAddressCountryIso": "?" // The mapped value from the settings
}
Response:
{
"messageCode": "OK",
"message": "Order has been successfully added.",
"result": 2115460
}