Skip to content
Ducksboard object implemented for use in your .NET projects
C#
Find file

README.md

Ducksboard API for .NET

This project contains objects specifically tied to the Ducksboard API, giving you the ability to update your Ducksboard dashboard from your .NET applications. The objects contained here can be used for both Push and Pull APIs. You can sign up for Ducksboard at http://www.ducksboard.com.

*** This project has a dependency on RestSharp ***

Gettings Started

Through Nuget (http://nuget.org):

PM > Install-Package Ducksboard

Somewhere in your code (Push API):

var dashboard = new DucksboardClient("** Your API Key Here **");
var response = dashboard.Update("**widget number**", new Numbers { Value = 3.5 });

Note: the response object will let you know if it was successful in updating. It is not worth looking at unless you are running into issues. I exposed it so you can debug issues more easily.

Supported Widgets

Widget Model Class
Counters Numbers
Gauges Gauges
Absolute Graphs Numbers
Absolute Area Graphs Numbers
Stacked Graphs Numbers
Relative Graphs Numbers
Relative Area Graphs Numbers
Bars Numbers
Boxes Numbers
Pins Numbers
Images Image
Status Status
Texts Text
Timelines Timeline
Leaderboards Leaderboard
Trend Leaderboards TreadLeaderboard
Status Leaderboards StatusLeaderboard
Funnels Funnel
Completion Completion

See http://dev.ducksboard.com/apidoc/slot-kinds/ for the list of widgets and their documentation.

Dashboard API

CRUD operations for Dashboards and widgets have been implemented in the dashboard api.

Example usage :

var dashboardClient = new DashboardClient("** Your API Key Here **");
var dashboard = new Dashboard()
            {
                Name = dashboardName,
                Background = "dark wood",
            };

dashboard = dashboardClient.Create(dashboard);

var leaderboard = client.Create(new Widget()
            {
                WidgetProperties = new WidgetProperties()
                {
                    Dashboard = dashboard.Slug,
                    Kind = "custom_textual_status_leaderboard",
                    Sound = true,
                    Title = "My Leaderboard",
                    Width = 1,
                    Height = 2
                },
                Slots = new Slot
                {
                    Slot1 = new SlotData
                        {
                            Subtitle1 = "Thing",
                            Color1 = Color.DarkSlateBlue.ToDucksboardColor(),
                            Subtitle2 = "Status",
                            Color2 = Color.Black.ToDucksboardColor()
                        }
                }
            });


leaderboard.Slots.Slot1.Label = "MySlotLabel";

dashboardCient.Update(leaderboard, leaderboard.Slug);


Supported Objects

  • Dashboards
  • Widgets

NOTE: Currently widget content is not supported. Any of the http://dev.ducksboard.com/apidoc/widgets-list/#custom-widgets Custom widgets can be used.

ASP.NET and Pull API

Using the pull API is very simple, you just need to provide Ducksboard with a url to pull from and provide the same JSON you would push to them. Below is a quick example with ASP.NET MVC.

  // imagine this is in your publicly accessible controller
  public ActionResult Tickets() {
    var numOfTickets = db.Tickets.Count();
    return Content(new Numbers { Value = numOfTickets }.ToJson());  
  }

ToJson() is a member method of all Ducksboard objects, so you can use it anywhere you can host a web process.

Contributors

Pull Requests

Feel free to fork this project and send me a pull request, if you can create a unit test that would be great as well.

Something went wrong with that request. Please try again.