1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Hey Guest, is it this your first time on the forums?

    Visit the Beginner's Box

    Introduce yourself, read some of the ins and outs of the community, access to useful links and information.

    Dismiss Notice

APIClient class source

Discussion in 'Community Dev Corner' started by FliesLikeABrick, Jun 18, 2012.

Mods: Downburst, Mazey
  1. FliesLikeABrick

    FliesLikeABrick THD Team THD Team Administrator Global Moderator

    Messages:
    952
    This code is available under the creative commons attribution license; should you use/reuse/modify/distribute this, please provide attribution that you are using APIClient provided by the KAG developers. Attribution is not necessary if you just use this as a code reference.

    http://creativecommons.org/licenses/by/3.0/


    --

    Here's the source code for the class used by KAG itself to talk to the API. I've removed some functions related to authentication and updating server statuses in the server list.

    It needs to be linked with libcurl and jsoncpp (I used 0.5.0).

    I don't expect anyone to try and compile this yet (I haven't tested it since taking some of the code out), but I'm posting it mostly for reference of a decent way to consume the API from C++. Eventually I'll get this in a public facing svn repo or on github, once I add some more calls to it and comment the source better (including an example usage file)

    I just started writing APIClient-example.cpp - I haven't even compiled it yet, so it's mostly here as a very simple example of usage. Sorry for how incomplete this posting is, but with the API starting to get used I wanted to provide whatever info I can.

    tl;dr: here's stuff, it may not compile/work atm but it at least provides a reference.
     

    Attached Files:

    Atheon, Noburu, JacKD and 2 others like this.
Mods: Downburst, Mazey