What is Swagger for Web API?

Swagger is a simple yet powerful representation of your RESTful API. With the largest ecosystem of API tooling on the planet, thousands of developers are supporting Swagger in almost every modern programming language and deployment environment. With a Swagger-enabled API, you get interactive documentation, client SDK generation and discoverability.

We created Swagger to help fulfill the promise of APIs. Swagger helps companies like Apigee, Getty Images, Intuit, LivingSocial, McKesson, Microsoft, Morningstar, and PayPal build the best possible services with RESTful APIs.

Now in version 2.0, Swagger is more enabling than ever. And it’s 100% open source software.

Demo Site:



Reference: http://swagger.io/

Host a Workflow Service with Windows Server App Fabric

Hosting workflow services in App Fabric is similar to hosting under IIS/WAS. The only difference is the tools App Fabric provides for deploying, monitoring, and managing workflow services. This topic uses the workflow service created in the Creating a Long-running Workflow Service. That topic will walk you through creating a workflow service. This topic will explain how to host the workflow service using App Fabric. For more information about Windows Server App Fabric, see Windows Server App Fabric Documentation. Before completing the steps below make sure you have Windows Server App Fabric installed. To do this open up Internet Information Services (inetmgr.exe), click your server name in the Connections view, click Sites, and click Default Web Site. In the right-hand side of the screen you should see a section called App Fabric. If you don’t see this section (it will be on the top of the right-hand pane) you do not have App Fabric installed. For more information about installing Windows Server App Fabric seeInstalling Windows Server App Fabric.

Creating a Simple Workflow Service

  1. Open Visual Studio 2012 and load the OrderProcessing solution you created in the Creating a Long-running Workflow Service topic.

  2. Right click the OrderService project and select Properties and select the Web tab.

  3. In the Start Action section of the property page select Specific Page and type Service1.xamlx in the edit box.

  4. In the Servers section of the property page select Use Local IIS Web Server and type in the following URL: http://localhost/OrderService.

  5. Click the Create Virtual Directory button. This will create a new virtual directory and set up the project to copy the needed files to the virtual directory when the project is built. Alternatively you could manually copy the .xamlx, the web.config, and any needed DLLs to the virtual directory.

Configuring a Workflow Service Hosted in Windows Server App Fabric

  1. Open Internet Information Services Manager (inetmgr.exe).

  2. Navigate to the OrderService virtual directory in the Connections pane.

  3. Right click OrderService and select Manage WCF and WF ServicesConfigure…. The Configure WCF and WF for Application dialog box is displayed.

  4. Select the General tab to display general information about the application as shown in the following screen shot.

    General tab of the App Fabric Configuration dialog

  5. Select the Monitoring tab. This shows various monitoring settings as shown in the following screen shot.

    App Fabric Configuration Monitoring tab

    For more information about configuring workflow service monitoring in App Fabric see Configuring monitoring with App Fabric.

  6. Select the Workflow Persistence tab. This allows you to configure your application to use App Fabric’s default persistence provider as shown in the following screen shot.

    App Fabric Configuration - Persistence

    For more information about configuring workflow persistence in Windows Server App Fabric see Configuring Workflow Persistence in App Fabric.

  7. Select the Workflow Host Management tab. This allows you to specify when idle workflow service instances should be unloaded and persisted as shown in the following screen shot.

    App Fabric Configuration  Workflow Host Management

    For more information about workflow host management configuration see Configuring Workflow Host Management in App Fabric.

  8. Select the Auto-Start tab. This allows you to specify auto-start settings for the workflow services in the application as shown in the following screen shot.

    App Fabric Auto-start configuration

    For more information about configuring Auto-Start see Configuring Auto-Start with App Fabric.

  9. Select the Throttling tab. This allows you to configure throttling settings for the workflow service as shown in the following screen shot.

    App Fabric configuration throttling

    For more information about configuring throttling see Configuring Throttling with App Fabric.

  10. Select the Security tab. This allows you to configure security settings for the application as shown in the following screen shot.

    App Fabric Security Configuration

    For more information about configuring security with Windows Server App Fabric see Configuring Security with App Fabric.

Using Windows Server App Fabric

  1. Build the solution to copy the necessary files to the virtual directory.

  2. Right click the OrderClient project and select DebugStart New Instance to launch the client application.

  3. The client will run and Visual Studio will display an Attach Security Warning dialog box, click the Don’t Attach button. This tells Visual Studio to not attach to the IIS process for debugging.

  4. The client application will immediately call the Workflow service and then wait. The workflow service will go idle and be persisted. You can verify this by starting Internet Information Services (inetmgr.exe), navigating to the OrderService in the Connections pane and selecting it. Next, click the App Fabric Dashboard icon in the right-hand pane. Under Persisted WF Instances you will see there is one persisted workflow service instance as shown in the following screen shot.

    App Fabric Dashboard

    The WF Instance History lists information about the workflow service such as the number of workflow service activations, the number of workflow service instance completions, and the number of workflow instances with failures. Under Active or Idle instances a link will be displayed, clicking on the link will display more information about the idle workflow instances as shown in the following screen shot.

    Persisted Workflow Instance Details

    For more information about Windows Server App Fabric features and how to use them see Windows Server App Fabric Hosting Features

Reference: http://msdn.microsoft.com/en-us/library/ff729689(v=vs.110).aspx

Introducing the Architecture REST – Creating APIs – Part 02

In this post, we continue talking about the REST architecture and our progress to create our first API.  This is the second part of the series, if you want to see the Introduction, please check this link.
The SOA Principles 

The REST is also considered a Service-Oriented Architecture (SOA) , so it the SOA principles must be considered. The REST architecture follows the interoperability by providing support for several types of response. It is a good practice to make your resource accept HTML, JSON or XML in the same method, turning it more portable.  Depending of the target of your application, the number of clients of your services can be bigger in this way. However, providing all those types of response consumes time, and you have to analyze if you are available for working on this interoperability.
It is also important that your RESTful services don’t take overloaded operations. This includes heavy processing tasks such as data transformations (XML to JSON, XML to Text/Plain, etc.) as also the validation of the data before each transformation.  This results in the other principle of SOA the weak coupling, that is, make your system less dependent of other modules in order to reduce the modification effects and failure tailoring.  Generally the simple RESTful services systems are divided in the following packages:
  • resources –  The resources of your system which implement the HTTP methods POST, GET, PUT, DELETE. For each request received, it uses the modules of the utils package and the communication provided with dao, if necessary. The resources also have the task of interpret the result , possible failures and response to the client.
  • utils – The utility classes as also related to data transformation.
  • dao –  The classes with the pattern DAO (Data Access Object), responsible for the database transactions

Introducing the Architecture REST – Creating APIs – Part 01

In this new series of posts I will talk about a architecture style widely used in web services for distributing simultaneously hypermedia content such as texts, images, videos, etc. The style is called REST (REpresentational State Transfer) where the term RESTful refers to the systems which follow the REST principles.Introduction

Currently, companies like Yahoo, Amazon among others, are deeply using this technology, which became quite popular. One of the reasons to this success is the fact that you can easily create a client that uses the Amazon services or even access your Twitter Account by a simple application.
Imagine if you have a web service or a social network and you want developers all around the planet to develop applications that communicate with your web service and use your data to develop new awesome ideas. By using REST architecture you can easily develop and deploy APIs for giving access to your data to outside applications, delivering new functionalities to the web community via an open API.
In this article and the next ones I will show a simple API that I developed and how I used the principles REST (HTTP response codes, methods, cache, cookies, security, tests) to implement it. The examples of codes presented here are using the library Python and the framework for Web Django.