-
Notifications
You must be signed in to change notification settings - Fork 4
Bookings Update
Brad Ploeger edited this page Apr 3, 2019
·
4 revisions
Updates an existing booking by Order Number.
Note: This is not a partial update, a full booking object, as it was retrieved from the booking Create or Search services, has to be send back to the request payload.
$rezdyApi->bookings->get($orderNumber, $request);
- string: $orderNumber
- Rezdy\Requests\Booking: $request
- none
use Rezdy\RezdyAPI;
use Rezdy\Requests\Booking;
use Rezdy\Requests\Customer;
use Rezdy\Requests\Objects\BookingItem;
use Rezdy\Requests\Objects\BookingItemQuantity;
// Initialize the API
$rezdyAPI = new RezdyAPI('your api key');
// IMPORTANT! The order number must be passed as a string.
$orderNumber = '123456';
$bookingParams = [
'comments' => 'Updated From API',
'internalNotes' => 'Updated From API' ];
$customerParams =[
'firstName' => 'John',
'lastName' => 'Doe',
'email' => 'john.doe@email.com' ];
$itemParams = [
'productCode' => 'P12345',
'startTimeLocal' => '2019-03-27 17:00:00' ];
$quantityParams = [
'optionLabel' => 'Quantity',
'value' => 5 ];
// Create the Booking request
$booking = new Booking($bookingParams);
// Create a Customer request
$customer = new Customer($customerParams);
// Create a BookingItem request
$item = new BookingItem($itemParams);
// Create the BookingItemQuantity request
$quantity = new BookingItemQuantity($quantityParams);
// Attach the BookingItemQuantity request to the BookingItem request
$item->attach($quantity);
// Attach the BookingItem request to the Booking request
$booking->attach($item);
// Attach the Customer request to the Booking request
$booking->attach($customer);
// Send the request to the API
$response = $rezdyAPI->bookings->update($orderNumber, $booking);
// View the response
echo $response;
Rezdy API V1 PHP Wrapper