Skip to content

GW2Treasures/gw2api

Repository files navigation

gw2treasures/gw2api

version license

PHP wrapper for the Guild Wars 2 API.

Features

  • Support for all v2 endpoints (including authenticated)
  • Parallel requests for pagination and bulk expansion

Requirements

  • PHP >= 7.2

Setup

Using composer (recommended)

composer require gw2treasures/gw2api

If you haven't included composers autoloader yet, you will have to add this before being able to use the GW2 API Wrapper.

include 'vendor/autoload.php';

Using the gw2api.phar archive

You need to download the latest gw2api.phar and the guzzle.phar of the latest 7.x version of the guzzle library and place both files in your project directory. Now you can include both files to start using the GW2 API wrapper.

include __DIR__ . '/gw2api.phar';
include __DIR__ . '/guzzle.phar';

Examples

// create new api instance
$api = new \GW2Treasures\GW2Api\GW2Api();

// get all worlds
$worlds = $api->worlds()->all();

// get some happy quaggans
$quaggans = $api->quaggans()->many([ 'cheer', 'party' ]);

// get item details in german
$ektoplasmakugel = $api->items()->lang('de')->get(19721);

// search recipes
$recipes = $api->recipes()->search()->input(46746);

// get all character names
$characters = $api->characters('api_key')->ids();

// get 10 recently bought items
$recentlyBought = $api->commerce()->transactions('api_key')->history()->buys()->page(0, 10);

Usage

For all examples it is assumed that you have a variable $api = new GW2Api().

Endpoint Overview

API Endpoint Class
Instance
Flags
/v2/account Account\AccountEndpoint
GW2Api::account()
🔒
/v2/account/achievements Account\AchievementEndpoint
GW2Api::account()->achievement()
🔒
/v2/account/bank Account\BankEndpoint
GW2Api::account()->bank()
🔒
/v2/account/dyes Account\DyeEndpoint
GW2Api::account()->dyes()
🔒
/v2/account/finishers Account\FinisherEndpoint
GW2Api::account()->finishers()
🔒
/v2/account/inventory Account\InventoryEndpoint
GW2Api::account()->inventory()
🔒
/v2/account/masteries Account\MasteryEndpoint
GW2Api::account()->masteries()
🔒
/v2/account/materials Account\MaterialEndpoint
GW2Api::account()->materials()
🔒
/v2/account/minis Account\MiniEndpoint
GW2Api::account()->minis()
🔒
/v2/account/recipes Account\RecipeEndpoint
GW2Api::account()->recipes()
🔒
/v2/account/skins Account\SkinEndpoint
GW2Api::account()->skins()
🔒
/v2/account/titles Account\TitleEndpoint
GW2Api::account()->titles()
🔒
/v2/account/wallet Account\WalletEndpoint
GW2Api::account()->wallet()
🔒
/v2/achievements Achievement\AchievementEndpoint
GW2Api::achievements()
📦🌏
/v2/achievements/categories Achievement\CategoryEndpoint
GW2Api::achievements()->categories()
📦🌏
/v2/achievements/daily Achievement\DailyEndpoint
GW2Api::achievements()->daily()
/v2/achievements/daily/tomorrow Achievement\DailyTomorrowEndpoint
GW2Api::achievements()->daily()->tomorrow()
/v2/achievements/groups Achievement\GroupEndpoint
GW2Api::achievements()->groups()
📦🌏
/v2/backstory/answers Backstory\AnswerEndpoint
GW2Api::backstory()->answers()
📦🌏
/v2/backstory/questions Backstory\QuestionEndpoint
GW2Api::backstory()->questions()
📦🌏
/v2/build Build\BuildEndpoint
GW2Api::build()
/v2/characters Character\CharacterEndpoint
GW2Api::characters()
🔒📦
/v2/characters/:id/backstory Character\BackstoryEndpoint
GW2Api::characters()->backstoryOf()
🔒
/v2/characters/:id/core Character\CoreEndpoint
GW2Api::characters()->coreOf()
🔒
/v2/characters/:id/crafting Character\CraftingEndpoint
GW2Api::characters()->craftingOf()
🔒
/v2/characters/:id/equipment Character\EquipmentEndpoint
GW2Api::characters()->equipmentOf()
🔒
/v2/characters/:id/heropoints Character\HeropointEndpoint
GW2Api::characters()->heropointsOf()
🔒
/v2/characters/:id/inventory Character\InventoryEndpoint
GW2Api::characters()->inventoryOf()
🔒
/v2/characters/:id/recipes Character\RecipeEndpoint
GW2Api::characters()->recipesOf()
🔒
/v2/characters/:id/skills Character\SkillEndpoint
GW2Api::characters()->skillsOf()
🔒
/v2/characters/:id/specializations Character\SpecializationEndpoint
GW2Api::characters()->specializationsOf()
🔒
/v2/characters/:id/training Character\TrainingEndpoint
GW2Api::characters()->trainingOf()
🔒
/v2/colors Color\ColorEndpoint
GW2Api::colors()
📦🌏
/v2/commerce/exchange Commerce\ExchangeEndpoint
GW2Api::commerce()->exchange()
/v2/commerce/listings Commerce\ListingEndpoint
GW2Api::commerce()->listings()
📦
/v2/commerce/prices Commerce\PriceEndpoint
GW2Api::commerce()->prices()
📦
/v2/commerce/transactions Commerce\Transaction\TransactionEndpoint
GW2Api::commerce()->transactions()
🔒📄
/v2/continents Continent\ContinentEndpoint
GW2Api::continents()
📦🌏
/v2/currencies Currency\CurrencyEndpoint
GW2Api::currencies()
📦🌏
/v2/novelties Novelty\NoveltyEndpoint
GW2Api::novelties()
📦🌏
/v2/emblem Emblem\EmblemEndpoint
GW2Api::emblem()
/v2/events disabled 🌏🚫
/v2/events-state disabled 🚫
/v2/files File\FileEndpoint
GW2Api::files()
📦
/v2/finishers Finisher\FinisherEndpoint
GW2Api::finishers()
📦🌏
/v2/guild/:id Guild\DetailsEndpoint
GW2Api::guild()->detailsOf()
🔓
/v2/guild/:id/log Guild\Authenticated\LogEndpoint
GW2Api::guild()->logOf()
🔒
/v2/guild/:id/members Guild\Authenticated\MemberEndpoint
GW2Api::guild()->membersOf()
🔒
/v2/guild/:id/ranks Guild\Authenticated\RankEndpoint
GW2Api::guild()->ranksOf()
🔒
/v2/guild/:id/stash Guild\Authenticated\StashEndpoint
GW2Api::guild()->stashOf()
🔒
/v2/guild/:id/teams Guild\Authenticated\TeamEndpoint
GW2Api::guild()->teamsOf()
🔒
/v2/guild/:id/treasury Guild\Authenticated\TreasuryEndpoint
GW2Api::guild()->treasuryOf()
🔒
/v2/guild/:id/upgrades Guild\Authenticated\UpgradeEndpoint
GW2Api::guild()->upgradesOf()
🔒
/v2/guild/permissions Guild\PermissionEndpoint
GW2Api::guild()->permissionsOf()
📦🌏
/v2/guild/upgrades Guild\UpgradeEndpoint
GW2Api::guild()->upgradesOf()
📦🌏
/v2/home/cats Home\CatEndpoint
GW2Api::home()->cats()
📦
/v2/home/nodes Home\NodeEndpoint
GW2Api::home()->nodes()
📦
/v2/items Item\ItemEndpoint
GW2Api::items()
📦🌏
/v2/itemstats Itemstat\ItemstatEndpoint
GW2Api::itemstats()
📦🌏
/v2/leaderboards disabled 🚫
/v2/legends Legend\LegendEndpoint
GW2Api::legends()
📦🌏
/v2/maps Map\MapEndpoint
GW2Api::maps()
📦🌏
/v2/masteries Mastery\MasteryEndpoint
GW2Api::masteries()
📦🌏
/v2/materials Material\MaterialEndpoint
GW2Api::materials()
📦🌏
/v2/minis Mini\MiniEndpoint
GW2Api::minis()
📦🌏
/v2/mounts/types Mount\TypeEndpoint
GW2Api::mounts()->types()
📦🌏
/v2/mounts/skins Mount\SkinEndpoint
GW2Api::mounts()->skins()
📦🌏
/v2/novelties Novelty\NoveltyEndpoint
GW2Api::novelties()
📦🌏
/v2/outfits Outfit\OutfitEndpoint
GW2Api::outfits()
📦🌏
/v2/pets Pet\PetEndpoint
GW2Api::pets()
📦🌏
/v2/profession Profession\ProfessionEndpoint
GW2Api::professions()
📦🌏
/v2/pvp/amulets Pvp\AmuletEndpoint
GW2Api::pvp()->amulets()
📦🌏
/v2/pvp/games Pvp\GameEndpoint
GW2Api::pvp()->games()
🔒📦
/v2/pvp/seasons Pvp\SeasonEndpoint
GW2Api::pvp()->seasons()
📦🌏
/v2/pvp/standings Pvp\StandingEndpoint
GW2Api::pvp()->standings()
🔒
/v2/pvp/stats Pvp\StatsEndpoint
GW2Api::pvp()->stats()
🔒
/v2/quaggans Quaggan\QuagganEndpoint
GW2Api::quaggans()
📦
/v2/recipes Recipe\RecipeEndpoint
GW2Api::recipes()
📦
/v2/recipes/search Recipe\SearchEndpoint
GW2Api::recipes()->search()
/v2/skills Skill\SkillEndpoint
GW2Api::skills()
📦🌏
/v2/skins Skin\SkinEndpoint
GW2Api::skins()
📦🌏
/v2/specializations Specialization\SpecializationEndpoint
GW2Api::specializations()
📦🌏
/v2/stories Story\StoryEndpoint
GW2Api::stories()
📦🌏
/v2/stories/seasons Story\SeasonEndpoint
GW2Api::stories()->season
📦🌏
/v2/titles Title\TitleEndpoint
GW2Api::titles()
📦🌏
/v2/tokeninfo Tokeninfo\TokeninfoEndpoint
GW2Api::tokeninfo()
🔒
/v2/traits Traits\TraitEndpoint
GW2Api::traits()
📦🌏
/v2/worlds World\WorldEndpoint
GW2Api::worlds()
📦🌏
/v2/wvw/abilities WvW\AbilityEndpoint
GW2Api::wvw()->abilities()
📦🌏
/v2/wvw/matches WvW\MatchEndpoint
GW2Api::wvw()->matches()
📦
/v2/wvw/objectives WvW\ObjectiveEndpoint
GW2Api::wvw()->objectives()
📦🌏

