Placing an order¶
- From the API root, follow orders-form, expanding its
productsvariable with the number of product lines you want. Request it as HAL-FORMS. - The form links to the order affordance. Select the template that targets that link.
- Submit the state of the form, its properties without
_linksand_templates, using the template's method, target and content type. Send anIdempotency-Keyheader with a value that identifies this attempt. - The response is the new order, with its URI in the
Locationheader. Keep that URI, it is the identity of the order.
If the response is lost, repeat the same request with the same key: the order is placed at most
once, and the repeat returns the original order with Idempotency-Replayed: true. Only reuse a
key for the same request; a different request under the same key is rejected with
idempotency-key-reused. See
orders for the details.
The server decides the price of each line from the current product price, so the form carries no prices, and anything a client adds is ignored.