MSpace Bulk SMS Service API Documentation


This page illustrates how you, a developer, a technical personnel or any form of our esteemed client can use our bulk SMS services with ease without necessarily logging into our web application. After this illustration you will be able to send texts, query SMS account balance and list your sub- account users in the system. This documentation assumes that you have subscribed for our bulk SMS services. If not please visit our website ‘www.mspace.co.ke’ or contact our offices to be assisted and be able to enjoy our services.






OverView of the API


Content


  1. Query SMS balance
  2. Send Text
  3. Query sub-account users

Overview


This is the get balance url = “ http://api.mspace.co.ke/mspaceservice/wr/sms/balance /username={username}/password={pass word}”, where username is the value of your username and password the value of your password.

Example:


http://api.mspace.co.ke/mspaceservice/wr/sms/balance /username=myusername/password=mypassword

You can test this by pasting in your browser and press enter.

Response:


“your sms balance e.g. ‘50’” if you are a subscribed user or “Error 100: Authentication Failure” if your credentials are wrong.

NOTE that your URL format should support URL encoding UTF- 8 . Messages that are not properly formatted may be delivered with incorrectly encoded text or not delivered at all.

The request methods are summarized in the table below:

main_url = http://api.mspace.co.ke/mspaceservice/wr/sms/

Method Url Structure Url example Response on success Response on failure
Query SMS Balance main_url +
balance/username=
{username}/password=
{password}
http://api.mspace.co.ke
/mspaceservice/wr
/sms/balance/
username=myusername/
password=mypassword
Your current SMS balance e.g. “50”. Authentication failure for wrong user credentials
or non-existing user.

Internal service error if there’s any.
Send Text main_url
+sendtext/username=
{username}/password
={password}/senderid
={senderId}/recipient
={recipient}/message
={message}
http://api.mspace.co.ke
/mspaceservice/wr
/sms/sendtext/username
=myusername/password
=mypassword/senderid
=mysenderid/recipient
=myrecipient/message
=mymessage
>
Send action status and the sent message id i.e.
“[{"messageId":"12345","responseTime":"2018-06-25
11:12:19:793","status":"successful"}]”
Athentication failure,
Insufficient Balance,
Invalid sender ID or
internal service error.
Query sub-account users main_url +
subusers/username
={username}/password
={password}
http://api.mspace.co.ke
/mspaceservice/wr
/sms/subusers/username
=myusername/password
=mypassword
The username of your sub-account users
and their SMS balances respectively i.e.
“[{"smsBalance":"20","subUserName":"subuser1"},
{"smsBalance":"18","subUserName":"subuser2"}]”
“[]” if no subuser exists.
Authentication failure.

DEVELOPERS


The following are examples of mspaceservice SMS client Java, python, PHP and VB.NET developers respectively. Note that more examples for various development languages e.g. C#, Ruby and JavaScript are yet to be released.

NOTE that your application should support URL encoding of your requests. Messages that are not properly formatted may be delivered with incorrectly encoded text or not delivered at all



Java Client


Java developers can be emailed or obtain the java client API jar file bundled with dependencies here and add into the class-path of their project. Having this jar file, your work will be made easier. The API contains all the request methods:

  1. sendMessage_JSON
  2. sendMessage_XML
  3. subUsers_XML
  4. subUsers_JSON
  5. getBalance
  6. close

sendMessage_ JSON

subUsers_JSON(Class responseType, String username, String password, String senderid, String recipient, String message);

Returns JSON object of the returned value by this method, example:


sendMessage_XML

subUsers_XML(Class responseType, String username, String password, String senderid, String recipient, String message);

Returns XML object of the returned value by this method, example:

subUsers_XML

subUsers_XML(Class responseType, String username, String password);

Returns XML object of the returned value by this method, example:


subUsers_JSON

subUsers_JSON(Class responseType, String username, String password);

Returns JSON object of the returned value by this method,

example:

getBalance

getBalance(String username, String password);

Returns PLAIN_TEXT object of the returned value by this method, example:


Closses the client instance.

To view your full request url, method type and request status by the API methods use Response class as the response type. Example:


Output:
InboundJaxrsResponse{ClientResponse{method=GET, uri=http://api.mspace.co.ke/mspaceservice/wr/sms/subusers/username=myusername/pas sword=mypassword, status=200, reason=OK}}



Python Client


The following methods are for python users.
main_api = "http://api.mspace.co.ke/mspaceservice/wr/sms/"

#get sub-account users

#get user balance

#send message



PHP Client


All methods Captured



VB.NET Client


Send Message





bulk sms scroll up