NAV
cURL PHP Class PHP Java Class Java Laravel Composer C# C Dart Go JavaScript NodeJS Objective-C OCAML PowerShell Python R Ruby Shell Swift

Introduction

The API is currently only implemented with a JSON wrapper.

These API's can be accessed with an HTTP client independent of language. We have provided PHP and Java examples to assist.

Some general considerations:

A negative number in status codes indicates an error. HTTP Keep-Alive is supported and should be used for large numbers of queries. Unbilled queries are limited to 10 per minute (message_status, user_get_balance, etc).

URL structure

The base path of the request URL is: https://api.sendsms.ro/json

Each method has an attribute called action. This attribute needs to be added to the query parameter list.

Implementation

For easier implementation, we have created the following classes that will be referenced in the following examples:

  1. PHP
  2. Java

API Key

An API Key acts as a permanent password for you to connect to an API.

API connections are handled this way because usernames and passwords may change, then instead of needing to change connection settings within the API, the Key will remain constant.

For a guide on how to create API Keys go here

Tutorials

Composer

General composer package

We are providing a general composer package.

You can use this package in frameworks such as: Zend, Code Igniter 4, Cake PHP, Symfony and many more

To install, run this command in the terminal window

$ composer require sendsms/sendsms

Laravel

Run this command in the terminal window

$ composer require sendsms/sendsms-laravel

In your .env file, add this variables:

SENDSMS_USERNAME 
SENDSMS_PASSWORD

All the debug informations will pe printed under the Laravel's log file.

PHP Class

To make any request using PHP you need to install the curl library. You can do it on linux running sudo apt-get install php-curl and sudo service apache2 restart

To use our PHP class you will need a server or a PHP interpreter.

Create a file named "sendsms_api.php" and paste the code from the PHP class there.

In the same directory, create a "demo.php" file and add our examples to it. To run this file, go to https://yourserver.com/demo.php.

This is just an example, please adjust it based on your needs.

Java Class

    <dependencies>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20201115</version>
        </dependency>
    </dependencies>

To run a Java application, you will need an IDE, we will use IntelliJ in this example.

The first step is to install the Java SDK.

Download IntelliJ Community Edition.

Open IntelliJ and create a new project. From the list to the right, select Maven and give your project a name.

Add this code in the file "pom.xml" from the document root file under the properties tag.

Annotation with the Maven icon will appear. Press it to load the changes.

Under src > main > java create a new package called "com.sendsms" and a Java class called Api.java in it. Past the code from Java class there.

Debugging

setDebugState(true);

You can print detailed informations about your request by setting the internal debug state of our packages / classes with the setDebugState function.

Codes

The sendSMS API uses the following response codes:

Code Constant Meaning
-8 api_result_authentication_failed Authentication failure
-256 api_result_could_not_save Could not save
-512 api_result_duplicate_record Duplicate record found (when adding)
-16 api_result_internal_error Internal error
-128 api_result_invalid_record Invalid record
2 api_result_key_created API Request Key created
1 api_result_message_sent Message sent/queued
-4 api_result_missing_parameter There was a required parameter missing from the request (see 'details' key in result for more information)
-1 api_result_no_action_specified No action was specified in the request
-2 api_result_no_such_action There was no matching action found
0 api_result_ok Generic OK
-64 api_result_out_of_credit Out of credit
-32 api_result_routing_error Routing error
-8191 api_result_timeout User has exceeded the maximum number of simultaneous requests to the API
-4096 api_result_too_many_connections User has exceeded the maximum number of simultaneous requests to the API
-1024 api_result_user_invalid_affiliate User is not part of any affiliate program
-2048 api_result_user_no_hlr User does not have HLR enabled on his account
-65536 api_result_permission_denied From field exceeds 11 alphanumeric characters
16 batch_status_busy Batch is busy being processed
128 batch_status_error There was an error processing the batch
256 batch_status_filter The batch is waiting to be filtered (Set the batch to this status if you wish for it to be filtered)
512 batch_status_filtering Batch is busy being filtered
1 batch_status_new Batch is waiting to be processed
2 batch_status_parsing Batch is busy being parsed
4 batch_status_parsing_paused Parsing of the batch has been paused
32 batch_status_paused Batch has been parsed and is currently paused
8 batch_status_ready Batch is waiting to be processed (no action required)
64 batch_status_submitted Batch has been submitted
-2048 maximum_affliate_registrations_reached User has reached maximum registrations during the specified period.
1 message_status_acknowledged Message acknowledged
4 message_status_delivered Message has been delivered
-1 message_status_does_not_exist Message does not exist
32 message_status_failed Message failed
64 message_status_filtered Filtered (blocked or previously failed)
8 message_status_internal_failed Message failed (internal error)
16 message_status_routing_error Routing error
2 message_status_submitted Message has been sent to the networks

Messages

Send Message

  curl "https://api.sendsms.ro/json?action=message_send&username=username&password=password&to=to&text=text&from=from&report_mask=report_mask&report_url=report_url&charset=charset&data_coding=data_coding&message_class=message_class&auto_detect_encoding=auto_detect_encoding&short=short&ctype=1"
<?php
require('sendsms_api.php');
$api = new SendsmsApi();

$api->setUsername('username');
$api->setPassword('password');
// send simple message
echo json_encode($api->message_send('40727363767', 'This is a message', '1898'));
<?php
$curl = curl_init();

curl_setopt($curl, CURLOPT_HEADER, 1);
$content = urlencode("Some message");
$password = urlencode("password");
$report_url = urlencode("https://yourserver.com/receive_report.php?myMessageId=12345&status=%d");
curl_setopt($curl, CURLOPT_URL, "https://api.sendsms.ro/json?action=message_send&username=yourusername&password=$password&to=40727363767&text=$content&from=1898&report_url=$report_url&ctype=1");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLINFO_HEADER_OUT, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Connection: keep-alive"));

$result = curl_exec($curl);

$size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);

$result = substr($result, $size);

echo $result;
package com.sendsms;

public class Main {
    public static void main(String[] args) {
        Api sendsms = new Api("username", "password");
        sendsms.setDebugState(true);
        System.out.println(sendsms.message_send("40727363767", "Some message", "1898", 19, null, "UTF-8", null, -1, 0, null));
    }
}
package com.sendsms;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

public class Main {
    public static void main(String[] args) throws IOException {
        String password = URLEncoder.encode("password", StandardCharsets.UTF_8);
        String text = URLEncoder.encode("Some generic message", StandardCharsets.UTF_8);
        String urlString = "https://api.sendsms.ro/json?action=message_send&username=demouser&password=" + password + "&to=40727363767&text=" + text + "&from=1898&ctype=1";
        URL url = new URL(urlString);
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        con.setConnectTimeout(5000);
        con.setReadTimeout(5000);
        BufferedReader in = new BufferedReader(
                new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer content = new StringBuffer();
        while ((inputLine = in.readLine()) != null) {
            content.append(inputLine);
        }
        in.close();
        con.disconnect();
        System.out.println(content);
    }
}
<?php

use Illuminate\Support\Facades\Route;
use SendSMS\SendsmsLaravel\API\Message;

Route::get('/', function () {
    $api = new Message();
    // simple message
    $api->message_send('40727363767', 'This is a message', '1898');
    // send message with ctype (requires laravel package version >= v0.8.1); last parameter is ctype
    $api->message_send('40727363767', 'This is a message', '1898', 19, null, null, null, -1, null, false, 3);
    return view('welcome');
});
<?php
use SendSMS\API\Message;

$api = new Message();
$api->setUsername("username");
$api->setPassword("password");
// simple message
$api->message_send("40727363767", "This is a message", "1898");
// send message with ctype (requires package version >= 0.6); last parameter is ctype
$api->message_send("40727363767", "This is a message", "1898", 19, null, null, null, -1, null, false, 3);
var client = new RestClient("https://api.sendsms.ro/json?action=message_send&username=username&password=password&to=40727363767&text=Some message&from=1898&report_url=https://yourserver.com/receive_report.php?myMessageId=12345%26status=&ctype=1");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
var request = http.Request('GET', Uri.parse('https://api.sendsms.ro/json?action=message_send&username=username&password=password&to=40727363767&text=Some message&from=1898&ctype=1&report_url=https://yourserver.com/receive_report.php?myMessageId=12345%26status='));


http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
  print(await response.stream.bytesToString());
}
else {
  print(response.reasonPhrase);
}
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.sendsms.ro/json?action=message_send&username=username&password=password&to=40727363767&text=Some%20message&from=1898&ctype=1&report_url=https://yourserver.com/receive_report.php?myMessageId=12345%2526status="
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
// WARNING: For GET requests, body is set to null by browsers.

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.sendsms.ro/json?action=message_send&username=username&password=password&to=40727363767&text=Some%20message&from=1898&ctype=1&report_url=https://yourserver.com/receive_report.php?myMessageId=12345%2526status=");

xhr.send();
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
  curl_easy_setopt(curl, CURLOPT_URL, "https://api.sendsms.ro/json?action=message_send&username=username&password=password&to=40727363767&text=Some%20message&from=1898&ctype=1&report_url=https://yourserver.com/receive_report.php?myMessageId=12345%2526status=");
  curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
  curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
  struct curl_slist *headers = NULL;
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'GET',
  'hostname': 'api.sendsms.ro',
  'path': '/json?action=message_send&username=username&password=password&to=40727363767&text=Some%20message&from=1898&ctype=1&report_url=https://yourserver.com/receive_report.php?myMessageId=12345%2526status=',
  'headers': {
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

req.end();
#import <Foundation/Foundation.h>

dispatch_semaphore_t sema = dispatch_semaphore_create(0);

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.sendsms.ro/json?action=message_send&username=username&password=password&to=40727363767&text=Some%20message&from=1898&ctype=1&report_url=https://yourserver.com/receive_report.php?myMessageId=12345%2526status="]
  cachePolicy:NSURLRequestUseProtocolCachePolicy
  timeoutInterval:10.0];

[request setHTTPMethod:@"GET"];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
  if (error) {
    NSLog(@"%@", error);
    dispatch_semaphore_signal(sema);
  } else {
    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
    NSError *parseError = nil;
    NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
    NSLog(@"%@",responseDictionary);
    dispatch_semaphore_signal(sema);
  }
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
open Lwt
open Cohttp
open Cohttp_lwt_unix

let reqBody = 
  let uri = Uri.of_string "https://api.sendsms.ro/json?action=message_send&username=username&password=password&to=40727363767&text=Some%20message&from=1898&ctype=1&report_url=https://yourserver.com/receive_report.php?myMessageId=12345%2526status=" in
  Client.call `GET uri >>= fun (_resp, body) ->
  body |> Cohttp_lwt.Body.to_string >|= fun body -> body

let () =
  let respBody = Lwt_main.run reqBody in
  print_endline (respBody)
$response = Invoke-RestMethod 'https://api.sendsms.ro/json?action=message_send&username=username&password=password&to=40727363767&text=Some message&from=1898&ctype=1&report_url=https://yourserver.com/receive_report.php?myMessageId=12345%26status=' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
import http.client

conn = http.client.HTTPSConnection("api.sendsms.ro")
payload = ''
headers = {}
conn.request("GET", "/json?action=message_send&username=username&password=password&to=40727363767&text=Some%20message&from=1898&ctype=1&report_url=https://yourserver.com/receive_report.php?myMessageId=12345%2526status=", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
library(httr)

res <- VERB("GET", url = "https://api.sendsms.ro/json?action=message_send&username=username&password=password&to=40727363767&text=Some message&from=1898&ctype=1&report_url=https://yourserver.com/receive_report.php?myMessageId=12345%26status=")

cat(content(res, 'text'))
require "uri"
require "net/http"

url = URI("https://api.sendsms.ro/json?action=message_send&username=username&password=password&to=40727363767&text=Some message&from=1898&ctype=1&report_url=https://yourserver.com/receive_report.php?myMessageId=12345%26status=")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)

response = https.request(request)
puts response.read_body
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

var semaphore = DispatchSemaphore (value: 0)

var request = URLRequest(url: URL(string: "https://api.sendsms.ro/json?action=message_send&username=username&password=password&to=40727363767&text=Some message&from=1898&ctype=1&report_url=https://yourserver.com/receive_report.php?myMessageId=12345%26status=")!,timeoutInterval: Double.infinity)
request.httpMethod = "GET"

let task = URLSession.shared.dataTask(with: request) { data, response, error in 
  guard let data = data else {
    print(String(describing: error))
    semaphore.signal()
    return
  }
  print(String(data: data, encoding: .utf8)!)
  semaphore.signal()
}

task.resume()
semaphore.wait()

In the return result, if successful the details key will contain the message ID.

When sending a message through sendSMS.ro, you have the option to track the delivery of these messages.

If using HTTP, you need to add two additional fields to your request, as below.

  1. report_url – The HTTP URL for us to request when the status changes
  2. report_mask – Which status messages you would like to receive

The above command returns JSON structured like this:

{
   "status":1,
   "message":"Sent",
   "details":"8beda1a8-5c12-489f-0107-123000000003"
}

Report Mask

The report mask is what is known as a bit mask field indicating which status messages you want to receive.

What are the different delivery status codes?

Code Meaning
1 Delivered
2 Undelivered
4 Queued at network
8 Sent to network
16 Failed at network

To calculate the report mask, you need to pick the status codes you want to receive, and then add them together, voila! That’s your report mask.

For example: I want to receive whether my message was delivered or failed. (1, 2 and 16).

report_mask = 1 + 2 + 16 = 19

So in your next request, send report_mask=19 and we’ll send you these status’ messages where applicable.

Report URL

The report url should have a similar structure to https://yourserver.com/receive_report.php?myMessageId=12345&status=%d and will be called as a GET request for every message matching the set report mask.

In the case of the example shown in the previous paragraph, the myMessageId parameter should contain an internal reference to the message, allowing you to match the callback to the original request as well as the %d placeholder which will be replaced by our systems with the message status code before sending.

Please note that the %d placeholder is mandatory for any report_url and no callbacks will be issued unless it is specified.

Please note that, as with any other sent parameter, report_url should be urlencoded before being passed to the request.

In case ctype is greater than 1, ctype will be added to the DLR. This way you can differentiate other Channel – like Viber, RCS, WhatsApp, etc, from SMS in the delivery report.

Give me an example

Ok, so we want to send a message, and receive status reports to our server when the message is delivered, or fails.

Our request parameters will look like this

Parameter Example Value Aditional informations
username myusername Your log-in username (required)
password mypassword Your log-in password or API Key (required)
to 40727363767 A phone number in E.164 Format but without the + sign (eg. 40727363767) (required)
from Eticheta Sending label (max 11 characters)
text Hello there, we are testing delivery reports! Your message (required)
report_mask 19
report_url https://yourserver.com/receive_report.php?myMessageId=12345&status=%d

https://api.sendsms.ro/json?action=message_send&username=myusername&password=mypassword&to=40727363767&from=Eticheta&text=Hello+there%2C+we+are+testing+delivery+reports%21&report_mask=19&report_url=http%3A%2F%2Fmyserver.com%2Freceive_report.php%3FmyMessageId%3D12345%26status%3D%25d

Short URL

The short parameter can have two forms

  1. "string" Add sort url at the end of message or search for key {short} in message and replace with short url when parameter contain URL
  2. "boolean" Searches long url and replaces them with coresponding sort url when short parameter is "true".

HTTP Request

GET https://api.sendsms.ro/json?action=message_send

Query Parameters

Parameter Type Description Required Default
username string Your log-in username true
password string Your log-in password or API Key true
to string A phone number in E.164 Format but without the + sign (eg. 40727363767) true
text string The body of your message true
from string Sending label (max 11 characters) false NULL
report_mask int Delivery report request bitmask (see above) false 19
report_url string URL to call when delivery status changes (see above) false NULL
charset string : Character set to use false UTF-8
data_coding int Data coding false NULL
message_class int Message class false -1
auto_detect_encoding int Auto detect the encoding and send appropriately (useful for sending arabic, hindi, unicode etc messages) 1 = on, 0 = off false 0 (off)
short string/boolean see above false NULL
ctype int 1 = SMS (Default), 2 = RCS - (not active yet), 3 = Viber (failover to SMS if undelivered) false 1
  curl "https://api.sendsms.ro/json?action=message_send_gdpr&username=username&password=password&to=to&text=text&from=from&report_mask=report_mask&report_url=report_url&charset=charset&data_coding=data_coding&message_class=message_class&auto_detect_encoding=auto_detect_encoding&short=short"
<?php
require('sendsms_api.php');
$api = new SendsmsApi();

$api->setUsername('username');
$api->setPassword('password');

echo json_encode($api->message_send_gdpr('40727363767', 'This is a message', '1898'));
<?php
$curl = curl_init();

curl_setopt($curl, CURLOPT_HEADER, 1);
$content = urlencode("Some message");
$password = urlencode("password");
$report_url = urlencode("https://yourserver.com/receive_report.php?myMessageId=12345&status=%d");
curl_setopt($curl, CURLOPT_URL, "https://api.sendsms.ro/json?action=message_send_gdpr&username=yourusername&password=$password&to=40727363767&text=$content&from=1898&report_url=$report_url")
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLINFO_HEADER_OUT, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Connection: keep-alive"));

$result = curl_exec($curl);

$size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);

$result = substr($result, $size);

echo $result;
package com.sendsms;

public class Main {
    public static void main(String[] args) {
        Api sendsms = new Api("username", "password");
        sendsms.setDebugState(true);
        System.out.println(sendsms.message_send_gdpr("40727363767", "Some message", "1898", 19, null, "UTF-8", null, -1, 0, null));
    }
}
package com.sendsms;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

public class Main {
    public static void main(String[] args) throws IOException {
        String password = URLEncoder.encode("password", StandardCharsets.UTF_8);
        String text = URLEncoder.encode("Some generic message", StandardCharsets.UTF_8);
        String urlString = "https://api.sendsms.ro/json?action=message_send_gdpr&username=demouser&password=" + password + "&to=40727363767&text=" + text + "&from=1898";        URL url = new URL(urlString);
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        con.setConnectTimeout(5000);
        con.setReadTimeout(5000);
        BufferedReader in = new BufferedReader(
                new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer content = new StringBuffer();
        while ((inputLine = in.readLine()) != null) {
            content.append(inputLine);
        }
        in.close();
        con.disconnect();
        System.out.println(content);
    }
}
<?php

use Illuminate\Support\Facades\Route;
use SendSMS\SendsmsLaravel\API\Message;

Route::get('/', function () {
    $api = new Message();
    $api->$api->message_send_gdpr('40727363767', 'This is a message', '1898');
    return view('welcome');
});
<?php
use SendSMS\API\Message;

$api = new Message();
$api->setUsername("username");
$api->setPassword("password");
$api->message_send_gdpr("40727363767", "This is a message", "1898");
var client = new RestClient("https://api.sendsms.ro/json?action=message_send_gdpr&username=username&password=password&to=40727363767&text=text&from=1898&report_mask=report_mask&report_url=report_url&charset=charset&data_coding=data_coding&message_class=message_class&auto_detect_encoding=auto_detect_encoding&short=short");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
var request = http.Request('GET', Uri.parse('https://api.sendsms.ro/json?action=message_send_gdpr&username=username&password=password&to=40727363767&text=text&from=1898&report_mask=report_mask&report_url=report_url&charset=charset&data_coding=data_coding&message_class=message_class&auto_detect_encoding=auto_detect_encoding&short=short'));


http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
  print(await response.stream.bytesToString());
}
else {
  print(response.reasonPhrase);
}
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.sendsms.ro/json?action=message_send_gdpr&username=username&password=password&to=40727363767&text=text&from=1898&report_mask=report_mask&report_url=report_url&charset=charset&data_coding=data_coding&message_class=message_class&auto_detect_encoding=auto_detect_encoding&short=short"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
// WARNING: For GET requests, body is set to null by browsers.

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.sendsms.ro/json?action=message_send_gdpr&username=username&password=password&to=40727363767&text=text&from=1898&report_mask=report_mask&report_url=report_url&charset=charset&data_coding=data_coding&message_class=message_class&auto_detect_encoding=auto_detect_encoding&short=short");

xhr.send();
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
  curl_easy_setopt(curl, CURLOPT_URL, "https://api.sendsms.ro/json?action=message_send_gdpr&username=username&password=password&to=40727363767&text=text&from=1898&report_mask=report_mask&report_url=report_url&charset=charset&data_coding=data_coding&message_class=message_class&auto_detect_encoding=auto_detect_encoding&short=short");
  curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
  curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
  struct curl_slist *headers = NULL;
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'GET',
  'hostname': 'api.sendsms.ro',
  'path': '/json?action=message_send_gdpr&username=username&password=password&to=40727363767&text=text&from=1898&report_mask=report_mask&report_url=report_url&charset=charset&data_coding=data_coding&message_class=message_class&auto_detect_encoding=auto_detect_encoding&short=short',
  'headers': {
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

req.end();
#import <Foundation/Foundation.h>

dispatch_semaphore_t sema = dispatch_semaphore_create(0);

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.sendsms.ro/json?action=message_send_gdpr&username=username&password=password&to=40727363767&text=text&from=1898&report_mask=report_mask&report_url=report_url&charset=charset&data_coding=data_coding&message_class=message_class&auto_detect_encoding=auto_detect_encoding&short=short"]
  cachePolicy:NSURLRequestUseProtocolCachePolicy
  timeoutInterval:10.0];

[request setHTTPMethod:@"GET"];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
  if (error) {
    NSLog(@"%@", error);
    dispatch_semaphore_signal(sema);
  } else {
    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
    NSError *parseError = nil;
    NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
    NSLog(@"%@",responseDictionary);
    dispatch_semaphore_signal(sema);
  }
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
open Lwt
open Cohttp
open Cohttp_lwt_unix

let reqBody = 
  let uri = Uri.of_string "https://api.sendsms.ro/json?action=message_send_gdpr&username=username&password=password&to=40727363767&text=text&from=1898&report_mask=report_mask&report_url=report_url&charset=charset&data_coding=data_coding&message_class=message_class&auto_detect_encoding=auto_detect_encoding&short=short" in
  Client.call `GET uri >>= fun (_resp, body) ->
  body |> Cohttp_lwt.Body.to_string >|= fun body -> body

