This API is used to delete a device via API.
Before proceed, the only way to delete device is by giving correct OTP code.
The OTP code is sent to the whatsapp number on the setting menu.
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.fonnte.com/delete-device',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('otp' => ''),
CURLOPT_HTTPHEADER => array(
'Authorization: TOKEN'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
There are 2 steps to use this API :
- Request the OTP
- Submit the OTP
To request the OTP, you can use the curl code above, with otp value empty.
After you got the OTP code, input the OTP code as otp value.
If you prefer to see on postman, see here.
The token is device token. seeĀ how to get token.
Response
Successfull response
{
"detail": "device 08123456789 successfully deleted",
"status": true
}
- invalid device : invalid token
{
"reason": "invalid device",
"status": false
}
- please wait x seconds before requesting new otp : wait 10 minutes before requesting new otp
{
"reason": "please wait x seconds before requesting new otp",
"status": false
}
- otp haven't requested : you are not following procedures, make a request first.
{
"reason": "otp haven't requested",
"status": false
}
- delete failed. try again in x seconds : invalid otp multiple time
{
"reason": "delete failed. try again in x seconds",
"status": false
}
- incorrect OTP : wrong OTP code
{
"reason": "incorrect OTP",
"status": false
}