Geeks With Blogs
Buhay Programmer Dont byte more than you can chew

Introduction

REST services has been steadily gaining popularity over the past years.  While SOAP web services are still being used, (and will not go away), it is no longer the preferred method of providing an online API (application programming interface) to web sites and/or services.  Google for example have stopped supporting their SOAP-based API and is almost exclusively using REST based services. Several companies like , especially startups (or previous startups) such as Reddit, Imgur only provide REST APIs

With this tutorial I'd like to show you how easy it is to test REST services using a tool called WCFStorm.REST. With just 2 clicks you can already start interacting with your service


Before we begin

WCFStorm.REST can be downloaded here at http://www.wcfstorm.com, or directly from here.  If you go into the web site, you probably noticed that WCFStorm.REST is a commercial tool.  But don't worry a LITE version of it is available for free and has enough features especially for developers who just needs to simply call REST services.  The FULL version is aimed mainly at Software Testers who needs to prepare test cases, compare actual and expected responses, etc.   

So now go download WCFStorm.Rest.  The first time you run it, it will open in 15-day trial mode.  That is OK.  After the trial period is over it will convert to LITE mode and you'll still be able to use the tool.    

Note:  You can use discount code RESTPROMO to get a 30% off on WcfStorm.Rest

In order to get the content of the programming subreddit, we need to use this url, http://www.reddit.com/r/programming.json.  Notice that it ends with ".json"?  That's because that URL returns JSON.  If you want to get back an XML instead, just change the ".json" to ".xml"

Reddit's full API is described here http://www.reddit.com/dev/api  


Let's get started

Assuming, you've already downloaded the tool,  go double click on WcfStorm.Rest.exe to open it up.   You'll get the screen below.  It's a welcome screen.  It shows you the operations/functionalities of the tool.



Click #1 : Click on the QuickTest Tab

Or you can also click on the "Test" tile.  It doesn't matter you will still get the window below.  Enter the text "http://www.reddit.com/r/programming.json" on the url textbox.  Reddit expects an HTTP GET request on that URL, so leave the "Verb" dropdown list unchanged. By default, the it should have the "GET" option selected.


Click #2: Click the Send button. Done.

Click the send button (the one with the Green Play icon) to send the HTTP GET request to reddit's service.  Wait a second or two and if all goes well you'll get back the response below.  The HTTP headers are displayed on the upper right while the response body is shown below it.  Notice that the JSON response has syntax highlighting ( a nice little touch, if I may say so)

 

So there you go.  All it took was 2 clicks.  And finally, as the JSON response says, the top submission is about a security vulnerability in internet explorer, titled "Any page loaded in IE can track your mouse movements, anywhere, any time",".  Not a very comforting thought.


Points to consider

WcfStorm.Rest runs on .NET 4.0 so you need to install the 4.0 framework if you want to use this tool.  If you only have .NET 4.5, you have to delete WcfStorm.Rest.exe.config so that it will run, otherwise it will crash.  For some reason the config points to the 4.0 Fsharp assemblies.  Deleting the config file, forces it to use the 4.5 assemblies.

Posted on Thursday, December 13, 2012 8:55 PM | Back to top


Comments on this post: Easy Testing of REST Services with WcfStorm.Rest

No comments posted yet.
Your comment:
 (will show your gravatar)
 


Copyright © Erik Araojo | Powered by: GeeksWithBlogs.net | Join free