When a new TIME reservation is created, it is possible to supply new times or time pairs in new nextReservationTimes
attribute. This can come in handy if the Box is full for the initially supplied reservation time (pair) via startReservationDate
and expirationDate
.
Description
Input attributes
The new nextReservationTimes
attribute is a collection and one or more new reservation time (pairs) can be provided, as you can see in the example below. The naming of the attributes is consistent with the already existing initial attributes in root, that is startReservationDate
and expirationDate
.
Please note that the expirationDate
is optional and does not have to be provided. However if the expirationDate
is not supplied in the nextReservationTimes
, the root expirationDate
attribute is used, which may result in expirationDate
being older than startReservationDate
from nextReservationTimes
. This would result in the reservation expiration, although the startReservationDate
is in the future. For this reason we encourage you to use the expirationDate
attribute within nextReservationTimes
.
The order of the supplied NextReservationTimes is respected, thus the first time (pair) in the collection is used, in case the initially supplied startReservationDate
and expirationDate
result in Box is full. In case the first supplied NextReservationTimes time (pair) results in Box is full, the second time (pair) is used and so on. In case of none of the NextReservationTimes time (pair) results in successful reservation creation, the well-known error 'BOX_IS_FULL' is returned.
Response
The response structure of the POST request remains the same.
Request example
An example of a POST request for a TIME reservation starting from 13. 11. 2023 and expiring 15. 11. 2023 with additional NextReservationTimes:
starting from 14. 11. 2023 and expiring 16. 11. 2023,
starting from 15. 11. 2023 and expiring 17. 11. 2023.
POST /parcel-lockers/v2/reservation { "data": { "reservation": { "id": "RES123", "attributes": { "startReservationDate": "2023-11-13T00:00:00.000Z", "expirationDate": "2023-11-14T00:00:00.000Z", "blocked": false, "packages": [ { ... } ], "type": "TIME", "nextReservationTimes": [ { "startReservationDate": "2023-11-14T00:00:00.000Z", "expirationDate": "2023-11-16T00:00:00.000Z", }, { "startReservationDate": "2023-11-15T00:00:00.000Z", //NOTE: Since expirationDate is not supplied in here, //the root expirationDate shall be used, that is "2023-11-14T00:00:00.000Z" } ] }, "relationships": { "box": { "id": 1234, "pid": "PID9876" } } } } }