Skip to content

Adds Rest-style api to a Jobbr-Server and a strong typed .NET Client

License

Notifications You must be signed in to change notification settings

jobbrIO/jobbr-webapi

Repository files navigation

Jobbr Web API Extension Develop build status

Adds Rest-style api to a Jobbr-Server and and provides a strong typed .NET Client for the Jobbr .NET JobServer. The Jobbr main repository can be found on JobbrIO/jobbr-server.

Master build status NuGet-Stable
Develop build status NuGet Pre-Release

Installation

First of all you'll need a working jobserver by using the usual builder as shown in the demos (jobbrIO/demo).

NuGet

Install the NuGet Jobbr.Server.WebAPI to the project where you host you Jobbr-Server. The extension already comes with a small webserver based on OWIN/Katana. The referenced HttpListenr will be installed by NuGet automatically.

Install-Package Jobbr.Server.WebAPI

Registration

The Library comes with an extension method for the JobbrBuilder. To add the Web API to a Jobbr-Server you need to register it prior start as you see below. Please note that this is not ASP.NET WebAPI when registering it to an OWIN Pipeline, allthough we're using the same principle. (In fact, we're using WebAPI internally 😄 )

using Jobbr.Server.WebAPI;

// ....

// Create a new builder which helps to setup your JobbrServer
var builder = new JobbrBuilder();

// Register the extension
builder.AddWebApi();

// Create a new instance of the JobbrServer
var server = builder.Create();

// Start
server.Start();

Configuration

If you don't specify any value for BackendAddress the server will try to find a free port automatically and binds to all available interfaces. The endpoint is logged and usually shown in the console, but this approach is not suggested in production scenarios, see below:

[WARN]  (Jobbr.Server.WebAPI.Core.WebHost) There was no BackendAdress specified. Falling back to random port, which is not guaranteed to work in production scenarios
....
[INFO]  (Jobbr.Server.JobbrServer) The configuration was validated and seems ok. Final configuration below:
JobbrWebApiConfiguration = [BackendAddress: "http://localhost:1903/api"]

You can override this behavior, by explicitly providing your own URI prefix, for instance http://localhost:8765/api. See example below:

builder.AddWebApi(config => 
{
	config.BaseUrl = "http://localhost:8765/api";
});

Note: Please refer to https://msdn.microsoft.com/en-us/library/system.net.httplistener(v=vs.110).aspx for the supported URI prefixes depending on your operating system and .NET Runtime version.

Please note that the API documentation has moved to jobbr.readthedocs.io

Static Typed Client

There is also a static typed client available which you can use to interact with any Jobbr Rest Api. Please see the documentation on jobbr.readthedocs.io for more details

License

This software is licenced under GPLv3. See LICENSE and the related licences of 3rd party libraries below.

Acknowledgements

Jobbr Server is based on the following awesome libraries:

Credits

This extension was built by the following awesome developers:

About

Adds Rest-style api to a Jobbr-Server and a strong typed .NET Client

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages