NetConsole.WebApi is a package that it provides a way to access commands by using a sort of RPC-like API interaction.
Though it is possible to use this package as standalone web api, it is designed to be used better as part of another Web API or MVC project.
The API offers command metadata for each command that can be reached. The metadata is about:
- Number of actions available for a given command.
- Command overview (inherited from the command definition).
- Command name (inherited from the command definition).
- For each action it provides the following information:
- Action name
- Return type
- Parameter types
To register the API as part of another application, just do:
NetConsole.WebApi.WebApiConfig.Register(config); // HttpConfiguration config
Usually in Global.asax's Application_Start method or in WebApiConfig's Register method.
Once the API is running on a server the following urls will accessible from clients:
- api/commands
// Return an array of commands object with all their public properties
- api/commands/meta
// Return an array of command metadata
- api/commands/{commandName}
// Return a single command whose name is commandName
- api/commands/{commandName}/meta
// Return command metadata for the command whose name is commandName
- api/commands/perform
// Read the message body and perform the operation stated within.
Install the latest version from NuGet.
In lieu of a formal style guide, please take care to follow the existing code style. Add unit tests for any new or changed functionality. Use FAKE and paket to handle automation and dependencies management.
Checks Release Notes to see the changes history.