let () =
  let respBody = Lwt_main.run reqBody in
  print_endline (respBody)
$response = Invoke-RestMethod 'https://api.sendsms.ro/json?action=message_send_gdpr&username=username&password=password&to=40727363767&text=text&from=1898&report_mask=report_mask&report_url=report_url&charset=charset&data_coding=data_coding&message_class=message_class&auto_detect_encoding=auto_detect_encoding&short=short' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
import http.client

conn = http.client.HTTPSConnection("api.sendsms.ro")
payload = ''
headers = {}
conn.request("GET", "/json?action=message_send_gdpr&username=username&password=password&to=40727363767&text=text&from=1898&report_mask=report_mask&report_url=report_url&charset=charset&data_coding=data_coding&message_class=message_class&auto_detect_encoding=auto_detect_encoding&short=short", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
library(httr)

res <- VERB("GET", url = "https://api.sendsms.ro/json?action=message_send_gdpr&username=username&password=password&to=40727363767&text=text&from=1898&report_mask=report_mask&report_url=report_url&charset=charset&data_coding=data_coding&message_class=message_class&auto_detect_encoding=auto_detect_encoding&short=short")

cat(content(res, 'text'))
require "uri"
require "net/http"

url = URI("https://api.sendsms.ro/json?action=message_send_gdpr&username=username&password=password&to=40727363767&text=text&from=1898&report_mask=report_mask&report_url=report_url&charset=charset&data_coding=data_coding&message_class=message_class&auto_detect_encoding=auto_detect_encoding&short=short")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)

response = https.request(request)
puts response.read_body
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

var semaphore = DispatchSemaphore (value: 0)

var request = URLRequest(url: URL(string: "https://api.sendsms.ro/json?action=message_send_gdpr&username=username&password=password&to=40727363767&text=text&from=1898&report_mask=report_mask&report_url=report_url&charset=charset&data_coding=data_coding&message_class=message_class&auto_detect_encoding=auto_detect_encoding&short=short")!,timeoutInterval: Double.infinity)
request.httpMethod = "GET"

let task = URLSession.shared.dataTask(with: request) { data, response, error in 
  guard let data = data else {
    print(String(describing: error))
    semaphore.signal()
    return
  }
  print(String(data: data, encoding: .utf8)!)
  semaphore.signal()
}

task.resume()
semaphore.wait()

In the return result, if successful the details key will contain the message ID.

When sending a message through sendSMS.ro, you have the option to track the delivery of these messages.

If using HTTP, you need to add two additional fields to your request, as below.

  1. report_url – The HTTP URL for us to request when the status changes
  2. report_mask – Which status messages you would like to receive

The above command returns JSON structured like this:

{
   "status":1,
   "message":"Sent",
   "details":"8beda1a8-5c12-489f-0107-123000000003"
}

Report Mask & Report URL

The report mask is what is known as a bit mask field indicating which status messages you want to receive.

What are the different delivery status codes?

Code Meaning
1 Delivered
2 Undelivered
4 Queued at network
8 Sent to network
16 Failed at network

To calculate the report mask, you need to pick the status codes you want to receive, and then add them together, voila! That’s your report mask.

For example: I want to receive whether my message was delivered or failed. (1, 2 and 16).

report_mask = 1 + 2 + 16 = 19

So in your next request, send report_mask=19 and we’ll send you these status’ messages where applicable.

Seems simple enough, what about getting some extra data in the request?

We provide you with some extra fields which you can specify and we’ll replace them for you before we send the messages back to your server

In case ctype is greater than 1, ctype will be added to the DLR. This way you can differentiate Viber from SMS in the delivery report.

Give me an example

Ok, so we want to send a message, and receive status reports to our server when the message is delivered, or fails.

Our request parameters will look like this

Parameter Example Value Aditional informations
username myusername Your log-in username (required)
password mypassword Your log-in password or API Key (required)
to 40727363767 A phone number in E.164 Format but without the + sign (eg. 40727363767) (required)
from Eticheta Sending label (max 11 characters)
text Hello there, we are testing delivery reports! Your message (required)
report_mask 19
report_url https://yourserver.com/receive_report.php?myMessageId=12345&status=%d

https://api.sendsms.ro/json?action=message_send&username=myusername&password=mypassword&to=40727363767&from=Eticheta&text=Hello+there%2C+we+are+testing+delivery+reports%21&report_mask=19&report_url=http%3A%2F%2Fmyserver.com%2Freceive_report.php%3FmyMessageId%3D12345%26status%3D%25d

Short URL

The short parameter can have two forms

  1. "string" Add sort url at the end of message or search for key {short} in message and replace with short url when parameter contain URL
  2. "boolean" Searches long url and replaces them with coresponding sort url when short parameter is "true".

You must specify {gdpr} key message. {gdpr} key will be replaced automaticaly with confirmation unique confirmation link. If {gdpr} key is not specified confirmation link will be placed at the end of message.

HTTP Request

GET https://api.sendsms.ro/json?action=message_send_gdpr

Query Parameters

Parameter Type Description Required Default
username string Your log-in username true
password string Your log-in password or API Key true
to string A phone number in E.164 Format but without the + sign (eg. 40727363767) true
text string The body of your message true
from string Sending label (max 11 characters) false NULL
report_mask int Delivery report request bitmask (see above) false 19
report_url string URL to call when delivery status changes (see above) false NULL
charset string : Character set to use false UTF-8
data_coding int Data coding false NULL
message_class int Message class false -1
auto_detect_encoding int Auto detect the encoding and send appropriately (useful for sending arabic, hindi, unicode etc messages) 1 = on, 0 = off false 0 (off)
short string/boolean see above false NULL
ctype int 1 = SMS (Default), 2 = RCS - (not active yet), 3 = Viber (failover to SMS if undelivered) false 1

Get Messages

  curl "https://api.sendsms.ro/json?action=messages_get&username=username&password=password&last_id=last_id"
<?php
require('sendsms_api.php');
$api = new SendsmsApi();

$api->setUsername('username');
$api->setPassword('password');

echo json_encode($api->messages_get(0));
<?php
$curl = curl_init();

curl_setopt($curl, CURLOPT_HEADER, 1);
$password = urlencode("password");
curl_setopt($curl, CURLOPT_URL, "https://api.sendsms.ro/json?action=messages_get&username=username&password=$password&last_id=0");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLINFO_HEADER_OUT, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Connection: keep-alive"));

$result = curl_exec($curl);

$size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);

$result = substr($result, $size);

echo $result;
package com.sendsms;

public class Main {
    public static void main(String[] args) {
        Api sendsms = new Api("username", "password");
        sendsms.setDebugState(true);
        System.out.println(sendsms.messages_get(0));
    }
}
package com.sendsms;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

public class Main {
    public static void main(String[] args) throws IOException {
        String password = URLEncoder.encode("password", StandardCharsets.UTF_8);
        String urlString = "https://api.sendsms.ro/json?action=messages_get&username=usernam}&password=" + password + "&last_id=0";
        URL url = new URL(urlString);
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        con.setConnectTimeout(5000);
        con.setReadTimeout(5000);
        BufferedReader in = new BufferedReader(
                new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer content = new StringBuffer();
        while ((inputLine = in.readLine()) != null) {
            content.append(inputLine);
        }
        in.close();
        con.disconnect();
        System.out.println(content);
    }
}
<?php

use Illuminate\Support\Facades\Route;
use SendSMS\SendsmsLaravel\API\Message;

Route::get('/', function () {
    $api = new Message();
    $api->messages_get(0);
    return view('welcome');
});
<?php
use SendSMS\API\Message;

$api = new Message();
$api->setUsername("username");
$api->setPassword("password");
$api->messages_get(0);
var client = new RestClient("https://api.sendsms.ro/json?action=messages_get&username=username&password=password&last_id=last_id");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
var request = http.Request('GET', Uri.parse('https://api.sendsms.ro/json?action=messages_get&username=username&password=password&last_id=last_id'));


http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
  print(await response.stream.bytesToString());
}
else {
  print(response.reasonPhrase);
}
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.sendsms.ro/json?action=messages_get&username=username&password=password&last_id=last_id"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
// WARNING: For GET requests, body is set to null by browsers.

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.sendsms.ro/json?action=messages_get&username=username&password=password&last_id=last_id");

xhr.send();
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
  curl_easy_setopt(curl, CURLOPT_URL, "https://api.sendsms.ro/json?action=messages_get&username=username&password=password&last_id=last_id");
  curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
  curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
  struct curl_slist *headers = NULL;
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'GET',
  'hostname': 'api.sendsms.ro',
  'path': '/json?action=messages_get&username=username&password=password&last_id=last_id',
  'headers': {
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

req.end();
#import <Foundation/Foundation.h>

dispatch_semaphore_t sema = dispatch_semaphore_create(0);

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.sendsms.ro/json?action=messages_get&username=username&password=password&last_id=last_id"]
  cachePolicy:NSURLRequestUseProtocolCachePolicy
  timeoutInterval:10.0];

[request setHTTPMethod:@"GET"];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
  if (error) {
    NSLog(@"%@", error);
    dispatch_semaphore_signal(sema);
  } else {
    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
    NSError *parseError = nil;
    NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
    NSLog(@"%@",responseDictionary);
    dispatch_semaphore_signal(sema);
  }
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
open Lwt
open Cohttp
open Cohttp_lwt_unix

let reqBody = 
  let uri = Uri.of_string "https://api.sendsms.ro/json?action=messages_get&username=username&password=password&last_id=last_id" in
  Client.call `GET uri >>= fun (_resp, body) ->
  body |> Cohttp_lwt.Body.to_string >|= fun body -> body

let () =
  let respBody = Lwt_main.run reqBody in
  print_endline (respBody)
$response = Invoke-RestMethod 'https://api.sendsms.ro/json?action=messages_get&username=username&password=password&last_id=last_id' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
import http.client

conn = http.client.HTTPSConnection("api.sendsms.ro")
payload = ''
headers = {}
conn.request("GET", "/json?action=messages_get&username=username&password=password&last_id=last_id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
library(httr)

res <- VERB("GET", url = "https://api.sendsms.ro/json?action=messages_get&username=username&password=password&last_id=last_id")

cat(content(res, 'text'))
require "uri"
require "net/http"

url = URI("https://api.sendsms.ro/json?action=messages_get&username=username&password=password&last_id=last_id")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)

response = https.request(request)
puts response.read_body
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

var semaphore = DispatchSemaphore (value: 0)

var request = URLRequest(url: URL(string: "https://api.sendsms.ro/json?action=messages_get&username=username&password=password&last_id=last_id")!,timeoutInterval: Double.infinity)
request.httpMethod = "GET"

let task = URLSession.shared.dataTask(with: request) { data, response, error in 
  guard let data = data else {
    print(String(describing: error))
    semaphore.signal()
    return
  }
  print(String(data: data, encoding: .utf8)!)
  semaphore.signal()
}

task.resume()
semaphore.wait()

This function returns all inbound (MO) messages for the user who have an ID larger than 'last_id'.

The best practice is to use this function starting with last_id = 0, then as messages are received, to store last_id as the highest message ID you receive back from the API request. Results are limited to 50 at a time.

The above command returns JSON structured like this:

{
   "details":[
      {
         "charset":"UTF-8",
         "data":"programmer1",
         "created":"2021-02-23 12:52:05",
         "from":"+40727363767",
         "id":"id",
         "to":"1898"
      }
   ],
   "message":"OK",
   "status":0
}

HTTP Request

GET https://api.sendsms.ro/json?action=messages_get

Query Parameters

Parameter Type Description Required Default
username string Your log-in username true
password string Your log-in password or API Key true
last_id integer The ID of the first message true

Real-time inbox

If you have bidirectional SMS enabled you can receive messages on a custom link in the form of a GET request.

To set-up a link, go to admin > Account > Inbound Messaging. For this example, we will put https://mysite.ro/inbox in the URL for HTTP delivery field.

We will send a GET request to https://mysite.ro/inbox containing pieces of information about the message recieved. Your server should respond with a header status of 200 and no additional content.

Example of GET request: https://mysite.ro/inbox/?to=1898&from=407XXXXXXXX&charset=UTF-8&message=CONTENT&code=mc&client_reference=&mcc=XXX&mnc=XX&mo_message_id=XXXXXXXX

Get query parameters list

Name Meaning
to The phone number where the message was sent
from Who sent the message
charset The character encoding of the message
message The content of the message
code
client_reference The ID of the client
mcc Mobile country code
mnc Mobile network code
mo_message_id The ID of the message

Messages Statistics

  curl "https://api.sendsms.ro/json?action=messages_statistics&username=username&password=password&user_id=user_id&start_date=start_date&end_date=end_date"
<?php
require('sendsms_api.php');
$api = new SendsmsApi();

$api->setUsername('username');
$api->setPassword('password');

echo json_encode($api->messages_statistics());
<?php
$curl = curl_init();

curl_setopt($curl, CURLOPT_HEADER, 1);
$password = urlencode("password");
curl_setopt($curl, CURLOPT_URL, "https://api.sendsms.ro/json?action=messages_statistics&username=username&password=$password");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLINFO_HEADER_OUT, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Connection: keep-alive"));

$result = curl_exec($curl);

$size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);

$result = substr($result, $size);

echo $result;
package com.sendsms;

public class Main {
    public static void main(String[] args) {
        Api sendsms = new Api("username", "password");
        sendsms.setDebugState(true);
        System.out.println(sendsms.messages_statistics(null, null, null));
    }
}
package com.sendsms;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

public class Main {
    public static void main(String[] args) throws IOException {
        String password = URLEncoder.encode("password", StandardCharsets.UTF_8);
        String urlString = "https://api.sendsms.ro/json?action=messages_statistics&username=username&password=" + password;
        URL url = new URL(urlString);
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        con.setConnectTimeout(5000);
        con.setReadTimeout(5000);
        BufferedReader in = new BufferedReader(
                new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer content = new StringBuffer();
        while ((inputLine = in.readLine()) != null) {
            content.append(inputLine);
        }
        in.close();
        con.disconnect();
        System.out.println(content);
    }
}
<?php

use Illuminate\Support\Facades\Route;
use SendSMS\SendsmsLaravel\API\Message;

Route::get('/', function () {
    $api = new Message();
    $api->messages_statistics();
    return view('welcome');
});
<?php
use SendSMS\API\Message;

$api = new Message();
$api->setUsername("username");
$api->setPassword("password");
$api->messages_statistics();
var client = new RestClient("https://api.sendsms.ro/json?action=messages_statistics&username=username&password=password&user_id=user_id&start_date=start_date&end_date=end_date");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
var request = http.Request('GET', Uri.parse('https://api.sendsms.ro/json?action=messages_statistics&username=username&password=password&user_id=user_id&start_date=start_date&end_date=end_date'));


http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
  print(await response.stream.bytesToString());
}
else {
  print(response.reasonPhrase);
}
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.sendsms.ro/json?action=messages_statistics&username=username&password=password&user_id=user_id&start_date=start_date&end_date=end_date"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
// WARNING: For GET requests, body is set to null by browsers.

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.sendsms.ro/json?action=messages_statistics&username=username&password=password&user_id=user_id&start_date=start_date&end_date=end_date");

xhr.send();
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
  curl_easy_setopt(curl, CURLOPT_URL, "https://api.sendsms.ro/json?action=messages_statistics&username=username&password=password&user_id=user_id&start_date=start_date&end_date=end_date");
  curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
  curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
  struct curl_slist *headers = NULL;
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'GET',
  'hostname': 'api.sendsms.ro',
  'path': '/json?action=messages_statistics&username=username&password=password&user_id=user_id&start_date=start_date&end_date=end_date',
  'headers': {
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

req.end();
#import <Foundation/Foundation.h>

dispatch_semaphore_t sema = dispatch_semaphore_create(0);

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.sendsms.ro/json?action=messages_statistics&username=username&password=password&user_id=user_id&start_date=start_date&end_date=end_date"]
  cachePolicy:NSURLRequestUseProtocolCachePolicy
  timeoutInterval:10.0];

[request setHTTPMethod:@"GET"];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
  if (error) {
    NSLog(@"%@", error);
    dispatch_semaphore_signal(sema);
  } else {
    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
    NSError *parseError = nil;
    NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
    NSLog(@"%@",responseDictionary);
    dispatch_semaphore_signal(sema);
  }
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
open Lwt
open Cohttp
open Cohttp_lwt_unix

let reqBody = 
  let uri = Uri.of_string "https://api.sendsms.ro/json?action=messages_statistics&username=username&password=password&user_id=user_id&start_date=start_date&end_date=end_date" in
  Client.call `GET uri >>= fun (_resp, body) ->
  body |> Cohttp_lwt.Body.to_string >|= fun body -> body

let () =
  let respBody = Lwt_main.run reqBody in
  print_endline (respBody)
$response = Invoke-RestMethod 'https://api.sendsms.ro/json?action=messages_statistics&username=username&password=password&user_id=user_id&start_date=start_date&end_date=end_date' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
import http.client

conn = http.client.HTTPSConnection("api.sendsms.ro")
payload = ''
headers = {}
conn.request("GET", "/json?action=messages_statistics&username=username&password=password&user_id=user_id&start_date=start_date&end_date=end_date", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
library(httr)

res <- VERB("GET", url = "https://api.sendsms.ro/json?action=messages_statistics&username=username&password=password&user_id=user_id&start_date=start_date&end_date=end_date")

cat(content(res, 'text'))
require "uri"
require "net/http"

url = URI("https://api.sendsms.ro/json?action=messages_statistics&username=username&password=password&user_id=user_id&start_date=start_date&end_date=end_date")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)

response = https.request(request)
puts response.read_body
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

var semaphore = DispatchSemaphore (value: 0)

var request = URLRequest(url: URL(string: "https://api.sendsms.ro/json?action=messages_statistics&username=username&password=password&user_id=user_id&start_date=start_date&end_date=end_date")!,timeoutInterval: Double.infinity)
request.httpMethod = "GET"

let task = URLSession.shared.dataTask(with: request) { data, response, error in 
  guard let data = data else {
    print(String(describing: error))
    semaphore.signal()
    return
  }
  print(String(data: data, encoding: .utf8)!)
  semaphore.signal()
}

