User:Otacon/GWLadderAPI

From Guild Wars Wiki
Jump to navigationJump to search

What is it?[edit]

The Guild Wars (GW) Ladder API was a way for clients to tap into the ladders of Guild Wars and get data in XML, JSON, or serialized PHP format. It was up briefly during the month of May 2009.

Usage[edit]

The following are some generic calls to the API.

Output[edit]

The following are a few examples of the most basic output of the API.

Valid Output[edit]

This is the most generic output produced by the API.

XML[edit]

<?xml version='1.0' encoding='UTF-8' ?>
<Rankings>
    <Rank>
        <BatchId>199225</BatchId>
        <Rank>1</Rank>
        <WorldRank>1</WorldRank>
        <Name>Straight Outta Kamadan</Name>
        <Tag>KMD</Tag>
        <Territory>Europe</Territory>
        <Rating>1730</Rating>
        <Wins>289</Wins>
        <Losses>29</Losses>
        <QPoints>0</QPoints>
        <PeakWorldRank>1</PeakWorldRank>
        <MinSinceLastMatch>4161</MinSinceLastMatch>
    </Rank>
</Rankings>

JSON[edit]

A callback function has been specified.

myCallback2000(
    [
        {
            "BatchId":199225,
            "Rank":1,
            "WorldRank":1,
            "Name":"Straight Outta Kamadan",
            "Tag":"KMD",
            "Territory":"Europe",
            "Rating":1730,
            "Wins":289,
            "Losses":29,
            "QPoints":0,
            "PeakWorldRank":1,
            "MinSinceLastMatch":4161
        }
    ]
);

Serialized PHP[edit]

a:1:
    {
        i:0;
        a:12:
            {
                s:7:"BatchId";
                i:199225;
                s:4:"Rank";
                i:1;
                s:9:"WorldRank";
                i:1;
                s:4:"Name";
                s:22:"Straight Outta Kamadan";
                s:3:"Tag";
                s:3:"KMD";
                s:9:"Territory";
                s:6:"Europe";
                s:6:"Rating";
                i:1730;
                s:4:"Wins";
                i:289;
                s:6:"Losses";
                i:29;
                s:7:"QPoints";
                i:0;
                s:13:"PeakWorldRank";
                i:1;
                s:17:"MinSinceLastMatch";
                i:4161;
            }
    }

Invalid Output[edit]

This is the most generic output of an error. The error messages will have a similar output in all the formats described above.

<?xml version='1.0' encoding='UTF-8' ?>
<error>
    <errorCode>40</errorCode>
    <errorMessage>Invalid ladder specified. Valid ladders are: guild, hero Example: ?format=xml&ladder=guild</errorMessage>
</error>

Errors[edit]

Error Codes[edit]

The following are a list of error codes generated by the API.

  • 20 - Invalid name specified
  • 30 - Invalid tag specified
  • 40 - Invalid ladder specified
  • 41 - No ladder specified
  • 50 - Invalid callback function declaration
  • 60 - Throttling responses to client

General Error[edit]

The following will appear if there was an error server side: The server encountered a problem. Please try again later.

Basic Info[edit]

The following is the basic example, arguments/options, and notes generated by the API.

==============================================================================
GW LADDER API BETA

Example:
http://www.guildwars.com/competitive/ladder/?format=xml&ladder=guild

Argument/Options:
format		- xml, json, php-serial
ladder		- guild, hero
limit   	- 1-1000 (guild ladder), 1-1080 (hero ladder)
offset		- 0-1000 ", 0-1080 "
name		- string 1-50 chars
column		- column name (see example output for names)
order     	- asc or desc
callback	- string 1-40 chars (JSON only)

Errors will return in requested format output. Ladders update HOURLY: please
limit your calls accordingly.

NOTE: API is subject to change without notice. Currently available as BETA. 
For questions, issues, etc. please contact support regarding "GW LADDER API".
==============================================================================

Source: "View Source" of the Official Guild Wars Guild Ladder.