The web interface of Seq connects to the server via a simple API using JSON/HTTP. (I’d call it REST, but it’s not fully IEEE 1337.00 REST-1.1 compliant ;-))

Quite a few customers integrate with the API, either for querying events or for automating administrative tasks like adding users, creating/modifying queries and views, etc.

Though it’s possible to just jump right in using JSON, it’s a pain to figure out the dynamic structure of the entities that are sent and received and hand-code C# types that serialize appropriately using JSON.NET.

To fix this, we just published the entire set of Seq API types, as well as higher-level wrappers, to the new seq-api project on GitHub and published via NuGet:

Install-Package Seq.Api

You can use the package to connect and work with items from your Seq instance:

var connection = new SeqConnection("http://my-seq/prd");

var views = await connection.Views.ListAsync();
foreach (var view in views)
{
    Console.WriteLine(view.Title);
}

Things should be pretty self-explanatory - just dot your way through the properties on SeqConnection to find your way around.

As a brand new project we fully expect some rough edges in there, for example you may need to upgrade to Seq 1.6.7 in order for some features to work. You can already do some interesting things with it though!

The seq-tail.exe app that’s included as a sample in the repository implements something like the Unix tail for logs from your remote Seq server.

seq-tail

Syntax is:

seq-tail.exe  [--filter=] [--apikey=] [--window=]

(Nerdy note - if you haven’t seen docopt.net in action before, check out how the command-line parsing in the example works.)

Now that the API is published I’m looking forward to actively improving it - it’s crying out for some Rx love, for starters. If you crank it up I’d love to hear about your experiences.