Working with Pinnacle API – Get Leagues

This is a follow up article of  Working with Pinnacle API.

Next operation is to get a list of leagues under a specific sports.  Let’s try to continue from the previous view and get list of leagues.

Let’s go to PinnacleAPIHandler and make another class function to call the API operation v2/leagues?sportid={sportid}, and also get new Model ready for request and response of this API.

Continue reading “Working with Pinnacle API – Get Leagues”

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.

Continue reading “Working with Pinnacle API”

Making Android App with Xamarin 3 – Connecting with ASP.Net Identity

Many of ASP.Net guys or girls are taking great feature of ASP.Net Identity to manage credential of their web services.  When offering same service via App, it is nice to be able to use the same credential management.

Continue on from  Making Android App with Xamarin 2 – Get InsntaceID. Now that we know how to get InsntaceID to identify the app, we will connect this ID with ASP.net Identity.

Continue reading “Making Android App with Xamarin 3 – Connecting with ASP.Net Identity”

ASP.Net Web API 2 and AMCHARTS

Amcharts is one of the best js base chart service out there today.   Amcharts takes JSON data and display all sorts of neat charts.  Here, I am generating JSON data through ASP.Net Web API 2 and show AmCharts graphs.

I followed tutorial document from Amcharts (https://www.amcharts.com/tutorials/using-data-loader-to-connect-charts-to-mysql-data-base/).  This tutorial goes over how to query data from mySQL then generate JSON data then display charts in PHP, but we don’t have to worry about MySQL or PHP, we just create and fetch JSON data from API and goes from there.

First, we will have to know what type of data you want to generate.  We can generalize shape of data we want to work with.  Graphs usually are generated from table of data (or in this case JSON data that fits in table).  If you are to work with 2D graphs, then we will need to generate 2 dimensions of data, x and y. And that’s what we do today.

Let’s start with something simple.  I have system log stored in my DB,  X being time, call it category, Y being some value of some log properties, call it value1 and value2.

Continue reading “ASP.Net Web API 2 and AMCHARTS”

Adding WebAPI to your current MVC Project

Started off as regular web site in MVC, later you want to add Web API to the same project?  You can simply add Web API controllers, but to make it work you have to do few more steps.

inside your Global.asax, you have to make reference to System.Web.Http and also add  GlobalConfiguration.Configure(WebApiConfig.Register)

This should take care of API request routing properly and good to go.

Iko puts it all well at http://stackoverflow.com/questions/26067296/how-to-add-web-api-to-an-existing-asp-net-mvc-5-web-application-project

Gurunavi Web Service

Gurunavi is one the largest and popular restaurant listing service in Japan. They provide great web service to let you search and list all restaurants in multiple languages.

The link is http://api.gnavi.co.jp/api/manual_e.html

You have to first register from this page, http://api.gnavi.co.jp/api/use02_e.html and get access ID.

Let’s say;
I want to be able to search restaurants in Japan by prefectures or metropolitan areas.  I will call API to get list of prefectures or areas, then be able to click them then show the list of restaurants in the specific prefectures or areas.

Create API URL below;

Then you ll get response like;

The list of area is probably not going to be updated for long, and up to little less than 50 prefectures, so instead of making call to Gurunavi server every time, I fetch the list and store them locally or just hard code them. But if you are to make call to API and build links from server side when the page is load. I ll make new model called gAreaMasterModels as a container for Area data Gurunavi passes like below;

Expected API response is like below;

and Model is below;

Then I create controllers, which load xml response from gurunavi and put them into variable g.