Rogers Catalyst

 
null
4
Mar
2011
 

Be RESTful with curl PART-2

Posted by Vishal
 

About This Blog

“Be RESTful with curl" series of blog posts are my chronicles of leraning about Rogers Catalyst APIs. These will be particularly useful for you if you are taking a first stab at the APIs. In this post I will use the SMS RESTful API to send a text message to a mobile phone from my dev virtual machine. 

Rogers Catalyst SMS Service

The SMS API allows your app to send and receive SMS messages on all Rogers and Fido network. You can use the SMS API to:  

1) Send SMS to a Rogers (or Fido) mobile phone & Receive Notification of SMS delivery Status

2) Receive SMS Messages from Rogers (or Fido) mobile phones to your app

Rogers Catalyst CLI (rc-cmd)

I have developed a bash script that uses curl to interact with Rogers Catalyst RESTful web-services APIs. You can use this script to get started with Rogers Catalyst, to validate your environment and to get up to speed with the APIs.

Sign up for a Free Account

Sign up for your free account at www.rogerscatalyst .com and set up your project.  Refer to my earlier blog post for more details on setting up your account here 

Set up your Development Environment

I am using Lucid Lynx (Ubuntu 10.4 LTS Desktop) for my development environment, although this tutorial will work on Snow Leopard or any *nix distribution with latest version of curl and git. On your Ubuntu dev machine, open "Terminal" and run apt-get to install curl and git-core

sudo apt-get install curl git-core


Download and Install Rogers Catalyst CLI

Open Terminal and run the following commands

git clone git://github.com/rogers-catalyst/rogers-catalyst-cli.git rogers-catalyst-cli

cd ./rogers-catalyst-cli

chmod 744 rc-cmd


Set up your Authentication Credentials

Store your Rogers Catalyst Project credentials in environment variables 

echo 'export RC_USER_NAME="your project user name"' | tee -a ~/.bashrc

echo 'export RC_USER_PASSWORD="your password"' | tee -a ~/.bashrc

Quit Terminal and start it again. Make sure environment varaibles are set

echo $RC_USER_NAME:$RC_USER_PASSWORD

 

Send SMS to a Mobile Phone

Run rc-cmd from rogers-catalyst-cli directory

/rc-cmd --api sendsms \

                 --phone-number 16472411234  \

                 --sms-message "Hello There"

 

You will see a response similar to:

HTTP/1.1 201 Created

Date: Fri, 04 Mar 2011 21:06:27 GMT

Server: Jetty(6.1.x)

Content-Type: application/xml

Content-Length: 91

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><SmsResponse messageId="305322387"/>

Note: Make sure to use a mobile phone (e.g. 16472411234) that has been configured in your Rogers Catalyst Project Customer Telephone Number whitelist.

Sending SMS from your app is as simple as that. For more examples of using Rogers Catalyst Location, Privacy, User Profile and SMS APIs click here. In the next post in this series I will show how to use the SMS SPI to receive SMS messages.

Stay tuned and follow me on twitter here 

 
 

Comments

Please login or register to comment on this post.

Twitter

Off The Blog