Back to top

HOGASHOP API

API Plans

An API user can subscribe to one of the following plans:

  1. Free

  2. Pro

  3. Enterprise

Please refer to the website for more information https://hogalog.ch/preise-api/

Rate limiting

The data of the catalog output is refreshed based on the API plans as follows:

  • Free plan: monthly on 1st day of a month, at 08:10

  • Pro plan: weekly on Monday mornings, 08:30

  • Enterprise plan: daily in the morning, at 08:00

Provided information

The Free plan does not contain price information.

Ordering

  • Free & Pro plan: Use the basket endpoints to manage the basket. Provide the current basket-revision to the order endpoint to place an order from the basket.

  • Enteprise plan: Submit orders directly with the order endpoint, skipping the basket. It is recommended to calculate the basket items before submitting (basket calculate endpoint).

Departments

  • GET /paginated/departments

Resource

GET/paginated/departments{?search,limit,offset,sortBy,sortOrder,customerId}

Returns the list of available departments for the logged in user.

Example URI

GET https://clients-api.hogashop.ch/v5/paginated/departments?search=Adank&limit=&offset=&sortBy=&sortOrder=&customerId=
URI Parameters
HideShow
limit
number (optional) Default: 20 
offset
number (optional) Default: 0 
search
string (optional) Example: Adank

query string

first
string (optional) 

comma separated list of department IDs to be listed first

sortBy
string (optional) 

field name for sorting, available fields:

  • department_id

  • department_name

  • customer_id

  • customer_name

sortOrder
string (optional) 

sorting direction, ASC by default

  • ASC

  • DESC

customerId
number (optional) 

restricting list by customer Id

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "total": 3,
  "items": [
    {
      "id": 2,
      "name": "Küche",
      "customer": {
        "id": 2,
        "name": "Gourmet-Restaurant"
      },
      "itemsInBasket": 0
    },
    {
      "id": 74,
      "name": "Biergarten",
      "customer": {
        "id": 60,
        "name": "Gourmet-Restaurant"
      },
      "itemsInBasket": 3
    },
    {
      "id": 79,
      "name": "Bahnhof-Imbiss",
      "customer": {
        "id": 65,
        "name": "Bahnhof-Imbiss"
      },
      "itemsInBasket": 0
    }
  ]
}

Products in Catalog

  • GET /department/1168/available-products

  • GET /department/1168/available-products/count

Resource

GET/department/{departmentId}/available-products

Retrieves list of available products for a department.

Example URI

GET https://clients-api.hogashop.ch/v5/department/5/available-products
URI Parameters
HideShow
departmentId
number (required) Example: 5

ID of department

