Working with Pinnacle API

Today, I am here playing with Pinnacle API, get game information, run statistics, using C#.

The referecen document is here at “Getting started” https://www.pinnacle.com/en/api/manual#getting-started

First you need to create account here, https://www.pinnaclesports.com/secure/signup.aspx

Then get your client ID, store it to secure place, suggest place will be inside Web.config.

Please be sure that your account is funded, else the credential will not work.

OK, assuming that you got your account and got your credential in your web.config.

Pinnacle API support simple JSON data, so I ll be using Newtonsoft.Json class to serialize, deserialize JSON.

Now let’s go through operations that are available to call.

First one is v2/sports, which returns a list of sports.

Let’s create model that can work with request and response for the API v2/sports, which are

 

Let’s create new class called PinnacleAPIHandler where I will be putting all calls and related functions to work with Pinnacle API, at Handlers/PinnacleAPIHandler.cs, which look like below;

 

Now we got nice wrapper library that can talk with Pinnacle API service.

Let ‘s get controller and view to show result.

My controller;

Now my View;

 

Let’s hit the URL.  Looking good.  Now I have a  list of sports.

 

Let’s move on to next operation.

Leave a Reply