1. Home
  2. Docs
  3. API Documentation
  4. Active APIs
  5. requestOneTimeCode

requestOneTimeCode

Generate OTP (One Time Password). 

This API needs to be called using an HTTP Post method with data in JSON format as shown below.

URL: https://api2.juvlon.com/v4/requestOneTimeCode

JSON Parameters

 {
   "apiKey":"$apiKey",
   "codeType":"$codeType",
   "codeLength":"$codeLength"          		   
  }

Arguments

NameTypeDescriptionDefault
apiKeyStringMandatory. The apiKey that gives you access to our HTTP APIs. The apiKey authenticates you and helps us to identify your Juvlon account. 
codeTypeStringOptional. Default – num  
num – If you want to generate OTP Digit only. 
alpha  – If you want to generate OTP alphabets 
alphanum – If you want to generate OTP mix of     Digit and Alphabets.
 
codeLengthintOptional  Default – 4 digit length 
OTP Code Length between 4-12
 

Return values

NameTypeDescription
codeStringThe Success or Error response code as returned by the API. Please refer to the section “Possible-Response-Codes” for more details.
statusStringDescription of the error code returned.
OTPStringA number generated by the API to uniquely identify the current call.
   

Usage / Example(s)

PHP Example Code for Integration

 $url = 'https://api2.juvlon.com/v4/requestOneTimeCode';
 $data = '{
           "apiKey":"KEY",
           "codeType":"num",
           "codeLength":"4",
          }'; 
 $ch = curl_init($url);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 curl_setopt($ch, CURLOPT_POST, true);
 curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
 $res1 = curl_exec($ch);
 curl_close($ch);

Success-Response

 HTTP/1.1
  {
     "code":200,
     "status":"Success",
     "OTP":”3274”
  }

Error-Response

 HTTP/1.1
  {
     "code":403,
     "status":"Error"
  } 

Possible-Response-Codes

 200    Success: API Request Accepted
 401    Error:Invalid Method
 402    Error: Unauthorized/Empty Key
 403    Error: Unauthorized/Invalid Key
 404    Error: Account Sending Blocked
 405    Error: Your Juvlon account is expired
 448    Your Juvlon account is Deactivated