Overview
Marketplace provides 2 ways to work with orders:
- create/update whole order with orderItems
- add/update/delete single orderItems to/from the existing order
On the client-side, the full order object is created with references to products and travelers. You can find the base URLs here.
POST https://api.discover.swiss/market/v1/orders
PUT https://api.discover.swiss/market/v1/{orderNumber}
DELETE https://api.discover.swiss/market/v1/{orderNumber}
Order model defintion: see here
Example ordering Zürich-card
This sample order contains two orderItem, Zürich-card24 and Zürich-card72. It shows the minimal data that the client must send to create an order.
Sample order:
!!! Warning "Locking of the order" (prevent concurrency violation)
The order is locked for the duration of each request execution or until 5 minutes are up.
Locking means that only one request can modify the order at the same time, and all other requests will receive 423 error.
Additional info:
- The customer data is taken from the profile-person object
- A BillingAddress is not mandatory, because we create e-tickets only
- The product Identifier is the same in all environments (test/prod) but prices can change
- The order validation will add the name and the price to the orderItem
- ValidFrom is the desired starting date and time of the ticket
- orderNumber and orderItemNumber are determined by the server and not part of the request
- orderItemStatus is determined by the server and not part of the request
Note
For public transportation tickets, the ValidFrom date should be less than 2 months in the future.