† Not FQN, all endpoints are in the namespace \GW2Treasures\GW2Api\V2\Endpoint
‡ Flags:
    🔒AuthenticatedEndpoint
    📦BulkEndpoint
    🌏LocalizedEndpoint
    📄PaginatedEndpoint
    🚫Disabled in the API

Abstract Endpoints

AuthenticatedEndpoint

\GW2Treasures\GW2Api\V2\Authentication\IAuthenticatedEndpoint (source)

All endpoints requiring authentication implement the interface IAuthenticatedEndpoint. Throws AuthenticationException and InvalidPermissionsException.

BulkEndpoint

\GW2Treasures\GW2Api\V2\Bulk\IBulkEndpoint (source)

All endpoints supporting bulk expansion implement the interface IBulkEndpoint. Extends PaginatedEndpoint. Throws PageOutOfRangeException.

Methods
  • all():array Get all entries.
    If the endpoint doesn't support ?ids=all this falls back to PaginatedEndpoint::all().
  • ids():int[]|string[] Get all ids.
  • get(int|string $id):mixed Get a single entry by id.
  • many(int[]|string[] $ids):array Get multiple entries by id.
  • IPaginatedEndpoint::page(int $page, [int $size]):array Get a specific page of the endpoint.
  • IPaginatedEndpoint::batch([int $parallelRequests], Closure $callback):void Get all entries in multiple small batches. The callback gets called with new entries until all entries have been processed.
    Signature of the callback: function(array $entries):void.
Example
$api->items()->all();
// => returns array with all items

$api->items()->ids();
// => returns array with all item ids

$api->items()->get(1);
// => returns item with id 1

$api->items()->many([1,2,3]);
// => returns items with ids 1, 2 and 3

LocalizedEndpoint

\GW2Treasures\GW2Api\V2\Localization\ILocalizedEndpoint (source)

All endpoints supporting localization implement the interface ILocalizedEndpoint. Defaults to en. Throws InvalidLanguageException.

