Message-ID: <18954800.15717.1614957800911.JavaMail.confluence@wiki> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_15716_1445541710.1614957800911" ------=_Part_15716_1445541710.1614957800911 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html The Java wrapper library

The Java wrapper library

=20
=20
=20
=20
=20
=20
=20
=20
=20
=20

To send an SMS with our Java wrapper, download and unzip the wrapper fro= m here, t= hen copy the TMRestClient.jar file into your CLASSPATH or added as = a command-line option in your java virtual machine e.g: 

=20

java -classpath /usr/java/library= /TMRestClient.jar

=20
=20
=20
=20
=20
=20
=20

Now put the following code somewhere in a Java file and execute it to se= nd an SMS =E2=80=93 don't forget to substitute your own API username and pa= ssword and a real mobile number to send to!

=20
=20
=20
=20
=20
=20
Example
=20
import java.util.Map;
import uk.co.textmarketer.RestAPI.*;
import uk.co.textmarketer.RestAPI.RestClientException;
public class SendSMS {
=09public static void main(String[] args) {
=09=09RestClient tmClient;
=09=09tmClient =3D new RestClient("myAPIusername", "myAPIpas=
sword", RestClient.ENV_PRODUCTION);
=09=09try {
=09=09=09Hashtable<String, String> result;
=09=09=09result =3D tmClient.sendSMS("My message", "44700000=
0000", "Sender", 72, "", "", null);
=09=09=09System.out.println("Message sent with ID " + result.get(=
"message_id"));
=09=09} catch(RestClientException e) {
=09=09=09Hashtable<String, String> errors =3D tmClient.getLastErrors(=
);
=09=09=09for(Map.Entry<String, String> error: errors.entrySet())
=09=09=09=09System.out.println("Error code " + error.getKey() + &=
quot;: " + error.getValue());
=09=09}
=09}
}
=20
=20
=20
=20
=20
=20 =20
=20
=20
=20

 

=20
=20
=20
=20

 

=20
=20
=20
=20
=20
=20
=20

You can find your API username and password (which may be different to y= our web interface username/password) via your account: https://messagebox.textmarketer.co.uk/#!accountsettings/=


If you don't have an account, you can set one up for free at www.textmarketer.co.uk.

=20
=20
=20

You must know!

=20 =20

Our example code is an illustra= tion of how you might integrate with our systems and is not certified for p= roduction environments. You are responsible for testing and QA.


=20
=20
=20
=20
=20 =20
------=_Part_15716_1445541710.1614957800911--