-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
501 lines (462 loc) · 28.5 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
<!DOCTYPE html>
<!--[if lt IE 7 ]><html class="ie ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]><html class="ie ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]><html class="ie ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!-->
<html lang="en">
<!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<meta name="keywords" content="">
<title>PikaServe (pokemon-api) | Developer Documentation</title>
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">
<link rel="stylesheet" type="text/css" href="fonts/font-awesome-4.3.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="css/animate.css">
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="stylesheet" type="text/css" href="css/jquery.json-view.min.css">
<!-- CUSTOM -->
<link rel="stylesheet" type="text/css" href="css/custom.css">
<link rel="stylesheet" href="js/highlight/styles/atom-one-dark.css">
<script src="js/highlight/highlight.pack.js"></script>
<script>
hljs.initHighlightingOnLoad();
</script>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<header>
<img class="logo" src="https://raw.githubusercontent.com/Purukitto/pokemon-api/master/logo.png" alt="pokemon-api">
<nav>
<div class="theme-switch-wrapper">
<p><strong id="theme-text">Dark Mode _</strong></p>
<label class="theme-switch" for="checkbox">
<input type="checkbox" id="checkbox" />
<div class="slider round"></div>
</label>
</div>
<ul class="nav__links">
<li class="active"><a href=""><strong>Documentation</strong></a></li>
<!-- <li><a href="">Applet</a></li> -->
</ul>
</nav>
</header>
<div id="wrapper">
<div class="container">
<section id="top" class="section docs-heading">
<div class="row">
<div class="col-md-12">
<div class="big-title text-center">
<h1>PikaServe Wiki</h1>
<p class="lead">PikaServe (pokemon-api) 2.0.0</p>
</div>
<!-- end title -->
</div>
<!-- end 12 -->
</div>
<!-- end row -->
<hr>
</section>
<!-- end section -->
<div class="row">
<div class="col-md-3">
<nav class="docs-sidebar" data-spy="affix" data-offset-top="300" data-offset-bottom="200" role="navigation">
<ul class="nav">
<li><a href="#line1">Front-End Portal</a></li>
<li><a href="#line2">API Quickstart</a></li>
<li><a href="#line3">GET Methods</a>
<ul class="nav">
<li><a href="#line3_1">Pokemon</a></li>
<li><a href="#line3_2">Moves</a></li>
<li><a href="#line3_3">Items</a></li>
<li><a href="#line3_4">Types</a></li>
</ul>
</li>
<li><a href="#line4">Usage Examples</a>
<ul class="nav">
<li><a href="#line4_1">Node.js (JavaScript)</a></li>
<li><a href="#line4_2">Python</a></li>
</ul>
</li>
<li><a href="#line5">Changelog</a></li>
<li><a href="#line6">Copyright and license</a></li>
</ul>
</nav>
</div>
<div class="col-md-9">
<section class="welcome">
<div class="row">
<div class="col-md-12 left-align">
<!-- <h2 class="dark-text">Introduction
<hr>
</h2> -->
<div class="row">
<div class="col-md-12 full">
<div class="intro1">
<ul>
<li><strong>Project Name : </strong> PikaServe (pokemon-api)</li>
<li><strong>Project Version : </strong>v2.0.0</li>
<li><strong>Project URL : </strong> <a href="https://github.com/Purukitto/PikaServe" target="_blank">https://github.com/Purukitto/PikaServe</a></li>
<li><strong>Query Endpoint : </strong> <a href="https://api.pikaserve.xyz/" target="_blank">https://api.pikaserve.xyz/</a></li>
<li><strong>Database URL : </strong> <a href="https://github.com/Purukitto/pokemon-data.json" target="_blank">https://github.com/Purukitto/pokemon-data.json</a></li>
<li><strong>Author : </strong> <a href="https://github.com/Purukitto/" target="_blank">Pulkit Sambhavi Singh</a></li>
<li><strong>Issues/Bugs/Support : </strong> <a href="https://github.com/Purukitto/PikaServe/issues" target="_blank">https://github.com/Purukitto/PikaServe/issues</a></li>
<li><strong>License : </strong> <a href="#line11" target="_blank">GNU GPLv3 License</a></li>
</ul>
</div>
<hr>
<div>
<p>This documentation is to help you use the front-end portal, as well as the query endpoint. Please go through the specefic sections carefully to avoid any error. You can always skip to sections from the navigation
sidebar present on the left.
</br>
</br>
<b>Quick tip:</b> Use your browser's "find on page" feature to search for a specific resource ( <kbd>Ctrl+F</kbd> or <kbd>Cmd+F</kbd> )
</p>
<div class="intro2 clearfix">
<p><a href="https://github.com/Purukitto/"><i class="fa fa-github"></i></a>This project was made for educational purposes. It was recently moved to a payed hosting in the favour of server over a secure connection(https)
for modern broswers, which also means faster queries. Please consider <a href="https://ko-fi.com/purukitto" target="_blank"> supporting me by buying me a coffee</a> if you would like to support development
and hosting costs!
</p>
</div>
</br>
</br>
<h4>Notice</h4>
<p>This is a <b>consumption-only API</b> — only.
</br>
No authentication is required to access this API, and all resources are open and available. <b>The API is rate limited to 2500 calls</b> as of now.
</p>
<ul class="bullet-list">
<li>Locally cache resources whenever you request them</li>
<li>Report any bugs/flaws on the <a href="https://github.com/Purukitto/PikaServe/issues" target="_blank">Github page</a> as soon as you encounter them</li>
<li>Consider contributing to this open-source project</li>
</ul>
</div>
</div>
</div>
<!-- end row -->
</div>
</div>
</section>
<section id="line1" class="section">
<div class="row">
<div class="col-md-12 left-align">
<h2 class="dark-text">Front-End Portal<a href="#top">#back to top</a>
<hr>
</h2>
</div>
<!-- end col -->
</div>
<!-- end row -->
<div class="intro3 clearfix">
<p><i class="fa fa-gamepad"></i> The front-end API module is under development, please watch <a href="#line7">this space</a> for updates</p>
</div>
</section>
<!-- end section -->
<section id="line2" class="section">
<div class="row">
<div class="col-md-12 left-align">
<h2 class="dark-text">API Quickstart<a href="#top">#back to top</a>
<hr>
</h2>
</div>
<!-- end col -->
</div>
<!-- end row -->
<h4>Get a random Pokemon!</h4>
<p>Using the language / framework of your choice:
<ul class="bullet-list">
<li>Load <a href="https://api.pikaserve.xyz/pokemon/random">https://api.pikaserve.xyz/pokemon/random</a></li>
<li>Parse the response body</li>
<li>Load it's the required parameters (e.g. <code>body.id</code> or <code>body.name.english</code>)</li>
</ul>
Try it or some other stuff below:
<form id="poke-form">
<div class="form-group form-input">
<label for="input" class="form-label">api.pikaserve.xyz/</label>
<input type="text" name="input" id="input" value="" required>
<input type="submit" value="Fetch Data" class="submit" onclick="fetchAPI($('#input').val().toLowerCase().trim())" />
</div>
</form>
<p>
<b>Confused?</b> You can try <a onclick="putValue('pokemon/pikachu')">pokemon/pikachu</a>, <a onclick="putValue('pokemon/500')">pokemon/500</a>, <a onclick="putValue('moves/aerialace')">moves/aerialace</a>, <a onclick="putValue('items/masterball')">items/masterball</a>,
etc.
</p>
<pre><code class="json"><div id="pokeData"></div></code></pre>
<p>Getting the hang of it? Navigate using the navigation sidebar to specific endpoints to learn more about them! </p>
</p>
<hr>
</section>
<!-- end section -->
<section id="line3" class="section">
<div class="row">
<div class="col-md-12 left-align">
<h2 class="dark-text">GET Methods<a href="#top">#back to top</a>
<hr>
</h2>
</div>
<!-- end col -->
</div>
<!-- end row -->
<section id="line3_1" class="section">
<h4 class="dark-text"><code>/pokemon</code></h4>
<h4 class="mini-title"><code>/pokemon/all</code></h4>
<p>Retrieves the complete pokemon database.<br>Request URL : <a href="https://api.pikaserve.xyz/pokemon/all" target="blank_">https://api.pikaserve.xyz/pokemon/all</a></p>
<b>Output sample:</b>
<pre><code><div class="getpokemonall"></div></code></pre>
<h4 class="mini-title"><code>/pokemon/random</code></h4>
<p>Retrives a random pokemon from the database.<br>Request URL : <a href="https://api.pikaserve.xyz/pokemon/random" target="blank_">https://api.pikaserve.xyz/pokemon/random</a></p>
<b>Output sample:</b>
<pre><code><div class="getpokemonrand"></div></code></pre>
<h4 class="mini-title"><code>/pokemon/{name}</code></h4>
<p>Searches the database and retrives pokemon named {name}.<br>Request URL : <a href="https://api.pikaserve.xyz/pokemon/infernape" target="blank_">https://api.pikaserve.xyz/pokemon/infernape</a></p>
<b>Output sample:</b>
<pre><code><div class="getpokemonname"></div></code></pre>
<h4 class="mini-title"><code>/pokemon/{pokedexID}</code></h4>
<p>Searches the database and retrives pokemon numbered {pokedexID}.<br>Request URL : <a href="https://api.pikaserve.xyz/pokemon/696" target="blank_">https://api.pikaserve.xyz/pokemon/696</a></p>
<b>Output sample:</b>
<pre><code><div class="getpokemonid"></div></code></pre>
<hr>
</section>
<section id="line3_2" class="section">
<h4 class="dark-text"><code>/moves</code></h4>
<h4 class="mini-title"><code>/moves/all</code></h4>
<p>Retrieves the complete moves database.<br>Request URL : <a href="https://api.pikaserve.xyz/moves/all" target="blank_">https://api.pikaserve.xyz/moves/all</a></p>
<b>Output sample:</b>
<pre><code><div class="getmoveall"></div></code></pre>
<h4 class="mini-title"><code>/moves/random</code></h4>
<p>Retrives a random move from the database.<br>Request URL : <a href="https://api.pikaserve.xyz/moves/random" target="blank_">https://api.pikaserve.xyz/moves/random</a></p>
<b>Output sample:</b>
<pre><code><div class="getmoverand"></div></code></pre>
<h4 class="mini-title"><code>/moves/{name}</code></h4>
<p>Searches the database and retrives move named {name}.<br>Request URL : <a href="https://api.pikaserve.xyz/moves/watershuriken" target="blank_">https://api.pikaserve.xyz/moves/watershuriken</a></p>
<b>Output sample:</b>
<pre><code><div class="getmovename"></div></code></pre>
<h4 class="mini-title"><code>/moves/{movesID}</code></h4>
<p>Searches the database and retrives move numbered {movesID}.<br>Request URL : <a href="https://api.pikaserve.xyz/moves/500" target="blank_">https://api.pikaserve.xyz/pokemon/500</a></p>
<b>Output sample:</b>
<pre><code><div class="getmoveid"></div></code></pre>
<hr>
</section>
<section id="line3_3" class="section">
<h4 class="dark-text"><code>/items</code></h4>
<h4 class="mini-title"><code>/items/all</code></h4>
<p>Retrieves the complete items database.<br>Request URL : <a href="https://api.pikaserve.xyz/items/all" target="blank_">https://api.pikaserve.xyz/items/all</a></p>
<b>Output sample:</b>
<pre><code><div class="getitemall"></div></code></pre>
<h4 class="mini-title"><code>/items/random</code></h4>
<p>Retrives a random item from the database.<br>Request URL : <a href="https://api.pikaserve.xyz/items/random" target="blank_">https://api.pikaserve.xyz/items/random</a></p>
<b>Output sample:</b>
<pre><code><div class="getitemrand"></div></code></pre>
<h4 class="mini-title"><code>/items/{name}</code></h4>
<p>Searches the database and retrives item named {name}.<br>Request URL : <a href="https://api.pikaserve.xyz/items/bicycle" target="blank_">https://api.pikaserve.xyz/items/bicycle</a></p>
<b>Output sample:</b>
<pre><code><div class="getitemname"></div></code></pre>
<h4 class="mini-title"><code>/items/{itemsID}</code></h4>
<p>Searches the database and retrives item numbered {itemsID}.<br>Request URL : <a href="https://api.pikaserve.xyz/items/420" target="blank_">https://api.pikaserve.xyz/items/420</a></p>
<b>Output sample:</b>
<pre><code><div class="getitemid"></div></code></pre>
<hr>
</section>
<section id="line3_4" class="section">
<h4 class="dark-text"><code>/types</code></h4>
<h4 class="mini-title"><code>/types/all</code></h4>
<p>Retrieves the complete types database.<br>Request URL : <a href="https://api.pikaserve.xyz/types/all" target="blank_">https://api.pikaserve.xyz/types/all</a></p>
<b>Output sample:</b>
<pre><code><div class="gettypeall"></div></code></pre>
<h4 class="mini-title"><code>/types/random</code></h4>
<p>Retrives a random type from the database.<br>Request URL : <a href="https://api.pikaserve.xyz/types/random" target="blank_">https://api.pikaserve.xyz/types/random</a></p>
<b>Output sample:</b>
<pre><code><div class="gettyperand"></div></code></pre>
<h4 class="mini-title"><code>/types/{name}</code></h4>
<p>Searches the database and retrives type named {name}.<br>Request URL : <a href="https://api.pikaserve.xyz/types/fairy" target="blank_">https://api.pikaserve.xyz/types/fairy</a></p>
<b>Output sample:</b>
<pre><code><div class="gettypename"></div></code></pre>
<h4 class="mini-title"><code>/types/{typesID}</code></h4>
<p>Searches the database and retrives type numbered {typesID}.<br>Request URL : <a href="https://api.pikaserve.xyz/types/15" target="blank_">https://api.pikaserve.xyz/types/15</a></p>
<b>Output sample:</b>
<pre><code><div class="gettypeid"></div></code></pre>
<hr>
</section>
</section>
<!-- end section -->
<section id="line4" class="section">
<div class="row">
<div class="col-md-12 left-align">
<h2 class="dark-text">Usage Examples<a href="#top">#back to top</a>
<hr>
</h2>
</div>
</div>
<!-- end row -->
<section id="line4_1" class="section">
<h4 class="dark-text">Node.js (JavaScript)</h4>
<h4 class="mini-title"><strong>Using npm fetch</strong></h4>
<ul class="bullet-list">
<li><strong>Install <code>fetch</code> using npm (or yarn)</strong></li>
<pre><code>npm i fetch</code></pre> or
<pre><code>yarn add node-fetch</code></pre>
<li><strong>Create a file <code>PikaServe.js</code></strong></li>
<pre><code>
const fetchUrl = require("fetch ").fetchUrl;
const url = 'https://api.pikaserve.xyz/pokemon/random';
fetchUrl(url, function(error, meta, body) {
if (!error) {
var data = new String();
data = JSON.parse(body)
// Do something with data
console.log(data)
}
});
</code></pre>
<li><strong>Run the file using the following code (in the terminal)</strong></li>
<pre><code>node PikaServe.js</code></pre>
<li><strong>You will see the following output in the terminal in this case</strong></li>
<pre><code>
// Sample Output
{
id: 799,
name: {
english: 'Guzzlord',
japanese: 'アクジキング',
chinese: '恶食大王',
french: 'Necrozma'
},
type: [ 'Dark', 'Dragon' ],
base: {
HP: 223,
Attack: 101,
Defense: 53,
'Sp. Attack': 97,
'Sp. Defense': 53,
Speed: 43
}
}
</code></pre>
</ul>
</section>
<section id="line4_2" class="section">
<h4 class="dark-text">Python</h4>
<ul class="bullet-list">
<li><strong>Install <code>requests</code> using pip or any other package manager</strong></li>
<pre><code>pip install requests</code></pre>
<li><strong>Create a file <code>PikaServe.py</code></strong></li>
<pre><code class="py">
import requests
import json # For formatting the output
response = requests.get("https://api.pikaserve.xyz/pokemon/random")
# Do something with response data
print(json.dumps(response.json(), sort_keys=True, indent=4)) #Or simply print(response.json())
</code></pre>
<li><strong>Run the file in your IDE or by running the following code</strong></li>
<pre><code>python -u "{pathToFile}\PikaServe.py"</code></pre>
<li><strong>You will see the following output in this case</strong></li>
<pre><code>
{
"base": {
"Attack": 65,
"Defense": 95,
"HP": 40,
"Sp. Attack": 60,
"Sp. Defense": 45,
"Speed": 35
},
"id": 109,
"name": {
"chinese": "\u74e6\u65af\u5f39",
"english": "Koffing",
"french": "Smogo",
"japanese": "\u30c9\u30ac\u30fc\u30b9"
},
"type": [
"Poison"
]
}
</code></pre> You can see a live example with this <a href="https://colab.research.google.com/drive/1eoLojz_J4cCVnXYQzJ6xrwZnBZSv98Xy?usp=sharing" target="_blank">Google Colab notebook</a>.
</section>
</section>
<!-- end section -->
<section id="line5" class="section ">
<div class="row ">
<div class="col-md-12 left-align ">
<h2 class="dark-text ">Change log <a href="#top ">#back to top</a>
<hr>
</h2>
</div>
<!-- end col -->
</div>
<!-- end row -->
<div class="row ">
<div class="col-md-12 ">
<pre><code>
-----------------------------------------------------------------------------------------
Version 2.0.0 - Apr 6th, 2022
-----------------------------------------------------------------------------------------
- domain changed and updated
- project name changed (from pokemon-api to pikaserve)
-----------------------------------------------------------------------------------------
Version 1.4.0 - Oct 24th, 2020
-----------------------------------------------------------------------------------------
- /items structure changed
- /items returns name in English, Japanese and Chinese
-----------------------------------------------------------------------------------------
Version 1.3.0 - Oct 24th, 2020
-----------------------------------------------------------------------------------------
- Added image links (hires,thumbs,sprites) in /pokemon
</code></pre>
</div>
</div>
<!-- end row -->
<div class="intro3 clearfix ">
<p>
<a href="https://github.com/Purukitto/PikaServe "><i class="fa fa-github "></i></a>Check the file <a href="https://github.com/Purukitto/PikaServe/blob/master/versionHistory.md ">versionHistory.md</a> in the Github repository
for the full version history
</p>
</div>
</section>
<!-- end section -->
<section id="line6" class="section ">
<div class="row ">
<div class="col-md-12 left-align ">
<h2 class="dark-text ">Copyright and license <a href="#top ">#back to top</a>
<hr>
</h2>
</div>
<!-- end col -->
</div>
<!-- end row -->
<div class="row ">
<div class="col-md-12 ">
<p>Source code released under <a href="https://github.com/Purukitto/PikaServe/blob/master/LICENSE " target="_blank ">GNU GPLv3 </a> License.</p>
<p>For more information about copyright and license check <a href="https://choosealicense.com/ " target="_blank ">choosealicense.com</a>.</p>
Pokémon and Pokémon character names are trademarks of Nintendo and The Pokémon Company.
</div>
</div>
<!-- end row -->
</section>
<!-- end section -->
</div>
<!-- // end .col -->
</div>
<!-- // end .row -->
</div>
<!-- // end container -->
</div>
<!-- end wrapper -->
<script src="js/jquery.min.js "></script>
<script src="js/bootstrap.min.js "></script>
<script src="js/wow.js "></script>
<!-- CUSTOM JS -->
<script src="js/custom.js "></script>
<script src="js/main.js "></script>
<script src="js/themes.js "></script>
<script src="js/jsonsamples.js"></script>
</body>
</html>