Methods
  • lang(string $lang):$this Change the language of the endpoint.
Example
$api->items()->lang('de')->get(1)
// => returns german item 1

PaginatedEndpoint

\GW2Treasures\GW2Api\V2\Pagination\IPaginatedEndpoint (source)

All endpoints supporting pagination implement the interface IPaginatedEndpoint. Throws PageOutOfRangeException.

Methods
  • all():array Get all entries.
    Requests all pages of this endpoint in parallel and returns the merged result.
  • page(int $page, [int $size]):array Get a page of entries. The $size defaults to the maximum page size (200 for most endpoints).
  • batch([int $parallelRequests], Closure $callback):void Get all entries in multiple small batches. The callback gets called with new entries until all entries have been processed.
    Signature of the callback: function(array $entries):void.

Example

$api->items()->all();
// => returns all items

$api->items()->page(0, 10);
// => returns first page of 10 items

$api->items()->batch(function($items) {
    // $items contains items of current batch.
    // gets called multiple times with different items untill all items have been processed.
});

RestrictedGuildEndpoint

\GW2Treasures\GW2Api\V2\Endpoint\Guild\IRestrictedGuildEndpoint (source)

All guild endpoints requiring you to be a member implement the interface RestrictedGuildEndpoint. Throws GuildLeaderRequiredException or MembershipRequiredException.

Exceptions

ApiException

\GW2Treasures\GW2Api\Exception\ApiException (source)

Gets thrown by all endpoints when the API returns an error. Extends \Exception.

Methods
  • getResponse():ResponseInterface The response that was returned by the API.
Example
try {
    $api->items()->get('invalid item id');
} catch(ApiException $exception) {
    $exception->getMessage() === "no such id"
}

AuthenticationException

\GW2Treasures\GW2Api\V2\Authentication\Exception\AuthenticationException (source)

Gets thrown by AuthenticatedEndpoints when the endpoint needs authentication but no API key was specified or the API key was invalid. Extends ApiException.

Example
try {
    $api->account('INVALID_API_KEY')->get();
} catch(AuthenticationException $exception) {
    $exception->getMessage() === "invalid key"
}

InvalidPermissionsException

\GW2Treasures\GW2Api\V2\Authentication\Exception\InvalidPermissionsException (source)

Gets thrown by AuthenticatedEndpoints when the API key is missing permissions to access the endpoint. Extends AuthenticationException.

Methods
  • getMissingScope():string The permission that was missing to access the endpoint.
Example
try {
    $api->characters('API_KEY_WITHOUT_CHARACTERS_SCOPE')->get();
} catch(InvalidPermissionsException $exception) {
    $exception->getMessage() === "requires scope characters"
    $exception->getMissingScope() === "characters"
}

InvalidLanguageException

\GW2Treasures\GW2Api\V2\Localization\Exception\InvalidLanguageException (source)

Gets thrown by LocalizedEndpoints when the API responds with a different language than requested. Extends ApiException.

Methods
  • getRequestLanguage():string The requested language.
  • getResponseLanguage():string The language the API responded with.
Example
try {
    $api->items()->lang('invalid')->get(1);
} catch(InvalidLanguageException $exception) {
    $exception->getMessage() === "Invalid language (expected: invalid; actual: en)"
    $exception->getRequestLanguage() === "invalid"
    $exception->getResponseLanguage() === "en"
}

PageOutOfRangeException

\GW2Treasures\GW2Api\V2\Pagination\Exception\PageOutOfRangeException (source)

Gets thrown by PaginatedEndpoints when requesting a page that doesn't exist. Extends ApiException.

Example
try {
    $api->items()->page(9001);
} catch(PageOutOfRangeException $exception) {
    $exception->getMessage() === "page out of range. Use page values 0 - 826."
}

GuildException

\GW2Treasures\GW2Api\V2\Endpoint\Guild\Exception\GuildException (source)

Parent class of all guild exceptions. Extends ApiException.

GuildLeaderRequiredException

\GW2Treasures\GW2Api\V2\Endpoint\Guild\Exception\GuildLeaderRequiredException (source)

Gets thrown by RestrictedGuildEndpoint when requesting informations of a guild you are not the leader of. Extends GuildException.

Example
try {
    $api->guild()->membersOf('API_KEY', 'GUILD_ID_YOU_ARE_NOT_LEADER_OF');
} catch(GuildLeaderRequiredException $exception) {
    $exception->getMessage() === "access restricted to guild leaders"
}

MembershipRequiredException

\GW2Treasures\GW2Api\V2\Endpoint\Guild\Exception\GuildLeaderRequiredException (source)

Gets thrown by RestrictedGuildEndpoint when requesting informations of a guild you are not a member of. Extends GuildException.

Example
try {
    $api->guild()->membersOf('API_KEY', 'GUILD_ID_YOU_ARE_NOT_A_MEMBER_OF');
} catch(GuildLeaderRequiredException $exception) {
    $exception->getMessage() === "membership required"
}

Endpoints

/v2/account

\GW2Treasures\GW2Api\V2\Endpoint\Account\AccountEndpoint (source)

Implements 🔒AuthenticatedEndpoint.

Methods
Example
$api->account('API_KEY')->get();
// => { id: "account-guid", name: "Lawton.1234", … }

/v2/account/achievements

\GW2Treasures\GW2Api\V2\Endpoint\Account\AchievementEndpoint (source)

The AchievementEndpoint can be used to look up the achievements returned by this endpoint. Implements 🔒AuthenticatedEndpoint.

Methods
  • get():array Get account achievement progression.
Example
$api->account('API_KEY')->achievements()->get();
// => [ { id: 1, current: 1, max: 1000, done: false }, … ]

/v2/account/bank

\GW2Treasures\GW2Api\V2\Endpoint\Account\BankEndpoint (source)

Implements 🔒AuthenticatedEndpoint.

Methods
  • get():array Get account bank.
Example
$api->account('API_KEY')->bank()->get();
// => [ null, { id: 46774, slot: 1, count: 1 }, … ]

/v2/account/dyes

\GW2Treasures\GW2Api\V2\Endpoint\Account\DyeEndpoint (source)

The ColorEndpoint can be used to look up the colors used by this endpoint. Implements 🔒AuthenticatedEndpoint.

Methods
  • get():array Get unlocked dyes.
