ServiceStack – Testing services with Chrome REST Console

My favourite tool for testing RESTful services is the Chrome plugin, “REST Console”. Since ServiceStack is an ideal framework to build REST APIs, REST Console is an excellent tool to accompany ServiceStack. Let’s see how to use free Chrome REST Console tool to test a service. For this demonstration, I am going to use the simple Flight Service that I created previously.

First and foremost, we must install REST Console into Chrome browser. If you don’t have Chrome browser installed in your computer please download it from Google and install it first. Visit www.google.com using Chrome browser and search for “Chrome Web Store” and click on the relevant link to visit Chrome Web Store.

Now search for “REST Console” in Chrome Web Store and hit on the +FREE button to install it into the browser.

ChromeWebStore

Now you’ll notice that REST Console is available in your Chrome Apps.

ChromeApps

Click on the application icon to launch REST Console. You should now see something similar to the following.

RESTConsole

Now, let’s launch the Flight Service that we have created during the previous demonstration.

FlightService

In this example let’s try to replicate the JSON request through REST Console and see how it works. So, click on the JSON link on the Operations section to view the details that we need to perform a service call to our Flight Service via REST Console.

JSONConfig

In order to generate the service URL of the service, we’ll have to combine the base address (http://localhost:63808) with the default service URL (/json/oneway/FlightRequest) so, the complete URL becomes the following.

http://localhost:63808/json/oneway/FlightRequest
 
Please note that the port number of the base address (happen to be 63808 in my local environment) could be a different one if you run this demonstration in your local environment. So, make sure that you replace 63808 with your local port number.

Specify the service URL in the Request URI box.

TargetRequestURI

Next, enable the content-type by clicking on the checkbox and then, specify application/json request type.

ContenyType

Finally, we should specify our request payload in JSON format.

RequestPayLoad

Now, we may go ahead and click on the POST button. This will cause REST Console to invoke our Flight Service with supplied request payload and, the resulting response should be observable in the response section.

Response

As we have expected, Arrival and Departure fields are populated from the request that we sent and, values for other properties are also populated. Don’t’ worry about the ArrivalTime and DepartureTime values as those values are encoded in JASON format which is not very readable.

Advertisements

About Dilan Perera

I am a Microsoft .NET evangelist (C#) with more than 8 years of hands on experience in software engineering. I have a Bachelor of Engineering degree and a number of certifications including MCPD, MCTS, MCDBA, MCSD, MCAD, and MCP.
This entry was posted in ServiceStack and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s