IOM supports "basic http authentication" only. Please configure your clients to use this authentication method. A very simple method to send REST requests on the command line can be realized using wget. The example also shows, how to configure this client to use "basic http authentication" (--auth-no-challenge).
wget -q -O- --auth-no-challenge --http-user=<user> --http-password='<password>' \ --method=put --body-data='{"lifetime":60, "items":[{"id":"First-Test", "qty":7}]}' \ http://<hostname>/servlets/services/reservation/130
It is Important that the permission REST_RESERVATION (oms.RightDefDO
with ID = 124 and name "Reservation REST service") is assigned to the requesting user. The permission is a part of the class bakery.persistence.dataobject.configuration.common.RightDefDO
.
The user also needs the permission for the IOM shop instance which relates to the requested stock reservation.
To avoid overbooking of products the OMS checks the current inventory of the product before storing the reservation. The inventory check itself depends on stock reservations. For this reason the OMS uses database advisory locks to serialize the requests.
If it is not possible for a request to obtain all locks for the products to reverse within five seconds, the client gets a response with HTTP status code 500 and the following payload:
{ "data": null, "statusCode": 500, "errors": null, "exceptions": [{ "code": "500", "message": "bakery.util.exception.TechnicalException: Technical error while working on object 'ReservationPersistenceBean': Unable to update reservation. Cannot get the necessary database lock to perform a concurrent safe inventory check." }] }
Request data format | application/json | |||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Request related java object | bakery.v2.reservation.ReservationRequestImpl | |||||||||||||||||||||||||||||||
Request Attributes |
| |||||||||||||||||||||||||||||||
Request data example | { "lifetime": 180, "items": [ { "id": "First-Test", "qty": 7 } ] } | |||||||||||||||||||||||||||||||
Response data format | application/json | |||||||||||||||||||||||||||||||
Response related java object | bakery.webservice.rest.v1.HttpResponse bakery.reservation.v2.ReservationResponse as "data" object | |||||||||||||||||||||||||||||||
Response Attributes |
| |||||||||||||||||||||||||||||||
Response Attribute Errors |
HTTP status code = 400 | |||||||||||||||||||||||||||||||
Response Attribute Exceptions |
| |||||||||||||||||||||||||||||||
Response data example | { "data": { "validUntil": "2016-01-07 14:29:32", "resvId": 130, "items": [ { "id": "First-Test", "qty": 7, "state": "reserved" } ] }, "statusCode": 201, "errors": [ ], "exceptions": [ ] } | |||||||||||||||||||||||||||||||
Response Code | 201 |