2. Create a product
Create the product and let it refer to the rules and parameters from the previous step.
Before you begin
Make sure that:
- You have completed 1. Create rules and parameters.
- You have the ids of the parameters the product refers to.
What a product is
A product is what the traveller gets, for example a ticket or a supplement such as parking or a bicycle. Each type of product is its own element with its own endpoints in the Products API. New types are added over time. The API reference lists the types you can create today.
Whatever the type, a product has the same parts:
- names and descriptions that travellers see
- references, by NeTEx id, to the rules and parameters that decide when, where, for whom and on which conditions it can be bought and used
- references to the fare tables that price it. See 3. Set prices.
- settings for the type, such as when the traveller pays and which VAT group applies
So the steps are always the same:
- Create the product with a
POSTto the endpoint for its type. Send the content and the references. - Note the
idand theversionIdin the response. The new version is aDRAFT. - Change the draft with
PUTuntil it is right. Send the complete content each time.
Example: create a supplement product
A supplement product (SupplementProduct) is sold in addition to, or independently of, a
travel ticket. The example creates a parking product:
Code
The fields specific to a supplement product are:
| Field | What it does |
|---|---|
supplementProductType | The kind of supplement, for example PARKING, BICYCLE or SEAT_RESERVATION. See the API reference for all values. |
chargingMomentType | When the traveller pays. Only BEFORE_TRAVEL is supported in sales. |
purchaseWindowRef | The purchase window, by NeTEx id. |
usageValidityPeriodRef | The usage validity period: how long the product can be used after purchase or activation. Required before the product can be published. |
entitlementRequiredRefs | What the traveller must already have. Empty if the product can be bought on its own. |
securityPolicy | Optional security level for the travel document: LOW, MEDIUM or HIGH. |
validityParameters | Where the product is valid, for example lines, zones or a parking facility. |
To change the draft, send the complete product with PUT:
Check the references
While the product is a draft or under test, the API only checks that the parameters exist. The full coverage rule applies when you publish the product.