Product Documentation
Auto Light Dark
Auto Light Dark

BASKET API

BASKET, commonly known as Basket API, is a REST interface over HTTP(S) that uses XML or JSON as input and output format.

It provides basket and receipt calculation optimized for web and scalability, and makes discounts work in the same way as they do with a regular ViKING till.

Key characteristics

  • Exposed as a stateless REST interface.

  • No persistence of basket or receipt.

  • Supports multiple ViKING tills for load balancing and scalability.

  • Each ViKING till has a single import of articles and a single database, but can have multiple execution threads.

  • Useful for automated tests and verification of correct calculations.

HTTP return codes

Code

Meaning

200 OK

Successful GET reply or successful POST reply.

204 No Content

Default return code for POST with no reply data.

400 Bad Request

Request is wrong or missing required information.

404 Not Found

Request fails, for example because of missing content.

50x Internal Server Error

Server-side error, such as missing instance or wrong server-side configuration.

Supported encoding

  • UTF-8

CalculateBasket

CalculateBasket is called whenever a receipt is to be calculated. The calculation logic is controlled by ViKING.

Receipts are line-oriented. Articles can be sold one by one or by quantity, and lines are neither collapsed nor expanded automatically. The same applies to discounts: they are calculated with the current article line and quantity in mind.

Note: When the API refers to coupons, it means vouchers. See also VOUCHER API.

Content input

Field

Value

URI

/CalculateBasket?

Method

POST

Query string

Store and Chain are optional.

Example

/CalculateBasket?Store=3477&Chain=1

Accept

text/xml, application/json

Reply output

CalculateBasket output is defined by the basket output schema and JSON definitions in the source documentation. The related ReceiptBasket.xsd schema is available as a child reference page.

Revision history

The source topic includes a Basket API revision history section. Keep this page aligned with the source when API revisions are published.