Example
$api->account('API_KEY')->dyes()->get();
// => [ 8, 12, 14, 17, … ]

/v2/account/finishers

\GW2Treasures\GW2Api\V2\Endpoint\Account\FinisherEndpoint (source)

The FinisherEndpoint can be used to look up the finishers used by this endpoint. Implements 🔒AuthenticatedEndpoint.

Methods
  • get():array Get unlocked finishers.
Example
$api->account('API_KEY')->finishers()->get();
// => [ { id: 1, permanent: true }

/v2/account/inventory

\GW2Treasures\GW2Api\V2\Endpoint\Account\InventoryEndpoint (source)

Implements 🔒AuthenticatedEndpoint.

Methods
  • get():array Returns a list of item stacks representing the account's shared inventory slots.
Example
$api->account('API_KEY')->inventory()->get();
// => [ null, { id: 12138, count: 250 }, null ]

/v2/account/masteries

\GW2Treasures\GW2Api\V2\Endpoint\Account\MasteryEndpoint (source)

The MasteryEndpoint can be used to get the masteries used by this endpoint. Implements 🔒AuthenticatedEndpoint.

Methods
  • get():array Get unlocked masteries.
Example
$api->account('API_KEY')->masteries()->get();
// => [ { id: 4, level: 4 }, … ]

/v2/account/materials

\GW2Treasures\GW2Api\V2\Endpoint\Account\MaterialEndpoint (source)

The MaterialEndpoint can be used to get the categories used by this endpoint. Implements 🔒AuthenticatedEndpoint.

Methods
  • get():array Get account material storage.
Example
$api->account('API_KEY')->materials()->get();
// => [ { id: 19699, category: 5, count: 250 }, … ]

/v2/account/minis

\GW2Treasures\GW2Api\V2\Endpoint\Account\MiniEndpoint (source)

The MiniEndpoint can be used to look up the minis returned by this endpoint. Implements 🔒AuthenticatedEndpoint.

Methods
  • get():array Get unlocked minis.
Example
$api->account('API_KEY')->minis()->get();
// => [ 1, 2, 3, 4, … ]

/v2/account/novelties

\GW2Treasures\GW2Api\V2\Endpoint\Account\MiniEndpoint (source)

The NoveltyEndpoint can be used to look up the minis returned by this endpoint. Implements 🔒AuthenticatedEndpoint.

Methods
  • get():array Get unlocked novelties.
Example
$api->account('API_KEY')->novelties()->get();
// => [ 1, 2, 3, 4, … ]

/v2/account/recipes

\GW2Treasures\GW2Api\V2\Endpoint\Account\RecipeEndpoint (source)

The RecipeEndpoint can be used to look up the recipes used by this endpoint. Implements 🔒AuthenticatedEndpoint.

Methods
  • get():array Get unlocked recipes.
Example
$api->account('API_KEY')->recipes()->get();
// => [ 104, 105, 106, 107, … ]

/v2/account/skins

\GW2Treasures\GW2Api\V2\Endpoint\Account\SkinEndpoint (source)

The SkinEndpoint can be used to look up the skins used by this endpoint. Implements 🔒AuthenticatedEndpoint.

Methods
  • get():array Get unlocked skins.
Example
$api->account('API_KEY')->skins()->get();
// => [ 1, 2, 3, 4, … ]

/v2/account/titles

\GW2Treasures\GW2Api\V2\Endpoint\Account\TitleEndpoint (source)

The TitleEndpoint can be used to look up the titles used by this endpoint. Implements 🔒AuthenticatedEndpoint.

Methods
  • get():array Get unlocked titles.
Example
$api->account('API_KEY')->titles()->get();
// => [ 1, 17, 188, … ]

/v2/account/wallet

\GW2Treasures\GW2Api\V2\Endpoint\Account\WalletEndpoint (source)

The CurrencyEndpoint can be used to look up the currencies used by this endpoint. Implements 🔒AuthenticatedEndpoint.

Methods
  • get():array Get the account wallet.
Example
$api->account('API_KEY')->wallet()->get();
// => [ { id: 1, value: 234885 }, … ]

/v2/achievements

\GW2Treasures\GW2Api\V2\Endpoint\Achievement\AchievementEndpoint (source)

Implements 📦BulkEndpoint and 🌏LocalizedEndpoint.

Methods
Example
$api->achievements()->get(1);
// => { id: 1, name: "Centaur Slayer", … }

/v2/achievements/categories

\GW2Treasures\GW2Api\V2\Endpoint\Achievement\CategoryEndpoint (source)

Methods
Example
$api->achievements()->categories()->get(50);
// => { id: 50, name: "Twilight Assault", … }

/v2/achievements/daily

\GW2Treasures\GW2Api\V2\Endpoint\Achievement\DailyEndpoint (source)

Methods
  • get():mixed Get the current daily achievements.
  • tomorrow():DailyTomorrowEndpoint Get tomorrows daily achievements.
Example
$api->achievements()->daily()->get();
// => { pve: [ { id: 1984, level: { min:1, max: 80 } }, … ], pvp: [ … ], wvw: [ … ] }

/v2/achievements/daily/tomorrow

\GW2Treasures\GW2Api\V2\Endpoint\Achievement\DailyTomorrowEndpoint (source)

Methods
  • get():mixed Get the current daily achievements.
Example
$api->achievements()->daily()->tomorrow()->get();
// => { pve: [ { id: 1973, level: { min:1, max: 79 } }, … ], pvp: [ … ], wvw: [ … ] }

/v2/achievements/groups

\GW2Treasures\GW2Api\V2\Endpoint\Achievement\GroupEndpoint (source)

Methods
Example
$api->achievements()->groups()->get('65B4B678-607E-4D97-B458-076C3E96A810');
// => { id: "65B4B678-607E-4D97-B458-076C3E96A810", name: "Heart of Thorns", … }

/v2/backstory/answers

\GW2Treasures\GW2Api\V2\Endpoint\Backstory\AnswerEndpoint (source)

Methods
Example
$api->backstory()->answers()->get('7-54');
// => { id: "7-54", title: "Dignity", question: 7, … }

/v2/backstory/questions

\GW2Treasures\GW2Api\V2\Endpoint\Backstory\QuestionEndpoint (source)

Methods
Example
$api->backstory()->questions()->get('7');
// => { id: 7, title: "My Personality", answers: [ "7-53", "7-54", "7-55" ], … }

