Developer_API
Old: ChuanHsing 2023-01-05 09:40:40
New: ChuanHsing 2023-01-05 10:11:53
| Old | New | Differences | |
|---|---|---|---|
| 1 | - | # | |
| 1 | + | # Developer API | |
| 2 | 2 | ||
| 3 | + | There are 2 api sets, POESESSID and OAuth 2.0. | |
| 3 | 4 | ||
| 5 | + | ## POESESSID | |
| 4 | 6 | ||
| 5 | - | ## Information Resources | |
| 7 | + | One works with http cookie header, that used by official site. You can use Chrome browser in Dev Tool (Press F12), click the `Network` tab, click `Fetch/XHR` filter to see how the API used. But note that this api is not officially supported and no documentation. | |
| 8 | + | ||
| 9 | + | ### Find the POESESSID in Chrome or Edge | |
| 10 | + | ||
| 11 | + | **Strongly recommend extreme caution with the use of your POESESSID, as providing that information to anyone else may put your account access at risk.** | |
| 12 | + | ||
| 13 | + | * Login to pathofexile.com | |
| 14 | + | * Press F12 to open the Dev Tool | |
| 15 | + | * Click the Application tab | |
| 16 | + | * Expand the Cookies dropdown and select pathofexile.com | |
| 17 | + | * Double click the POESESSID Value and copy | |
| 18 | + | ||
| 19 | + |  | |
| 20 | + | ||
| 21 | + | ## OAuth 2.0 | |
| 22 | + | ||
| 23 | + | To improve the security of POESESSID. This one only works with OAuth 2.0 and have official support and [official documents](https://www.pathofexile.com/developer/docs). | |
| 24 | + | ||
| 25 | + | GGG strongly recommend tool to use OAuth 2.0, but you need a distinct server hosted from your client to do the OAuth thing. | |
| 26 | + | ||
| 27 | + | * You set that up by contacting the `oauth@` email address with the details they desire. | |
| 28 | + | * Your project need to have a secure server that runs the whole OAuth dispatching stuff for your clients as you can't have any of that running client-side, clients need to do the auth procedure to bounce via the GGG OAuth sign-in system to grant your application rights. | |
| 29 | + | * You will receive a email how to setup the OAuth with `client_id` and `client_secret` | |
| 30 | + | ||
| 31 | + | ### Summary of OAuth 2.0 | |
| 32 | + | ||
| 33 | + | * Set a page to redirect to `https://www.pathofexile.com/oauth/authorize?client_id={client_id}&response_type=code&scope={scope}&state={state}&redirect_uri={redirect_uri}` | |
| 34 | + | * User confirmed the privilege and redirect_uri with `code` | |
| 35 | + | * Server use `https://www.pathofexile.com/oauth/token?grant_type=authorization_code&code={code}&client_id={client_id}&client_secret={client_secret}&redirect_uri={redirect_uri}` to verify the returned code and get `access_token` | |
| 36 | + | * Access the scope endpoint, ex: `/api/profile` with `User-Agent` header and `access_token` | |
| 37 | + | ||
| 38 | + |  | |
| 39 | + | ||
| 40 | + | ## Public stash API | |
| 41 | + | ||
| 42 | + | [Public stash API](https://www.pathofexile.com/developer/docs/reference#publicstashes) doesn't contain any historical data and always returns the current state of stash tabs. Using ajax from a browser got blocked by CORS, you need to setup a basic proxy to fetch it. | |
| 43 | + | ||
| 44 | + | Every request will return a `next_change_id` and put it on next `id=` parameter. You will fetch the Json by sequence, for example | |
| 45 | + | ``` | |
| 46 | + | http://www.pathofexile.com/api/public-stash-tabs | |
| 47 | + | http://www.pathofexile.com/api/public-stash-tabs?id=342209785-336957592-338826328 | |
| 48 | + | http://www.pathofexile.com/api/public-stash-tabs?id=342209792-336957596-338826330 | |
| 49 | + | http://www.pathofexile.com/api/public-stash-tabs?id=342209797-336957599-338826336 | |
| 50 | + | ``` | |
| 51 | + | ||
| 52 | + | Using deflate parameter in request header will save a lot of traffic. | |
| 53 | + | ||
| 54 | + | ### Rate Limit | |
| 55 | + | ||
| 56 | + | Be aware there is a [rate limit](https://www.pathofexile.com/forum/view-thread/2079853#p15244273). | |
| 57 | + | ||
| 58 | + | ``` | |
| 59 | + | curl -XGET -s -D - http://www.pathofexile.com/api/public-stash-tabs | grep -i 'x-rate-limit' | |
| 60 | + | ``` | |
| 61 | + | ||
| 62 | + | ### Next change id | |
| 63 | + | ||
| 64 | + | You can get latest change id at https://poe.ninja/stats | |
| 65 | + | ||
| 66 | + | ## Official Trade Search | |
| 67 | + | ||
| 68 | + | You can use Chrome, Press F12 into dev tool, choose Network tab, and enable Fetch/XHR filter. | |
| 69 | + | ||
| 70 | + | ### Fetch league endpoint and get id, item_ids | |
| 71 | + | ||
| 72 | + | Endpoint: `https://www.pathofexile.com/api/trade/search/Sentinel`, POST JSON to or GET ?q=JSON | |
| 73 | + | ``` | |
| 74 | + | { | |
| 75 | + | "query":{ | |
| 76 | + | "status":{ | |
| 77 | + | "option":"online" | |
| 78 | + | }, | |
| 79 | + | "stats":[ | |
| 80 | + | { | |
| 81 | + | "type":"and", | |
| 82 | + | "filters":[ | |
| 83 | + | { | |
| 84 | + | "id":"explicit.stat_3299347043", | |
| 85 | + | "value":{ | |
| 86 | + | "min":100 | |
| 87 | + | }, | |
| 88 | + | "disabled":false | |
| 89 | + | } | |
| 90 | + | ] | |
| 91 | + | } | |
| 92 | + | ], | |
| 93 | + | "filters":{ | |
| 94 | + | "type_filters":{ | |
| 95 | + | "filters":{ | |
| 96 | + | "category":{ | |
| 97 | + | "option":"accessory.belt" | |
| 98 | + | }, | |
| 99 | + | "rarity":{ | |
| 100 | + | "option":"rare" | |
| 101 | + | } | |
| 102 | + | } | |
| 103 | + | }, | |
| 104 | + | "misc_filters":{ | |
| 105 | + | "filters":{ | |
| 106 | + | "ilvl":{ | |
| 107 | + | "min":85 | |
| 108 | + | }, | |
| 109 | + | "corrupted":{ | |
| 110 | + | "option":"false" | |
| 111 | + | } | |
| 112 | + | } | |
| 113 | + | } | |
| 114 | + | } | |
| 115 | + | }, | |
| 116 | + | "sort":{ | |
| 117 | + | "price":"asc" | |
| 118 | + | } | |
| 119 | + | } | |
| 120 | + | ``` | |
| 121 | + | ||
| 122 | + | Got return | |
| 123 | + | ||
| 124 | + | ``` | |
| 125 | + | { | |
| 126 | + | "id":"OQMzdqQUE", | |
| 127 | + | "complexity":11, | |
| 128 | + | "result":[ | |
| 129 | + | "c66708d98d350298186753096dbe9bed7dedbcd6d02d740e32b161c0c5d0c49d", | |
| 130 | + | "b56bcae791c0ecad463fafed58722fcbf6fd6c501066fb80700289d8507acd3c", | |
| 131 | + | "62e432ab385a23c62f05484061be15d557b66bc4cff42e549e90031f0ceb0723", | |
| 132 | + | ... | |
| 133 | + | ], | |
| 134 | + | "total":258 | |
| 135 | + | } | |
| 136 | + | ``` | |
| 137 | + | ||
| 138 | + | ### Fetch items | |
| 139 | + | ||
| 140 | + | GET the items by endpoint `https://www.pathofexile.com/api/trade/fetch/` and the items are separated with `,`. ex: | |
| 141 | + | ``` | |
| 142 | + | https://www.pathofexile.com/api/trade/fetch/{item_id1},{item_id2}?query=OQMzdqQUE | |
| 143 | + | ``` | |
| 144 | + | ||
| 145 | + | ## Ladder API | |
| 146 | + | ||
| 147 | + | Each ladder only contains the top 15000 entries. | |
| 148 | + | ||
| 149 | + | endpoint | per page | description | |
| 150 | + | - | - | - | |
| 151 | + | /api/ladders/{league} | 200 | | |
| 152 | + | /ladder/export-csv/league/{league} | 2000 | csv output | |
| 153 | + | /api/league/{league}/ladder | 500 | OAuth 2.0 API, have sort function | |
| 154 | + | ||
| 155 | + | ## Data Export | |
| 156 | + | ||
| 157 | + | The game data does not have any official API, and only possible data can be analyzed from the game files. | |
| 158 | + | ||
| 159 | + | Almost all data is stored in [.dat](https://zao.github.io/poe-doc/dat.html) files within Content.ggpk. But they only have data, no headers. You can start with the .dat format, the [PoE dat schema](https://github.com/poe-tool-dev/dat-schema) project is the latest format. Or try to parse the .dat format from [PoE Dat Viewer](https://snosme.github.io/poe-dat-viewer/) yourself. [RePoE](https://github.com/brather1ng/RePoE/) collects many common and processed .dat files and exports them to .json format. | |
| 6 | 160 | ||
| 7 | 161 | Site | Description | |
| 8 | 162 | - | - | |
| 9 | - | [PoEDB](https://poedb.tw/us/) | Database and index for information from the ggpk | |
| 10 | - | [Developer API](Developer_API) | | |
| 11 | - | [PoE Community Wiki](https://www.poewiki.net/) | Community fan wiki | |
| 12 | - | [Daily Labyrinth Layouts](http://www.poelab.com/) | Labyrinth Layouts are updated daily by a team of runners | |
| 163 | + | [PyPoE](https://github.com/Project-Path-of-Exile-Wiki/PyPoE) | Collection of Python Tools for Path of Exile, mostly used by wiki | |
| 164 | + | [RePoE](https://github.com/brather1ng/RePoE/) | Repository of Path of Exile resources for tool developers. | |
| 165 | + | [Poe Dat Viewer](https://snosme.github.io/poe-dat-viewer/) | Web-base Poe Dat Viewer | |
| 166 | + | [PoE dat schema](https://github.com/poe-tool-dev/dat-schema) | Source of truth schema for dat files. | |
| 167 | + | [LibGGPK2](https://github.com/aianlinb/LibGGPK2) | Windows GUI tool to view Content.ggpk and export | |
| 13 | 168 | ||
| 14 | - | ## Character Builds and Planners | |
| 169 | + | ||
| 170 | + | ## Passive Skill Tree | |
| 171 | + | ||
| 172 | + | Extra reference: https://www.pathofexile.com/developer/docs/reference#extra | |
| 173 | + | ||
| 174 | + | ``` | |
| 175 | + | class PassiveUrl | |
| 176 | + | { | |
| 177 | + | public function test() | |
| 178 | + | { | |
| 179 | + | return $this->toArray('https://www.pathofexile.com/fullscreen-passive-skill-tree/3.20.1/AAAABgMADQQHES0fAiycLR9Ms18qg_eOvpLBz8TfsOvkAAELVs_E'); | |
| 180 | + | } | |
| 181 | + | ||
| 182 | + | public function toArray(string $url): array | |
| 183 | + | { | |
| 184 | + | $burl = $this->base64url_decode($this->strip_burl($url)); | |
| 185 | + | $tree = unpack("Nversion/Cclass/Cascendancy/Cn", $burl); | |
| 186 | + | $burl = substr($burl, 7); | |
| 187 | + | $tree['hashes'] = unpack("n".$tree['n'], substr($burl, 0, $tree['n']*2)); | |
| 188 | + | if ($tree['version'] != 6) { | |
| 189 | + | return $tree; | |
| 190 | + | } | |
| 191 | + | $burl = substr($burl, $tree['n']*2); | |
| 192 | + | // extended hashes | |
| 193 | + | $tree['m'] = unpack("Cm", substr($burl, 0, 1))['m']; | |
| 194 | + | $burl = substr($burl, 1); | |
| 195 | + | if ($tree['m']) { | |
| 196 | + | $tree['extended_hashes'] = unpack("n".$tree['m'], substr($burl, 0, $tree['m']*2)); | |
| 197 | + | $burl = substr($burl, $tree['m']*2); | |
| 198 | + | } | |
| 199 | + | // mastery effect pairs | |
| 200 | + | $tree['o'] = unpack("Co", substr($burl, 0, 1))['o']; | |
| 201 | + | $burl = substr($burl, 1); | |
| 202 | + | if ($tree['o']) { | |
| 203 | + | $tree['mastery_effect_pairs'] = unpack("N".$tree['o'], substr($burl, 0, $tree['o']*4)); | |
| 204 | + | foreach($tree['mastery_effect_pairs'] as $key => $pair) { | |
| 205 | + | $tree['mastery_effect_pairs'][$key] = [ | |
| 206 | + | 'nodeHash' => $pair & 0xffff, | |
| 207 | + | 'effectHash' => $pair >> 16, | |
| 208 | + | ]; | |
| 209 | + | } | |
| 210 | + | } | |
| 211 | + | return $tree; | |
| 212 | + | } | |
| 213 | + | ||
| 214 | + | private function base64url_encode($data) | |
| 215 | + | { | |
| 216 | + | return rtrim(strtr(base64_encode($data), '+/', '-_'), '='); | |
| 217 | + | } | |
| 218 | + | ||
| 219 | + | private function base64url_decode($data) | |
| 220 | + | { | |
| 221 | + | return base64_decode(strtr($data, '-_', '+/').str_repeat('=', 3-(3+strlen($data))%4)); | |
| 222 | + | } | |
| 223 | + | ||
| 224 | + | private function strip_burl($url) | |
| 225 | + | { | |
| 226 | + | return basename(parse_url($url, PHP_URL_PATH)); | |
| 227 | + | } | |
| 228 | + | } | |
| 229 | + | ``` | |
| 230 | + | ||
| 231 | + | Result: | |
| 232 | + | ``` | |
| 233 | + | { | |
| 234 | + | "version": 6, | |
| 235 | + | "class": 3, | |
| 236 | + | "ascendancy": 0, | |
| 237 | + | "n": 13, | |
| 238 | + | "hashes": { | |
| 239 | + | "1": 1031, | |
| 240 | + | "2": 4397, | |
| 241 | + | "3": 7938, | |
| 242 | + | "4": 11420, | |
| 243 | + | "5": 11551, | |
| 244 | + | "6": 19635, | |
| 245 | + | "7": 24362, | |
| 246 | + | "8": 33783, | |
| 247 | + | "9": 36542, | |
| 248 | + | "10": 37569, | |
| 249 | + | "11": 53188, | |
| 250 | + | "12": 57264, | |
| 251 | + | "13": 60388 | |
| 252 | + | }, | |
| 253 | + | "m": 0, | |
| 254 | + | "o": 1, | |
| 255 | + | "mastery_effect_pairs": { | |
| 256 | + | "1": { | |
| 257 | + | "nodeHash": 53188, | |
| 258 | + | "effectHash": 2902 | |
| 259 | + | } | |
| 260 | + | } | |
| 261 | + | } | |
| 262 | + | ``` | |
| 263 | + | ||
| 264 | + | hashes definition json: https://github.com/grindinggear/skilltree-export | |
| 265 | + | ||
| 266 | + | ## Development Tool | |
| 15 | 267 | ||
| 16 | 268 | Site | Description | |
| 17 | 269 | - | - | |
| 18 | - | [poe.ninja Builds](https://poe.ninja/challenge/builds) | An index of player and streamer character data in challenge and event leagues | |
| 19 | - | [Path of Building fork](https://github.com/PathOfBuildingCommunity/PathOfBuilding/) | A fork of the original Path of Building with more features, managed by the community | |
| 20 | - | [PoE Planner](http://poeplanner.com/) | An online build planner | |
| 21 | - | [PoESkillTree](https://github.com/PoESkillTree/PoESkillTree/) | An offline build planner | |
| 22 | - | [poebuilds.cc](https://www.poebuilds.cc/) | simple build aggregator | |
| 23 | - | [Mikelat's Mana Reserved Calculator](https://poe.mikelat.com) | A simple mana reserve calculator | |
| 24 | - | [PoE Build Browser](http://www.timtips.com/buildbrowser) | An index of forum builds | |
| 25 | - | ||
| 26 | - | ## Crafting Resources | |
| 27 | - | ||
| 28 | - | Site | Description | |
| 29 | - | - | - | |
| 30 | - | [Craft of Exile](https://www.craftofexile.com/) | Item crafting resource and simulator | |
| 31 | - | [Vorici Chromatic Calculator](http://siveran.github.io/calc.html) | Attempts to calculate the optimal use for your Chromatic Orbs. May not be fully accurate. | |
| 32 | - | ||
| 33 | - | ## Trading and Economy | |
| 34 | - | ||
| 35 | - | Site | Description | |
| 36 | - | - | - | |
| 37 | - | [Official Path of Exile Trade](https://www.pathofexile.com/trade) | PoE Shop Indexer | |
| 38 | - | [Better Trading Extension](https://chrome.google.com/webstore/detail/better-pathofexile-tradin/fhlinfpmdlijegjlpgedcmglkakaghnk) | Extension for Google Chrome that can save trade searches and improves trading interface among other features | |
| 39 | - | [poe.ninja](http://poe.ninja/) | A history graph of the price of items across leagues | |
| 40 | - | [PoE Antiquary](https://poe-antiquary.xyz/) | index of older league price data from poe.ninja | |
| 41 | - | [PoE Overlay](https://kyusung4698.github.io/PoE-Overlay/) | All-in-one macro and price checking tool. Requires installation of Overwolf. Has several additional features compared to the Community version. | |
| 42 | - | [PoE Overlay Community Fork](https://github.com/PoE-Overlay-Community/PoE-Overlay-Community-Fork/) | All-in-one macro and price checking tool, standalone community version. | |
| 43 | - | [Awakened PoE Trade](https://github.com/SnosMe/awakened-poe-trade/) | price checking tool | |
| 44 | - | [Menagerie](https://github.com/nomis51/Menagerie/) | A Path of Exile trade manager to simplify and speed up your trading experience, and much more! | |
| 45 | - | [PoE Lurker](https://github.com/C1rdec/Poe-Lurker/) | Compact trading manager and companion | |
| 46 | - | ||
| 47 | - | ## Filters | |
| 48 | - | ||
| 49 | - | Site | Description | |
| 50 | - | - | - | |
| 51 | - | [NeverSink.Filter](https://github.com/NeverSinkDev/NeverSink-Filter/releases) | NeverSink.Filter | |
| 52 | - | [FilterBlade](http://www.filterblade.xyz/) | Loot Filter Customizer | |
| 53 | - | [FilterBlast](https://filterblast.xyz) | Loot Filter Hub & Editor | |
| 54 | - | ||
| 55 | - | ||
| 56 | - | ## In-Game Tools | |
| 57 | - | ||
| 58 | - | Site | Description | |
| 59 | - | - | - | |
| 60 | - | [Lutbot Logout Macro](http://lutbot.com/) | A TCP disconnect logout macro with more optional functionality. Also integrated with the Trade Macro. | |
| 61 | - | [Exilence Next](https://github.com/viktorgullmark/exilence-next) | A progression and income tracker for you and your friends | |
| 62 | - | ||
| 63 | - | ## Hideouts | |
| 64 | - | ||
| 65 | - | Site | Description | |
| 66 | - | - | - | |
| 67 | - | [HideoutShowcase](https://hideoutshowcase.com/) | Hideouts import file database and calculator. Contains screenshots, videos, master level required, decorations needed, etc. | |
| 68 | - | ||
| 69 | - | ## Media | |
| 70 | - | ||
| 71 | - | Site | Description | |
| 72 | - | - | - | |
| 73 | - | [Developer Tracker](http://www.gggtracker.com/) | Tracks the post from GGG staff members on the official forums and reddit. | |
| 74 | - | [Reddit](https://www.reddit.com/r/pathofexile/) | A subreddit dedicated to Path of Exile | |
| 75 | - | ||
| 76 | - | ## Community | |
| 77 | - | ||
| 78 | - | Site | Description | |
| 79 | - | - | - | |
| 80 | - | [The Forbidden Trove Discord](https://discord.gg/zBpfweq) | Largest In-game trading Discord group | |
| 81 | - | [MF Academy](https://discord.gg/AUGEZM7e) | MF Academy Discord group | |
| 82 | - | ||
| 83 | - | ||
| 270 | + | [Tooldev Discord Channel](https://discord.gg/pathofexile) | #tooldev-general | |
| 271 | + | [PoE API](https://poedb.tw/us/poe-api) | PoEDB collections of official API | |
| 272 | + | [Official Website API](https://www.pathofexile.com/developer/docs) | OAuth 2.0 API endpoints of Path of Exile | |
| 273 | + | [Skilltree Typescript](https://github.com/EmmittJ/SkillTree_TypeScript) | Best reference for how Skilltree worked | |
| 274 | + | [PoeSharp](https://github.com/andreandersen/PoeSharp) | C# Library to deal with PoE stuff | |
| 275 | + | [PoE Format Specification](https://zao.github.io/poe-doc/) | Best book for the file formats used by Path of Exile. | |
| 276 | + | [PoE Go](https://github.com/ccbrown/poe-go) | an entry-level guide to writing tools for PoE in the Go programming language. |