task.resume()
semaphore.wait()

Statistics for the user account. These are a summarized value and should only be user to provide a broad overview of statistics.

The above command returns JSON structured like this:

{
   "details":{
      "dlr_received":2738,
      "received":66,
      "dlr_requested":3154,
      "sent":3187
   },
   "message":"OK",
   "status":0
}

HTTP Request

GET https://api.sendsms.ro/json?action=messages_statistics

Query Parameters

Parameter Type Description Required Default
username string Your log-in username true
password string Your log-in password or API Key true
user_id string The sub user id that these statistics are for false NULL
start_date string Start point of the statistics false NULL
end_date string End point of the statistics false NULL

Message Status

    curl "https://api.sendsms.ro/json?action=message_status&username=username&password=password&message_id=message_id"
<?php
require('sendsms_api.php');
$api = new SendsmsApi();

$api->setUsername('username');
$api->setPassword('password');

echo json_encode($api->message_status("43212295-ghr5-123s-oiui-022400000bda"));
<?php
$curl = curl_init();

curl_setopt($curl, CURLOPT_HEADER, 1);
$password = urlencode("password");
$message_id = urlencode("43212295-ghr5-123s-oiui-022400000bda");
curl_setopt($curl, CURLOPT_URL, "https://api.sendsms.ro/json?action=message_status&username=username&password=$password&message_id=$message_id");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLINFO_HEADER_OUT, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Connection: keep-alive"));

$result = curl_exec($curl);

$size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);

$result = substr($result, $size);

echo $result;
package com.sendsms;

public class Main {
    public static void main(String[] args) {
        Api sendsms = new Api("username", "password");
        sendsms.setDebugState(true);

        System.out.println(sendsms.message_status("43212295-ghr5-123s-oiui-022400000bda"));
    }
}
package com.sendsms;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

public class Main {
    public static void main(String[] args) throws IOException {
        String password = URLEncoder.encode("password", StandardCharsets.UTF_8);
        String message_id = URLEncoder.encode("43212295-ghr5-123s-oiui-022400000bda", StandardCharsets.UTF_8);
        String urlString = "https://api.sendsms.ro/json?action=message_status&username=username&password=" + password + "&message_id=" + message_id;
        URL url = new URL(urlString);
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        con.setConnectTimeout(5000);
        con.setReadTimeout(5000);
        BufferedReader in = new BufferedReader(
                new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer content = new StringBuffer();
        while ((inputLine = in.readLine()) != null) {
            content.append(inputLine);
        }
        in.close();
        con.disconnect();
        System.out.println(content);
    }
}
<?php

use Illuminate\Support\Facades\Route;
use SendSMS\SendsmsLaravel\API\Message;

Route::get('/', function () {
    $api = new Message();
    $api->message_status("43212295-ghr5-123s-oiui-022400000bda");
    return view('welcome');
});
<?php
use SendSMS\API\Message;

$api = new Message();
$api->setUsername("username");
$api->setPassword("password");
$api->message_status("43212295-ghr5-123s-oiui-022400000bda");
var client = new RestClient("https://api.sendsms.ro/json?username=username&password=password&action=message_status&message_id=message_id");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
var request = http.Request('GET', Uri.parse('https://api.sendsms.ro/json?username=username&password=password&action=message_status&message_id=message_id'));


http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
  print(await response.stream.bytesToString());
}
else {
  print(response.reasonPhrase);
}
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.sendsms.ro/json?username=username&password=password&action=message_status&message_id=message_id"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
// WARNING: For GET requests, body is set to null by browsers.

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.sendsms.ro/json?username=username&password=password&action=message_status&message_id=message_id");

xhr.send();
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
  curl_easy_setopt(curl, CURLOPT_URL, "https://api.sendsms.ro/json?username=username&password=password&action=message_status&message_id=message_id");
  curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
  curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
  struct curl_slist *headers = NULL;
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'GET',
  'hostname': 'api.sendsms.ro',
  'path': '/json?username=username&password=password&action=message_status&message_id=message_id',
  'headers': {
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

req.end();
#import <Foundation/Foundation.h>

dispatch_semaphore_t sema = dispatch_semaphore_create(0);

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.sendsms.ro/json?username=username&password=password&action=message_status&message_id=message_id"]
  cachePolicy:NSURLRequestUseProtocolCachePolicy
  timeoutInterval:10.0];

[request setHTTPMethod:@"GET"];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
  if (error) {
    NSLog(@"%@", error);
    dispatch_semaphore_signal(sema);
  } else {
    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
    NSError *parseError = nil;
    NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
    NSLog(@"%@",responseDictionary);
    dispatch_semaphore_signal(sema);
  }
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
open Lwt
open Cohttp
open Cohttp_lwt_unix

let reqBody = 
  let uri = Uri.of_string "https://api.sendsms.ro/json?username=username&password=password&action=message_status&message_id=message_id" in
  Client.call `GET uri >>= fun (_resp, body) ->
  body |> Cohttp_lwt.Body.to_string >|= fun body -> body

let () =
  let respBody = Lwt_main.run reqBody in
  print_endline (respBody)
$response = Invoke-RestMethod 'https://api.sendsms.ro/json?username=username&password=password&action=message_status&message_id=message_id' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
import http.client

conn = http.client.HTTPSConnection("api.sendsms.ro")
payload = ''
headers = {}
conn.request("GET", "/json?username=username&password=password&action=message_status&message_id=message_id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
library(httr)

res <- VERB("GET", url = "https://api.sendsms.ro/json?username=username&password=password&action=message_status&message_id=message_id")

cat(content(res, 'text'))
require "uri"
require "net/http"

url = URI("https://api.sendsms.ro/json?username=username&password=password&action=message_status&message_id=message_id")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)

response = https.request(request)
puts response.read_body
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

var semaphore = DispatchSemaphore (value: 0)

var request = URLRequest(url: URL(string: "https://api.sendsms.ro/json?username=username&password=password&action=message_status&message_id=message_id")!,timeoutInterval: Double.infinity)
request.httpMethod = "GET"

let task = URLSession.shared.dataTask(with: request) { data, response, error in 
  guard let data = data else {
    print(String(describing: error))
    semaphore.signal()
    return
  }
  print(String(data: data, encoding: .utf8)!)
  semaphore.signal()
}

task.resume()
semaphore.wait()

Checks the status of a message

This function can only be used 10 times per minute (to prevent bad implementation :)) if you require status for each message you send please use the report_url and report_mask variables when sending your messages with message_send().

The above command returns JSON structured like this:

{
   "status":0,
   "message":"OK",
   "details":{
      "status":1,
      "cost":0.20000,
      "parts":1
   }
}

HTTP Request

GET https://api.sendsms.ro/json?action=message_status

Query Parameters

Parameter Type Description Required Default
username string Your log-in username true
password string Your log-in password or API Key true
message_id string The ID of the message true

User Get Last Messages

  curl "https://api.sendsms.ro/json?action=user_get_last_messages&username=username&password=password"
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.sendsms.ro/json?action=user_get_last_messages&username=username&password=password',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Get last messages for user

The above command returns JSON structured like this:

{
    "status": 0,
    "message": "OK",
    "details": [
        {
            "network_id": "1099",
            "country_id": "150",
            "destaddr": "40777777777",
            "srcaddr": "Info.SMS",
            "status": "4",
            "cost": "0.03500",
            "parts": "1",
            "user_batch_id": "0",
            "msg_uuid": "7d7f22ce-6052-489e-0100-07040000120a",
            "created": "2024-07-04 13:07:43",
            "timestamp_ack": "2024-07-04 13:07:43",
            "timestamp_delivered": "2024-07-04 13:07:44",
            "timestamp_failed": "0000-00-00 00:00:00",
            "msgdata": "Message content",
            "charset": null
        },
        {
            "network_id": "1099",
            "country_id": "150",
            "destaddr": "40777777777",
            "srcaddr": "Info.SMS",
            "status": "4",
            "cost": "0.03500",
            "parts": "1",
            "user_batch_id": "0",
            "msg_uuid": "0c25633f-17d1-4304-0100-05010000120b",
            "created": "2024-05-01 23:02:47",
            "timestamp_ack": "2024-05-01 23:02:47",
            "timestamp_delivered": "2024-05-01 23:02:49",
            "timestamp_failed": "0000-00-00 00:00:00",
            "msgdata": "Message content",
            "charset": null
        },
        {
            "network_id": "1099",
            "country_id": "150",
            "destaddr": "40777777777",
            "srcaddr": "Info.SMS",
            "status": "4",
            "cost": "0.03500",
            "parts": "1",
            "user_batch_id": "0",
            "msg_uuid": "92cc79d5-f9f6-42d1-0100-04050000120c",
            "created": "2024-04-05 10:48:33",
            "timestamp_ack": "2024-04-05 10:48:34",
            "timestamp_delivered": "2024-04-05 10:48:37",
            "timestamp_failed": "0000-00-00 00:00:00",
            "msgdata": "Message content",
            "charset": null
        },
        {
            "network_id": "1099",
            "country_id": "150",
            "destaddr": "40777777777",
            "srcaddr": "Info.SMS",
            "status": "4",
            "cost": "0.03500",
            "parts": "1",
            "user_batch_id": "0",
            "msg_uuid": "1cd6d085-2985-4429-0100-04050000120c",
            "created": "2024-04-05 10:45:24",
            "timestamp_ack": "2024-04-05 10:45:24",
            "timestamp_delivered": "2024-04-05 10:45:26",
            "timestamp_failed": "0000-00-00 00:00:00",
            "msgdata": "Message content",
            "charset": null
        }
    ],
    "run_time": 0.0281
}

HTTP Request

GET https://api.sendsms.ro/json?action=user_get_last_messages

Query Parameters

Parameter Type Description Required Default
username string Your log-in username true
password string Your log-in password or API Key true

Resend message

  curl "https://api.sendsms.ro/json?action=resend_message&username=username&password=password&msgUUID=uuid"
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.sendsms.ro/json?action=resend_message&username=username&password=password&msgUUID=uuid',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Resend message based on message uuid

The above command returns JSON structured like this:

{
    "status": 1,
    "message": "Sent",
    "message_id": "8eb41e79-e3e2-4953-0100-08260000120a",
    "details": "8eb41e79-e3e2-4953-0100-08260000120a",
    "mcc": "226",
    "mnc": "10",
    "parts": 1,
    "length": 59,
    "run_time": 0.1856
}

HTTP Request

GET https://api.sendsms.ro/json?action=resend_message

Query Parameters

Parameter Type Description Required Default
username string Your log-in username true
password string Your log-in password or API Key true
msgUUID string Message UUID true

Address book

Contacts

Get All Contacts

  curl "https://api.sendsms.ro/json?action=address_book_contacts_get_list&username=username&password=password&group_id=group_id"
<?php
require('sendsms_api.php');
$api = new SendsmsApi();

$api->setUsername('username');
$api->setPassword('password');

echo json_encode($api->address_book_contacts_get_list('3242'));
<?php
$curl = curl_init();

curl_setopt($curl, CURLOPT_HEADER, 1);
$password = urlencode("password");
curl_setopt($curl, CURLOPT_URL, "https://api.sendsms.ro/json?action=address_book_contacts_get_list&username=username&password=$password&group_id=2323");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLINFO_HEADER_OUT, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Connection: keep-alive"));

$result = curl_exec($curl);

$size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);

$result = substr($result, $size);

echo $result;
package com.sendsms;

public class Main {
    public static void main(String[] args) {
        Api sendsms = new Api("username", "password");
        sendsms.setDebugState(true);
        System.out.println(sendsms.address_book_contacts_get_list(3244));
    }
}
package com.sendsms;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

public class Main {
    public static void main(String[] args) throws IOException {
        String password = URLEncoder.encode("password", StandardCharsets.UTF_8);
        String urlString = "https://api.sendsms.ro/json?action=address_book_contacts_get_list&username=username&password=" + password + "&group_id=432";
        URL url = new URL(urlString);
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        con.setConnectTimeout(5000);
        con.setReadTimeout(5000);
        BufferedReader in = new BufferedReader(
                new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer content = new StringBuffer();
        while ((inputLine = in.readLine()) != null) {
            content.append(inputLine);
        }
        in.close();
        con.disconnect();
        System.out.println(content);
    }
}
<?php

use Illuminate\Support\Facades\Route;
use SendSMS\SendsmsLaravel\API\AddressBook;

Route::get('/', function () {
    $api = new AddressBook();
    $api->address_book_contacts_get_list('3242');
    return view('welcome');
});
<?php
use SendSMS\API\AddressBook;

$api = new AddressBook();
$api->setUsername("username");
$api->setPassword("password");
$api->address_book_contacts_get_list('3242');
var client = new RestClient("https://api.sendsms.ro/json?action=address_book_contacts_get_list&username=username&password=password&group_id=group_id");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
var request = http.Request('GET', Uri.parse('https://api.sendsms.ro/json?action=address_book_contacts_get_list&username=username&password=password&group_id=group_id'));


http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
  print(await response.stream.bytesToString());
}
else {
  print(response.reasonPhrase);
}
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.sendsms.ro/json?action=address_book_contacts_get_list&username=username&password=password&group_id=group_id"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
// WARNING: For GET requests, body is set to null by browsers.

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.sendsms.ro/json?action=address_book_contacts_get_list&username=username&password=password&group_id=group_id");

xhr.send();
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
  curl_easy_setopt(curl, CURLOPT_URL, "https://api.sendsms.ro/json?action=address_book_contacts_get_list&username=username&password=password&group_id=group_id");
  curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
  curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
  struct curl_slist *headers = NULL;
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'GET',
  'hostname': 'api.sendsms.ro',
  'path': '/json?action=address_book_contacts_get_list&username=username&password=password&group_id=group_id',
  'headers': {
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

req.end();
#import <Foundation/Foundation.h>

dispatch_semaphore_t sema = dispatch_semaphore_create(0);

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.sendsms.ro/json?action=address_book_contacts_get_list&username=username&password=password&group_id=group_id"]
  cachePolicy:NSURLRequestUseProtocolCachePolicy
  timeoutInterval:10.0];

[request setHTTPMethod:@"GET"];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
  if (error) {
    NSLog(@"%@", error);
    dispatch_semaphore_signal(sema);
  } else {
    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
    NSError *parseError = nil;
    NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
    NSLog(@"%@",responseDictionary);
    dispatch_semaphore_signal(sema);
  }
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
open Lwt
open Cohttp
open Cohttp_lwt_unix

let reqBody = 
  let uri = Uri.of_string "https://api.sendsms.ro/json?action=address_book_contacts_get_list&username=username&password=password&group_id=group_id" in
  Client.call `GET uri >>= fun (_resp, body) ->
  body |> Cohttp_lwt.Body.to_string >|= fun body -> body

let () =
  let respBody = Lwt_main.run reqBody in
  print_endline (respBody)
$response = Invoke-RestMethod 'https://api.sendsms.ro/json?action=address_book_contacts_get_list&username=username&password=password&group_id=group_id' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
import http.client

conn = http.client.HTTPSConnection("api.sendsms.ro")
payload = ''
headers = {}
conn.request("GET", "/json?action=address_book_contacts_get_list&username=username&password=password&group_id=group_id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
library(httr)

res <- VERB("GET", url = "https://api.sendsms.ro/json?action=address_book_contacts_get_list&username=username&password=password&group_id=group_id")

cat(content(res, 'text'))
require "uri"
require "net/http"

url = URI("https://api.sendsms.ro/json?action=address_book_contacts_get_list&username=username&password=password&group_id=group_id")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)

response = https.request(request)
puts response.read_body
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

var semaphore = DispatchSemaphore (value: 0)

var request = URLRequest(url: URL(string: "https://api.sendsms.ro/json?action=address_book_contacts_get_list&username=username&password=password&group_id=group_id")!,timeoutInterval: Double.infinity)
request.httpMethod = "GET"

let task = URLSession.shared.dataTask(with: request) { data, response, error in 
  guard let data = data else {
    print(String(describing: error))
    semaphore.signal()
    return
  }
  print(String(data: data, encoding: .utf8)!)
  semaphore.signal()
}

task.resume()
semaphore.wait()

The above command returns JSON structured like this:

{
   "status":0,
   "message":"OK",
   "details":[
      {
         "first_name":"First name",
         "last_name":"Last name",
         "phone_number":"40000000000",
         "id":"00000000"
      }
   ]
}

Gets a list of contacts for a particular group

HTTP Request

GET https://api.sendsms.ro/json?action=address_book_contacts_get_list

Query Parameters

Parameter Type Description Required Default
username string Your log-in username true
password string Your log-in password or API Key true
group_id integer The id of the group you want to retrieve the contacts from true

Add a Contact

    curl "https://api.sendsms.ro/json?action=address_book_contact_add&username=username&password=password&group_id=group_id&phone_number=phone_number&first_name=first_name&last_name=last_name"
<?php
require('sendsms_api.php');
$api = new SendsmsApi();

$api->setUsername('username');
$api->setPassword('password');

echo json_encode($api->address_book_contact_add(2341, '40727363767', 'John', 'Smith'));
<?php
$curl = curl_init();

curl_setopt($curl, CURLOPT_HEADER, 1);
$password = urlencode("password");
curl_setopt($curl, CURLOPT_URL, "https://api.sendsms.ro/json?action=address_book_contacts_get_list&username=username&password=$password&group_id=2314&phone_number=40727363767&first_name=John&last_name=Smith");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLINFO_HEADER_OUT, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Connection: keep-alive"));

$result = curl_exec($curl);

$size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);

$result = substr($result, $size);

echo $result;
package com.sendsms;

public class Main {
    public static void main(String[] args) {
        Api sendsms = new Api("username", "password");
        sendsms.setDebugState(true);
        System.out.println(sendsms.address_book_contact_add(123, "40727363767", "John", "Smith"));
    }
}
package com.sendsms;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

public class Main {
    public static void main(String[] args) throws IOException {
        String password = URLEncoder.encode("password", StandardCharsets.UTF_8);
        String urlString = "https://api.sendsms.ro/json?action=address_book_contact_add&username=username&password=" + password +"&group_id=313&phone_number=40727363767&first_name=John&last_name=Smith";
        URL url = new URL(urlString);
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        con.setConnectTimeout(5000);
        con.setReadTimeout(5000);
        BufferedReader in = new BufferedReader(
                new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer content = new StringBuffer();
        while ((inputLine = in.readLine()) != null) {
            content.append(inputLine);
        }
        in.close();
        con.disconnect();
        System.out.println(content);
    }
}
<?php

use Illuminate\Support\Facades\Route;
use SendSMS\SendsmsLaravel\API\AddressBook;

Route::get('/', function () {
    $api = new AddressBook();
    $api->address_book_contact_add(2341, '40727363767', 'John', 'Smith');
    return view('welcome');
});
<?php
use SendSMS\API\AddressBook;

$api = new AddressBook();
$api->setUsername("username");
$api->setPassword("password");
$api->address_book_contact_add(2341, '40727363767', 'John', 'Smith');
var client = new RestClient("https://api.sendsms.ro/json?action=address_book_contact_add&username=username&password=password&group_id=group_id&phone_number=phone_number&first_name=first_name&last_name=last_name");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
var request = http.Request('GET', Uri.parse('https://api.sendsms.ro/json?action=address_book_contact_add&username=username&password=password&group_id=group_id&phone_number=phone_number&first_name=first_name&last_name=last_name'));


http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
  print(await response.stream.bytesToString());
}
else {
  print(response.reasonPhrase);
}
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.sendsms.ro/json?action=address_book_contact_add&username=username&password=password&group_id=group_id&phone_number=phone_number&first_name=first_name&last_name=last_name"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
// WARNING: For GET requests, body is set to null by browsers.

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.sendsms.ro/json?action=address_book_contact_add&username=username&password=password&group_id=group_id&phone_number=phone_number&first_name=first_name&last_name=last_name");

