Implementation Details

Once the application is generated you will see additional folders and files specific to the RESTful application.

 

App_Start

Filters

Handlers

Controllers

Web.config settings

Bin Directory

App_Start

This folder includes WebAPIConfig.cs(vb) file. This file registers handlers, different route patterns and other configuration settings required by the Restful API:

Config.Routes.MapHttpRout (RoutesPattern): Calls proper method such as PostGetList, PostGetCount, etc. based on the incoming request’s URL form.

Config.EnableCors(): Registers the Cross Origin Request  (CORS) library which allows to accept requests from different domains.

Config.MessageHandler(Handler): Registers custom handler to check for incoming request authentication. For example APIKeyHandler is registered to provide Private/Public keys authentication while RequireHTTPS handler is registered to enforce HTTPS protocol.

According to best practices it is recommended that your application use HTTPS protocol.

Filters

Filters can be added to specific methods, for example RequireHTTPS filter enforce HTTPS protocol for the specific method.

Handlers

Handlers are similar to Filters, but it puts restriction on the whole application.

Controllers

Iron Speed Designer generates a controller class for each table plus a CommonRestful class for third party applications. These classes implement methods to handle incoming requests.

Web.config settings

There are 6 different keys inside this file which plays vital role for Restful application to work correctly.

Key

Description

RestfulEnabled

Enables RESTful API.

RestfulHost

Specifies the URL of the Restful API provider and is used for constructing request URI.

Note: It is set by Deployment Wizard and empty before Deployment Wizard is run.

RestfulEnforcePublicPrivateKey

Enables  Public and Private Key authentication.

RestfulEnforceEncryption

Enables payload encryption using Crypto class.

RestfulPublicKey and RestfulPrivateKey

These keys are generated out of the box using 32 bit Cryptography. These are used by out of the box consumer and provider application, changing these key values could result in unauthorized request.

They are set by the Application Wizard and Deployment Wizard

Bin Directory

Following are the DLLs copied for the Restful application

Newtonsoft.Json.dll

System.Data.SqlServerCe.dll

System.Net.Http.dll

System.Net.Http.Formatting.dll

System.Web.Cors.dll

System.Web.Http.Cors.dll

System.Web.Http.dll

System.Web.Http.WebHost.dll

See Also

Creating RESTful Applications

Deployment

Troubleshooting

Third Party Application

Implementation Details