200 OTP successfully sent 401 OTP not sent
Copy {
"success" : true ,
"message" : "OTP sent" ,
"code" : 0 ,
"data" : null
}
Copy {
"success": false,
"message": "Error sending OTP",
"code": 0,
"data": null
}
Take a look at how you might call this method using our official libraries, or via curl
:
curl Node Python PHP Java Javascript
Copy curl --location --request POST 'https://api.getspendo.com/gateway/api/v1/send/whatsapp' \
--header 'apiKey: test_api_key' \
--header 'Content-Type: application/json' \
--data-raw '{
"message": "string",
"phoneNumber": "string"
}'
Copy var axios = require ( 'axios' );
var data = JSON .stringify ({
"code" : "string" ,
"phoneNumber" : "string"
});
var config = {
method : 'post' ,
url : 'https://api.getspendo.com/gateway/api/v1/send/voice/call' ,
headers : {
'apiKey' : 'test_api_key' ,
'Content-Type' : 'application/json'
} ,
data : data
};
axios (config)
.then ( function (response) {
console .log ( JSON .stringify ( response .data));
})
.catch ( function (error) {
console .log (error);
});
Copy import http . client
import json
conn = http . client . HTTPSConnection ( "api.getspendo.com" )
payload = json . dumps ({
"code" : "string" ,
"phoneNumber" : "string"
})
headers = {
'apiKey' : 'test_api_key' ,
'Content-Type' : 'application/json'
}
conn . request ( "POST" , "/gateway/api/v1/send/voice/call" , payload, headers)
res = conn . getresponse ()
data = res . read ()
print (data. decode ( "utf-8" ))
Copy <? php
$curl = curl_init () ;
curl_setopt_array ( $curl , array(
CURLOPT_URL => 'https://api.getspendo.com/gateway/api/v1/send/voice/call' ,
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 => '{
"code": "string",
"phoneNumber": "string"
}' ,
CURLOPT_HTTPHEADER => array(
'apiKey: test_api_key' ,
'Content-Type: application/json'
) ,
) ) ;
$response = curl_exec ( $curl ) ;
curl_close ( $curl ) ;
echo $response;
Copy OkHttpClient client = new OkHttpClient() . newBuilder ()
. build ();
MediaType mediaType = MediaType . parse ( "application/json" );
RequestBody body = RequestBody . create (mediaType , "{\n \"code\": \"string\",\n \"phoneNumber\": \"string\"\n}" );
Request request = new Request . Builder ()
. url ( "https://api.getspendo.com/gateway/api/v1/send/voice/call" )
. method ( "POST" , body)
. addHeader ( "apiKey" , "test_api_key" )
. addHeader ( "Content-Type" , "application/json" )
. build ();
Response response = client . newCall (request) . execute ();
Copy var settings = {
"url" : "https://api.getspendo.com/gateway/api/v1/send/voice/call" ,
"method" : "POST" ,
"timeout" : 0 ,
"headers" : {
"apiKey" : "test_api_key" ,
"Content-Type" : "application/json"
} ,
"data" : JSON .stringify ({
"code" : "string" ,
"phoneNumber" : "string"
}) ,
};
$ .ajax (settings) .done ( function (response) {
console .log (response);
});