Document Tree
Document Properties
Kbid
2729Y4
Last Modified
31-May-2022
Added to KB
13-Nov-2015
Public Access
Everyone
Status
Online
Doc Type
References
Product
  • IOM 3.0
  • IOM 3.1
  • IOM 3.2
  • IOM 3.3
  • IOM 3.4
  • IOM 3.5
  • IOM 3.6
  • IOM 3.7
  • IOM 4.0
  • IOM 4.1
  • IOM 4.2
  • IOM 4.3
IOM REST API - Update Stock Reservation

URI

servlets/services/reservation/<resvId>

Http Method

PUT

Short Description

Update a stock reservation.
Example Requests URLhttp://10.17.0.245:8080/servlets/services/reservation/130

Example Requests

{ "lifetime": 60, "items": [ { "id": "First-Test", "qty": 7 } ] }

HTTP Status Codes

  • 201 Created
    Stock reservation suspenseful updated

  • 400 Bad Request
    There is no reservation in the OMS system for parameter resvId or in the case of a semantic or syntactic error.

  • 401 Unauthorized

  • 404 Not Found

  • 500 Internal Server Error

Description

This PUT method updates an existing stock reservation. Unlike the POST method to create a new reservation, this method updates specific information of an existing stock reservation. You can update the validity of a reservation. You can remove already reserved products from a reservation or add other products (reservation items). Furthermore, the reserved quantity of an already reserved product can be changed.

If the reservation is already expired  each product reservations will be removed and the OMS perform the creation of new reservation items like the POST method it does. At the response appears an exception with code 21004 and message " The reservation with id <resvId> has already expired".

This service only supports and accepts requests with content-type application/json.

ParametersPath parameter resvId = ID of the existing IOM reservation - Example = 130

Product Version

1.1

Product To Version

 

Status

New Labels

Authorization

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.

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:

{
  "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."
    }]
}

JSON

Request data format

application/json

Request related java object

bakery.v2.reservation.ReservationRequestImpl
Request Attributes
Attribute
Description
TypeNullable
lifetime

The lifetime / validity of the stock reservation in seconds.Max value is 2147483647.
Greater values creates a response with HTTP status code 400 caused by a JsonParseException.

Default is 10 minutes.

Omitting of this attribute leads to an update of the validity to 10 minutes.

Integertrue
type

The reservation type:

  • COMPLETE = products are only reserved if all products of the request are reservable

  • PARTLY = products are reserved, even when one or more of the reserved products are not reservable.

If type is missing the OMS uses COMPLETE. All values unequal COMPLETE be interpreted as   PARTLY .

Stringtrue
items1..n products to reserve. For details see table below.Arrayfalse
Item Attribute
Description
TypeSizeNullable
idThe ID of the product. Via the IOM configurations it is determined if it is the shop or IOM product IDString30false
qtyReserved quantityInteger false
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
AttributesDescription
datasee table below
statusCodeHTTP status code
errorsempty in case of successful processing. For details see Response Attribute Errors
exceptionsempty in case of successful processing. For details see Response Attribute Exceptions
Data Attributes
Description
validUntilThe validity of the stock reservation
resvIdThe ID <primary key>  of the stock reservation
items1..n items. See table below
Item Attributes
Description
idThe ID of the product. Via the IOM configurations it is determined if it is the shop product number or the oms product ID.
qtyReserved quantity
stateState of the reservation.  
The reservation of the product is still "revered" or "expired".

Response Attribute Errors

Source Field
Message
items.qtyCan not construct instance of int from String value 'value from request': not a valid integer value

HTTP status code = 400

Response Attribute Exceptions
Code
DescriptionHTTP status code
JsonParseExceptionFor each not well formed JSON request payload 400
CODE_21001The product to be reserved was not found400

CODE_21004

The reservation has already expired

201 if the update is successful,

otherwise 400

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 Code201
Disclaimer
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 Web site, including, without limitation, any lost profits, business interruption, loss of programs or other data on your information handling system.
Home
Knowledge Base
Product Releases
Log on to continue
This Knowledge Base document is reserved for registered customers.
Log on with your Intershop Entra ID to continue.
Write an email to supportadmin@intershop.de if you experience login issues,
or if you want to register as customer.