Update bookings

This article explains how to update a booking using public API, which parts of the booking model is possible to update and what are the current limitations.

We will use these endpoints:

create booking: POST /bookings
update booking: PUT /bookings/{orderNumber}

Please be aware of the following, when considering to use booking update:

  • only certain fields can currently be updated using API

  • only manual payment bookings can be updated

  • update booking in API triggers webhooks and e-mail notifications in the same way as the order update through UI

  • good practice is to retrieve the full booking object either from create or get booking response, update the necessary fields and pass it whole back to the booking update service. In the future we might support updates of additional fields e.g. add and delete of participants. If you don't send the participants array in the request, we will recognize it as the participants deletion and remove the participant from the existing order

  • order of the items in arrays have to be preserved for the following fields "items", "participants", since no ids are exposed in the API and thus are matched based on the position in the array again the existing booking object

What can be currently updated?

Cutomer - all customer data can be updated
"per order" booking fields - all values can be updated, added or deleted
"per participant" booking fields - all values can be updated, added or deleted
order status - only available for supplier's own orders
Update customer and booking fields

Customer and per order and per participant booking field can be updated, added or deleted from the order. Below are sample calls, to first create a booking, and then update customer, order and participants booking fields:  

Create booking Request:

POST https://api.rezdy.com/latest/bookings/?apiKey=123456789XYZ
{
	"customer": {
		"firstName": "Dusan",
		"lastName": "Zahoransky",
		"email": "sample@test.com"
	},
	"items": [
		{
			"productCode": "P123456",
			"startTime": "2017-01-19T09:00:00.000Z",
			"quantities": [
				{
					"optionLabel": "Adult",
					"value": 1
				}
			],
			"participants": [
				{
					"fields": [
						{
							"label": "First Name",
							"value": "Janko"
						},
						{
							"label": "Last Name",
							"value": "Hrasko"
						}
					]
				}
			]
		}
	],
	"fields": [
		{
			"label": "Special Requirements",
			"value": "No meat meal option"
		}
	]
}

Create booking Response:

{
	"requestStatus": {
		"success": true,
		"version": "v1"
	},
	"booking": {
		"orderNumber": "RSKCJ1K",
		"status": "CONFIRMED",
		"supplierId": 61,
		"supplierName": "SUPPLIER_PREMIUM_AU",
		"customer": {
			"id": 2,
			"firstName": "Dusan",
			"lastName": "Zahoransky",
			"name": "Dusan Zahoransky",
			"email": "sample@test.com"
		},
		"items": [
			{
				"productName": "activity i session seats pp adult 100f",
				"productCode": "P123456",
				"startTime": "2017-01-19T09:00:00Z",
				"endTime": "2017-01-19T11:00:00Z",
				"startTimeLocal": "2017-01-19 20:00:00",
				"endTimeLocal": "2017-01-19 22:00:00",
				"quantities": [
					{
						"optionLabel": "Adult",
						"optionPrice": 100,
						"value": 1
					}
				],
				"totalQuantity": 1,
				"amount": 100,
				"extras": [
				],
				"participants": [
					{
						"fields": [
							{
								"label": "First Name",
								"value": "Janko",
								"requiredPerParticipant": false,
								"requiredPerBooking": false,
								"visiblePerParticipant": false,
								"visiblePerBooking": false
							},
							{
								"label": "Last Name",
								"value": "Hrasko",
								"requiredPerParticipant": false,
								"requiredPerBooking": false,
								"visiblePerParticipant": false,
								"visiblePerBooking": false
							}
						]
					}
				],
				"subtotal": 100,
				"vouchers": [
				]
			}
		],
		"totalAmount": 100,
		"totalCurrency": "AUD",
		"totalPaid": 0,
		"totalDue": 100,
		"dateCreated": "2017-01-19T03:36:18.462Z",
		"dateConfirmed": "2017-01-19T03:36:18.462Z",
		"payments": [
		],
		"fields": [
			{
				"label": "Special Requirements",
				"value": "No meat meal option",
				"requiredPerParticipant": false,
				"requiredPerBooking": false,
				"visiblePerParticipant": false,
				"visiblePerBooking": false
			}
		],
		"source": "API",
		"vouchers": [
		]
	}
}

Update booking Request:

