{"id":76,"date":"2022-08-01T06:46:25","date_gmt":"2022-08-01T06:46:25","guid":{"rendered":"https:\/\/www.wellnessliving.com\/developer-portal\/?p=76"},"modified":"2024-11-09T19:13:51","modified_gmt":"2024-11-09T19:13:51","slug":"cancelling-a-reservation","status":"publish","type":"post","link":"https:\/\/www.wellnessliving.com\/developer-portal\/tutorials\/cancelling-a-reservation\/","title":{"rendered":"Canceling a reservation"},"content":{"rendered":"\n<p>To cancel a reservation, you\u2019ll need the user\u2019s key (<span class=\"coding_type\">uid<\/span>), the date and time in GMT, and either the appointment or class period key. There are a few ways to retrieve this information, but this tutorial assumes the user is already known.<\/p>\n\n\n\n<p>The first call must be made to the <a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/wellnessliving\/wl-sdk\/blob\/4ad165716402d13b47511dd8970d1124755960e1\/WellnessLiving\/Wl\/Schedule\/Page\/PageListModel.php\" target=\"_blank\">PageListModel<\/a> endpoint to retrieve a list of upcoming visit keys.<\/p>\n\n\n\n<div class=\"wp-block-columns\">\n<div class=\"wp-block-column\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ Retrieve the list of upcoming visits.\n$o_page_model = new \\WellnessLiving\\Wl\\Schedule\\Page\\PageListModel($o_config);\n$o_page_model->cookieSet($o_notepad->cookieGet()); \/\/ Store cookies to maintain the session.\n\n$o_page_model->k_business='3';\n$o_page_model->dtu_start = '2023-03-27 00:00:00';\n$o_page_model->dtu_end = '2023-03-31 00:00:00';\n$o_page_model->uid = '4';\n\n$o_page_model->get();\n\n\/\/ Print the visit keys.\nforeach($o_page_model->a_visit as $a_visit)\n{\n echo $a_visit['k_visit'].\"\\n\";\n}<\/pre>\n\n\n\n<p>In the list of upcoming visits, find the visit you want to cancel. The <a href=\"https:\/\/github.com\/wellnessliving\/wl-sdk\/blob\/4ad165716402d13b47511dd8970d1124755960e1\/WellnessLiving\/Wl\/Schedule\/Page\/PageElementModel.php\" target=\"_blank\" rel=\"noreferrer noopener\">PageElementModel<\/a> endpoint takes one visit key at a time. From this visit, you can gather all the other required information.<\/p>\n\n\n\n<div class=\"wp-block-columns\">\n<div class=\"wp-block-column\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ Retrieve the details of a visit.\n$o_page_model = new \\WellnessLiving\\Wl\\Schedule\\Page\\PageElementModel($o_config);\n$o_page_model->cookieSet($o_notepad->cookieGet()); \/\/ Store cookies to maintain the session.\n\n$o_page_model->k_visit='246';\n$o_page_model->get();\n\n\/\/ Print information about a visit.\necho 'Date: '.$o_page_model->dt_date_global.\"\\n\";\nif($o_page_model->k_appointment)\n echo 'Appointment key: '.$o_page_model->k_appointment.\"\\n\";\nif($o_page_model->k_class_period)\n echo 'Appointment key: '.$o_page_model->k_class_period.\"\\n\";\necho 'User key: '.$o_page_model->uid.\"\\n\";<\/pre>\n\n\n\n<p>Using the information gathered, you can cancel the visit using the <a href=\"https:\/\/github.com\/wellnessliving\/wl-sdk\/blob\/4ad165716402d13b47511dd8970d1124755960e1\/WellnessLiving\/Wl\/Schedule\/CancelModel.php\" target=\"_blank\" rel=\"noreferrer noopener\">CancelModel<\/a> endpoint.<\/p>\n\n\n\n<div class=\"wp-block-columns\">\n<div class=\"wp-block-column\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ Cancel an upcoming visit.\n$o_cancel_model = new \\WellnessLiving\\Wl\\Schedule\\CancelModel($o_config);\n$o_cancel_model->cookieSet($o_notepad->cookieGet()); \/\/ Store cookies to maintain the session.\n\n$o_cancel_model->dt_date='2023-03-27 14:30:00';\n$o_cancel_model->is_backend=true;\n$o_cancel_model->k_appointment='49';\n$o_cancel_model->uid='4';\n\n$o_cancel_model->get();\n\n\/\/ If successful, the visit is canceled.\necho \"Cancellation complete\\n\";<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>To cancel a reservation, you\u2019ll need the user\u2019s key (uid), the date and time in GMT, and either the appointment or class period key. There are a few ways to retrieve this information, but this tutorial assumes the user is already known. The first call must be made to the PageListModel endpoint to retrieve a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[7,30],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/www.wellnessliving.com\/developer-portal\/wp-json\/wp\/v2\/posts\/76"}],"collection":[{"href":"https:\/\/www.wellnessliving.com\/developer-portal\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wellnessliving.com\/developer-portal\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wellnessliving.com\/developer-portal\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wellnessliving.com\/developer-portal\/wp-json\/wp\/v2\/comments?post=76"}],"version-history":[{"count":12,"href":"https:\/\/www.wellnessliving.com\/developer-portal\/wp-json\/wp\/v2\/posts\/76\/revisions"}],"predecessor-version":[{"id":489,"href":"https:\/\/www.wellnessliving.com\/developer-portal\/wp-json\/wp\/v2\/posts\/76\/revisions\/489"}],"wp:attachment":[{"href":"https:\/\/www.wellnessliving.com\/developer-portal\/wp-json\/wp\/v2\/media?parent=76"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wellnessliving.com\/developer-portal\/wp-json\/wp\/v2\/categories?post=76"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wellnessliving.com\/developer-portal\/wp-json\/wp\/v2\/tags?post=76"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}