/v2/build

\GW2Treasures\GW2Api\V2\Endpoint\Build\BuildEndpoint (source)

Methods
  • get():int Gets the current build id.
Example
$api->build()->get();
// => 50430

/v2/characters

\GW2Treasures\GW2Api\V2\Endpoint\Character\CharacterEndpoint (source)

Implements 🔒AuthenticatedEndpoint and 📦BulkEndpoint.

Methods
Example
$api->characters('API_KEY')->get('Character Name');
// => { name: "Hello", race: "Human", … }

/v2/characters/:id/backstory

\GW2Treasures\GW2Api\V2\Endpoint\Character\BackstoryEndpoint (source)

Implements 🔒AuthenticatedEndpoint.

Methods
  • get():array Gets the characters backstory.
Example
$api->characters('API_KEY')->backstoryOf('Character Name')->get();
// => [ "26-122", "27-125", … ]

/v2/characters/:id/core

\GW2Treasures\GW2Api\V2\Endpoint\Character\CoreEndpoint (source)

Implements 🔒AuthenticatedEndpoint.

Methods
  • get():array Gets the core information of a character.
Example
$api->characters('API_KEY')->coreOf('Character Name')->get();
// => { name: "Test Char", race: "Norn", gender: "Female", … }

/v2/characters/:id/crafting

\GW2Treasures\GW2Api\V2\Endpoint\Character\CraftingEndpoint (source)

Implements 🔒AuthenticatedEndpoint.

Methods
  • get():array Get the crafting information of a character.
Example
$api->characters('API_KEY')->craftingOf('Character Name')->get();
// => [ { discipline: "Tailor", rating: 400, active: true }, … ]

/v2/characters/:id/equipment

\GW2Treasures\GW2Api\V2\Endpoint\Character\EquipmentEndpoint (source)

Implements 🔒AuthenticatedEndpoint.

Methods
  • get():array Gets the characters equipment.
Example
$api->characters('API_KEY')->equipmentOf('Character Name')->get();
// => [ { id: 6472, slot: "Coat" }, … ]

/v2/characters/:id/heropoints

\GW2Treasures\GW2Api\V2\Endpoint\Character\HeropointEndpoint (source)

Implements 🔒AuthenticatedEndpoint.

Methods
  • get():array Gets the characters heropoints.
Example
$api->characters('API_KEY')->heropointsOf('Character Name')->get();
// => [ "0-3", "0-4", "0-5", "0-6", "0-8", … ]

/v2/characters/:id/inventory

\GW2Treasures\GW2Api\V2\Endpoint\Character\InventoryEndpoint (source)

Implements 🔒AuthenticatedEndpoint.

Methods
  • get():array Gets the characters inventory.
Example
$api->characters('API_KEY')->inventoryOf('Character Name')->get();
// => [ { id: 8941, size: 4 inventory: [ null, { id: 32134, count: 1 }, … ] }, … ]

/v2/characters/:id/recipes

\GW2Treasures\GW2Api\V2\Endpoint\Character\RecipeEndpoint (source)

Implements 🔒AuthenticatedEndpoint.

Methods
  • get():array Get unlocked recipes of a character.
Example
$api->characters('API_KEY')->recipesOf('Character Name')->get();
// => [ 7, 8, 9, 10, 11, … ]

/v2/characters/:id/skills

\GW2Treasures\GW2Api\V2\Endpoint\Character\SkillEndpoint (source)

Implements 🔒AuthenticatedEndpoint.

Methods
  • get():array Gets the characters skills.
Example
$api->characters('API_KEY')->skillsOf('Character Name')->get();
// => { pve: { heal: 5503, utilities: [ 5641, 5734, 5502 ], elite: 5666 }, … }

/v2/characters/:id/specializations

\GW2Treasures\GW2Api\V2\Endpoint\Character\SpecializationEndpoint (source)

Implements 🔒AuthenticatedEndpoint.

Methods
  • get():array Gets the characters specializations.
Example
$api->characters('API_KEY')->specializationsOf('Character Name')->get();
// => { pve: [ { id: 41, traits: [232, 214, 226] }, … ], … }

/v2/characters/:id/training

\GW2Treasures\GW2Api\V2\Endpoint\Character\TrainingEndpoint (source)

Implements 🔒AuthenticatedEndpoint.

Methods
  • get():array Gets the characters trainings.
Example
$api->characters('API_KEY')->trainingOf('Character Name')->get();
// => [ { id: 111, spent: 24, done: true }, … ]

/v2/colors

\GW2Treasures\GW2Api\V2\Endpoint\Color\ColorEndpoint (source)

Implements 📦BulkEndpoint and 🌏LocalizedEndpoint.

Methods
Example
$api->colors()->lang('de')->all();
// => [ { id: 1, name: "Farbentferner", base_rgb: [128,26,26], … }, … ]

/v2/commerce/exchange

\GW2Treasures\GW2Api\V2\Endpoint\Commerce\ExchangeEndpoint (source)

Methods
  • gems(int $quantity):mixed Current gem to coins exchange rate.
  • coins(int $quantity):mixed Current coins to gems exchange rate.
Example
$api->commerce()->exchange()->gems(50);
// => { coins_per_gem: 1211, quantity: 60579 }

/v2/commerce/listings

\GW2Treasures\GW2Api\V2\Endpoint\Commerce\ListingEndpoint (source)

Implements 📦BulkEndpoint.

Methods
Example
$api->commerce()->listings()->get(24);
// => { id: 24, buys: [ { listings: 1, unit_price: 186, quantity: 250 }, … ] }

/v2/commerce/prices

\GW2Treasures\GW2Api\V2\Endpoint\Commerce\PriceEndpoint (source)

Implements 📦BulkEndpoint.

Methods
Example
$api->commerce()->prices()->get(24);
// => { id: 24, buys: { quantity: 20854, unit_price: 186 }, sells: { quantity: 9787, unit_price: 340 } }

/v2/commerce/transactions

\GW2Treasures\GW2Api\V2\Endpoint\Commerce\Transaction\TransactionEndpoint (source)

Implements 🔒AuthenticatedEndpoint.

Methods

/v2/commerce/transactions/:type

\GW2Treasures\GW2Api\V2\Endpoint\Commerce\Transaction\TypeEndpoint (source)

Implements 🔒AuthenticatedEndpoint.