xhr.send();
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
  curl_easy_setopt(curl, CURLOPT_URL, "https://api.sendsms.ro/json?action=address_book_contact_add&username=username&password=password&group_id=group_id&phone_number=phone_number&first_name=first_name&last_name=last_name");
  curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
  curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
  struct curl_slist *headers = NULL;
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'GET',
  'hostname': 'api.sendsms.ro',
  'path': '/json?action=address_book_contact_add&username=username&password=password&group_id=group_id&phone_number=phone_number&first_name=first_name&last_name=last_name',
  'headers': {
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

req.end();
#import <Foundation/Foundation.h>

dispatch_semaphore_t sema = dispatch_semaphore_create(0);

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.sendsms.ro/json?action=address_book_contact_add&username=username&password=password&group_id=group_id&phone_number=phone_number&first_name=first_name&last_name=last_name"]
  cachePolicy:NSURLRequestUseProtocolCachePolicy
  timeoutInterval:10.0];

[request setHTTPMethod:@"GET"];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
  if (error) {
    NSLog(@"%@", error);
    dispatch_semaphore_signal(sema);
  } else {
    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
    NSError *parseError = nil;
    NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
    NSLog(@"%@",responseDictionary);
    dispatch_semaphore_signal(sema);
  }
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
open Lwt
open Cohttp
open Cohttp_lwt_unix

let reqBody = 
  let uri = Uri.of_string "https://api.sendsms.ro/json?action=address_book_contact_add&username=username&password=password&group_id=group_id&phone_number=phone_number&first_name=first_name&last_name=last_name" in
  Client.call `GET uri >>= fun (_resp, body) ->
  body |> Cohttp_lwt.Body.to_string >|= fun body -> body

let () =
  let respBody = Lwt_main.run reqBody in
  print_endline (respBody)
$response = Invoke-RestMethod 'https://api.sendsms.ro/json?action=address_book_contact_add&username=username&password=password&group_id=group_id&phone_number=phone_number&first_name=first_name&last_name=last_name' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
import http.client

conn = http.client.HTTPSConnection("api.sendsms.ro")
payload = ''
headers = {}
conn.request("GET", "/json?action=address_book_contact_add&username=username&password=password&group_id=group_id&phone_number=phone_number&first_name=first_name&last_name=last_name", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
library(httr)

res <- VERB("GET", url = "https://api.sendsms.ro/json?action=address_book_contact_add&username=username&password=password&group_id=group_id&phone_number=phone_number&first_name=first_name&last_name=last_name")

cat(content(res, 'text'))
require "uri"
require "net/http"

url = URI("https://api.sendsms.ro/json?action=address_book_contact_add&username=username&password=password&group_id=group_id&phone_number=phone_number&first_name=first_name&last_name=last_name")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)

response = https.request(request)
puts response.read_body
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

var semaphore = DispatchSemaphore (value: 0)

var request = URLRequest(url: URL(string: "https://api.sendsms.ro/json?action=address_book_contact_add&username=username&password=password&group_id=group_id&phone_number=phone_number&first_name=first_name&last_name=last_name")!,timeoutInterval: Double.infinity)
request.httpMethod = "GET"

let task = URLSession.shared.dataTask(with: request) { data, response, error in 
  guard let data = data else {
    print(String(describing: error))
    semaphore.signal()
    return
  }
  print(String(data: data, encoding: .utf8)!)
  semaphore.signal()
}

task.resume()
semaphore.wait()

The above command returns JSON structured like this:

{
   "status":0,
   "message":"OK",
   "details":"00000000"
}

Add a contact to a group

HTTP Request

GET https://api.sendsms.ro/json?action=address_book_contact_add

Query Parameters

Parameter Type Description Required Default
username string Your log-in username true
password string Your log-in password or API Key true
group_id integer The id of the group you want to retrieve the contacts from true
phone_number string A phone number in E.164 Format but without the + sign (eg. 40727363767) true
first_name string First name of the user false
last_name string Last name of the user false

Delete a Contact

  curl "https://api.sendsms.ro/json?action=address_book_contact_delete&username=username&password=password&contact_id=contact_id" 
<?php
require('sendsms_api.php');
$api = new SendsmsApi();

$api->setUsername('username');
$api->setPassword('password');

echo json_encode($api->address_book_contact_delete('5435'));
<?php
$curl = curl_init();

curl_setopt($curl, CURLOPT_HEADER, 1);
$password = urlencode("password");
curl_setopt($curl, CURLOPT_URL, "https://api.sendsms.ro/json?action=address_book_contact_delete&username=username&password=$password&contact_id=5435");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLINFO_HEADER_OUT, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Connection: keep-alive"));

$result = curl_exec($curl);

$size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);

$result = substr($result, $size);

echo $result;
package com.sendsms;

public class Main {
    public static void main(String[] args) {
        Api sendsms = new Api("username", "password");
        sendsms.setDebugState(true);
        System.out.println(sendsms.address_book_contact_delete(5435));
    }
}
package com.sendsms;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

public class Main {
    public static void main(String[] args) throws IOException {
        String password = URLEncoder.encode("password", StandardCharsets.UTF_8);
        String urlString = "https://api.sendsms.ro/json?action=address_book_contact_delete&username=username&password=" + password + "&contact_id=5435";
        URL url = new URL(urlString);
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        con.setConnectTimeout(5000);
        con.setReadTimeout(5000);
        BufferedReader in = new BufferedReader(
                new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer content = new StringBuffer();
        while ((inputLine = in.readLine()) != null) {
            content.append(inputLine);
        }
        in.close();
        con.disconnect();
        System.out.println(content);
    }
}
<?php

use Illuminate\Support\Facades\Route;
use SendSMS\SendsmsLaravel\API\AddressBook;

Route::get('/', function () {
    $api = new AddressBook();
    $api->address_book_contact_delete('5435');
    return view('welcome');
});
<?php
use SendSMS\API\AddressBook;

$api = new AddressBook();
$api->setUsername("username");
$api->setPassword("password");
$api->address_book_contact_delete('5435');
var client = new RestClient("https://api.sendsms.ro/json?action=address_book_contact_delete&username=username&password=password&contact_id=5435");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
var request = http.Request('GET', Uri.parse('https://api.sendsms.ro/json?action=address_book_contact_delete&username=username&password=password&contact_id=5435'));


http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
  print(await response.stream.bytesToString());
}
else {
  print(response.reasonPhrase);
}
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := https://api.sendsms.ro/json?action=address_book_contact_delete&username=username&password=password&contact_id=5435"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
// WARNING: For GET requests, body is set to null by browsers.

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.sendsms.ro/json?action=address_book_contact_delete&username=username&password=password&contact_id=5435");

xhr.send();
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
  curl_easy_setopt(curl, CURLOPT_URL, "https://api.sendsms.ro/json?action=address_book_contact_delete&username=username&password=password&contact_id=5435");
  curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
  curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
  struct curl_slist *headers = NULL;
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'GET',
  'hostname': 'api.sendsms.ro',
  'path': '/json?action=address_book_contact_delete&username=username&password=password&contact_id=5435',
  'headers': {
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

req.end();
#import <Foundation/Foundation.h>

dispatch_semaphore_t sema = dispatch_semaphore_create(0);

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.sendsms.ro/json?action=address_book_contact_delete&username=username&password=password&contact_id=5435"]
  cachePolicy:NSURLRequestUseProtocolCachePolicy
  timeoutInterval:10.0];

[request setHTTPMethod:@"GET"];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
  if (error) {
    NSLog(@"%@", error);
    dispatch_semaphore_signal(sema);
  } else {
    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
    NSError *parseError = nil;
    NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
    NSLog(@"%@",responseDictionary);
    dispatch_semaphore_signal(sema);
  }
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
open Lwt
open Cohttp
open Cohttp_lwt_unix

let reqBody = 
  let uri = Uri.of_string "https://api.sendsms.ro/json?action=address_book_contact_delete&username=username&password=password&contact_id=5435" in
  Client.call `GET uri >>= fun (_resp, body) ->
  body |> Cohttp_lwt.Body.to_string >|= fun body -> body

let () =
  let respBody = Lwt_main.run reqBody in
  print_endline (respBody)
$response = Invoke-RestMethod 'https://api.sendsms.ro/json?action=address_book_contact_delete&username=username&password=password&contact_id=5435' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
import http.client

conn = http.client.HTTPSConnection("api.sendsms.ro")
payload = ''
headers = {}
conn.request("GET", "/json?action=address_book_contact_delete&username=username&password=password&contact_id=5435", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
library(httr)

res <- VERB("GET", url = "https://api.sendsms.ro/json?action=address_book_contact_delete&username=username&password=password&contact_id=5435")

cat(content(res, 'text'))
require "uri"
require "net/http"

url = URI("https://api.sendsms.ro/json?action=address_book_contact_delete&username=username&password=password&contact_id=5435")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)

response = https.request(request)
puts response.read_body
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

var semaphore = DispatchSemaphore (value: 0)

var request = URLRequest(url: URL(string: "https://api.sendsms.ro/json?action=address_book_contact_delete&username=username&password=password&contact_id=5435")!,timeoutInterval: Double.infinity)
request.httpMethod = "GET"

let task = URLSession.shared.dataTask(with: request) { data, response, error in 
  guard let data = data else {
    print(String(describing: error))
    semaphore.signal()
    return
  }
  print(String(data: data, encoding: .utf8)!)
  semaphore.signal()
}

task.resume()
semaphore.wait()

The above command returns JSON structured like this:

{
   "status":0,
   "message":"OK"
}

Delete a contact

HTTP Request

GET https://api.sendsms.ro/json?action=address_book_contact_delete

Query Parameters

Parameter Type Description Required Default
username string Your log-in username true
password string Your log-in password or API Key true
contact_id integer The contact ID true

Update a Contact

  curl "https://api.sendsms.ro/json?action=address_book_contact_update&username=username&password=password&contact_id=contact_id&phone_number=phone_number&first_name=first_name&last_name=last_name"
<?php
require('sendsms_api.php');
$api = new SendsmsApi();

$api->setUsername('username');
$api->setPassword('password');

echo json_encode($api->address_book_contact_update('1234', '40727363767'));
<?php
$curl = curl_init();

curl_setopt($curl, CURLOPT_HEADER, 1);
$password = urlencode("password");
curl_setopt($curl, CURLOPT_URL, "https://api.sendsms.ro/json?action=address_book_contact_update&username=username&password=$password&contact_id=1234&phone_number=40727363767");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLINFO_HEADER_OUT, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Connection: keep-alive"));

$result = curl_exec($curl);

$size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);

$result = substr($result, $size);

echo $result;
package com.sendsms;

public class Main {
    public static void main(String[] args) {
        Api sendsms = new Api("username", "password");
        sendsms.setDebugState(true);
        System.out.println(sendsms.address_book_contact_update(1234, "40727363767", null, null));
    }
}
package com.sendsms;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

public class Main {
    public static void main(String[] args) throws IOException {
        String password = URLEncoder.encode("password", StandardCharsets.UTF_8);
        String urlString = "https://api.sendsms.ro/json?action=address_book_contact_update&username=username&password=" + password + "&contact_id=1234&phone_number=40727363767";
        URL url = new URL(urlString);
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        con.setConnectTimeout(5000);
        con.setReadTimeout(5000);
        BufferedReader in = new BufferedReader(
                new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer content = new StringBuffer();
        while ((inputLine = in.readLine()) != null) {
            content.append(inputLine);
        }
        in.close();
        con.disconnect();
        System.out.println(content);
    }
}
<?php

use Illuminate\Support\Facades\Route;
use SendSMS\SendsmsLaravel\API\AddressBook;

Route::get('/', function () {
    $api = new AddressBook();
    $api->address_book_contact_update('1234', '40727363767');
    return view('welcome');
});
<?php
use SendSMS\API\AddressBook;

$api = new AddressBook();
$api->setUsername("username");
$api->setPassword("password");
$api->address_book_contact_update('1234', '40727363767');
var client = new RestClient("https://api.sendsms.ro/json?action=address_book_contact_update&username=username&password=password&contact_id=contact_id&phone_number=phone_number&first_name=first_name&last_name=last_name");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
var request = http.Request('GET', Uri.parse('https://api.sendsms.ro/json?action=address_book_contact_update&username=username&password=password&contact_id=contact_id&phone_number=phone_number&first_name=first_name&last_name=last_name'));


http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
  print(await response.stream.bytesToString());
}
else {
  print(response.reasonPhrase);
}
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := https://api.sendsms.ro/json?action=address_book_contact_update&username=username&password=password&contact_id=contact_id&phone_number=phone_number&first_name=first_name&last_name=last_name"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
// WARNING: For GET requests, body is set to null by browsers.

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.sendsms.ro/json?action=address_book_contact_update&username=username&password=password&contact_id=contact_id&phone_number=phone_number&first_name=first_name&last_name=last_name");

xhr.send();
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
  curl_easy_setopt(curl, CURLOPT_URL, "https://api.sendsms.ro/json?action=address_book_contact_update&username=username&password=password&contact_id=contact_id&phone_number=phone_number&first_name=first_name&last_name=last_name");
  curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
  curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
  struct curl_slist *headers = NULL;
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'GET',
  'hostname': 'api.sendsms.ro',
  'path': '/json?action=address_book_contact_update&username=username&password=password&contact_id=contact_id&phone_number=phone_number&first_name=first_name&last_name=last_name',
  'headers': {
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

req.end();
#import <Foundation/Foundation.h>

dispatch_semaphore_t sema = dispatch_semaphore_create(0);

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.sendsms.ro/json?action=address_book_contact_update&username=username&password=password&contact_id=contact_id&phone_number=phone_number&first_name=first_name&last_name=last_name"]
  cachePolicy:NSURLRequestUseProtocolCachePolicy
  timeoutInterval:10.0];

[request setHTTPMethod:@"GET"];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
  if (error) {
    NSLog(@"%@", error);
    dispatch_semaphore_signal(sema);
  } else {
    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
    NSError *parseError = nil;
    NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
    NSLog(@"%@",responseDictionary);
    dispatch_semaphore_signal(sema);
  }
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
open Lwt
open Cohttp
open Cohttp_lwt_unix

let reqBody = 
  let uri = Uri.of_string "https://api.sendsms.ro/json?action=address_book_contact_update&username=username&password=password&contact_id=contact_id&phone_number=phone_number&first_name=first_name&last_name=last_name" in
  Client.call `GET uri >>= fun (_resp, body) ->
  body |> Cohttp_lwt.Body.to_string >|= fun body -> body

let () =
  let respBody = Lwt_main.run reqBody in
  print_endline (respBody)
$response = Invoke-RestMethod 'https://api.sendsms.ro/json?action=address_book_contact_update&username=username&password=password&contact_id=contact_id&phone_number=phone_number&first_name=first_name&last_name=last_name' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
import http.client

conn = http.client.HTTPSConnection("api.sendsms.ro")
payload = ''
headers = {}
conn.request("GET", "/json?action=address_book_contact_update&username=username&password=password&contact_id=contact_id&phone_number=phone_number&first_name=first_name&last_name=last_name", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
library(httr)

res <- VERB("GET", url = "https://api.sendsms.ro/json?action=address_book_contact_update&username=username&password=password&contact_id=contact_id&phone_number=phone_number&first_name=first_name&last_name=last_name")

cat(content(res, 'text'))
require "uri"
require "net/http"

url = URI("https://api.sendsms.ro/json?action=address_book_contact_update&username=username&password=password&contact_id=contact_id&phone_number=phone_number&first_name=first_name&last_name=last_name")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)

response = https.request(request)
puts response.read_body
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

var semaphore = DispatchSemaphore (value: 0)

var request = URLRequest(url: URL(string: "https://api.sendsms.ro/json?action=address_book_contact_update&username=username&password=password&contact_id=contact_id&phone_number=phone_number&first_name=first_name&last_name=last_name")!,timeoutInterval: Double.infinity)
request.httpMethod = "GET"

let task = URLSession.shared.dataTask(with: request) { data, response, error in 
  guard let data = data else {
    print(String(describing: error))
    semaphore.signal()
    return
  }
  print(String(data: data, encoding: .utf8)!)
  semaphore.signal()
}

task.resume()
semaphore.wait()

The above command returns JSON structured like this:

{
   "status":0,
   "message":"OK"
}

Update a contact

HTTP Request

GET https://api.sendsms.ro/json?action=address_book_contact_update

Query Parameters

Parameter Type Description Required Default
username string Your log-in username true
password string Your log-in password or API Key true
contact_id integer The id of the contact true
phone_number string A phone number in E.164 Format but without the + sign (eg. 40727363767) false NULL
first_name string First name of the user false NULL
last_name string Last name of the user false NULL

Groups

Get All Groups

  curl "https://api.sendsms.ro/json?action=address_book_groups_get_list&username=username&password=password"
<?php
require('sendsms_api.php');
$api = new SendsmsApi();

$api->setUsername('username');
$api->setPassword('password');

echo json_encode($api->address_book_groups_get_list());
<?php
$curl = curl_init();

curl_setopt($curl, CURLOPT_HEADER, 1);
$password = urlencode("password");
curl_setopt($curl, CURLOPT_URL, "https://api.sendsms.ro/json?action=address_book_groups_get_list&username=username&password=$password");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLINFO_HEADER_OUT, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Connection: keep-alive"));

$result = curl_exec($curl);

$size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);

$result = substr($result, $size);

echo $result;
package com.sendsms;

public class Main {
    public static void main(String[] args) {
        Api sendsms = new Api("username", "password");
        sendsms.setDebugState(true);
        System.out.println(sendsms.address_book_groups_get_list());
    }
}
package com.sendsms;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

public class Main {
    public static void main(String[] args) throws IOException {
        String password = URLEncoder.encode("password", StandardCharsets.UTF_8);
        String urlString = "https://api.sendsms.ro/json?action=address_book_groups_get_list&username=username&password=" + password;
        URL url = new URL(urlString);
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        con.setConnectTimeout(5000);
        con.setReadTimeout(5000);
        BufferedReader in = new BufferedReader(
                new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer content = new StringBuffer();
        while ((inputLine = in.readLine()) != null) {
            content.append(inputLine);
        }
        in.close();
        con.disconnect();
        System.out.println(content);
    }
}
<?php

use Illuminate\Support\Facades\Route;
use SendSMS\SendsmsLaravel\API\AddressBook;

Route::get('/', function () {
    $api = new AddressBook();
    $api->address_book_groups_get_list();
    return view('welcome');
});
<?php
use SendSMS\API\AddressBook;

$api = new AddressBook();
$api->setUsername("username");
$api->setPassword("password");
$api->address_book_groups_get_list();
var client = new RestClient("https://api.sendsms.ro/json?action=address_book_groups_get_list&username=username&password=password");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
var request = http.Request('GET', Uri.parse('https://api.sendsms.ro/json?action=address_book_groups_get_list&username=username&password=password'));


http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
  print(await response.stream.bytesToString());
}
else {
  print(response.reasonPhrase);
}
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := https://api.sendsms.ro/json?action=address_book_groups_get_list&username=username&password=password"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
// WARNING: For GET requests, body is set to null by browsers.

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.sendsms.ro/json?action=address_book_groups_get_list&username=username&password=password");

xhr.send();
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
  curl_easy_setopt(curl, CURLOPT_URL, "https://api.sendsms.ro/json?action=address_book_groups_get_list&username=username&password=password");
  curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
  curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
  struct curl_slist *headers = NULL;
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'GET',
  'hostname': 'api.sendsms.ro',
  'path': '/json?action=address_book_groups_get_list&username=username&password=password',
  'headers': {
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

req.end();
#import <Foundation/Foundation.h>

dispatch_semaphore_t sema = dispatch_semaphore_create(0);

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.sendsms.ro/json?action=address_book_groups_get_list&username=username&password=password"]
  cachePolicy:NSURLRequestUseProtocolCachePolicy
  timeoutInterval:10.0];

[request setHTTPMethod:@"GET"];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
  if (error) {
    NSLog(@"%@", error);
    dispatch_semaphore_signal(sema);
  } else {
    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
    NSError *parseError = nil;
    NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
    NSLog(@"%@",responseDictionary);
    dispatch_semaphore_signal(sema);
  }
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
open Lwt
open Cohttp
open Cohttp_lwt_unix

let reqBody = 
  let uri = Uri.of_string "https://api.sendsms.ro/json?action=address_book_groups_get_list&username=username&password=password" in
  Client.call `GET uri >>= fun (_resp, body) ->
  body |> Cohttp_lwt.Body.to_string >|= fun body -> body