Response  200
HideShow
Headers
Content-Type: application/json
Body
[Schema](https://www.hogashop.ch/schema/productListItems.json)

Resource

GET/department/{departmentId}/available-products/count

Calculate amount of available products.

Example URI

GET https://clients-api.hogashop.ch/v5/department/5/available-products/count
URI Parameters
HideShow
departmentId
number (required) Example: 5

ID of department

Response  200
HideShow
Headers
Content-Type: application/json
Body
40345 (number) - total count of products in search query

Products in Order Lists

Only products from the department’s order lists are considered. Supplier order lists are excluded.

  • /department/1168/available-orderlist-products

  • /department/1168/available-orderlist-products/count

Resource

GET/department/{departmentId}/available-orderlist-products

Retrieves list of available products for a department currently on order lists.

Example URI

GET https://clients-api.hogashop.ch/v5/department/5/available-orderlist-products
URI Parameters
HideShow
departmentId
number (required) Example: 5

ID of department

Response  200
HideShow
Headers
Content-Type: application/json
Body
[Schema](https://www.hogashop.ch/schema/productListItems.json)

Resource

GET/department/{departmentId}/available-orderlist-products/count

Calculate amount of available products, according to search query.

Example URI

GET https://clients-api.hogashop.ch/v5/department/5/available-orderlist-products/count
URI Parameters
HideShow
departmentId
number (required) Example: 5

ID of department

Response  200
HideShow
Headers
Content-Type: application/json
Body
345 (number) - total count of products in search query

Server-Side Basket

Always provide the Basket-Revision when modifying the basket endpoints. This way you will receive an error (409 Conflict) if the basket was modified by another user in the meanwhile.

  • GET /department/{departmentId}/basket - read the basket

  • GET /department/{departmentId}/basket/overview - overview the basket (totals, without the items)

  • POST /department/{departmentId}/basket/items - add products, suppliers IDs and EAN codes are supported

  • PUT /department/{departmentId}/basket/part/{partIndex}/item/{itemIndex} - edit a basket item

  • DELETE /department/{departmentId}/basket/part/{partIndex}/item/{itemIndex} - remove an item

  • DELETE /department/{departmentId}/basket - empty basket

  • PUT /department/{departmentId}/basket/part/{partIndex} - add comments, set delivery date

  • POST /department/{departmentId}/order/basket-revision/{basket_revision} - Place order from basket

These resources give control over the user’s basket in HOGASHOP. The same basket that is visible when a user gets logged in to the HOGASHOP online application.

  • POST /department/{departmentId}/basket/calculated - validate an external basket

Resource

GET/department/{departmentId}/basket

Read a basket for a department, considering currently authenticated user. Stored basket is re-calculated providing actual mutations.

Example URI

GET https://clients-api.hogashop.ch/v5/department/1234/basket
URI Parameters
HideShow
departmentId
number (required) Example: 1234
Response  200
HideShow
Headers
Content-Type: application/json
Basket-Revision: 123 - current basket revision number
Schema
:[Schema](https://www.hogashop.ch/schema/basket.json)
Response  404
HideShow
Headers
Content-Type: application/json
Body
{
  "message": "Department does not exist",
  "code": 40411
}

Resource

DELETE/department/{departmentId}/basket{?revision}

Remove basket of a department for currently authenticated user

Example URI

DELETE https://clients-api.hogashop.ch/v5/department/1234/basket?revision=1234
URI Parameters
HideShow
departmentId
number (required) Example: 1234
revision
number (required) Example: 1234

last basket revision number that is known by the client.

Response  204
HideShow
Headers
Content-Type: application/json
Basket-Revision: 123 - updated basket revision
Response  400
HideShow
Headers
Content-Type: application/json
Body
{
  "message": "The revision value is expected. The basket data may be out of date.",
  "code": 400
}
Response  404
HideShow
Headers
Content-Type: application/json
Body
{
  "message": "Department does not exist",
  "code": 40411
}
Response  409
HideShow
Headers
Content-Type: application/json
Body
{
  "message": "Concurrent update of basket",
  "code": 4092
}

Resource

GET/department/{departmentId}/basket/overview

Read a basket for a department and return it without items, considering currently authenticated user. Stored basket is re-calculated providing actual mutations.

Example URI

GET https://clients-api.hogashop.ch/v5/department/1234/basket/overview
URI Parameters
HideShow
departmentId
number (required) Example: 1234
Response  200
HideShow
Headers
Content-Type: application/json
Basket-Revision: 123 - current basket revision number
Schema
:[Schema](https://www.hogashop.ch/schema/basketOverview.json)
Response  404
HideShow
Headers
Content-Type: application/json
Body
{
  "message": "Department does not exist",
  "code": 40411
}

Resource

POST/department/{departmentId}/basket/items{?source,ignoreErrors}

Add items to basket. After this the client should GET whole basket to obtain correct parts and totals.

When the basket has products the merge is performed with this rules:

  • Products of type 1 are never merged

  • Same products are merged: the amount of existing basket item will be increased, unless delivery dates are different.

Example URI

POST https://clients-api.hogashop.ch/v5/department/1234/basket/items?source=web&ignoreErrors=1
URI Parameters
HideShow
departmentId
number (required) Example: 1234
source
string (optional) Example: web

Client name or name of third-party

ignoreErrors
number (optional) Default: 0 Example: 1

Whether to add correct items, ignoring the bad ones.

Choices: 0 1

Request  Add items to basket
HideShow

The resource expects the following addToBasketRequest payload. Please refer to the schema for a comprehensive description of the payload structure.

Headers
Content-Type: application/json
Body
[
  {
    "product": {
      "id": 23
    },
    "sellingUnit": {
      "name": "Sa",
      "quantity": 5
    }
  }
]
Schema
:[addToBasketRequest](https://www.hogashop.ch/schema/addToBasketRequest.json)
Response  201
HideShow
Headers
Content-Type: application/json
Basket-Revision: 123 - updated basket revision
Schema
:[addToBasketRequest](https://www.hogashop.ch/schema/addToBasketRequest.json)
Response  400
HideShow
Headers
Content-Type: application/json
Body
{
  "message": " ... any message about wrong addToBasketRequest schema ... ",
  "code": 40023
}
Response  404
HideShow
Headers
Content-Type: application/json
Body
{
  "message": "Department does not exist",
  "code": 40411
}
Response  409
HideShow
Headers
Content-Type: application/json
Body
{
  "message": "Concurrent update of basket",
  "code": 4092
}
Response  422
HideShow
Headers
Content-Type: application/json
Schema
:[addToBasketRequest](https://www.hogashop.ch/schema/addToBasketRequest.json)
Response  207
HideShow

This response is only possible when ignoreErrors=1 and there was some errors.

Headers
Content-Type: application/json
Schema
:[addToBasketRequest](https://www.hogashop.ch/schema/addToBasketRequest.json)

Resource

PUT/department/{departmentId}/basket/part/{partIndex}/item/{itemIndex}{?revision,source}

Update an item in basket.

Example URI

PUT https://clients-api.hogashop.ch/v5/department/1234/basket/part/1/item/2?revision=1234&source=web
URI Parameters
HideShow
departmentId
number (required) Example: 1234
partIndex
number (required) Example: 1
itemIndex
number (required) Example: 2
revision
number (required) Example: 1234

last basket revision number that is known by the client.

source
string (optional) Example: web

basket item’s source.

Request
HideShow
Headers
Content-Type: application/json
Schema
:[addToBasketRequestItem](https://www.hogashop.ch/schema/addToBasketRequest.json#/definitions/item)
Response  200
HideShow
Headers
Content-Type: application/json
Basket-Revision: 123 - updated basket revision
Body
"Ok"
Response  404
HideShow
Headers
Content-Type: application/json
Body
{"message":"Department does not exist","code":40411}
{"message":"Basket item does not exist","code":40417}
Response  409
HideShow
Headers
Content-Type: application/json
Body
{
  "message": "Concurrent update of basket",
  "code": 4092
}
Response  422
HideShow
Headers
Content-Type: application/json
Schema
:[addToBasketRequestItem](https://www.hogashop.ch/schema/addToBasketRequest.json#/definitions/item)

Resource

DELETE/department/{departmentId}/basket/part/{partIndex}/item/{itemIndex}

Delete an item from basket.

Example URI

DELETE https://clients-api.hogashop.ch/v5/department/1234/basket/part/1/item/2
URI Parameters
HideShow
departmentId
number (required) Example: 1234
partIndex
number (required) Example: 1
itemIndex
number (required) Example: 2
revision
number (required) Example: 1234

last basket revision number that is known by the client.

Response  204
HideShow
Headers
Content-Type: application/json
Basket-Revision: 123 - updated basket revision
Response  404
HideShow
Headers
Content-Type: application/json
Body
{"message":"Department does not exist","code":40411}
{"message":"Basket item does not exist","code":40417}
Response  409
HideShow
Headers
Content-Type: application/json
Body
{
  "message": "Concurrent update of basket",
  "code": 4092
}

Resource

PUT/department/{departmentId}/basket/part/{partIndex}{?revision,delivery_date,comment,referenceNumber}

Changes delivery date for a whole basket part or/and a comment for basket part

Example URI

PUT https://clients-api.hogashop.ch/v5/department/1234/basket/part/1?revision=1234&delivery_date=2019-08-22&comment=New comment&referenceNumber=22
URI Parameters
HideShow
departmentId
number (required) Example: 1234
partIndex
number (required) Example: 1
revision
number (required) Example: 1234

last basket revision number that knows the client

delivery_date
string (required) Example: 2019-08-22

delivery date in YYYY-MM-DD format

comment
string (required) Example: New comment
referenceNumber
string (required) Example: 22
Response  200
HideShow
Headers
Content-Type: application/json
Basket-Revision: 123 - updated basket revision
Body
"Ok"
Response  400
HideShow
Headers
Content-Type: application/json
Body
{"message": "Invalid delivery date", "code": 40030}
{"message": "Customer input is not allowed"}
{"message": "Not enough query parameters"}
{"message": "The revision value is expected. The basket data may be out of date."}
Response  404
HideShow
Headers
Content-Type: application/json
Body
{"message": "Department does not exist", "code": 40411}
{"message": "Basket is empty", "code": 40416}
{"message": "Basket part index is not exist", "code": 40418}
Response  409
HideShow
Headers
Content-Type: application/json
Body
{
  "message": "Concurrent update of basket",
  "code": 4092
}

Resource

POST/department/{departmentId}/basket/calculated

Calculate a basket object.

Mutations

When input basket has prices and delivery dates defined, the API will check if those values are correct. All values will be recalculated according to the business rules at the moment of this request, and will be written back in the same basket structure. Any differences will be reported in mutation property. When this property isn’t exists one can say that input basket is actual.

It is not necessary to provide dates and prices. The only required properties are “product” and “amount”. Giving that minimized basket the client side can obtain all the missed properties filled in in the response of this resource.

Example URI

POST https://clients-api.hogashop.ch/v5/department/1234/basket/calculated
URI Parameters
HideShow
departmentId
number (required) Example: 1234
deliveryStrategy
string (optional) Default: define Example: define

What delivery strategy to use calculating delivery dates:

  • define - just define or approve already defined dates

  • unite - try to deliver all products in same day if possible

  • findNearest - select nearest delivery day for each product

Choices: define unite findNearest

desiredDeliveryOn
string (optional) Example: 2016-01-01

What delivery date is preferred. Resulting delivery dates will be not earlier than this date.

orderSessionId
string (optional) Example: 7D143C15-D0DF-4718-90AC-022304D96300

string used to check against order duplicates

ignorePriceDecreaseMutation
number (optional) Default: 0 Example: 1

show/don’t show prices mutation if was increased ones.

Choices: 0 1

Request
HideShow
Headers
Content-Type: application/json
Schema
:[basket](https://www.hogashop.ch/schema/basket.json)
Response  200
HideShow
Headers
Content-Type: application/json
Schema
:[Schema](https://www.hogashop.ch/schema/basket.json)
Response  400
HideShow
Headers
Content-Type: application/json
Body
{"message":"Wrong department ID","code":4000}
{"message":"Unknown delivery strategy specified","code":40014}
{"message":"Invalid desired delivery date","code":40015}
{"message":" ... any message about wrong basket schema ... ","code":40017}
Response  404
HideShow
Headers
Content-Type: application/json
Body
{
  "message": "Department does not exist",
  "code": 40411
}

Ordering

Always check that a response arrived after calling one of those endpoints.

  • POST /department/{departmentId}/order/basket-revision/{basket_revision} - Place order from basket

  • POST /department/{departmentId}/order - order with external basket

Resource

POST/department/{departmentId}/order{?deliveryStrategy,allowDuplicates,ignoreMutations,ignorePriceDecreaseMutation,archive,orderSessionId,supplierReference}

Create an order. Using provided basket the orders will be created. Each basket part produces one order. A basket part is a set of products provided by the same supplier delivered on the same day.

Delivery strategy

Parameter deliveryStrategy can be provided to make delivery dates for each product be calculated in different ways: deliver as fast as possible, deliver in the same day or do not define delivery date at all.

Allowing duplicate orders

Parameter allowDuplicates can to turn off duplicate orders protection. The API won’t create an order when exactly the same set of products is already ordered or orderSessionId is a duplicate. See explanation of orderSessionId below.

Mutations

When the input basket has prices and/or delivery dates defined the API will apply the current business rules to confirm that information. Is it possible that in the moment of ordering the prices are changed or the delivery time is passed. This makes the request to be rejected with code “400 Bad request: basket isn’t actual”. To refresh the information a different API resource should be used, for example POST /department/{departmentId}/basket/calculated.

It is not necessary to provide prices and delivery dates in the basket, if your client side isn’t interested in validating them and report mutations. Orders will be created for nearest delivery dates with current prices. Parameter ignoreMutations can make API to create orders no matter if the basket actual or not.

Order session ID

Second level of duplicate orders protection.

The idea behind is to give an unique ID to a user’s session, the context a person in. For example when a user puts the first product in the basket the client application can generate this ID and remember. After order was created and the client application have received “201 Created” status code from the server this ID can be forgotten until next basket (set of products) will be collected.

This orderSessionId parameter should be provided in POST /department/{departmentId}/order request to make server to check if an order is already created within this session (with this basket). The duplicate is possible because of poor internet connection, when the client application does “create order” request but receives no response. This makes basket to remain, user can do request again. This time, when client application provide the same orderSessionId, the server won’t create a duplicate, but rejects the request with status code 409.

Example URI

POST https://clients-api.hogashop.ch/v5/department/1234/order?deliveryStrategy=define&allowDuplicates=1&ignoreMutations=1&ignorePriceDecreaseMutation=1&archive=1&orderSessionId=sessionIdentifier&supplierReference=ref123
URI Parameters
HideShow
departmentId
number (required) Example: 1234
deliveryStrategy
string (optional) Default: define Example: define

What delivery strategy to use calculating delivery dates:

  • define - just define or approve already defined dates

  • unite - try to deliver all products in same day if possible

  • findNearest - select nearest delivery day for each product

  • withoutDate - send order without date

Choices: define unite findNearest withoutDate

allowDuplicates
number (optional) Default: 0 Example: 1

Choices: 0 1

ignoreMutations
number (optional) Default: 0 Example: 1

Choices: 0 1

ignorePriceDecreaseMutation
number (optional) Example: 1

Show/don’t show prices mutation if was increased ones. +Default: 0

Choices: 0 1

archive
number (optional) Default: 0 Example: 1
  • 0 - normal order

  • 1 - order is marked as “blind” - no notifications will be sent to supplier or customer

Choices: 0 1

orderSessionId
string (optional) Example: sessionIdentifier

Arbitrary string to identify order session.

supplierReference
string (optional) Example: ref123

Arbitrary string to identify supplier reference field.

Request
HideShow
Body
:[Schema](https://www.hogashop.ch/schema/basket.json)
Response  201
HideShow

List of created orders ids.

Headers
Content-Type: application/json
Body
[
  123,
  124
]
Response  400
HideShow
Headers
Content-Type: application/json
Body
{message: "Wrong department ID", code: 4000}
{message: " ... any message about wrong basket schema ... ", code: 40017}
for example {message: "The object must contain the properties ["customer","parts"].","path":"/", code: 40017}
{message: "Unknown delivery strategy specified", code: 40014}
{message: "Basket data is expired", code: 40019}
Response  403
HideShow
Headers
Content-Type: application/json
Body
{message: "You have no rights to create orders", code: 4036}
Response  404
HideShow
Headers
Content-Type: application/json
Body
{message: "Customer not found. Id: %s", code: 40411}
{message: "Department not found. Id: %s", code: 40411}
Response  409
HideShow
Headers
Content-Type: application/json
Body
{message: "Using this data an order has already been created (order session id = {orderSessionId}).", code: 4090}
{message: "Same products already were ordered", code: 4091}
Response  500
HideShow
Body
any server error

Resource

POST/department/{departmentId}/order/basket-revision/{basket_revision}{?part,deliveryStrategy,allowDuplicates,ignoreMutations,ignorePriceDecreaseMutation,archive,orderSessionId,supplierReference}

Create an order using the basket stored at the server. See the detailed description in the POST /department/{departmentId}/order paragraph.

To make an order the client side should provide basket-revision. It protects from wrong orders, when basket has been updated by different client.

Example URI

POST https://clients-api.hogashop.ch/v5/department/1234/order/basket-revision/1234?part=1&deliveryStrategy=define&allowDuplicates=1&ignoreMutations=1&ignorePriceDecreaseMutation=1&archive=1&orderSessionId=sessionIdentifier&supplierReference=ref123
URI Parameters
HideShow
departmentId
number (required) Example: 1234
basket_revision
number (required) Example: 1234

Current basket revision

part
number (optional) Example: 1

Number of basket part to place order. If omitted, order will be placed for the whole basket

deliveryStrategy
string (optional) Default: define Example: define

What delivery strategy to use calculating delivery dates:

  • define - just define or approve already defined dates

  • unite - try to deliver all products in same day if possible

  • findNearest - select nearest delivery day for each product

  • withoutDate - send order without date

Choices: define unite findNearest withoutDate

allowDuplicates
number (optional) Default: 0 Example: 1

Choices: 0 1

ignoreMutations
number (optional) Default: 0 Example: 1

Choices: 0 1

ignorePriceDecreaseMutation
number (optional) Default: 0 Example: 1

Show/don’t show prices mutation if was increased ones

Choices: 0 1

archive
number (optional) Default: 0 Example: 1
  • 0 - normal order

  • 1 - order is marked as “blind” - no notifications will be sent to supplier or customer

Choices: 0 1

orderSessionId
string (optional) Example: sessionIdentifier

Arbitrary string to identify order session

supplierReference
string (optional) Example: ref123

Arbitrary string to identify supplier reference field

Response  201
HideShow

List of created orders ids.

Headers
Content-Type: application/json
Basket-Revision: {newRevisionNumber} - only for partial orders
Body
[
  123,
  124
]
Response  400
HideShow
Headers
Content-Type: application/json
Body
{message: "Wrong department ID", code: 4000}
{message: "Wrong revision number", code: 4000}
{message: "Wrong basket part", code: 4000}
{message: "Unknown delivery strategy specified", code: 40014}
Response  403
HideShow
Headers
Content-Type: application/json
Body
{message: "You have no rights to create orders", code: 4036}
{message: "You have no rights to create archive orders", code: 4036}
Response  404
HideShow
Headers
Content-Type: application/json
Body
{message: "Department not found. Id: %s", code: 40411}
Response  409
HideShow
Headers
Content-Type: application/json
Body
{message: "Using this data an order has already been created (order session id = {orderSessionId}).", code: 4090}
{message: "Same products already were ordered", code: 4091}
{message: "Basket data is expired", code: 40019}
Response  500
HideShow
Body
any server error

Generated by aglio on 24 Apr 2025