1. I have corrected the e-mail settings so that outgoing e-mails from these forums should be sent now. If you tried to Register or Reset your Password, please try again!
    Dismiss Notice

PS2-Parser: Java-based client for the API

Discussion in 'Census: Planetside 2' started by Casey, Apr 13, 2013.

  1. Casey

    Casey Guest

    I'm finally confident enough to release the first stable (beta-) version of my POJO mapper for the API. The goal is to simplyfy working with the API and taking care of most of the annoyances it currently has, like random errors. It includes (nearly) all collections the API offers plus the server status, which is somewhat hidden.

    Example:

    Code:
    // basic setup to retrieve character informationApiConnection apiConnection = new ApiConnection();CharacterApiDAO characterDao = apiConnection.getCharacterDao(); // get the character by name (don't needCharacterResponse characterResponse =        characterDao.getCharacter("ICaseyI"); // no need to check if the character exists.// I know the character exists because its mine.ApiCharacter character = characterResponse.getCharacters().get(0); // getting additional character informationCharactersFriendsResponse friends = characterDao.getFriends(character);CharacterOnlineStatusResponse onlineStatus =        characterDao.getOnlineStatus(character);CharactersEventsResponse dearthEvents =        characterDao.getEvents(character, CharactersEventType.DEATH);CharactersWorldResponse world = characterDao.getWorld(character); System.out.println(characterResponse);
    That's 5 API Request with just 8 lines of code and you can continue working with it, like you would with any normal data structure. You don't need to thing about json/xml.

    You can find more information on the projects website. I'm also at Planetside universe's API irc channel (irc.planet-universe.com #api).
     
  2. Feldon

    Feldon Guest

    That's irc.planetside-universe.com. ;)

    Nice wiki you guys have on the API.
     
  3. Casey

    Casey Guest

    Didn't noticed. Thanks for the info. Sadly I can't edit the post any more.
     
  4. StevilKnevil

    StevilKnevil Guest

    Interesting... :) Is there any support for async requests, or do you anticipate people putting their own async wrapping around your stuff?

    How are large numbers of results handled? Are you getting pages of info behind the scenes and concatenating them into one big object?
     
  5. Casey

    Casey Guest

    Support for Async requests is a good idea, but also very easy to do yourself on demand. It would be especially interessting for long running requests like a full character request (never seen it below 2 seconds). For me it would basically mean to wrap each function. I will add it to my Todo-list, but currently the focus is on further support for c:show and starting to add c:resolve support.

    Results are returned like the API sends them, no automated paging is done to retrieve the whole collection, but I already thought about adding it. On large collections, like Leaderboard, to get all entries you need to do the paging yourself. There should already the needed methods in place to do it, where needed.
     

Share This Page