URI | servlets/services/reservation/<shopId> |
|---|---|
Http Method | POST |
Short Description | Create a stock reservation. |
| Example Requests URL | http://10.17.0.245:8080/servlets/services/reservation/10010 |
Example Requests | { "lifetime": 180, "type": "COMPLETE", "items": [ { "id": "First-Test", "qty": "2" } ] } |
HTTP Status Codes |
|
Description | This service creates stock reservations for a given OMS shop instance. A stock reservation is a list of reserved products with the appropriate amount. Each stock reservation has a validity which can be set by the field The response provides a status code 201 on success with the reserved products, the state of the reservation and a unique reservation reference ID. This service only supports and accepts requests with content-type application/json. |
| Parameters | Path parameter shopId = ID of the OMS shop instance - Example = 10010 |
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=post --post-data='{"lifetime":180, "type":"COMPLETE", "items":[{"id":"First-Test", "qty":"2"}]}' \
http://<hostname>/servlets/services/reservation/10010
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 OMS shop instance which relates to the requested stock reservation.
Concurrency
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:
JSON
Request data format | application/json | |||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Request related java object | bakery.v2.reservation.ReservationRequestImpl | |||||||||||||||||||||||||||||||
Request Attributes |
| |||||||||||||||||||||||||||||||
Request data example | ||||||||||||||||||||||||||||||||
Response data format | application/json | |||||||||||||||||||||||||||||||
Response related java object | bakery.webservice.rest.v1.HttpResponse bakery.reservation.v2.ReservationResponse as "data" object | |||||||||||||||||||||||||||||||
Response Attributes |
| |||||||||||||||||||||||||||||||
Response AttributeErrors |
HTTP status code= 400 | |||||||||||||||||||||||||||||||
Response AttributeExceptions |
HTTP status code= 400 | |||||||||||||||||||||||||||||||
Response data example | {
"data": {
"validUntil": "2016-01-07 15:03:36",
"resvId": 119,
"items": [
{
"id": "First-Test",
"qty": 2,
"state": "reserved"
}
]
},
"statusCode": 201,
"errors": [
],
"exceptions": [
]
}
| |||||||||||||||||||||||||||||||
Response Code | 201 |
The information provided in the Knowledge Base may not be applicable to all systems and situations. Intershop Communications will not be liable to any party for any direct or indirect damages resulting from the use of the Customer Support section of the Intershop Corporate Website, including, without limitation, any lost profits, business interruption, loss of programs or other data on your information handling system.