Methods

/v2/commerce/transactions/:type/:list

\GW2Treasures\GW2Api\V2\Endpoint\Commerce\Transaction\ListEndpoint (source)

Implements 🔒AuthenticatedEndpoint and 📄PaginatedEndpoint.

Methods
Example
$api->commerce()->transactions('API_KEY')->current()->sells()->all();
// => [ { id: 1999, item_id: 19699, price: 1004, quantity: 20, created: "2014-12-15T14:43:36+00:00" }, … ]

/v2/continents

\GW2Treasures\GW2Api\V2\Endpoint\Continent\ContinentEndpoint (source)

Implements 📦BulkEndpoint and 🌏LocalizedEndpoint.

Methods
Example
$api->continents()->get(1);
// => { name: "Tyria", … }

/v2/currencies

\GW2Treasures\GW2Api\V2\Endpoint\Currency\CurrencyEndpoint (source)

Implements 📦BulkEndpoint and 🌏LocalizedEndpoint.

Methods
Example
$api->currencies()->get(1);
// => { id: 1, name: "Coin", … }

/v2/continents/:id/floors

\GW2Treasures\GW2Api\V2\Endpoint\Continent\FloorEndpoint (source)

Implements 📦BulkEndpoint.

Methods
Example
$api->continents()->floorsOf(1)->get(0);
// => { texture_dims: [ 32768, 32768 ], … }

/v2/emblem

\GW2Treasures\GW2Api\V2\Endpoint\Emblem\EmblemEndpoint (source)

Methods
  • backgrounds():Emblem\LayerEndpoint Gets a new Emblem\LayerEndpoint instance of all background layers.
  • foregrounds():Emblem\LayerEndpoint Gets a new Emblem\LayerEndpoint instance of all foreground layers.

/v2/emblem/:type

\GW2Treasures\GW2Api\V2\Endpoint\Emblem\LayerEndpoint (source)

Implements 📦BulkEndpoint.

Methods
Example
$api->emblem()->foregrounds()->get(1);
// => { id: 1, layers: [ "59641.png", "59643.png", "59645.png" ] }

/v2/files

\GW2Treasures\GW2Api\V2\Endpoint\File\FileEndpoint (source)

Implements 📦BulkEndpoint.

Methods
Example
$api->files()->ids();
// => [ "map_complete", "map_dungeon", … ]

/v2/finishers

\GW2Treasures\GW2Api\V2\Endpoint\Finisher\FinisherEndpoint (source)

Implements 📦BulkEndpoint and 🌏LocalizedEndpoint.

Methods
Example
$api->finishers()->get();
// => { id:1, name: "Rabbit Rank Finisher", … }

/v2/guild/:id

\GW2Treasures\GW2Api\V2\Endpoint\Guild\DetailsEndpoint (source)

Implements 🔒AuthenticatedEndpoint. The API key is optional.

Methods
Example
$api->guild()->detailsOf('GUILD_ID');
// => { id: "GUILD_ID", name: "Test Guild", tag: "API", … }

$api->guild()->detailsOf('GUILD_ID', 'API_KEY');
// => { level: 42, motd: "gw2treasures.com\n", id: "GUILD_ID", name: "Test Guild", tag: "API", … }

/v2/guild/:id/log

\GW2Treasures\GW2Api\V2\Endpoint\Guild\Authenticated\LogEndpoint (source)

Implements 🔒AuthenticatedEndpoint and RestrictedGuildEndpoint.

Methods
Example
$api->guild()->logOf('API_KEY', 'GUILD_ID');
// => [ { id: 1190, time: "…", type: "treasury", user: "Lawton Campbell.9413", … }, … ]

/v2/guild/:id/members

\GW2Treasures\GW2Api\V2\Endpoint\Guild\Authenticated\MemberEndpoint (source)

Implements 🔒AuthenticatedEndpoint and RestrictedGuildEndpoint.

Methods
Example
$api->guild()->membersOf('API_KEY', 'GUILD_ID');
// => [ { name: "darthmaim.6017", rank: "Leader", joined: "2015-12-16T02:50:26.000Z" } ]

/v2/guild/:id/ranks

\GW2Treasures\GW2Api\V2\Endpoint\Guild\Authenticated\RankEndpoint (source)

Implements 🔒AuthenticatedEndpoint and RestrictedGuildEndpoint.

Methods
Example
$api->guild()->ranksOf('API_KEY', 'GUILD_ID');
// => [ { id: "Leader", order: 1, permissions: [ "Admin", … ], icon: "…" }, … ]

/v2/guild/:id/stash

\GW2Treasures\GW2Api\V2\Endpoint\Guild\Authenticated\StashEndpoint (source)

Implements 🔒AuthenticatedEndpoint and RestrictedGuildEndpoint.

Methods
Example
$api->guild()->stashOf('API_KEY', 'GUILD_ID')->get();
// => [ { upgrade_id: 1, size: 100, coins: 1002, note: "stash test", inventory: [] } ]

/v2/guild/:id/teams

\GW2Treasures\GW2Api\V2\Endpoint\Guild\Authenticated\TeamEndpoint (source)

Implements 🔒AuthenticatedEndpoint and RestrictedGuildEndpoint.

Methods
Example
$api->guild()->teamsOf('API_KEY', 'GUILD_ID')->get();
// => [ { id: 1, members: [], name: "ez game" } ]

/v2/guild/:id/treasury

\GW2Treasures\GW2Api\V2\Endpoint\Guild\Authenticated\TreasuryEndpoint (source)

Implements 🔒AuthenticatedEndpoint and RestrictedGuildEndpoint.

Methods
Example
$api->guild()->treasuryOf('API_KEY', 'GUILD_ID')->get();
// => [ { id: 123, count: 100, needed_by: [] } ]

/v2/guild/:id/upgrades

\GW2Treasures\GW2Api\V2\Endpoint\Guild\Authenticated\UpgradeEndpoint (source)

Implements 🔒AuthenticatedEndpoint and RestrictedGuildEndpoint.

Methods
Example
$api->guild()->upgradesOf('API_KEY', 'GUILD_ID')->get();
// => [ 38, 43, 44, 51, 55, … ]

/v2/guild/permissions

\GW2Treasures\GW2Api\V2\Endpoint\Guild\PermissionEndpoint (source)

Implements 📦BulkEndpoint and 🌏LocalizedEndpoint.

