Cancel a Client/Reservation
When a reservation is canceled, the previously created customer is completely removed from OZmap, freeing up the port for new sales.
Below, we will provide an example of how using the OZmap API, we can cancel a client reservation.
From this point, we assume that this concept is clear. However, if you still have any questions, please contact the support team.
To simplify understanding, we will create a sample scenario using the scope of a Chatbot / IVR.
Initial scenario
Following the example, let’s assume that the customer has canceled and no longer wishes to continue with the process they had previously chosen, for some reason. Therefore, their reservation must be canceled in OZmap.
Example
A customer signed up for a service from the provider by accessing the portal and contacting the provider's support. The chatbot made the reservation in OZmap and waited to activate it.
However, for any reason, the customer can no longer proceed with the service. As a result, they wish to cancel the reservation.
At this point, the provider's chatbot will retrieve the reservation information.
After identifying the reservation and having the identification code, the chatbot will cancel the reservation found in OZmap.
Below there's a flow to facilitate the understanding:
Using the information returned by OZmap, the Chatbot can decide what to answer to the client.
API
The next step is to figure out how to call OZmap to cancel a customer's reservation.
Here’s an example:
After identifying the code that represents the customer's reservation in OZmap, let's assume the reservation code is: 123|123
The reservation code is used to find the property and remember that the customer is deleted along with the property.
First, we will perform a search in OZmap to find the property's identification code.
With the reservation code 123|123, the search in OZmap would be made as follows:
curl --location --request
GET 'https://sandbox.ozmap.com.br:9994/api/v2/properties/client/123|123'
--header 'authorization: AUTHORIZATION_TOKEN'
Attention! The authorization token must be created in the OZmap interface. For more information, click here.
The expected return for this search is:
[
{
"_id": "62d194b46c9401002392c704",
"observation": "Reserva de Porta",
"drop": "62d194b56c9401002392c706",
"tags": [],
"cables": [],
"kind": "Property",
"address": "R. Delminda Silveira, 900 - Agronômica, Florianópolis - SC, 88025-500",
"coords": [
-48.527442812919624,
-27.5782336721312
],
"box": "5da62201493d9c00066655b8",
"client": {
"_id": "62d194b46c9401002392c701",
"certified": false,
"status": 0,
"observation": "Reserva do Novo Cliente",
"tags": [],
"implanted": false,
"onu": {
"user_PPPoE": "",
"serial_number": "",
"mac_address": ""
},
"kind": "ftth",
"code": "123|123",
"name": "Gabriel Marioto",
"creatorData": {
"id": "628f8c3269a79101db8b407b",
"name": "teste_integracao",
"username": "teste_integracao"
},
"createdAt": "2022-07-15T16:24:20.966Z",
"updatedAt": "2022-07-15T16:24:20.966Z",
"__v": 0
},
"creatorData": {
"id": "628f8c3269a79101db8b407b",
"name": "teste_integracao",
"username": "teste_integracao"
},
"project": "62bc9b89a17d2b0030bddc0c",
"pole": "5da62201493d9c00066655b1",
"history": {
"clients": [
{
"id": "62d194b46c9401002392c701",
"code": "123|123",
"enter_date": "2022-07-15T16:24:20.976Z",
"exit_date": null
}
]
},
"createdAt": "2022-07-15T16:24:20.980Z",
"updatedAt": "2022-07-15T16:24:21.104Z",
"__v": 0,
"connections": [
{
"id": "5da6220df003e8132800001e",
"kind": "Splitter",
"port": 4,
"name": "Splitter 1",
"implanted": true,
"fiber": "62d194b56c9401002392c707"
}
]
}
]
The field that must be used for this situation is the _id
, which in this example has the value 62d194b46c9401002392c704
.
With the code 62d194b46c9401002392c704
, the reservation cancellation in OZmap is performed as follows:
curl --location -g --request \
curl -X DELETE 'https://sandbox.ozmap.com.br:9994/api/v2/properties/62d194b46c9401002392c704'
--header 'authorization: AUTHORIZATION_TOKEN'
Attention! The authorization token must be created in the OZmap interface. For more information, click here.
The expected return for this client would be no message, indicating that the reservation was successfully canceled.
With that information, the Chatbot could, for example, provide a standard answer to the client, indicating that the reservation was created and the team is aware. This also avoids the need to contact an agent directly.