Restful Web Services

Sample Web Service #1: List Of Presidents

The technology used in creating this web service is as follows:

  • Visual Studio 2017
  • C#
  • Web API - Restful service restricted to return data. Does not allow updating. This restriction was necessary to protect the database table content.
  • SQL Server 2014
  • Entity Framework 6
About The Return Data

The data returned from the web service is in JASON format. Some browsers may automatically format JASON data into a easy to view format like the Opera Browser. However, several will not without an extenstion. I have used a Chrome browser extenstion called JSONView. Below is an example of what JSON data looks like when using the JSONView extension for Chrome:

You can also simply copy the returned JSON data and paste it into the online web tool called JSON formatter followed by selecting the XML option.

Test Number

1

Data Returned

List of U.S. Presidents from first to 45th

How To Test

The easiest way to obtain the presidential list without writing a program is to simply use a web browser of your choice and entering the following URL into your browser or clicking the link:
http://robertmarquez.com/restservices/api/presidents

Test Number

2

Data Returned

A single U.S. President matching the number of the president in office you specify.

How To Test

Append the number of the U.S. President you want to view as the last parameter after the word "presidents". Note the below example where the 16th president is retrieved by appending the numbe 16 at the end of the url preceded by a forward slash:
http://robertmarquez.com/restservices/api/presidents/16