Methods
Example
$api->guild()->permissions()->ids();
// => [ "ClaimableEditOptions", "EditBGM", "ActivatePlaceables", … ]

/v2/guild/upgrades

\GW2Treasures\GW2Api\V2\Endpoint\Guild\UpgradeEndpoint (source)

Implements 📦BulkEndpoint and 🌏LocalizedEndpoint.

Methods
Example
$api->guild()->upgrades()->get(38);
// => { id: 38, name: "Guild Armorer 1", … }

/v2/home/cats

\GW2Treasures\GW2Api\V2\Endpoint\Home\CatEndpoint (source)

Implements 📦BulkEndpoint.

Methods
Example
$api->home()->cats()->get('1');
// => { id: 1, hint: "chicken", … }

/v2/home/nodes

\GW2Treasures\GW2Api\V2\Endpoint\Home\NodeEndpoint (source)

Implements 📦BulkEndpoint.

Methods
Example
$api->mounts()->skins()->ids();
// => [ "advanced_cloth_rack", "advanced_leather_rack", … ]

/v2/items

\GW2Treasures\GW2Api\V2\Endpoint\Item\ItemEndpoint (source)

Implements 📦BulkEndpoint and 🌏LocalizedEndpoint.

Methods
Example
$api->items()->ids();
// => [ 1, 2, 6, 11, 24, … ]

/v2/itemstats

\GW2Treasures\GW2Api\V2\Endpoint\Itemstat\ItemstatEndpoint (source)

Implements 📦BulkEndpoint and 🌏LocalizedEndpoint.

Methods
Example
$api->itemstats()->get(137);
// => { id: 137, name: "Mighty", attributes: { Power: 0.35 } }

/v2/legends

\GW2Treasures\GW2Api\V2\Endpoint\Legend\LegendEndpoint (source)

Implements 📦BulkEndpoint and 🌏LocalizedEndpoint.

Methods
Example
$api->legends()->get('Legend1');
// => { id: "Legend1", swap: 28229, heal: 27220, … }

/v2/maps

\GW2Treasures\GW2Api\V2\Endpoint\Map\MapEndpoint (source)

Implements 📦BulkEndpoint and 🌏LocalizedEndpoint.

Methods
Example
$api->maps()->get(15);
// => { id: 15, name: "Queensdale", … }

/v2/masteries

\GW2Treasures\GW2Api\V2\Endpoint\Mastery\MasteryEndpoint (source)

Implements 📦BulkEndpoint and 🌏LocalizedEndpoint.

Methods
Example
$api->masteries()->get(15);
// => { id: 1, name: "Exalted Lore", … }

/v2/materials

\GW2Treasures\GW2Api\V2\Endpoint\Material\MaterialEndpoint (source)

Implements 📦BulkEndpoint and 🌏LocalizedEndpoint.

Methods
Example
$api->materials()->lang('es')->all();
// => [ { id:5, name: "Materiales de cocina", items: [ 12134, … ] }, … ]

/v2/minis

\GW2Treasures\GW2Api\V2\Endpoint\Mini\MiniEndpoint (source)

Implements 📦BulkEndpoint and 🌏LocalizedEndpoint.

Methods
Example
$api->minis()->get(1);
// => { id: 1, name: "Miniature Rytlock", … }

/v2/mounts/types

\GW2Treasures\GW2Api\V2\Endpoint\Mount\TypeEndpoint (source)

Implements 📦BulkEndpoint and 🌏LocalizedEndpoint.

Methods
Example
$api->mounts()->types()->get('raptor');
// => { id: "raptor", name: "Raptor", … }

/v2/mounts/skins

\GW2Treasures\GW2Api\V2\Endpoint\Mount\SkinEndpoint (source)

Implements 📦BulkEndpoint and 🌏LocalizedEndpoint.

Methods
Example
$api->mounts()->skins()->get(1);
// => { id: 1, mount: "raptor", … }

/v2/novelties

\GW2Treasures\GW2Api\V2\Endpoint\Novelty\NoveltyEndpoint (source)

Implements 📦BulkEndpoint and 🌏LocalizedEndpoint.

Methods
Example
$api->novelties()->get(1);
// => { id: 1, name: "Embellished Kite", … }

/v2/outfits

\GW2Treasures\GW2Api\V2\Endpoint\Outfit\OutfitEndpoint (source)

Implements 📦BulkEndpoint and 🌏LocalizedEndpoint.

Methods
Example
$api->outfits()->get(1);
// => { id: 1, name: "Cook's Outfit", … }

/v2/pets

\GW2Treasures\GW2Api\V2\Endpoint\Pet\PetEndpoint (source)

Implements 📦BulkEndpoint and 🌏LocalizedEndpoint.

Methods
Example
$api->pets()->get(1);
// => { id: 1, name: "Juvenile Jungle Stalker", … }

/v2/professions

\GW2Treasures\GW2Api\V2\Endpoint\Profession\ProfessionEndpoint (source)

Implements 📦BulkEndpoint and 🌏LocalizedEndpoint.

Methods
Example
$api->professions()->get('Warrior');
// => { id: "Warrior", name: "Warrior", … }

/v2/pvp/amulets

\GW2Treasures\GW2Api\V2\Endpoint\Pvp\AmuletEndpoint (source)

Implements 📦BulkEndpoint and 🌏LocalizedEndpoint.

Methods
Example
$api->pvp()->amulets()->get(4);
// => { id: 4, name: "Assassin Amulet", … }

/v2/pvp/games

\GW2Treasures\GW2Api\V2\Endpoint\Pvp\GameEndpoint (source)

Implements 🔒AuthenticatedEndpoint and 📦BulkEndpoint.

Methods
Example
$api->pvp('API_KEY')->games()->get('A9F9FD97-F114-4F97-B2CA-5E814DF0340E');
// => { id: "A9F9FD97-F114-4F97-B2CA-5E814DF0340E", map_id: 795, … }

/v2/pvp/seasons

\GW2Treasures\GW2Api\V2\Endpoint\Pvp\SeasonEndpoint (source)

Implements 📦BulkEndpoint and 🌏LocalizedEndpoint.

Methods
Example
$api->pvp()->seasons()->get('44B85826-B5ED-4890-8C77-82DDF9F2CF2B');
// => { id: "44B85826-B5ED-4890-8C77-82DDF9F2CF2B", name: "PvP League Season One", … }

