API-NG Heaven to Hell and then again to Heaven

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Lopiner
    Junior Member
    • Feb 2009
    • 117

    #1

    API-NG Heaven to Hell and then again to Heaven

    Hi to all

    I'm not a programmer, i know how to build some simple apps and i do my own coding but Im a newbie. Still i have build a quiet large application on the API 6 in VB.net and now Im migrating (or trying) to NG. I have told in previous posts that i find it very hard to believe that we all have to build an enormous amount of code just to do Request/Responses to the API. We all have to build classes for the post requests, classes for the request objects and for the response objects to dump the info that the api give us. We have to document all of the Enum's and figure out all of the possible exceptions. For example, the sample code in C# that doesn't even include all the requests it's already larger than my old App.
    I know that in the old API there was a lot of code hidden that was auto generated by the WSDL. In API 6 we all shared common and stable code for the Requests/Responses. Any update to the API would become available to us in our apps instantly.
    It would be great if the Developer team could release a JSDL or similar description file. I think that would boost a lot the development on the new API and the migration process.

    It doesn't make sense that we are all building the same code, we should be focusing on building functionality to our costumers or bots on top of the API.

    Please leave your opinion. Thanks

    PS: People are using things like json2csharp to build classes in a rudimentary way (based on a sample response) or generating Schema files but i don't know how to use them (jsonschema.net).
    fooledbyabet.com
  • Lopiner
    Junior Member
    • Feb 2009
    • 117

    #2
    I think it's even possible to describe the JSON Rest in a WSDL. Link here

    Isn't this a better way than trying to distribute and maintain sample code on every popular programming language?
    fooledbyabet.com

    Comment

    • HonestDiver
      Junior Member
      • May 2014
      • 2

      #3
      Same general issue here. Will have to upgrade my .NET-bot to API-NG. Haven't really started yet. Have you tried this stuff?: https://forum.bdp.betfair.com/showthread.php?t=2167

      There should be quite a few ppl having the same problems migrating their .NET API 6 projects to API-NG. Do you know if there is a thread where ppl collaborate? Should we start such a thread? Any other resources?

      Comment

      • Lopiner
        Junior Member
        • Feb 2009
        • 117

        #4
        Hi HonestDiver

        That project was the only way i could get started in API-NG. Although im already testing it i dot fully understand it yet and unfortunately it just has 4 API calls. I think the way to go is to collaborate on a thread much like the one for the old API. I will try to contribute but im really not an expert on JSON, just trying to educate myself.
        There is already an attempt to start a VB.NET thread, let me see if i can find it.
        fooledbyabet.com

        Comment

        • HonestDiver
          Junior Member
          • May 2014
          • 2

          #5
          Hi Lopiner

          Was it this one?:
          https://forum.bdp.betfair.com/showthread.php?t=2169

          Too bad mumbles retired Will try to get started now ...

          Comment

          • Lopiner
            Junior Member
            • Feb 2009
            • 117

            #6
            Yes HonestDiver, thats the one. I think we should start from that VB.Net project, it seems to be a good starting point. I have made some changes to allow Gzip requests and stuff.

            I think mumbles deserves a statue, without him i wouldn't be able to build my bot. Wherever you are mumbles we thank you
            fooledbyabet.com

            Comment

            • Guest

              #7
              Originally posted by Lopiner View Post
              Hi to all

              I have told in previous posts that i find it very hard to believe that we all have to build an enormous amount of code just to do Request/Responses to the API. We all have to build classes for the post requests, classes for the request objects and for the response objects to dump the info that the api give us. We have to document all of the Enum's and figure out all of the possible exceptions. For example, the sample code in C# that doesn't even include all the requests it's already larger than my old App.

              Hi Lopiner, Originally when I started I thought this also and Thanks to Dave and Peter Simple they put me on the right track. Dave actually gave me some great code running in a windows app, however after this I went back to his original VB NET example which is Betfairs C# example converted to VB NET by Dave.

              Here is the Betfair C# example https://github.com/betfair/API-NG-sa.../master/cSharp

              Here is Dave's post which he converted the C# to VB.NET and is also referenced above http://forum.bdp.betfair.com/showthread.php?t=2167


              You will noted that if you drill down though directory structure all the CLASSES, ENUMS etc are under the TO directory.

              As an example if you follow this link you will see the CLASS for MarketCatalog in the API C# example
              https://github.com/betfair/API-NG-sa...etCatalogue.cs



              After I downloaded Daves VB converted code, it took me a full week I reckon to learn the entire code. I am also a classic VB6 programmer making the move to VB.NET but I think I can now say I have made the transition. I changed the output in the original VB example from console to Windows and then slowly started to develop my Bot.

              OK - so that's the good news. NOW THE BAD NEWS !!!!

              1) First the betfair team do not keep these examples up to date. For instance the MarketCatalog now also returns TotalMatched funds (which was only originally only in the MarketBook), so therefore if you want to access this then you simply need to add the following code into MarketCatalog class

              Code:
                      <JsonProperty(PropertyName:="totalMatched")> _
                      Public Property TotalMatched() As Double        'Added 24 Feb 14      totalMatched Double   The total amount of money matched on the market BUT IS IN MARKET BOOK calls

              2) The C# and hence VB.NET example only has 4 calls, listEvents, listMarketCatalog, listMarketBook, and placeOrders. After this you are on your own.


              I now have listCurrentOrders and listClearedOrders working together with full CLASSES and ENUMS uploaded onto the forum here. As I develop more I will upload and share. Here is a thread on listCurrentOrders http://forum.bdp.betfair.com/showpos...61&postcount=5

              I hope this post helps and I am just thankful to Dave and Peter who got me started
              Last edited by Guest; 20-05-2014, 12:48 AM.

              Comment

              • Lopiner
                Junior Member
                • Feb 2009
                • 117

                #8
                Thanks troyedwards8

                You work is very helpfull, thanks for sharing
                fooledbyabet.com

                Comment

                Working...
                X