let () =
  let respBody = Lwt_main.run reqBody in
  print_endline (respBody)
$response = Invoke-RestMethod 'https://api.sendsms.ro/json?action=address_book_groups_get_list&username=username&password=password' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
import http.client

conn = http.client.HTTPSConnection("api.sendsms.ro")
payload = ''
headers = {}
conn.request("GET", "/json?action=address_book_groups_get_list&username=username&password=password", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
library(httr)

res <- VERB("GET", url = "https://api.sendsms.ro/json?action=address_book_groups_get_list&username=username&password=password")

cat(content(res, 'text'))
require "uri"
require "net/http"

url = URI("https://api.sendsms.ro/json?action=address_book_groups_get_list&username=username&password=password")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)

response = https.request(request)
puts response.read_body
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

var semaphore = DispatchSemaphore (value: 0)

var request = URLRequest(url: URL(string: "https://api.sendsms.ro/json?action=address_book_groups_get_list&username=username&password=password")!,timeoutInterval: Double.infinity)
request.httpMethod = "GET"

let task = URLSession.shared.dataTask(with: request) { data, response, error in 
  guard let data = data else {
    print(String(describing: error))
    semaphore.signal()
    return
  }
  print(String(data: data, encoding: .utf8)!)
  semaphore.signal()
}

task.resume()
semaphore.wait()

The above command returns JSON structured like this:

{
   "status":0,
   "message":"OK",
   "details":[
      {
         "id":"1",
         "name":"Name"
      }
   ]
}

Get a list of all your groups

HTTP Request

GET https://api.sendsms.ro/json?action=address_book_groups_get_list

Query Parameters

Parameter Type Description Required Default
username string Your log-in username true
password string Your log-in password or API Key true

Add a group

  curl "https://api.sendsms.ro/json?action=address_book_group_add&username=username&password=password&name=name"
<?php
require('sendsms_api.php');
$api = new SendsmsApi();

$api->setUsername('username');
$api->setPassword('password');

echo json_encode($api->address_book_group_add('Home'));
<?php
$curl = curl_init();

curl_setopt($curl, CURLOPT_HEADER, 1);
$password = urlencode("password");
curl_setopt($curl, CURLOPT_URL, "https://api.sendsms.ro/json?action=address_book_group_add&username=username&password=$password&name=Home");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLINFO_HEADER_OUT, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Connection: keep-alive"));

$result = curl_exec($curl);

$size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);

$result = substr($result, $size);

echo $result;
package com.sendsms;

public class Main {
    public static void main(String[] args) {
        Api sendsms = new Api("username", "password");
        sendsms.setDebugState(true);
        System.out.println(sendsms.address_book_group_add("Home"));
    }
}
package com.sendsms;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

public class Main {
    public static void main(String[] args) throws IOException {
        String password = URLEncoder.encode("password", StandardCharsets.UTF_8);
        String urlString = "https://api.sendsms.ro/json?action=address_book_group_add&username=username&password=" + password + "&name=Home";
        URL url = new URL(urlString);
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        con.setConnectTimeout(5000);
        con.setReadTimeout(5000);
        BufferedReader in = new BufferedReader(
                new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer content = new StringBuffer();
        while ((inputLine = in.readLine()) != null) {
            content.append(inputLine);
        }
        in.close();
        con.disconnect();
        System.out.println(content);
    }
}
<?php

use Illuminate\Support\Facades\Route;
use SendSMS\SendsmsLaravel\API\AddressBook;

Route::get('/', function () {
    $api = new AddressBook();
    $api->address_book_group_add('Home');
    return view('welcome');
});
<?php
use SendSMS\API\AddressBook;

$api = new AddressBook();
$api->setUsername("username");
$api->setPassword("password");
$api->address_book_group_add('Home');
var client = new RestClient("https://api.sendsms.ro/json?username=username&password=password&action=address_book_group_add&name=name");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
var request = http.Request('GET', Uri.parse('https://api.sendsms.ro/json?username=username&password=password&action=address_book_group_add&name=name'));


http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
  print(await response.stream.bytesToString());
}
else {
  print(response.reasonPhrase);
}
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := https://api.sendsms.ro/json?username=username&password=password&action=address_book_group_add&name=name"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
// WARNING: For GET requests, body is set to null by browsers.

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.sendsms.ro/json?username=username&password=password&action=address_book_group_add&name=name");

xhr.send();
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
  curl_easy_setopt(curl, CURLOPT_URL, "https://api.sendsms.ro/json?username=username&password=password&action=address_book_group_add&name=name");
  curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
  curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
  struct curl_slist *headers = NULL;
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'GET',
  'hostname': 'api.sendsms.ro',
  'path': '/json?username=username&password=password&action=address_book_group_add&name=name',
  'headers': {
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

req.end();
#import <Foundation/Foundation.h>

dispatch_semaphore_t sema = dispatch_semaphore_create(0);

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.sendsms.ro/json?username=username&password=password&action=address_book_group_add&name=name"]
  cachePolicy:NSURLRequestUseProtocolCachePolicy
  timeoutInterval:10.0];

[request setHTTPMethod:@"GET"];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
  if (error) {
    NSLog(@"%@", error);
    dispatch_semaphore_signal(sema);
  } else {
    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
    NSError *parseError = nil;
    NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
    NSLog(@"%@",responseDictionary);
    dispatch_semaphore_signal(sema);
  }
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
open Lwt
open Cohttp
open Cohttp_lwt_unix

let reqBody = 
  let uri = Uri.of_string "https://api.sendsms.ro/json?username=username&password=password&action=address_book_group_add&name=name" in
  Client.call `GET uri >>= fun (_resp, body) ->
  body |> Cohttp_lwt.Body.to_string >|= fun body -> body

let () =
  let respBody = Lwt_main.run reqBody in
  print_endline (respBody)
$response = Invoke-RestMethod 'https://api.sendsms.ro/json?username=username&password=password&action=address_book_group_add&name=name' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
import http.client

conn = http.client.HTTPSConnection("api.sendsms.ro")
payload = ''
headers = {}
conn.request("GET", "/json?username=username&password=password&action=address_book_group_add&name=name", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
library(httr)

res <- VERB("GET", url = "https://api.sendsms.ro/json?username=username&password=password&action=address_book_group_add&name=name")

cat(content(res, 'text'))
require "uri"
require "net/http"

url = URI("https://api.sendsms.ro/json?username=username&password=password&action=address_book_group_add&name=name")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)

response = https.request(request)
puts response.read_body
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

var semaphore = DispatchSemaphore (value: 0)

var request = URLRequest(url: URL(string: "https://api.sendsms.ro/json?username=username&password=password&action=address_book_group_add&name=name")!,timeoutInterval: Double.infinity)
request.httpMethod = "GET"

let task = URLSession.shared.dataTask(with: request) { data, response, error in 
  guard let data = data else {
    print(String(describing: error))
    semaphore.signal()
    return
  }
  print(String(data: data, encoding: .utf8)!)
  semaphore.signal()
}

task.resume()
semaphore.wait()

The above command returns JSON structured like this:

{
   "status":0,
   "message":"OK",
   "details":"00000"
}

Adds a new address book group

HTTP Request

GET https://api.sendsms.ro/json?action=address_book_group_add

Query Parameters

Parameter Type Description Required Default
username string Your log-in username true
password string Your log-in password or API Key true
name string The name of the new group true

Delete a group

  curl "https://api.sendsms.ro/json?action=address_book_group_delete&username=username&password=password&group_id=group_id"
<?php
require('sendsms_api.php');
$api = new SendsmsApi();

$api->setUsername('username');
$api->setPassword('password');

echo json_encode($api->address_book_group_delete('1234'));
<?php
$curl = curl_init();

curl_setopt($curl, CURLOPT_HEADER, 1);
$password = urlencode("password");
curl_setopt($curl, CURLOPT_URL, "https://api.sendsms.ro/json?action=address_book_group_delete&username=username&password=$password&group_id=1234");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLINFO_HEADER_OUT, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Connection: keep-alive"));

$result = curl_exec($curl);

$size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);

$result = substr($result, $size);

echo $result;
package com.sendsms;

public class Main {
    public static void main(String[] args) {
        Api sendsms = new Api("username", "password");
        sendsms.setDebugState(true);
        System.out.println(sendsms.address_book_group_delete(1234));
    }
}
package com.sendsms;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

public class Main {
    public static void main(String[] args) throws IOException {
        String password = URLEncoder.encode("password", StandardCharsets.UTF_8);
        String urlString = "https://api.sendsms.ro/json?action=address_book_group_delete&username=username&password=" + password + "&group_id=group_id";
        URL url = new URL(urlString);
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        con.setConnectTimeout(5000);
        con.setReadTimeout(5000);
        BufferedReader in = new BufferedReader(
                new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer content = new StringBuffer();
        while ((inputLine = in.readLine()) != null) {
            content.append(inputLine);
        }
        in.close();
        con.disconnect();
        System.out.println(content);
    }
}
<?php

use Illuminate\Support\Facades\Route;
use SendSMS\SendsmsLaravel\API\AddressBook;

Route::get('/', function () {
    $api = new AddressBook();
    $api->address_book_group_delete('1234');
    return view('welcome');
});
<?php
use SendSMS\API\AddressBook;

$api = new AddressBook();
$api->setUsername("username");
$api->setPassword("password");
$api->address_book_group_delete('1234');
var client = new RestClient("https://api.sendsms.ro/json?action=address_book_group_delete&username=username&password=password&group_id=group_id");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
var request = http.Request('GET', Uri.parse('https://api.sendsms.ro/json?action=address_book_group_delete&username=username&password=password&group_id=group_id'));


http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
  print(await response.stream.bytesToString());
}
else {
  print(response.reasonPhrase);
}
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := https://api.sendsms.ro/json?action=address_book_group_delete&username=username&password=password&group_id=group_id"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
// WARNING: For GET requests, body is set to null by browsers.

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.sendsms.ro/json?action=address_book_group_delete&username=username&password=password&group_id=group_id");

xhr.send();
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
  curl_easy_setopt(curl, CURLOPT_URL, "https://api.sendsms.ro/json?action=address_book_group_delete&username=username&password=password&group_id=group_id");
  curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
  curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
  struct curl_slist *headers = NULL;
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'GET',
  'hostname': 'api.sendsms.ro',
  'path': '/json?action=address_book_group_delete&username=username&password=password&group_id=group_id',
  'headers': {
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

req.end();
#import <Foundation/Foundation.h>

dispatch_semaphore_t sema = dispatch_semaphore_create(0);

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.sendsms.ro/json?action=address_book_group_delete&username=username&password=password&group_id=group_id"]
  cachePolicy:NSURLRequestUseProtocolCachePolicy
  timeoutInterval:10.0];

[request setHTTPMethod:@"GET"];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
  if (error) {
    NSLog(@"%@", error);
    dispatch_semaphore_signal(sema);
  } else {
    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
    NSError *parseError = nil;
    NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
    NSLog(@"%@",responseDictionary);
    dispatch_semaphore_signal(sema);
  }
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
open Lwt
open Cohttp
open Cohttp_lwt_unix

let reqBody = 
  let uri = Uri.of_string "https://api.sendsms.ro/json?action=address_book_group_delete&username=username&password=password&group_id=group_id" in
  Client.call `GET uri >>= fun (_resp, body) ->
  body |> Cohttp_lwt.Body.to_string >|= fun body -> body

let () =
  let respBody = Lwt_main.run reqBody in
  print_endline (respBody)
$response = Invoke-RestMethod 'https://api.sendsms.ro/json?action=address_book_group_delete&username=username&password=password&group_id=group_id' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
import http.client

conn = http.client.HTTPSConnection("api.sendsms.ro")
payload = ''
headers = {}
conn.request("GET", "/json?action=address_book_group_delete&username=username&password=password&group_id=group_id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
library(httr)

res <- VERB("GET", url = "https://api.sendsms.ro/json?action=address_book_group_delete&username=username&password=password&group_id=group_id")

cat(content(res, 'text'))
require "uri"
require "net/http"

url = URI("https://api.sendsms.ro/json?action=address_book_group_delete&username=username&password=password&group_id=group_id")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)

response = https.request(request)
puts response.read_body
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

var semaphore = DispatchSemaphore (value: 0)

var request = URLRequest(url: URL(string: "https://api.sendsms.ro/json?action=address_book_group_delete&username=username&password=password&group_id=group_id")!,timeoutInterval: Double.infinity)
request.httpMethod = "GET"

let task = URLSession.shared.dataTask(with: request) { data, response, error in 
  guard let data = data else {
    print(String(describing: error))
    semaphore.signal()
    return
  }
  print(String(data: data, encoding: .utf8)!)
  semaphore.signal()
}

task.resume()
semaphore.wait()

The above command returns JSON structured like this:

{
   "status":0,
   "message":"OK"
}

Deletes an address book group

HTTP Request

GET https://api.sendsms.ro/json?action=address_book_group_delete

Query Parameters

Parameter Type Description Required Default
username string Your log-in username true
password string Your log-in password or API Key true
group_id integer The ID of the group true

Batch

Create a batch

    # No Zip File
    curl -d "data=message%2Cto%2Cfrom%2Ccoding%0D%0Adfdsfsd%2C400000%2C1898%2C-1%0D%0A" 
    -X POST "https://api.sendsms.ro/json?username=username&password=password&filter=filter&file_type=file_type&name=name&action=batch_create&throughput=throughput&start_time=start_time"
    # Zip File
    curl -d "data=UEsDBAoAAAAAAMptU1IAAAAAAAAAAAAAAAAGAAAAYmF0Y2gvUEsDBBQAAAAIABpqUlJfSYH%2BNwAAADUAAAAqAAAAYmF0Y2gvYmF0Y2hfMjAyMC0wOC0zMS0xNC00My0wOSAtIENvcHkuY3N2y00tLk5MT9UpyddJK8rP1UnOT8nMS%2BflSklLKU4rTtExMTA3trQ0sTQ0NtQxtLC00NE15OUCAFBLAQIfAAoAAAAAAMptU1IAAAAAAAAAAAAAAAAGACQAAAAAAAAAEAAAAAAAAABiYXRjaC8KACAAAAAAAAEAGABWAyp1rAbXAVYDKnWsBtcBQ34xcKwG1wFQSwECHwAUAAAACAAaalJSX0mB%2FjcAAAA1AAAAKgAkAAAAAAAAACAAAAAkAAAAYmF0Y2gvYmF0Y2hfMjAyMC0wOC0zMS0xNC00My0wOSAtIENvcHkuY3N2CgAgAAAAAAABABgAU3uwLd8F1wHwIoB0rAbXAfSw5XOsBtcBUEsFBgAAAAACAAIA1AAAAKMAAAAAAA%3D%3D" 
    -X POST "https://api.sendsms.ro/json?username=username&password=password&filter=filter&file_type=zip&name=name&action=batch_create&throughput=throughput&start_time=start_time"
<?php
require('sendsms_api.php');
$api = new SendsmsApi();

$api->setUsername('username');
$api->setPassword('password');

$file = "batch.csv";
echo json_encode($api->batch_create('Test', $file, 0, false, "csv"));
<?php
$file = "batch.csv";
$name = 'Test';
$username = 'username';
$password = 'password';
$file_type = "csv";
$filter = false;
$throughput = 0;
$url = "https://api.sendsms.ro/json";

$start_time = null;
if (function_exists('curl_init')) {
    $curl = curl_init();

    if (!file_exists($file)) {
        $debug("File {$file} does not exist");
        return FALSE;
    }

    if ($file_type != 'zip') {
        $data = "data=" . urlencode(file_get_contents($file));
    } else {
        $data = "data=" . urlencode(base64_encode(file_get_contents($file)));
    }

    $url = $url . "?action=batch_create";
    $url .= "&username=" . urlencode($username);
    $url .= "&password=" . urlencode($password);
    $url .= "&name=" . urlencode($name);
    $url .= "&file_type=" . urlencode($file_type);
    $url .= "&filter=" . ($filter ? 'true' : 'false');
    $url .= "&throughput=" . $throughput;

    if (!is_null($start_time)) {
        $url .= "&start_time=" . urlencode($start_time);
    }

    curl_setopt($curl, CURLOPT_HEADER, 1);
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLINFO_HEADER_OUT, true);
    curl_setopt($curl, CURLOPT_HTTPHEADER, array("Connection: keep-alive"));
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $data);

    $result = curl_exec($curl);

    $size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
    $request_headers = curl_getinfo($curl, CURLINFO_HEADER_OUT);
    $response_headers = substr($result, 0, $size);
    $result = substr($result, $size);

    if ($result !== FALSE) {
        echo $result;
    }
} else {
    echo "You need cURL to use this API Library";
}
package com.sendsms;

import java.io.IOException;
import java.io.InputStream;

public class Main {
    public static void main(String[] args) throws IOException {
        Api sendsms = new Api("username", "password");
        sendsms.setDebugState(true);
        InputStream is = Main.class.getClassLoader().getResourceAsStream("batch.zip");
        System.out.println(sendsms.batch_create("Test-Batch", is, 0 ,false, "zip", null));
    }
}
package com.sendsms;

import org.json.JSONObject;

import java.io.*;
import java.net.ConnectException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        String username = "username";
        String password = "password";
        InputStream file = Main.class.getClassLoader().getResourceAsStream("batch.zip");
        String name = "Test";
        int throughput = 0;
        boolean filter = false;
        String file_type = "zip";
        String start_time = null;
        HashMap<String, String> map = new HashMap<>();
        map.put("action", "batch_create");
        map.put("name", name);
        map.put("throughput", Integer.toString(throughput));
        map.put("filter", filter ? "true" : "false");
        map.put("file_type", file_type);
        map.put("start_time", start_time);

        StringBuilder textBuilder = new StringBuilder();
        if(!file_type.equals("zip")) {
            assert file != null;
            try (Reader reader = new BufferedReader(new InputStreamReader
                    (file, Charset.forName(StandardCharsets.UTF_8.name())))) {
                int c;
                while ((c = reader.read()) != -1) {
                    textBuilder.append((char) c);
                }
            }
        } else {
            int bytesRead;
            int chunkSize = 10000000;
            byte[] chunk = new byte[chunkSize];
            while (true)
            {
                assert file != null;
                if (!((bytesRead = file.read(chunk)) > 0)) break;
                byte[] ba = new byte[bytesRead];
                System.arraycopy(chunk, 0, ba, 0, ba.length);
                byte[] encStr = Base64.getEncoder().encode(ba);

                textBuilder.append( new String(encStr, StandardCharsets.UTF_8));
            }
        }
        file.close();

        String apiUrl = "https://api.sendsms.ro/json";
        StringBuilder workingUrl = new StringBuilder(apiUrl);
        try {
            String val;
            String key;
            String encodingScheme = "UTF-8";
            workingUrl.append("?username=").append(URLEncoder.encode(username, encodingScheme));
            workingUrl.append("&password=").append(URLEncoder.encode(password, encodingScheme));

            Set<String> keys = map.keySet();


            for (String s : keys) {
                // check this for possible errors
                key = s;
                val = map.get(key);
                if (val != null) {
                    workingUrl.append("&").append(URLEncoder.encode(key, encodingScheme)).append("=").append(URLEncoder.encode(val, encodingScheme));
                }
            }

            URL url = new URL(workingUrl.toString());
            HttpURLConnection urlConnection = (HttpURLConnection)url.openConnection();

            StringBuilder data = new StringBuilder();
            data.append(URLEncoder.encode(textBuilder.toString(), encodingScheme));

            Map<String,Object> params = new LinkedHashMap<>();
            params.put("data", data);

            StringBuilder postData = new StringBuilder();
            for (Map.Entry<String,Object> param : params.entrySet()) {
                if (postData.length() != 0) postData.append('&');
                postData.append(param.getKey());
                postData.append('=');
                postData.append(param.getValue());
            }
            byte[] postDataBytes = postData.toString().getBytes(StandardCharsets.UTF_8);

            urlConnection.setRequestMethod("POST");
            urlConnection.setDoOutput(true);
            urlConnection.getOutputStream().write(postDataBytes);
            InputStream is = urlConnection.getInputStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(is));
            StringBuilder sb = new StringBuilder();

            String line;
            try {
                while ((line = reader.readLine()) != null) {
                    sb.append(line).append("\n");
                }
            } catch (IOException e) {
                e.printStackTrace();
            } finally {
                try {
                    is.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            String result = sb.toString();

            if(result.length() > 0) {
                System.out.println(new JSONObject(result).getString("details"));
            }
        } catch(ConnectException e) {
            System.out.println("Connection error "+ e.getMessage());
        } catch(Exception e) {
            e.printStackTrace();
        }
    }
}
<?php