(adding customer phone, also participant's phone, removing his first name and changing the last name, also changing Special Requirements field and adding How did you hear about us? booking field)

PUT https://api.rezdy.com/latest/bookings/RSKCJ1K?apiKey=123456789XYZ
{
	"orderNumber": "RSKCJ1K",
	"status": "CONFIRMED",
	"supplierId": 1,
	"supplierName": "SUPPLIER_PREMIUM_AU",
	"customer": {
		"id": 1,
		"firstName": "Dusan",
		"lastName": "Zahoransky",
		"name": "Dusan Zahoransky",
		"email": "sample@test.com",
		"phone": "012345679"
	},
	"items": [
		{
			"productName": "activity i session seats pp adult 100f",
			"productCode": "P123456",
			"startTime": "2017-01-19T09:00:00Z",
			"endTime": "2017-01-19T11:00:00Z",
			"startTimeLocal": "2017-01-19 20:00:00",
			"endTimeLocal": "2017-01-19 22:00:00",
			"quantities": [
				{
					"optionLabel": "Adult",
					"optionPrice": 100,
					"value": 1
				}
			],
			"totalQuantity": 1,
			"amount": 100,
			"extras": [
			],
			"participants": [
				{
					"fields": [
						{
							"label": "Last Name",
							"value": "Mrkvicka",
							"requiredPerParticipant": false,
							"requiredPerBooking": false,
							"visiblePerParticipant": false,
							"visiblePerBooking": false
						},
						{
							"label": "Phone",
							"value": "987654321"
						}
					]
				}
			],
			"subtotal": 100,
			"vouchers": [
			]
		}
	],
	"totalAmount": 100,
	"totalCurrency": "AUD",
	"totalPaid": 0,
	"totalDue": 100,
	"dateCreated": "2017-01-19T03:36:18.462Z",
	"dateConfirmed": "2017-01-19T03:36:18.462Z",
	"payments": [
	],
	"fields": [
		{
			"label": "Special Requirements",
			"value": "Nothing special",
			"requiredPerParticipant": false,
			"requiredPerBooking": false,
			"visiblePerParticipant": false,
			"visiblePerBooking": false
		},
		{
			"label": "How did you hear about us?",
			"value": "Internet ad"
		}
	],
	"source": "API",
	"vouchers": [
	]
}

Booking update response:

{
	"requestStatus": {
		"success": true,
		"version": "v1"
	},
	"booking": {
		"orderNumber": "RCACA40",
		"status": "CONFIRMED",
		"supplierId": 1,
		"supplierName": "SUPPLIER_PREMIUM_AU",
		"customer": {
			"id": 1,
			"firstName": "Dusan",
			"lastName": "Zahoransky",
			"name": "Dusan Zahoransky",
			"email": "sample@test.com",
			"phone": "012345679"
		},
		"items": [
			{
				"productName": "activity i session seats pp adult 100f",
				"productCode": "P123456",
				"startTime": "2017-01-19T09:00:00Z",
				"endTime": "2017-01-19T11:00:00Z",
				"startTimeLocal": "2017-01-19 20:00:00",
				"endTimeLocal": "2017-01-19 22:00:00",
				"quantities": [
					{
						"optionLabel": "Adult",
						"optionPrice": 100,
						"value": 1
					}
				],
				"totalQuantity": 1,
				"amount": 100,
				"extras": [
				],
				"participants": [
					{
						"fields": [
							{
								"label": "Last Name",
								"value": "Hrasko",
								"requiredPerParticipant": false,
								"requiredPerBooking": false,
								"visiblePerParticipant": false,
								"visiblePerBooking": false
							},
							{
								"label": "Phone",
								"value": "987654321",
								"requiredPerParticipant": false,
								"requiredPerBooking": false,
								"visiblePerParticipant": false,
								"visiblePerBooking": false
							}
						]
					}
				],
				"subtotal": 100,
				"vouchers": [
				]
			}
		],
		"totalAmount": 100,
		"totalCurrency": "AUD",
		"totalPaid": 0,
		"totalDue": 100,
		"dateCreated": "2017-01-19T03:58:12.892Z",
		"dateConfirmed": "2017-01-19T03:58:12.892Z",
		"payments": [
		],
		"fields": [
			{
				"label": "Special Requirements",
				"value": "Nothing special",
				"requiredPerParticipant": false,
				"requiredPerBooking": false,
				"visiblePerParticipant": false,
				"visiblePerBooking": false
			},
			{
				"label": "How did you hear about us?",
				"value": "Internet ad",
				"requiredPerParticipant": false,
				"requiredPerBooking": false,
				"visiblePerParticipant": false,
				"visiblePerBooking": false
			}
		],
		"source": "API",
		"vouchers": [
		]
	}
}

Updating order status (2 steps booking)

Please note, that only supplier is currently allowed to update order status. The status update can be useful to implement 2 steps booking process, to create an order in a processing state and later confirm or cancel the booking.

There are certain transitions, specially handled in the business logic:

From ABANDONED_CART/PROCESSING to CONFIRMED

  • the target state - PROCESSING or CONFIRMED is determined by the business logic based on the product confirmation mode or product type

To CANCELED_ORDER

  • the cancellation emails will be send. Automated payments are not refunded, for a cancellation with refunds, call DELETE /bookings/{orderNumber} service

Sample requests to do a 2 steps booking are similar to the create and update booking above, only difference is field  "status"

Request - create a booking in the processing status:

POST https://api.rezdy.com/latest/bookings/?apiKey=123456789XYZ
{

	"status": "PROCESSING", 
	"customer": {
...	

}

Request - update a booking R123456 to confirmed status:

PUT https://api.rezdy.com/latest/bookings/R123456/?apiKey=123456789XYZ
{
	"status": "CONFIRMED", 
	"customer": {
...	

}