''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''
' :: How to generate Token in C# using our Restful API
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''
var client = new RestClient(" https://api.bulksmsonline.co/rest/api/v1/sms/gettoken/username/YOURUSERNAME/password/YOURPASSWORD");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''
' ::: How to send sms with your generated Token
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''
var client = new RestClient(" https://api.bulksmsonline.co/rest/api/v1/sms/send");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/json");
request.AddHeader("token", "USER TOKEN GENERATED FROM GET TOKEN API");
request.AddParameter(
"application/json",
"{\"from\":\"Sender Name\",\"to\":[\"16813000014\",\"16813000014\"],\"type\":\"Text\",\"content\":\"Sample SMS Content To Be Sent\"}",
ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
/*
*:: How to generate Token in PHP using our Restful API
*/
" https://api.bulksmsonline.co/rest/api/v1/sms/gettoken/username/YOURUSERNAME/password/YOURPASSWORD",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
/*
*::: How to send sms with your generated Token
*/
" https://api.bulksmsonline.co/rest/api/sms/send",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\"from\":\"Sender Name\",\"to\":[\"16813000014\",\"16813000014\"],\"type\":\"Text\",\"content\":\"Sample SMS Content To Be Sent\"}",
CURLOPT_HTTPHEADER => array(
"token : USER TOKEN GENERATED FROM GET TOKEN API",
"content-type: application/json"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
/**
* :: How to generate Token in JAVA using our Restful API
**/
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url(" https://api.bulksmsonline.co/rest/api/v1/sms/gettoken/username/YOURUSERNAME/password/YOURPASSWORD")
.get()
.build();
Response response = client.newCall(request).execute();
/**
* ::: How to send sms with your generated Token
**/
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(
mediaType,
"{\"from\":\"Sender Name\",\"to\":[\"16813000014\",\"16813000014\"],\"type\":\"Text\",\"content\":\"Sample SMS Content To Be Sent\"}"
);
Request request = new Request.Builder()
.url(" https://api.bulksmsonline.co/rest/api/v1/sms/send")
.post(body)
.addHeader("token", "USER TOKEN GENERATED FROM GET TOKEN API")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();