1. Create rules and parameters
A product's rules live in separate parameters that the product refers to. Create them first, because the product can only be published when its parameters are published.
Before you begin
Make sure that:
- You have a client and can get an access token. See Authentication.
What rules and parameters are
Rules and parameters decide when, where, for whom and on which conditions a product can be bought and used. For example, one parameter can say how long before departure the product can be bought, and another how long it is valid after purchase.
Each type of rule is its own element with its own endpoints in the Product parameters API. New types are added over time. The API reference lists the types you can use today.
Rules and parameters are shared. One parameter can be used by many products, and many products can use the same parameter. Before you create a new one, check whether you or Entur already have one that fits.
Why parameters come first
A product refers to its parameters by NeTEx id. Before a product can be published, its parameters must be published for the whole time the product is valid. This is the coverage rule.
So the order is always the same, whatever the rule:
- Find a parameter that fits, or create a new one.
- Note its
id, so the product can refer to it. - Send it to test and publish it before the product. See 4. Test and publish.
Example: create a purchase window
A purchase window (PurchaseWindow) decides when a product can be bought. Every type of
parameter is created the same way: a POST with the content, which returns the new element.
The example allows purchase up to 90 days before, and at least one hour before, the product is used:
Code
Leave out ownerOrganisationId. The parameter then belongs to the organisation in your token.
The response contains the new element:
Code
Note the two ids:
ididentifies the parameter. The product refers to it by this id.versionIdidentifies this version of the parameter. You use it when you send the version to test and publish it in step 4.
The new version is a DRAFT, with effective dates that start today. You set the real effective dates when you send it to test.
Use existing parameters
You can refer to any published parameter by its NeTEx id, including parameters that Entur or other organisations own. You can't change parameters you don't own.
Find them with the list endpoints for each type in the Product parameters API.