/v2/pvp/standings

\GW2Treasures\GW2Api\V2\Endpoint\Pvp\StandingEndpoint (source)

Implements 🔒AuthenticatedEndpoint.

Methods
  • get():mixed Get pvp standings.
Example
$api->pvp()->standings('API-KEY')->get();
// => [{ current: { total_points: 101, … }, best: { total_points: 200, … }, … }]

/v2/pvp/stats

\GW2Treasures\GW2Api\V2\Endpoint\Pvp\StatsEndpoint (source)

Implements 🔒AuthenticatedEndpoint.

Methods
  • get():mixed Get pvp stats.
Example
$api->pvp('API_KEY')->stats()->get();
// => { pvp_rank: 57, aggregate: { wins: 343, … }, … }

/v2/quaggans

\GW2Treasures\GW2Api\V2\Endpoint\Quaggan\QuagganEndpoint (source)

Implements 📦BulkEndpoint.

Methods
Example
$api->quaggans()->many(['cheer', 'party']);
// => [ { id: "cheer", url: "cheer.jpg" }, { id: "party", url: "party.jpg" } ]

/v2/recipes

\GW2Treasures\GW2Api\V2\Endpoint\Recipe\RecipeEndpoint (source)

Implements 📦BulkEndpoint.

Methods
Example
$api->recipes()->ids();
// => [ 1, 2, 3, 4, 5, … ]

/v2/recipes/search

\GW2Treasures\GW2Api\V2\Endpoint\Recipe\SearchEndpoint (source)

Methods
  • input(int $id):mixed Searches for recipes with $id as ingredient.
  • output(int $id):mixed Searches for recipes with $id as output.
Example
$api->recipes()->search()->input(43775);
// => [ 7259, 7260, 7261, 7262, … ]

/v2/skills

\GW2Treasures\GW2Api\V2\Endpoint\Skill\SkillEndpoint (source)

Implements 📦BulkEndpoint and 🌏LocalizedEndpoint.

Methods
Example
$api->skills()->get(1);
// => { name: "Bandage", facts: [ { text: "Recharge", type: "Recharge", icon: "…", value: 5 } ], … }

/v2/skins

\GW2Treasures\GW2Api\V2\Endpoint\Skin\SkinEndpoint (source)

Implements 📦BulkEndpoint and 🌏LocalizedEndpoint.

Methods
Example
$api->skins()->get(1);
// => { name: "Chainmail Leggings", type: "Armor", … }

/v2/specializations

\GW2Treasures\GW2Api\V2\Endpoint\Specialization\SpecializationEndpoint (source)

Implements 📦BulkEndpoint and 🌏LocalizedEndpoint.

Methods
Example
$api->specializations()->get(1);
// => { id: 1, name: "Dueling", profession: "Mesmer", … }

/v2/titles

\GW2Treasures\GW2Api\V2\Endpoint\Title\TitleEndpoint (source)

Implements 📦BulkEndpoint and 🌏LocalizedEndpoint.

Methods
Example
$api->titles()->get(1);
// => { id: 1, name: "Traveler", achievement: 111 }

/v2/stories

\GW2Treasures\GW2Api\V2\Endpoint\Story\StoryEndpoint (source)

Implements 📦BulkEndpoint and 🌏LocalizedEndpoint.

Methods
Example
$api->stories()->get(1);
// => { id: 1, season: "215AAA0F-CDAC-4F93-86DA-C155A99B5784", name: "My Story", … }

/v2/stories/seasons

\GW2Treasures\GW2Api\V2\Endpoint\Story\SeasonEndpoint (source)

Implements 📦BulkEndpoint and 🌏LocalizedEndpoint.

Methods
Example
$api->stories()->seasons()->get('215AAA0F-CDAC-4F93-86DA-C155A99B5784');
// => { id: "215AAA0F-CDAC-4F93-86DA-C155A99B5784", name: "My Story", … }

/v2/titles

\GW2Treasures\GW2Api\V2\Endpoint\Title\TitleEndpoint (source)

Implements 📦BulkEndpoint and 🌏LocalizedEndpoint.

Methods
Example
$api->titles()->get(1);
// => { id: 1, name: "Traveler", achievement: 111 }

/v2/tokeninfo

\GW2Treasures\GW2Api\V2\Endpoint\Tokeninfo\TokeninfoEndpoint (source)

Implements 🔒AuthenticatedEndpoint.

Methods
  • get():mixed Get info about the used api key.
Example
$api->tokeninfo('API_KEY')->get();
// => { id: "API_KEY", name: "key name", permissions: [ "account", … ] }

/v2/traits

\GW2Treasures\GW2Api\V2\Endpoint\Traits\TraitEndpoint (source)

Implements 📦BulkEndpoint and 🌏LocalizedEndpoint.

Methods
Example
$api->traits()->get(214);
// => { id: 214, tier:2, name: "Aeromancer's Training", … }

/v2/worlds

\GW2Treasures\GW2Api\V2\Endpoint\World\WorldEndpoint (source)

Implements 📦BulkEndpoint and 🌏LocalizedEndpoint.

Methods
Example
$api->worlds()->all();
// => [ { id: 1001, name: "Anvil Rock" }, … ]

/v2/wvw/abilities

\GW2Treasures\GW2Api\V2\Endpoint\WvW\AbilityEndpoint (source)

Implements 📦BulkEndpoint and 🌏LocalizedEndpoint.

Methods
Example
$api->wvw()->abilities()->get(2);
// => { id: 2, name: "Guard Killer", … }

/v2/wvw/matches

\GW2Treasures\GW2Api\V2\Endpoint\WvW\MatchEndpoint (source)

Implements 📦BulkEndpoint.

Methods
  • Inherited methods from 📦BulkEndpoint
  • world(int $id):mixed Get the current match of a world.
Example
$api->wvw()->matches()->get('2-6');

// => { id: "2-6", "scores": { red: 169331, blue: 246780, green: 216241 }, … }

/v2/wvw/objectives

\GW2Treasures\GW2Api\V2\Endpoint\WvW\ObjectiveEndpoint (source)

Implements 📦BulkEndpoint and 🌏LocalizedEndpoint.

Methods
Example
$api->wvw()->objectives()->get('968-98');

// => { id: "968-98", name: "Wurm Tunnel", … }

License

MIT © 2015 gw2treasures.com