use Illuminate\Support\Facades\Route;
use SendSMS\SendsmsLaravel\API\Batch;

Route::get('/', function () {
    $api = new Batch();
    $file = "batch.csv";
    $api->batch_create('Test', $file, 0, false, "csv");
    return view('welcome');
});
<?php
use SendSMS\API\Batch;

$api->setUsername('username');
$api->setPassword('password');
$api = new Batch();
$file = "batch.csv";
$api->batch_create('Test', $file, 0, false, "csv");
var client = new RestClient("https://api.sendsms.ro/json?username=username&password=password&filter=filter&file_type=file_type&name=name&action=batch_create&throughput=throughput&start_time=start_time");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AlwaysMultipartFormData = true;
request.AddParameter("data", "message,to,from,coding
Batch Message 1,40727363767,1898,-1
Batch Message 2,40727363767,1898,-1
Batch Message 3,40727363767,1898,-1");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
var request = http.MultipartRequest('POST', Uri.parse('https://api.sendsms.ro/json?username=username&password=password&filter=filter&file_type=file_type&name=name&action=batch_create&throughput=throughput&start_time=start_time'));
request.fields.addAll({
  'data': 'message,to,from,coding\nBatch Message 1,40727363767,1898,-1\nBatch Message 2,40727363767,1898,-1\nBatch Message 3,40727363767,1898,-1'
});


http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
  print(await response.stream.bytesToString());
}
else {
  print(response.reasonPhrase);
}

package main

