PUT
https://api.octopush.com/v1/public/service/otp/validateEncodage : UTF-8
Authentification
La api-key et le api-login doivent être ajoutés dans un header.
Définition
Permet de valider un code OTP généré sur Octopush.
Paramètres
| Nom | Type | Description |
|---|---|---|
phone_number | string | (optionel, obligatoire si otp_request_token est absent) Numéro de téléphone au format international +XXZZZZZ : « +33611223344 » |
code | string | Code OTP tapé par votre visiteur / utilisateur. |
otp_request_token | string | (optionnel, obligatoire si phone_number est absent) Token de l’OTP que vous essayez de valider. Si cette valeur est absente, Octopush essaiera de valider le dernier code envoyé à ce destinataire |
Exemples Curl
curl -X PUT \
'https://api.octopush.com/v1/public/service/otp/validate' \
-H 'Content-Type: application/json' \
-H 'api-login: ******@email.org' \
-H 'api-key: ************' \
-H 'cache-control: no-cache' \
-d '
{
"code": "TRQXSDYNJY",
"otp_request_token": "otp_111111dab2222222aaa33333"
}'Code à copier-coller
curl -X PUT 'https://api.octopush.com/v1/public/service/otp/validate' -H 'Content-Type: application/json' -H 'api-login: ******@email.org' -H 'api-key: ************' -H 'cache-control: no-cache' -d '{"code": "TRQXSDYNJY", "otp_request_token": "otp_111111dab2222222aaa33333"}'Retour Server en json
Success : 200 Created
{
"code": 0,
"message": "success"
}Error : 400 BAD REQUEST
{
"code": 199,
"message": "Wrong OTP code.",
"remaining_number_of_attempts": 3
}Failure : 400 BAD REQUEST
{
"code": 194,
"message": "At least phone number or request token is mandatory."
}Exemples de code retours
| Code | Description |
|---|---|
| 194 | At least phone number or request token is mandatory. |
| 195 | The code field is mandatory. |
| 196 | Maximum amount of wrong attempts has been reached. |
| 197 | OTP Request expired. |
| 198 | OTP Request not found. |
| 199 | Wrong otp code. |