PUT
https://api.octopush.com/v1/public/service/otp/validateEncodage : UTF-8
Authentification
Your “api-key” and “api-login” identifiers must be added in the headers.
Definition
Allows you to validate an OTP code generated on Octopush.
Special parameters
| Name | Type | Description |
|---|---|---|
| phone_number | string | (optional, required if otp_request_token is absent) International phone number +XXZZZZZ: “+33611223344”. |
| code | string | OTP code typed by your visitor/user. |
| otp_request_token | string | (optional, required if phone_number is missing) Token of the OTP you are trying to validate. If this value is missing, Octopush will try to validate the last code sent to this recipient. |
Curl Example
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"
}'Command to copy/paste
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"}'JSON Server Response
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."
}Examples of return codes
| 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. |