import (
  "fmt"
  "bytes"
  "mime/multipart"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.sendsms.ro/json?username=username&password=password&filter=filter&file_type=file_type&name=name&action=batch_create&throughput=throughput&start_time=start_time"
  method := "POST"

  payload := &bytes.Buffer{}
  writer := multipart.NewWriter(payload)
  _ = writer.WriteField("data", "message,to,from,coding\nBatch Message 1,40727363767,1898,-1\nBatch Message 2,40727363767,1898,-1\nBatch Message 3,40727363767,1898,-1")
  err := writer.Close()
  if err != nil {
    fmt.Println(err)
    return
  }


  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Set("Content-Type", writer.FormDataContentType())
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
// WARNING: For POST requests, body is set to null by browsers.
var data = new FormData();
data.append("data", "message,to,from,coding\nBatch Message 1,40727363767,1898,-1\nBatch Message 2,40727363767,1898,-1\nBatch Message 3,40727363767,1898,-1");

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.sendsms.ro/json?username=username&password=password&filter=filter&file_type=file_type&name=name&action=batch_create&throughput=throughput&start_time=start_time");

xhr.send(data);
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
  curl_easy_setopt(curl, CURLOPT_URL, "https://api.sendsms.ro/json?username=username&password=password&filter=filter&file_type=file_type&name=name&action=batch_create&throughput=throughput&start_time=start_time");
  curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
  curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
  struct curl_slist *headers = NULL;
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  curl_mime *mime;
  curl_mimepart *part;
  mime = curl_mime_init(curl);
  part = curl_mime_addpart(mime);
  curl_mime_name(part, "data");
  curl_mime_data(part, "message,to,from,coding\nBatch Message 1,40727363767,1898,-1\nBatch Message 2,40727363767,1898,-1\nBatch Message 3,40727363767,1898,-1", CURL_ZERO_TERMINATED);
  curl_easy_setopt(curl, CURLOPT_MIMEPOST, mime);
  res = curl_easy_perform(curl);
  curl_mime_free(mime);
}
curl_easy_cleanup(curl);
var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'POST',
  'hostname': 'api.sendsms.ro',
  'path': '/json?username=username&password=password&filter=filter&file_type=file_type&name=name&action=batch_create&throughput=throughput&start_time=start_time',
  'headers': {
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

var postData = "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"data\"\r\n\r\nmessage,to,from,coding
Batch Message 1,40727363767,1898,-1
Batch Message 2,40727363767,1898,-1
Batch Message 3,40727363767,1898,-1\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--";

req.setHeader('content-type', 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW');

req.write(postData);

req.end();
#import <Foundation/Foundation.h>

dispatch_semaphore_t sema = dispatch_semaphore_create(0);

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.sendsms.ro/json?username=username&password=password&filter=filter&file_type=file_type&name=name&action=batch_create&throughput=throughput&start_time=start_time"]
  cachePolicy:NSURLRequestUseProtocolCachePolicy
  timeoutInterval:10.0];
NSArray *parameters = @[
  @{ @"name": @"data", @"value": @"message,to,from,coding\nBatch Message 1,40727363767,1898,-1\nBatch Message 2,40727363767,1898,-1\nBatch Message 3,40727363767,1898,-1" } 
];

NSString *boundary = @"----WebKitFormBoundary7MA4YWxkTrZu0gW";
NSError *error;
NSMutableString *body = [NSMutableString string];

for (NSDictionary *param in parameters) {
  [body appendFormat:@"--%@\r\n", boundary];
  [body appendFormat:@"Content-Disposition:form-data; name=\"%@\"\r\n\r\n", param[@"name"]];
  [body appendFormat:@"%@", param[@"value"]];
}
[body appendFormat:@"\r\n--%@--\r\n", boundary];
NSData *postData = [body dataUsingEncoding:NSUTF8StringEncoding];
[request setHTTPBody:postData];

[request setHTTPMethod:@"POST"];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
  if (error) {
    NSLog(@"%@", error);
    dispatch_semaphore_signal(sema);
  } else {
    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
    NSError *parseError = nil;
    NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
    NSLog(@"%@",responseDictionary);
    dispatch_semaphore_signal(sema);
  }
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
open Lwt
open Cohttp
open Cohttp_lwt_unix

let parameters = [|
  [| ("name", "data"); ("value", "message,to,from,coding
Batch Message 1,40727363767,1898,-1
Batch Message 2,40727363767,1898,-1
Batch Message 3,40727363767,1898,-1") |]
|];;
let boundary = "----WebKitFormBoundary7MA4YWxkTrZu0gW";;
let postData = ref "";;

for x = 0 to Array.length parameters - 1 do
  let (_, paramName) = parameters.(x).(0) in
  let (paramType, _) = parameters.(x).(1) in
  let accum = "--" ^ boundary ^ "\r\n" ^ "Content-Disposition: form-data; name=\"" ^ paramName ^ "\"" in
  if paramType = "value" then (
    let (_, paramValue) = parameters.(x).(1) in
    postData := if Array.length parameters.(x) == 3 then (
      let (_, contentType) = parameters.(x).(2) in
      !postData ^ accum ^ "\r\n" ^ "Content-Type: " ^ contentType ^ "\r\n\r\n" ^ paramValue ^ "\r\n"
    ) else (
      !postData ^ accum ^ "\r\n\r\n" ^ paramValue ^ "\r\n"
    );
  )
  else if paramType = "fileName" then (
    let (_, filepath) = parameters.(x).(1) in
    postData := !postData ^ accum ^ "; filename=\""^ filepath ^"\"\r\n";
    let ch = open_in filepath in
      let fileContent = really_input_string ch (in_channel_length ch) in
      close_in ch;
    postData := !postData ^ "Content-Type: {content-type header}\r\n\r\n"^ fileContent ^"\r\n";
  )
done;;
postData := !postData ^ "--" ^ boundary ^ "--"

let reqBody = 
  let uri = Uri.of_string "https://api.sendsms.ro/json?username=username&password=password&filter=filter&file_type=file_type&name=name&action=batch_create&throughput=throughput&start_time=start_time" in
  let headers = Header.init ()
    |> fun h -> Header.add h "content-type" "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW"
  in
  let body = Cohttp_lwt.Body.of_string !postData in

  Client.call ~headers ~body `POST uri >>= fun (_resp, body) ->
  body |> Cohttp_lwt.Body.to_string >|= fun body -> body

let () =
  let respBody = Lwt_main.run reqBody in
  print_endline (respBody)
$multipartContent = [System.Net.Http.MultipartFormDataContent]::new()
$stringHeader = [System.Net.Http.Headers.ContentDispositionHeaderValue]::new("form-data")
$stringHeader.Name = "data"
$stringContent = [System.Net.Http.StringContent]::new("message,to,from,coding`nBatch Message 1,40727363767,1898,-1`nBatch Message 2,40727363767,1898,-1`nBatch Message 3,40727363767,1898,-1")
$stringContent.Headers.ContentDisposition = $stringHeader
$multipartContent.Add($stringContent)

$body = $multipartContent

$response = Invoke-RestMethod 'https://api.sendsms.ro/json?username=username&password=password&filter=filter&file_type=file_type&name=name&action=batch_create&throughput=throughput&start_time=start_time' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
import http.client
import mimetypes
from codecs import encode

conn = http.client.HTTPSConnection("api.sendsms.ro")
dataList = []
boundary = 'wL36Yn8afVp8Ag7AmP8qZ0SA4n1v9T'
dataList.append(encode('--' + boundary))
dataList.append(encode('Content-Disposition: form-data; name=data;'))

dataList.append(encode('Content-Type: {}'.format('text/plain')))
dataList.append(encode(''))

dataList.append(encode("message,to,from,coding
Batch Message 1,40727363767,1898,-1
Batch Message 2,40727363767,1898,-1
Batch Message 3,40727363767,1898,-1"))
dataList.append(encode('--'+boundary+'--'))
dataList.append(encode(''))
body = b'\r\n'.join(dataList)
payload = body
headers = {
   'Content-type': 'multipart/form-data; boundary={}'.format(boundary) 
}
conn.request("POST", "/json?username=username&password=password&filter=filter&file_type=file_type&name=name&action=batch_create&throughput=throughput&start_time=start_time", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
library(httr)

body = list(
  'data' = 'message,to,from,coding
Batch Message 1,40727363767,1898,-1
Batch Message 2,40727363767,1898,-1
Batch Message 3,40727363767,1898,-1'
)

res <- VERB("POST", url = "https://api.sendsms.ro/json?username=username&password=password&filter=filter&file_type=file_type&name=name&action=batch_create&throughput=throughput&start_time=start_time", body = body, encode = 'multipart')

cat(content(res, 'text'))
require "uri"
require "net/http"

url = URI("https://api.sendsms.ro/json?username=username&password=password&filter=filter&file_type=file_type&name=name&action=batch_create&throughput=throughput&start_time=start_time")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
form_data = [['data', 'message,to,from,coding
Batch Message 1,40727363767,1898,-1
Batch Message 2,40727363767,1898,-1
Batch Message 3,40727363767,1898,-1']]
request.set_form form_data, 'multipart/form-data'
response = https.request(request)
puts response.read_body
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

var semaphore = DispatchSemaphore (value: 0)

let parameters = [
  [
    "key": "data",
    "value": "message,to,from,coding
Batch Message 1,40727363767,1898,-1
Batch Message 2,40727363767,1898,-1
Batch Message 3,40727363767,1898,-1",
    "type": "text"
  ]] as [[String : Any]]

let boundary = "Boundary-\(UUID().uuidString)"
var body = ""
var error: Error? = nil
for param in parameters {
  if param["disabled"] == nil {
    let paramName = param["key"]!
    body += "--\(boundary)\r\n"
    body += "Content-Disposition:form-data; name=\"\(paramName)\""
    if param["contentType"] != nil {
      body += "\r\nContent-Type: \(param["contentType"] as! String)"
    }
    let paramType = param["type"] as! String
    if paramType == "text" {
      let paramValue = param["value"] as! String
      body += "\r\n\r\n\(paramValue)\r\n"
    } else {
      let paramSrc = param["src"] as! String
      let fileData = try NSData(contentsOfFile:paramSrc, options:[]) as Data
      let fileContent = String(data: fileData, encoding: .utf8)!
      body += "; filename=\"\(paramSrc)\"\r\n"
        + "Content-Type: \"content-type header\"\r\n\r\n\(fileContent)\r\n"
    }
  }
}
body += "--\(boundary)--\r\n";
let postData = body.data(using: .utf8)

var request = URLRequest(url: URL(string: "https://api.sendsms.ro/json?username=username&password=password&filter=filter&file_type=file_type&name=name&action=batch_create&throughput=throughput&start_time=start_time")!,timeoutInterval: Double.infinity)
request.addValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")

request.httpMethod = "POST"
request.httpBody = postData

let task = URLSession.shared.dataTask(with: request) { data, response, error in 
  guard let data = data else {
    print(String(describing: error))
    semaphore.signal()
    return
  }
  print(String(data: data, encoding: .utf8)!)
  semaphore.signal()
}

task.resume()
semaphore.wait()

The above command returns JSON structured like this:

{
   "status":0,
   "message":"OK",
   "details":"40585"
}

This method is for sending bulk SMS campaigns to .CSV, .TXT, .XLS, .XLSX and any other comma delimited file.

Including your batch file

Due to the limits of GET parameters, using the batch_create() method requires the batch file to be uploaded as a POST variable. The POST variable that must be used is named ‘data’. If the file is compressed using ZIP compression the POST data will need to be base 64 encoded prior to upload.

Inside Laravel, add your batch file under storage/app.

Pseudo code:

<%="

"%>
batchCsvData = readFile(myBatchFile.csv);
if(batchFileIsZip) { 
    batchCsvData = Base64Encode(batchCsvData);
}
postData = “data=“ + batchCsvData;
<%="
"%>

Example of batch files

Result

If the batch is successfully created a batch ID will be returned.

HTTP Request

POST https://api.sendsms.ro/json?action=batch_create

Query Parameters

Parameter Type Description Required Default
username string Your log-in username true
password string Your log-in password or API Key true
name string A description / name for this batch true
throughput integer Throughput to deliver this batch at (per second) false 0
filter boolean Filter this batch against the global blocklist false false
file_type string File type of the upload ( csv, xls or zip accepted ) false csv
start_time string If the batch must be auto-started at a given time, it must be specified here: eg: 2012-03-04 08:00:00 false NULL

Check the status of a batch

  curl "https://api.sendsms.ro/json?action=batch_check_status&username=username&password=password&batch_id=batch_id"
<?php
require('sendsms_api.php');
$api = new SendsmsApi();

$api->setUsername('username');
$api->setPassword('password');

$id = $api->batches_list()['details'][0]['id'];
echo json_encode($api->batch_check_status($id));
<?php
$curl = curl_init();

curl_setopt($curl, CURLOPT_HEADER, 1);
$password = urlencode("password");
curl_setopt($curl, CURLOPT_URL, "https://api.sendsms.ro/json?action=batch_check_status&username=username&password=$password&batch_id=1234");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLINFO_HEADER_OUT, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Connection: keep-alive"));

$result = curl_exec($curl);

$size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);

$result = substr($result, $size);

echo $result;
package com.sendsms;

public class Main {
    public static void main(String[] args) {
        Api sendsms = new Api("username", "password");
        sendsms.setDebugState(true);
        Integer batch_id = Integer.parseInt(sendsms.batches_list().getJSONObject(1).getString("id"));
        System.out.println(sendsms.batch_check_status(batch_id));
    }
}
package com.sendsms;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

public class Main {
    public static void main(String[] args) throws IOException {
        String password = URLEncoder.encode("password", StandardCharsets.UTF_8);
        String urlString = "https://api.sendsms.ro/json?action=batch_check_status&username=username&password=" + password + "&batch_id=1234";
        URL url = new URL(urlString);
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        con.setConnectTimeout(5000);
        con.setReadTimeout(5000);
        BufferedReader in = new BufferedReader(
                new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer content = new StringBuffer();
        while ((inputLine = in.readLine()) != null) {
            content.append(inputLine);
        }
        in.close();
        con.disconnect();
        System.out.println(content);
    }
}
<?php

use Illuminate\Support\Facades\Route;
use SendSMS\SendsmsLaravel\API\Batch;

Route::get('/', function () {
    $api = new Batch();
    $api->batch_check_status("000000");
    return view('welcome');
});
<?php
use SendSMS\API\Batch;

$api = new Batch();
$api->setUsername('username');
$api->setPassword('password');
$api->batch_check_status("000000");
var client = new RestClient("https://api.sendsms.ro/json?action=batch_check_status&username=username&password=password&batch_id=batch_id");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
var request = http.Request('GET', Uri.parse('https://api.sendsms.ro/json?action=batch_check_status&username=username&password=password&batch_id=batch_id'));


http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
  print(await response.stream.bytesToString());
}
else {
  print(response.reasonPhrase);
}
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := https://api.sendsms.ro/json?action=batch_check_status&username=username&password=password&batch_id=batch_id"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
// WARNING: For GET requests, body is set to null by browsers.

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.sendsms.ro/json?action=batch_check_status&username=username&password=password&batch_id=batch_id");

xhr.send();
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
  curl_easy_setopt(curl, CURLOPT_URL, "https://api.sendsms.ro/json?action=batch_check_status&username=username&password=password&batch_id=batch_id");
  curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
  curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
  struct curl_slist *headers = NULL;
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'GET',
  'hostname': 'api.sendsms.ro',
  'path': '/json?action=batch_check_status&username=username&password=password&batch_id=batch_id',
  'headers': {
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

req.end();
#import <Foundation/Foundation.h>

dispatch_semaphore_t sema = dispatch_semaphore_create(0);

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.sendsms.ro/json?action=batch_check_status&username=username&password=password&batch_id=batch_id"]
  cachePolicy:NSURLRequestUseProtocolCachePolicy
  timeoutInterval:10.0];

[request setHTTPMethod:@"GET"];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
  if (error) {
    NSLog(@"%@", error);
    dispatch_semaphore_signal(sema);
  } else {
    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
    NSError *parseError = nil;
    NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
    NSLog(@"%@",responseDictionary);
    dispatch_semaphore_signal(sema);
  }
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
open Lwt
open Cohttp
open Cohttp_lwt_unix

let reqBody = 
  let uri = Uri.of_string "https://api.sendsms.ro/json?action=batch_check_status&username=username&password=password&batch_id=batch_id" in
  Client.call `GET uri >>= fun (_resp, body) ->
  body |> Cohttp_lwt.Body.to_string >|= fun body -> body

let () =
  let respBody = Lwt_main.run reqBody in
  print_endline (respBody)
$response = Invoke-RestMethod 'https://api.sendsms.ro/json?action=batch_check_status&username=username&password=password&batch_id=batch_id' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
import http.client

conn = http.client.HTTPSConnection("api.sendsms.ro")
payload = ''
headers = {}
conn.request("GET", "/json?action=batch_check_status&username=username&password=password&batch_id=batch_id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
library(httr)

res <- VERB("GET", url = "https://api.sendsms.ro/json?action=batch_check_status&username=username&password=password&batch_id=batch_id")

cat(content(res, 'text'))
require "uri"
require "net/http"

url = URI("https://api.sendsms.ro/json?action=batch_check_status&username=username&password=password&batch_id=batch_id")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)

response = https.request(request)
puts response.read_body
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

var semaphore = DispatchSemaphore (value: 0)

var request = URLRequest(url: URL(string: "https://api.sendsms.ro/json?action=batch_check_status&username=username&password=password&batch_id=batch_id")!,timeoutInterval: Double.infinity)
request.httpMethod = "GET"

let task = URLSession.shared.dataTask(with: request) { data, response, error in 
  guard let data = data else {
    print(String(describing: error))
    semaphore.signal()
    return
  }
  print(String(data: data, encoding: .utf8)!)
  semaphore.signal()
}

task.resume()
semaphore.wait()

Checks the status of a batch

The above command returns JSON structured like this:

{
   "status":0,
   "message":"OK",
   "details":{
      "status":"64",
      "num_messages":"1",
      "num_processed":"1",
      "num_delivered":"1",
      "num_failed":"0",
      "num_blocked":"0"
   }
}

HTTP Request

GET https://api.sendsms.ro/json?action=batch_check_status

Query Parameters

Parameter Type Description Required Default
username string Your log-in username true
password string Your log-in password or API Key true
batch_id integer batch_id as returned from batches_list (or other batch API's) true

Get All Batches

  curl "https://api.sendsms.ro/json?action=batches_list&username=username&password=password"
<?php
require('sendsms_api.php');
$api = new SendsmsApi();

$api->setUsername('username');
$api->setPassword('password');

echo json_encode($api->batches_list());
<?php
$curl = curl_init();

curl_setopt($curl, CURLOPT_HEADER, 1);
$password = urlencode("password");
curl_setopt($curl, CURLOPT_URL, "https://api.sendsms.ro/json?action=batches_list&username=username&password=$password');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLINFO_HEADER_OUT, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Connection: keep-alive"));

$result = curl_exec($curl);

$size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);

$result = substr($result, $size);

echo $result;
package com.sendsms;

public class Main {
    public static void main(String[] args) {
        Api sendsms = new Api("username", "password");
        sendsms.setDebugState(true);
        System.out.println(sendsms.batches_list());
    }
}
package com.sendsms;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

public class Main {
    public static void main(String[] args) throws IOException {
        String password = URLEncoder.encode("password", StandardCharsets.UTF_8);
        String urlString = "https://api.sendsms.ro/json?action=batches_list&username=username&password=" + password;
        URL url = new URL(urlString);
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        con.setConnectTimeout(5000);
        con.setReadTimeout(5000);
        BufferedReader in = new BufferedReader(
                new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer content = new StringBuffer();
        while ((inputLine = in.readLine()) != null) {
            content.append(inputLine);
        }
        in.close();
        con.disconnect();
        System.out.println(content);
    }
}
<?php

use Illuminate\Support\Facades\Route;
use SendSMS\SendsmsLaravel\API\Batch;

Route::get('/', function () {
    $api = new Batch();
    $api->batches_list();
    return view('welcome');
});
<?php
use SendSMS\API\Batch;

$api = new Batch();
$api->setUsername('username');
$api->setPassword('password');
$api->batches_list();
var client = new RestClient("https://api.sendsms.ro/json?action=batches_list&username=username&password=password");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
var request = http.Request('GET', Uri.parse('https://api.sendsms.ro/json?action=batches_list&username=username&password=password'));


http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
  print(await response.stream.bytesToString());
}
else {
  print(response.reasonPhrase);
}
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := https://api.sendsms.ro/json?action=batches_list&username=username&password=password"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
// WARNING: For GET requests, body is set to null by browsers.

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.sendsms.ro/json?action=batches_list&username=username&password=password");

xhr.send();
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
  curl_easy_setopt(curl, CURLOPT_URL, "https://api.sendsms.ro/json?action=batches_list&username=username&password=password");
  curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
  curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
  struct curl_slist *headers = NULL;
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'GET',
  'hostname': 'api.sendsms.ro',
  'path': '/json?action=batches_list&username=username&password=password',
  'headers': {
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

req.end();
#import <Foundation/Foundation.h>

dispatch_semaphore_t sema = dispatch_semaphore_create(0);

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.sendsms.ro/json?action=batches_list&username=username&password=password"]
  cachePolicy:NSURLRequestUseProtocolCachePolicy
  timeoutInterval:10.0];

[request setHTTPMethod:@"GET"];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
  if (error) {
    NSLog(@"%@", error);
    dispatch_semaphore_signal(sema);
  } else {
    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
    NSError *parseError = nil;
    NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
    NSLog(@"%@",responseDictionary);
    dispatch_semaphore_signal(sema);
  }
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
open Lwt
open Cohttp
open Cohttp_lwt_unix

let reqBody = 
  let uri = Uri.of_string "https://api.sendsms.ro/json?action=batches_list&username=username&password=password" in
  Client.call `GET uri >>= fun (_resp, body) ->
  body |> Cohttp_lwt.Body.to_string >|= fun body -> body

let () =
  let respBody = Lwt_main.run reqBody in
  print_endline (respBody)
$response = Invoke-RestMethod 'https://api.sendsms.ro/json?action=batches_list&username=username&password=password' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
import http.client

conn = http.client.HTTPSConnection("api.sendsms.ro")
payload = ''
headers = {}
conn.request("GET", "/json?action=batches_list&username=username&password=password", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
library(httr)

res <- VERB("GET", url = "https://api.sendsms.ro/json?action=batches_list&username=username&password=password")

cat(content(res, 'text'))
require "uri"
require "net/http"

url = URI("https://api.sendsms.ro/json?action=batches_list&username=username&password=password")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)

response = https.request(request)
puts response.read_body
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

var semaphore = DispatchSemaphore (value: 0)

var request = URLRequest(url: URL(string: "https://api.sendsms.ro/json?action=batches_list&username=username&password=password")!,timeoutInterval: Double.infinity)
request.httpMethod = "GET"

let task = URLSession.shared.dataTask(with: request) { data, response, error in 
  guard let data = data else {
    print(String(describing: error))
    semaphore.signal()
    return
  }
  print(String(data: data, encoding: .utf8)!)
  semaphore.signal()
}

task.resume()
semaphore.wait()

Retrieves a list of the user batches.

The above command returns JSON structured like this:

{
   "status":0,
   "message":"OK",
   "details":[
      {
         "id":"11",
         "name":"test",
         "status":32,
         "deletable":false
      },
      {
         "id":"12",
         "name":"Relationships",
         "status":32,
         "deletable":false
      }
   ]
}

HTTP Request

GET https://api.sendsms.ro/json?action=batches_list

Query Parameters

Parameter Type Description Required Default
username string Your log-in username true
password string Your log-in password or API Key true

Starts the given batch

  curl "https://api.sendsms.ro/json?action=batch_start&username=username&password=password&batch_id=batch_id"
<?php
require('sendsms_api.php');
$api = new SendsmsApi();

$api->setUsername('username');
$api->setPassword('password');

$id = $api->batches_list()['details'][0]['id'];
echo json_encode($api->batch_start($id));
<?php
$curl = curl_init();

curl_setopt($curl, CURLOPT_HEADER, 1);
$password = urlencode("password");
curl_setopt($curl, CURLOPT_URL, "https://api.sendsms.ro/json?action=batch_start&username=username&password=$password&batch_id=1234");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLINFO_HEADER_OUT, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Connection: keep-alive"));

$result = curl_exec($curl);

$size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);

$result = substr($result, $size);

echo $result;
package com.sendsms;

public class Main {
    public static void main(String[] args) {
        Api sendsms = new Api("username", "password");
        sendsms.setDebugState(true);
        Integer batch_id = Integer.parseInt(sendsms.batches_list().getJSONObject(1).getString("id"));
        System.out.println(sendsms.batch_start(batch_id));
    }
}
package com.sendsms;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

public class Main {
    public static void main(String[] args) throws IOException {
        String password = URLEncoder.encode("password", StandardCharsets.UTF_8);
        String urlString = "https://api.sendsms.ro/json?action=batch_start&username=username&password=" + password + "&batch_id=1234";
        URL url = new URL(urlString);
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        con.setConnectTimeout(5000);
        con.setReadTimeout(5000);
        BufferedReader in = new BufferedReader(
                new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer content = new StringBuffer();
        while ((inputLine = in.readLine()) != null) {
            content.append(inputLine);
        }
        in.close();
        con.disconnect();
        System.out.println(content);
    }
}
<?php

use Illuminate\Support\Facades\Route;
use SendSMS\SendsmsLaravel\API\Batch;

Route::get('/', function () {
    $api = new Batch();
    $api->batch_start("00000");
    return view('welcome');
});
<?php
use SendSMS\API\Batch;

$api = new Batch();
$api->setUsername('username');
$api->setPassword('password');
$api->batch_start("00000");
var client = new RestClient("https://api.sendsms.ro/json?action=batch_start&username=username&password=password&batch_id=batch_id");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
var request = http.Request('GET', Uri.parse('https://api.sendsms.ro/json?action=batch_start&username=username&password=password&batch_id=batch_id'));


http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
  print(await response.stream.bytesToString());
}
else {
  print(response.reasonPhrase);
}
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := https://api.sendsms.ro/json?action=batch_start&username=username&password=password&batch_id=batch_id"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
// WARNING: For GET requests, body is set to null by browsers.

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.sendsms.ro/json?action=batch_start&username=username&password=password&batch_id=batch_id");

xhr.send();
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
  curl_easy_setopt(curl, CURLOPT_URL, "https://api.sendsms.ro/json?action=batch_start&username=username&password=password&batch_id=batch_id");
  curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
  curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
  struct curl_slist *headers = NULL;
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'GET',
  'hostname': 'api.sendsms.ro',
  'path': '/json?action=batch_start&username=username&password=password&batch_id=batch_id',
  'headers': {
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

req.end();
#import <Foundation/Foundation.h>

dispatch_semaphore_t sema = dispatch_semaphore_create(0);

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.sendsms.ro/json?action=batch_start&username=username&password=password&batch_id=batch_id"]
  cachePolicy:NSURLRequestUseProtocolCachePolicy
  timeoutInterval:10.0];

[request setHTTPMethod:@"GET"];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
  if (error) {
    NSLog(@"%@", error);
    dispatch_semaphore_signal(sema);
  } else {
    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
    NSError *parseError = nil;
    NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
    NSLog(@"%@",responseDictionary);
    dispatch_semaphore_signal(sema);
  }
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
open Lwt
open Cohttp
open Cohttp_lwt_unix

let reqBody = 
  let uri = Uri.of_string "https://api.sendsms.ro/json?action=batch_start&username=username&password=password&batch_id=batch_id" in
  Client.call `GET uri >>= fun (_resp, body) ->
  body |> Cohttp_lwt.Body.to_string >|= fun body -> body

let () =
  let respBody = Lwt_main.run reqBody in
  print_endline (respBody)
$response = Invoke-RestMethod 'https://api.sendsms.ro/json?action=address_book_groups_get_list&username=username&password=password' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
import http.client

conn = http.client.HTTPSConnection("api.sendsms.ro")
payload = ''
headers = {}
conn.request("GET", "/json?action=batch_start&username=username&password=password&batch_id=batch_id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
library(httr)

res <- VERB("GET", url = "https://api.sendsms.ro/json?action=batch_start&username=username&password=password&batch_id=batch_id")

cat(content(res, 'text'))
require "uri"
require "net/http"

url = URI("https://api.sendsms.ro/json?action=batch_start&username=username&password=password&batch_id=batch_id")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)

response = https.request(request)
puts response.read_body
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

var semaphore = DispatchSemaphore (value: 0)

var request = URLRequest(url: URL(string: "https://api.sendsms.ro/json?action=batch_start&username=username&password=password&batch_id=batch_id")!,timeoutInterval: Double.infinity)
request.httpMethod = "GET"

let task = URLSession.shared.dataTask(with: request) { data, response, error in 
  guard let data = data else {
    print(String(describing: error))
    semaphore.signal()
    return
  }
  print(String(data: data, encoding: .utf8)!)
  semaphore.signal()
}

task.resume()
semaphore.wait()

Starts the given batch

The above command returns JSON structured like this:

{
   "status":0,
   "message":"OK"
}

HTTP Request

GET https://api.sendsms.ro/json?action=batch_start

Query Parameters

Parameter Type Description Required Default
username string Your log-in username true
password string Your log-in password or API Key true
batch_id integer batch_id as returned from batches_list (or other batch API's) true

Stops / Pause the given batch

  curl "https://api.sendsms.ro/json?action=batch_stop&username=username&password=password&batch_id=batch_id"
<?php
require('sendsms_api.php');
$api = new SendsmsApi();

$api->setUsername('username');
$api->setPassword('password');

$id = $api->batches_list()['details'][0]['id'];
echo json_encode($api->batch_stop($id));
<?php
$curl = curl_init();

curl_setopt($curl, CURLOPT_HEADER, 1);
$password = urlencode("password");
curl_setopt($curl, CURLOPT_URL, "https://api.sendsms.ro/json?action=batch_stop&username=username&password=$password&batch_id=1234");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLINFO_HEADER_OUT, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Connection: keep-alive"));

$result = curl_exec($curl);

$size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);

$result = substr($result, $size);

echo $result;
package com.sendsms;

public class Main {
    public static void main(String[] args) {
        Api sendsms = new Api("username", "password");
        sendsms.setDebugState(true);
        Integer batch_id = Integer.parseInt(sendsms.batches_list().getJSONObject(1).getString("id"));
        System.out.println(sendsms.batch_stop(batch_id));
    }
}
package com.sendsms;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

public class Main {
    public static void main(String[] args) throws IOException {
        String password = URLEncoder.encode("password", StandardCharsets.UTF_8);
        String urlString = "https://api.sendsms.ro/json?action=batch_stop&username=username&password=" + password + "&batch_id=1234";
        URL url = new URL(urlString);
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        con.setConnectTimeout(5000);
        con.setReadTimeout(5000);
        BufferedReader in = new BufferedReader(
                new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer content = new StringBuffer();
        while ((inputLine = in.readLine()) != null) {
            content.append(inputLine);
        }
        in.close();
        con.disconnect();
        System.out.println(content);
    }
}
<?php

use Illuminate\Support\Facades\Route;
use SendSMS\SendsmsLaravel\API\Batch;

Route::get('/', function () {
    $api = new Batch();
    $api->batch_stop("000000");
    return view('welcome');
});
<?php
use SendSMS\API\Batch;

$api = new Batch();
$api->setUsername('username');
$api->setPassword('password');
$api->batch_stop("000000");
var client = new RestClient("https://api.sendsms.ro/json?action=batch_stop&username=username&password=password&batch_id=batch_id");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
var request = http.Request('GET', Uri.parse('https://api.sendsms.ro/json?action=batch_stop&username=username&password=password&batch_id=batch_id'));


http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
  print(await response.stream.bytesToString());
}
else {
  print(response.reasonPhrase);
}
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := https://api.sendsms.ro/json?action=batch_stop&username=username&password=password&batch_id=batch_id"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
// WARNING: For GET requests, body is set to null by browsers.

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.sendsms.ro/json?action=batch_stop&username=username&password=password&batch_id=batch_id");

xhr.send();
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
  curl_easy_setopt(curl, CURLOPT_URL, "https://api.sendsms.ro/json?action=batch_stop&username=username&password=password&batch_id=batch_id");
  curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
  curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
  struct curl_slist *headers = NULL;
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'GET',
  'hostname': 'api.sendsms.ro',
  'path': '/json?action=batch_stop&username=username&password=password&batch_id=batch_id',
  'headers': {
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

req.end();
#import <Foundation/Foundation.h>

dispatch_semaphore_t sema = dispatch_semaphore_create(0);

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.sendsms.ro/json?action=batch_stop&username=username&password=password&batch_id=batch_id"]
  cachePolicy:NSURLRequestUseProtocolCachePolicy
  timeoutInterval:10.0];

[request setHTTPMethod:@"GET"];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
  if (error) {
    NSLog(@"%@", error);
    dispatch_semaphore_signal(sema);
  } else {
    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
    NSError *parseError = nil;
    NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
    NSLog(@"%@",responseDictionary);
    dispatch_semaphore_signal(sema);
  }
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
open Lwt
open Cohttp
open Cohttp_lwt_unix

let reqBody = 
  let uri = Uri.of_string "https://api.sendsms.ro/json?action=batch_stop&username=username&password=password&batch_id=batch_id" in
  Client.call `GET uri >>= fun (_resp, body) ->
  body |> Cohttp_lwt.Body.to_string >|= fun body -> body

let () =
  let respBody = Lwt_main.run reqBody in
  print_endline (respBody)
$response = Invoke-RestMethod 'https://api.sendsms.ro/json?action=batch_stop&username=username&password=password&batch_id=batch_id' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
import http.client

conn = http.client.HTTPSConnection("api.sendsms.ro")
payload = ''
headers = {}
conn.request("GET", "/json?action=batch_stop&username=username&password=password&batch_id=batch_id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
library(httr)

res <- VERB("GET", url = "https://api.sendsms.ro/json?action=batch_stop&username=username&password=password&batch_id=batch_id")

cat(content(res, 'text'))
require "uri"
require "net/http"

url = URI("https://api.sendsms.ro/json?action=batch_stop&username=username&password=password&batch_id=batch_id")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)

response = https.request(request)
puts response.read_body
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

var semaphore = DispatchSemaphore (value: 0)

var request = URLRequest(url: URL(string: "https://api.sendsms.ro/json?action=batch_stop&username=username&password=password&batch_id=batch_id")!,timeoutInterval: Double.infinity)
request.httpMethod = "GET"

let task = URLSession.shared.dataTask(with: request) { data, response, error in 
  guard let data = data else {
    print(String(describing: error))
    semaphore.signal()
    return
  }
  print(String(data: data, encoding: .utf8)!)
  semaphore.signal()
}

task.resume()
semaphore.wait()

Stops/pauses the given batch

The above command returns JSON structured like this:

{
   "status":0,
   "message":"OK"
}

HTTP Request

GET https://api.sendsms.ro/json?action=batch_stop

Query Parameters

Parameter Type Description Required Default
username string Your log-in username true
password string Your log-in password or API Key true
batch_id integer batch_id as returned from batches_list (or other batch API's) true

Blocklist

Blocklist Add

  curl "https://api.sendsms.ro/json?action=blocklist_add&username=username&password=password&phonenumber=phonenumber"
<?php
require('sendsms_api.php');
$api = new SendsmsApi();

$api->setUsername('username');
$api->setPassword('password');

echo json_encode($api->blocklist_add("40727363767"));
<?php
$curl = curl_init();

curl_setopt($curl, CURLOPT_HEADER, 1);
$password = urlencode("password");
curl_setopt($curl, CURLOPT_URL, "https://api.sendsms.ro/json?action=blocklist_add&username=username&password=$password&phonenumber=40727363767");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLINFO_HEADER_OUT, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Connection: keep-alive"));

$result = curl_exec($curl);

$size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);

$result = substr($result, $size);

echo $result;
package com.sendsms;

public class Main {
    public static void main(String[] args) {
        Api sendsms = new Api("username", "password");
        sendsms.setDebugState(true);
        System.out.println(sendsms.blocklist_add(40727363767L));
    }
}
package com.sendsms;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

public class Main {
    public static void main(String[] args) throws IOException {
        String password = URLEncoder.encode("password", StandardCharsets.UTF_8);
        String urlString = "https://api.sendsms.ro/json?action=blocklist_add&username=username&password=" + password + "&phonenumber=40727363767";
        URL url = new URL(urlString);
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        con.setConnectTimeout(5000);
        con.setReadTimeout(5000);
        BufferedReader in = new BufferedReader(
                new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer content = new StringBuffer();
        while ((inputLine = in.readLine()) != null) {
            content.append(inputLine);
        }
        in.close();
        con.disconnect();
        System.out.println(content);
    }
}
<?php

use Illuminate\Support\Facades\Route;
use SendSMS\SendsmsLaravel\API\Blocklist;

Route::get('/', function () {
    $api = new Blocklist();
    $api->blocklist_add("40727363767");
    return view('welcome');
});
<?php
use SendSMS\API\Blocklist;

$api = new Blocklist();
$api->setUsername('username');
$api->setPassword('password');
$api->blocklist_add("40727363767");
var client = new RestClient("https://api.sendsms.ro/json?action=blocklist_add&username=username&password=password&phonenumber=40727363767");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
var request = http.Request('GET', Uri.parse('https://api.sendsms.ro/json?action=blocklist_add&username=username&password=password&phonenumber=40727363767'));


http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
  print(await response.stream.bytesToString());
}
else {
  print(response.reasonPhrase);
}
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := https://api.sendsms.ro/json?action=blocklist_add&username=username&password=password&phonenumber=40727363767"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
// WARNING: For GET requests, body is set to null by browsers.

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.sendsms.ro/json?action=blocklist_add&username=username&password=password&phonenumber=40727363767");

xhr.send();
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
  curl_easy_setopt(curl, CURLOPT_URL, "https://api.sendsms.ro/json?action=blocklist_add&username=username&password=password&phonenumber=40727363767");
  curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
  curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
  struct curl_slist *headers = NULL;
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'GET',
  'hostname': 'api.sendsms.ro',
  'path': '/json?action=blocklist_add&username=username&password=password&phonenumber=40727363767',
  'headers': {
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

req.end();
#import <Foundation/Foundation.h>

dispatch_semaphore_t sema = dispatch_semaphore_create(0);

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.sendsms.ro/json?action=blocklist_add&username=username&password=password&phonenumber=40727363767"]
  cachePolicy:NSURLRequestUseProtocolCachePolicy
  timeoutInterval:10.0];

[request setHTTPMethod:@"GET"];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
  if (error) {
    NSLog(@"%@", error);
    dispatch_semaphore_signal(sema);
  } else {
    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
    NSError *parseError = nil;
    NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
    NSLog(@"%@",responseDictionary);
    dispatch_semaphore_signal(sema);
  }
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
open Lwt
open Cohttp
open Cohttp_lwt_unix

let reqBody = 
  let uri = Uri.of_string "https://api.sendsms.ro/json?action=blocklist_add&username=username&password=password&phonenumber=40727363767" in
  Client.call `GET uri >>= fun (_resp, body) ->
  body |> Cohttp_lwt.Body.to_string >|= fun body -> body

let () =
  let respBody = Lwt_main.run reqBody in
  print_endline (respBody)
$response = Invoke-RestMethod 'https://api.sendsms.ro/json?action=blocklist_add&username=username&password=password&phonenumber=40727363767' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
import http.client

conn = http.client.HTTPSConnection("api.sendsms.ro")
payload = ''
headers = {}
conn.request("GET", "/json?action=blocklist_add&username=username&password=password&phonenumber=40727363767", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
library(httr)

res <- VERB("GET", url = "https://api.sendsms.ro/json?action=blocklist_add&username=username&password=password&phonenumber=40727363767")

cat(content(res, 'text'))
require "uri"
require "net/http"

url = URI("https://api.sendsms.ro/json?action=blocklist_add&username=username&password=password&phonenumber=40727363767")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)

response = https.request(request)
puts response.read_body
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

var semaphore = DispatchSemaphore (value: 0)

var request = URLRequest(url: URL(string: "https://api.sendsms.ro/json?action=blocklist_add&username=username&password=password&phonenumber=40727363767")!,timeoutInterval: Double.infinity)
request.httpMethod = "GET"

let task = URLSession.shared.dataTask(with: request) { data, response, error in 
  guard let data = data else {
    print(String(describing: error))
    semaphore.signal()
    return
  }
  print(String(data: data, encoding: .utf8)!)
  semaphore.signal()
}

task.resume()
semaphore.wait()

Add a contact to the blocklist

The above command returns JSON structured like this:

{
   "status":0,
   "message":"OK"
}

HTTP Request

GET https://api.sendsms.ro/json?action=blocklist_add

Query Parameters

Parameter Type Description Required Default
username string Your log-in username true
password string Your log-in password or API Key true
phonenumber integer A phone number in E.164 Format but without the + sign (eg. 40727363767) true

Blocklist Delete

  curl "https://api.sendsms.ro/json?action=blocklist_del&username=username&password=password&phonenumber=phonenumber"
<?php
require('sendsms_api.php');
$api = new SendsmsApi();

$api->setUsername('username');
$api->setPassword('password');

echo json_encode($api->blocklist_del("40727363767"));
<?php
$curl = curl_init();

curl_setopt($curl, CURLOPT_HEADER, 1);
$password = urlencode("password");
curl_setopt($curl, CURLOPT_URL, "https://api.sendsms.ro/json?action=blocklist_del&username=username&password=$password&phonenumber=40727363767');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLINFO_HEADER_OUT, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Connection: keep-alive"));

$result = curl_exec($curl);

$size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);

$result = substr($result, $size);

echo $result;
package com.sendsms;

public class Main {
    public static void main(String[] args) {
        Api sendsms = new Api("username", "password");
        sendsms.setDebugState(true);
        System.out.println(sendsms.blocklist_del(40727363767L));
    }
}
package com.sendsms;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

public class Main {
    public static void main(String[] args) throws IOException {
        String password = URLEncoder.encode("password", StandardCharsets.UTF_8);
        String urlString = "https://api.sendsms.ro/json?action=blocklist_del&username=username&password=" + password + "&phonenumber=40727363767";
        URL url = new URL(urlString);
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        con.setConnectTimeout(5000);
        con.setReadTimeout(5000);
        BufferedReader in = new BufferedReader(
                new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer content = new StringBuffer();
        while ((inputLine = in.readLine()) != null) {
            content.append(inputLine);
        }
        in.close();
        con.disconnect();
        System.out.println(content);
    }
}
<?php

use Illuminate\Support\Facades\Route;
use SendSMS\SendsmsLaravel\API\Blocklist;

Route::get('/', function () {
    $api = new Blocklist();
    $api->blocklist_del("40727363767");
    return view('welcome');
});
<?php
use SendSMS\API\Blocklist;

$api = new Blocklist();
$api->setUsername('username');
$api->setPassword('password');
$api->blocklist_del("40727363767");
var client = new RestClient("https://api.sendsms.ro/json?action=blocklist_del&username=username&password=password&phonenumber=40727363767");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
var request = http.Request('GET', Uri.parse('https://api.sendsms.ro/json?action=blocklist_del&username=username&password=password&phonenumber=40727363767'));


http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
  print(await response.stream.bytesToString());
}
else {
  print(response.reasonPhrase);
}
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := https://api.sendsms.ro/json?action=blocklist_del&username=username&password=password&phonenumber=40727363767"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
// WARNING: For GET requests, body is set to null by browsers.

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.sendsms.ro/json?action=blocklist_del&username=username&password=password&phonenumber=40727363767");

xhr.send();
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
  curl_easy_setopt(curl, CURLOPT_URL, "https://api.sendsms.ro/json?action=blocklist_del&username=username&password=password&phonenumber=40727363767");
  curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
  curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
  struct curl_slist *headers = NULL;
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'GET',
  'hostname': 'api.sendsms.ro',
  'path': '/json?action=blocklist_del&username=username&password=password&phonenumber=40727363767',
  'headers': {
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

req.end();
#import <Foundation/Foundation.h>

dispatch_semaphore_t sema = dispatch_semaphore_create(0);

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.sendsms.ro/json?action=blocklist_del&username=username&password=password&phonenumber=40727363767"]
  cachePolicy:NSURLRequestUseProtocolCachePolicy
  timeoutInterval:10.0];

[request setHTTPMethod:@"GET"];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
  if (error) {
    NSLog(@"%@", error);
    dispatch_semaphore_signal(sema);
  } else {
    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
    NSError *parseError = nil;
    NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
    NSLog(@"%@",responseDictionary);
    dispatch_semaphore_signal(sema);
  }
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
open Lwt
open Cohttp
open Cohttp_lwt_unix

let reqBody = 
  let uri = Uri.of_string "https://api.sendsms.ro/json?action=blocklist_del&username=username&password=password&phonenumber=40727363767" in
  Client.call `GET uri >>= fun (_resp, body) ->
  body |> Cohttp_lwt.Body.to_string >|= fun body -> body

let () =
  let respBody = Lwt_main.run reqBody in
  print_endline (respBody)
$response = Invoke-RestMethod 'https://api.sendsms.ro/json?action=blocklist_del&username=username&password=password&phonenumber=40727363767' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
import http.client

conn = http.client.HTTPSConnection("api.sendsms.ro")
payload = ''
headers = {}
conn.request("GET", "/json?action=blocklist_del&username=username&password=password&phonenumber=40727363767", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
library(httr)

res <- VERB("GET", url = "https://api.sendsms.ro/json?action=blocklist_del&username=username&password=password&phonenumber=40727363767")

cat(content(res, 'text'))
require "uri"
require "net/http"

url = URI("https://api.sendsms.ro/json?action=blocklist_del&username=username&password=password&phonenumber=40727363767")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)

response = https.request(request)
puts response.read_body
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

var semaphore = DispatchSemaphore (value: 0)

var request = URLRequest(url: URL(string: "https://api.sendsms.ro/json?action=blocklist_del&username=username&password=password&phonenumber=40727363767")!,timeoutInterval: Double.infinity)
request.httpMethod = "GET"

let task = URLSession.shared.dataTask(with: request) { data, response, error in 
  guard let data = data else {
    print(String(describing: error))
    semaphore.signal()
    return
  }
  print(String(data: data, encoding: .utf8)!)
  semaphore.signal()
}

task.resume()
semaphore.wait()

Delete the given number from block list

The above command returns JSON structured like this:

{
   "status":0,
   "message":"OK"
}

HTTP Request

GET https://api.sendsms.ro/json?action=blocklist_del

Query Parameters

Parameter Type Description Required Default
username string Your log-in username true
password string Your log-in password or API Key true
phonenumber integer A phone number in E.164 Format but without the + sign (eg. 40727363767) true

Blocklist Check

  curl "https://api.sendsms.ro/json?action=blocklist_check&username=username&password=password&phonenumber=phonenumber"
<?php
require('sendsms_api.php');
$api = new SendsmsApi();

$api->setUsername('username');
$api->setPassword('password');

echo json_encode($api->blocklist_check('40727363767'));
<?php
$curl = curl_init();

curl_setopt($curl, CURLOPT_HEADER, 1);
$password = urlencode("password");
curl_setopt($curl, CURLOPT_URL, "https://api.sendsms.ro/json?action=blocklist_check&username=username&password=$password&phonenumber=40727363767");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLINFO_HEADER_OUT, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Connection: keep-alive"));

$result = curl_exec($curl);

$size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);

$result = substr($result, $size);

echo $result;
package com.sendsms;

public class Main {
    public static void main(String[] args) {
        Api sendsms = new Api("username", "password");
        sendsms.setDebugState(true);
        System.out.println(sendsms.blocklist_check(40727363767L));
    }
}
package com.sendsms;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

public class Main {
    public static void main(String[] args) throws IOException {
        String password = URLEncoder.encode("password", StandardCharsets.UTF_8);
        String urlString = "https://api.sendsms.ro/json?action=blocklist_check&username=username&password=" + password + "&phonenumber=40727363767";
        URL url = new URL(urlString);
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        con.setConnectTimeout(5000);
        con.setReadTimeout(5000);
        BufferedReader in = new BufferedReader(
                new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer content = new StringBuffer();
        while ((inputLine = in.readLine()) != null) {
            content.append(inputLine);
        }
        in.close();
        con.disconnect();
        System.out.println(content);
    }
}
<?php

use Illuminate\Support\Facades\Route;
use SendSMS\SendsmsLaravel\API\Blocklist;

Route::get('/', function () {
    $api = new Blocklist();
    $api->blocklist_check("40727363767");
    return view('welcome');
});
<?php
use SendSMS\API\Blocklist;

$api = new Blocklist();
$api->setUsername('username');
$api->setPassword('password');
$api->blocklist_check("40727363767");
var client = new RestClient("https://api.sendsms.ro/json?action=blocklist_check&username=username&password=password&phonenumber=40727363767");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
var request = http.Request('GET', Uri.parse('https://api.sendsms.ro/json?action=blocklist_check&username=username&password=password&phonenumber=40727363767'));


http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
  print(await response.stream.bytesToString());
}
else {
  print(response.reasonPhrase);
}
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := https://api.sendsms.ro/json?action=blocklist_check&username=username&password=password&phonenumber=40727363767"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
// WARNING: For GET requests, body is set to null by browsers.

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.sendsms.ro/json?action=blocklist_check&username=username&password=password&phonenumber=40727363767");

xhr.send();
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
  curl_easy_setopt(curl, CURLOPT_URL, "https://api.sendsms.ro/json?action=blocklist_check&username=username&password=password&phonenumber=40727363767");
  curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
  curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
  struct curl_slist *headers = NULL;
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'GET',
  'hostname': 'api.sendsms.ro',
  'path': '/json?action=blocklist_check&username=username&password=password&phonenumber=40727363767',
  'headers': {
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

req.end();
#import <Foundation/Foundation.h>

dispatch_semaphore_t sema = dispatch_semaphore_create(0);

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.sendsms.ro/json?action=blocklist_check&username=username&password=password&phonenumber=40727363767"]
  cachePolicy:NSURLRequestUseProtocolCachePolicy
  timeoutInterval:10.0];

[request setHTTPMethod:@"GET"];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
  if (error) {
    NSLog(@"%@", error);
    dispatch_semaphore_signal(sema);
  } else {
    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
    NSError *parseError = nil;
    NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
    NSLog(@"%@",responseDictionary);
    dispatch_semaphore_signal(sema);
  }
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
open Lwt
open Cohttp
open Cohttp_lwt_unix

let reqBody = 
  let uri = Uri.of_string "https://api.sendsms.ro/json?action=blocklist_check&username=username&password=password&phonenumber=40727363767" in
  Client.call `GET uri >>= fun (_resp, body) ->
  body |> Cohttp_lwt.Body.to_string >|= fun body -> body

let () =
  let respBody = Lwt_main.run reqBody in
  print_endline (respBody)
$response = Invoke-RestMethod 'https://api.sendsms.ro/json?action=blocklist_check&username=username&password=password&phonenumber=40727363767' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
import http.client

conn = http.client.HTTPSConnection("api.sendsms.ro")
payload = ''
headers = {}
conn.request("GET", "/json?action=blocklist_check&username=username&password=password&phonenumber=40727363767", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
library(httr)

res <- VERB("GET", url = "https://api.sendsms.ro/json?action=blocklist_check&username=username&password=password&phonenumber=40727363767")

cat(content(res, 'text'))
require "uri"
require "net/http"

url = URI("https://api.sendsms.ro/json?action=blocklist_check&username=username&password=password&phonenumber=40727363767")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)

response = https.request(request)
puts response.read_body
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

var semaphore = DispatchSemaphore (value: 0)

var request = URLRequest(url: URL(string: "https://api.sendsms.ro/json?action=blocklist_check&username=username&password=password&phonenumber=40727363767")!,timeoutInterval: Double.infinity)
request.httpMethod = "GET"

let task = URLSession.shared.dataTask(with: request) { data, response, error in 
  guard let data = data else {
    print(String(describing: error))
    semaphore.signal()
    return
  }
  print(String(data: data, encoding: .utf8)!)
  semaphore.signal()
}

task.resume()
semaphore.wait()

Check if the given number is in block list

The above command returns JSON structured like this:

-- If not present --
{
   "status":0,
   "message":"OK"
}
-- If present --
{
   "status":-512,
   "message":"Duplicate Record"
}

HTTP Request

GET https://api.sendsms.ro/json?action=blocklist_check

Query Parameters

Parameter Type Description Required Default
username string Your log-in username true
password string Your log-in password or API Key true
phonenumber integer A phone number in E.164 Format but without the + sign (eg. 40727363767) true

Blocklist Get

  curl "https://api.sendsms.ro/json?action=blocklist_get&username=username&password=password"
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.sendsms.ro/json?action=blocklist_get&username=username&password=password',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Get block list

The above command returns JSON structured like this:

{
    "status": 0,
    "message": "OK",
    "details": [
        {
            "id": "1192544",
            "phonenumber": "0777777777",
            "created": "2022-07-26 10:21:24"
        }
    ],
    "run_time": 0.0216
}

HTTP Request

GET https://api.sendsms.ro/json?action=blocklist_get

Query Parameters

Parameter Type Description Required Default
username string Your log-in username true
password string Your log-in password or API Key true

HLR

HLR Perform

  curl "https://api.sendsms.ro/json?action=hlr_perform&username=username&password=password&number=number&report_url=report_url"
<?php
require('sendsms_api.php');
$api = new SendsmsApi();

$api->setUsername('username');
$api->setPassword('password');

echo json_encode($api->hlr_perform('40727363767', 'https://yourserver.com/report.php'));
<?php
$curl = curl_init();

curl_setopt($curl, CURLOPT_HEADER, 1);
$password = urlencode("password");
$return_url = urlencode("https://yourserver.com/report.php");
curl_setopt($curl, CURLOPT_URL, "https://api.sendsms.ro/json?action=hlr_perform&username=username&password=$password&number=40727363767&report_url=$report_url");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLINFO_HEADER_OUT, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Connection: keep-alive"));

$result = curl_exec($curl);

$size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);

$result = substr($result, $size);

echo $result;
package com.sendsms;

public class Main {
    public static void main(String[] args) {
        Api sendsms = new Api("username", "password");
        sendsms.setDebugState(true);
        System.out.println(sendsms.hlr_perform("40727363767" , "https://yourserver.com/report.php"));
    }
}
package com.sendsms;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

public class Main {
    public static void main(String[] args) throws IOException {
        String password = URLEncoder.encode("password", StandardCharsets.UTF_8);
        String return_url = URLEncoder.encode("https://yourserver.com/report.php", StandardCharsets.UTF_8);
        String urlString = "https://api.sendsms.ro/json?action=hlr_perform&username=username&password=" + password + "&number=40727363767&report_url=" + report_url;
        URL url = new URL(urlString);
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        con.setConnectTimeout(5000);
        con.setReadTimeout(5000);
        BufferedReader in = new BufferedReader(
                new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer content = new StringBuffer();
        while ((inputLine = in.readLine()) != null) {
            content.append(inputLine);
        }
        in.close();
        con.disconnect();
        System.out.println(content);
    }
}
<?php

use Illuminate\Support\Facades\Route;
use SendSMS\SendsmsLaravel\API\HLR;

Route::get('/', function () {
    $api = new HLR();
    $api->hlr_perform('40727363767', 'https://yourserver.com/report.php');
    return view('welcome');
});
<?php
use SendSMS\API\HLR;

$api = new HLR();
$api->setUsername('username');
$api->setPassword('password');
$api->hlr_perform('40727363767', 'https://yourserver.com/report.php');
var client = new RestClient("https://api.sendsms.ro/json?action=hlr_perform&username=username&password=password&number=40727363767&report_url=report_url");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
var request = http.Request('GET', Uri.parse('https://api.sendsms.ro/json?action=hlr_perform&username=username&password=password&number=40727363767&report_url=report_url'));


http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
  print(await response.stream.bytesToString());
}
else {
  print(response.reasonPhrase);
}
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := https://api.sendsms.ro/json?action=hlr_perform&username=username&password=password&number=40727363767&report_url=report_url"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
// WARNING: For GET requests, body is set to null by browsers.

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.sendsms.ro/json?action=hlr_perform&username=username&password=password&number=40727363767&report_url=report_url");

xhr.send();
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
  curl_easy_setopt(curl, CURLOPT_URL, "https://api.sendsms.ro/json?action=hlr_perform&username=username&password=password&number=40727363767&report_url=report_url");
  curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
  curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
  struct curl_slist *headers = NULL;
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'GET',
  'hostname': 'api.sendsms.ro',
  'path': '/json?action=hlr_perform&username=username&password=password&number=40727363767&report_url=report_url',
  'headers': {
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

req.end();
#import <Foundation/Foundation.h>

dispatch_semaphore_t sema = dispatch_semaphore_create(0);

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.sendsms.ro/json?action=hlr_perform&username=username&password=password&number=40727363767&report_url=report_url"]
  cachePolicy:NSURLRequestUseProtocolCachePolicy
  timeoutInterval:10.0];

[request setHTTPMethod:@"GET"];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
  if (error) {
    NSLog(@"%@", error);
    dispatch_semaphore_signal(sema);
  } else {
    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
    NSError *parseError = nil;
    NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
    NSLog(@"%@",responseDictionary);
    dispatch_semaphore_signal(sema);
  }
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
open Lwt
open Cohttp
open Cohttp_lwt_unix

let reqBody = 
  let uri = Uri.of_string "https://api.sendsms.ro/json?action=hlr_perform&username=username&password=password&number=40727363767&report_url=report_url" in
  Client.call `GET uri >>= fun (_resp, body) ->
  body |> Cohttp_lwt.Body.to_string >|= fun body -> body

let () =
  let respBody = Lwt_main.run reqBody in
  print_endline (respBody)
$response = Invoke-RestMethod 'https://api.sendsms.ro/json?action=hlr_perform&username=username&password=password&number=40727363767&report_url=report_url' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
import http.client

conn =