Dot Net example: API NG methods call

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zebuksys
    Junior Member
    • Oct 2013
    • 1

    #1

    Dot Net example: API NG methods call

    Hi Friends,

    I am new in using API NG methods, I am creating an .NET application which will fetch some data from API NG methods call and display.

    There are following data need to fetch regularly:

    >Race Types
    >Today's Race Timings
    >Track/Courses Info
    >Trainers Info
    >Jockey Info,etc.

    Can anybody please let me know which methods call will be suitable to get above data?

    Also in my application API call logic will be run in background on daily basis, how I need to implement logic of keep stable my Session Token Id and Application Key?

    Which URL will be suitable for API NG call?

    Please help me. Providing of Example code is more appreciable and helpful for me.

    Thanks in advance.
  • kawafan
    Junior Member
    • May 2011
    • 33

    #2
    Just to Let you know , You are not alone.

    Comment

    • BetfairDeveloperProgram
      Administrator
      • Oct 2008
      • 680

      #3
      Hi,

      We'll be making more .Net sample code available over the next few months. The current sample code is available here: https://api.developer.betfair.com/se...ni/Sample+Code

      To retrieve the data you require from API-NG, you need to make the following requests:

      Race Types - listEventTypes

      Request

      Code:
      [{"jsonrpc": "2.0", "method": "SportsAPING/v1.0/listMarketTypes", "params": {"filter":{"eventTypeIds":["7"]}}, "id": 1}]
      Response

      Code:
      [{"jsonrpc":"2.0","result":[{"marketType":"SPECIAL","marketCount":5},{"marketType":"STEWARDS","marketCount":2},{"marketType":"PLACE","marketCount":151},{"marketType":"WIN","marketCount":155},{"marketType":"FORECAST","marketCount":4},{"marketType":"MATCH_BET","marketCount":35},{"marketType":"DAILY_WIN_DIST","marketCount":3},{"marketType":"RACE_WIN_DIST","marketCount":2},{"marketType":"WITHOUT_FAV","marketCount":5},{"marketType":"REV_FORECAST","marketCount":15},{"marketType":"ANTEPOST_WIN","marketCount":30}],"id":1}]

      Today's Race Timings - listMarketCatalogue - marketProjection = MARKET_START_TIME

      Track/Courses Info - listMarketCatalogue marketProjection = EVENT_TYPE & EVENT

      Trainers/Jockeys Info - listMarektCatalogue marketProjection = RUNNER_METADATA

      Here's an example of a JSON request that returns all horseracing WIN & PLACE markets for today, including the above information.

      Code:
      [{"jsonrpc": "2.0", "method": "SportsAPING/v1.0/listMarketCatalogue", "params": {"filter":{"eventTypeIds":["7"],"marketTypeCodes":["WIN","PLACE"],"marketStartTime":{"from":"2013-10-16T23:00:00Z","to":"2013-10-17T22:45:00Z"}},"maxResults":"200","marketProjection":["MARKET_START_TIME","RUNNER_METADATA","RUNNER_DESCRIPTION","EVENT_TYPE","EVENT","COMPETITION"]}, "id": 1}]

      Comment

      • zebuksys.
        Junior Member
        • Oct 2013
        • 7

        #4
        Thanks for quick reply.

        I have downloaded .NET sample code and with your guidance now I am able to understand execution flow and result structure of API methods calling.

        Please help me for following point also:

        1> How can I use createDeveloperKey() and getDeveloperKey() methods to create and get App Key from .NET code instead of using Accounts API Visualizer.

        2> Please assist for accessing AccountAPI methods from .NET cade like getAccountDetails() and getAccountFunds()

        3> sample code to keep stable my Session Token Id (or active login session).

        Comment

        • kawafan
          Junior Member
          • May 2011
          • 33

          #5
          Hi
          Thats Work Ok for Soccer , we Get List Competition for event type 1
          and we Got Competitions. then By Competitions we get ListEvents
          and we get market like.

          Team A vs Team B.
          Team C v Team E.

          but for example for cricket Market.

          When we try to Get List Event for competition 3826038 , Aus Vs India 2013 .





          Code:
          Response truncated to 4,000 chars: 
          [{"jsonrpc":"2.0","result":[{"event":{"id":"27071379","name":"ODI Series","countryCode":"IN","timezone":"Asia/Calcutta","openDate":"2013-10-13T08:00:00.000Z"},"marketCount":6},{"event":{"id":"27079433","name":"Australia","countryCode":"IN","timezone":"Asia/Calcutta","openDate":"2013-10-19T08:00:00.000Z"},"marketCount":50},{"event":{"id":"27071492","name":"India v Australia (3rd ODI)","countryCode":"IN","timezone":"Asia/Calcutta","openDate":"2013-10-19T08:00:00.000Z"},"marketCount":30},{"event":{"id":"27079432","name":"India","countryCode":"IN","timezone":"Asia/Calcutta","openDate":"2013-10-19T08:00:00.000Z"},"marketCount":50}],"id":1}]


          Why i am getting Australia as Event and India As Event with 50+ Markets in Each.


          Originally posted by Betfair Developers Program View Post
          Hi,

          We'll be making more .Net sample code available over the next few months. The current sample code is available here: https://api.developer.betfair.com/se...ni/Sample+Code

          To retrieve the data you require from API-NG, you need to make the following requests:

          Race Types - listEventTypes

          Request


          Code:
          [{"jsonrpc": "2.0", "method": "SportsAPING/v1.0/listMarketTypes", "params": {"filter":{"eventTypeIds":["7"]}}, "id": 1}]
          Response

          Code:
          [{"jsonrpc":"2.0","result":[{"marketType":"SPECIAL","marketCount":5},{"marketType":"STEWARDS","marketCount":2},{"marketType":"PLACE","marketCount":151},{"marketType":"WIN","marketCount":155},{"marketType":"FORECAST","marketCount":4},{"marketType":"MATCH_BET","marketCount":35},{"marketType":"DAILY_WIN_DIST","marketCount":3},{"marketType":"RACE_WIN_DIST","marketCount":2},{"marketType":"WITHOUT_FAV","marketCount":5},{"marketType":"REV_FORECAST","marketCount":15},{"marketType":"ANTEPOST_WIN","marketCount":30}],"id":1}]

          Today's Race Timings - listMarketCatalogue - marketProjection = MARKET_START_TIME

          Track/Courses Info - listMarketCatalogue marketProjection = EVENT_TYPE & EVENT

          Trainers/Jockeys Info - listMarektCatalogue marketProjection = RUNNER_METADATA

          Here's an example of a JSON request that returns all horseracing WIN & PLACE markets for today, including the above information.

          Code:
          [{"jsonrpc": "2.0", "method": "SportsAPING/v1.0/listMarketCatalogue", "params": {"filter":{"eventTypeIds":["7"],"marketTypeCodes":["WIN","PLACE"],"marketStartTime":{"from":"2013-10-16T23:00:00Z","to":"2013-10-17T22:45:00Z"}},"maxResults":"200","marketProjection":["MARKET_START_TIME","RUNNER_METADATA","RUNNER_DESCRIPTION","EVENT_TYPE","EVENT","COMPETITION"]}, "id": 1}]

          Comment

          Working...
          X