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
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Authorization — Battelrite 0.2 documentation</title>
<link rel="stylesheet" href="../_static/css/battlerite.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '0.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="Titles" href="../titles/titles.html" />
<link rel="prev" title="Datacenters" href="../datacenters/datacenters.html" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
</head>
<body>
<header id="BTT" role="banner">
<div class="menu-top-outer clearfix">
<div class="wrapper clearfix">
<a href="/" id="site-logo"></a>
<span id="logSignBtn" class="btn">Login / Signup</span>
<nav id="mainMenu" class="main-menu-con">
<ul class="main-menu clearfix">
<li><a class="active" href="guides.html">Documentation</a></li>
<li><a href="faq.html">Faqs</a></li>
<li><a href="creations.html">Creations</a></li>
</ul>
</nav>
</div>
</div>
</header>
<div class="related top">
<nav id="rellinks">
<ul>
<li>
←
<a href="../datacenters/datacenters.html" title="Previous document">Datacenters</a>
</li>
<li>
<a href="../titles/titles.html" title="Next document">Titles</a>
→
</li>
</ul>
</nav>
<nav id="breadcrumbs">
<ul>
<li><a href="../index.html">Battelrite 0.2 documentation</a></li>
</ul>
</nav>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="authorization">
<span id="id1"></span><h1>Authorization<a class="headerlink" href="#authorization" title="Permalink to this headline">¶</a></h1>
<p>We require a JSON Web Token <a class="reference external" href="https://jwt.io/">JWT</a>. be sent along with your request via the Authorization header.
JWTs are passed as bearer tokens in the Authorization header, and look like the following:</p>
<p>Authorization: <Enter your API Key></p>
<p>There’s no need to create JWTs manually, they will be created for you when you register for the API - <a class="reference external" href="https://developer.battlerite.com">Register Here!</a>. In some cases an X-API-KEY will give you more access to information, and in all cases it means that you are operating under a per-token rate limit.</p>
<p>To specify the Headers, use this code:</p>
<p><strong>Shell</strong></p>
<div class="highlight-shell"><div class="highlight"><pre><span></span>//Shell
<span class="c1"># With shell, you can just pass the correct header with each request</span>
curl <span class="s2">"<endpoint-url>"</span> <span class="se">\</span>
-H <span class="s2">"Authorization: <api-key>"</span>
-H <span class="s2">"Accept: application/vnd.api+json"</span>
</pre></div>
</div>
<div class="highlight-java"><div class="highlight"><pre><span></span><span class="c1">//Java</span>
<span class="kn">import</span> <span class="nn">java.io.*</span><span class="o">;</span>
<span class="kn">import</span> <span class="nn">java.net.*</span><span class="o">;</span>
<span class="n">URL</span> <span class="n">url</span> <span class="o">=</span> <span class="k">new</span> <span class="n">URL</span><span class="o">(</span><span class="s">"<endpoint-url>"</span><span class="o">);</span>
<span class="n">HttpURLConnection</span> <span class="n">conn</span> <span class="o">=</span> <span class="o">(</span><span class="n">HttpURLConnection</span><span class="o">)</span> <span class="n">url</span><span class="o">.</span><span class="na">openConnection</span><span class="o">();</span>
<span class="n">conn</span><span class="o">.</span><span class="na">setRequestMethod</span><span class="o">(</span><span class="s">"GET"</span><span class="o">);</span>
<span class="n">conn</span><span class="o">.</span><span class="na">setRequestProperty</span><span class="o">(</span><span class="s">"Authorization"</span><span class="o">,</span><span class="s">"<api-key>"</span><span class="o">);</span>
<span class="n">conn</span><span class="o">.</span><span class="na">setRequestProperty</span><span class="o">(</span><span class="s">"Accept"</span><span class="o">,</span> <span class="s">"application/vnd.api+json"</span><span class="o">);</span>
<span class="n">conn</span><span class="o">.</span><span class="na">getInputStream</span><span class="o">()</span>
</pre></div>
</div>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="o">//</span><span class="n">Python</span>
<span class="kn">import</span> <span class="nn">requests</span>
<span class="n">url</span> <span class="o">=</span> <span class="s2">"<endpoint-url>"</span>
<span class="n">header</span> <span class="o">=</span> <span class="p">{</span>
<span class="s2">"Authorization"</span><span class="p">:</span> <span class="s2">"<api-key>"</span><span class="p">,</span>
<span class="s2">"Accept"</span><span class="p">:</span> <span class="s2">"application/vnd.api+json"</span>
<span class="p">}</span>
<span class="n">r</span> <span class="o">=</span> <span class="n">requests</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">url</span><span class="p">,</span> <span class="n">headers</span><span class="o">=</span><span class="n">header</span><span class="p">)</span>
</pre></div>
</div>
<div class="highlight-go"><div class="highlight"><pre><span></span><span class="c1">//Go</span>
<span class="kn">import</span> <span class="s">"net/http"</span>
<span class="nx">client</span> <span class="o">:=</span> <span class="o">&</span><span class="nx">http</span><span class="p">.</span><span class="nx">Client</span><span class="p">{}</span>
<span class="nx">req</span><span class="p">,</span> <span class="nx">_</span> <span class="o">:=</span> <span class="nx">http</span><span class="p">.</span><span class="nx">NewRequest</span><span class="p">(</span><span class="s">"GET"</span><span class="p">,</span><span class="s">"<endpoint-url>"</span><span class="p">,</span><span class="kc">nil</span><span class="p">)</span>
<span class="nx">req</span><span class="p">.</span><span class="nx">Header</span><span class="p">.</span><span class="nx">Set</span><span class="p">(</span><span class="s">"Authorization"</span><span class="p">,</span> <span class="s">"<api-key>"</span><span class="p">)</span>
<span class="nx">req</span><span class="p">.</span><span class="nx">Header</span><span class="p">.</span><span class="nx">Set</span><span class="p">(</span><span class="s">"Accept"</span><span class="p">,</span> <span class="s">"application/vnd.api+json"</span><span class="p">)</span>
<span class="nx">res</span><span class="p">,</span> <span class="nx">_</span> <span class="o">:=</span> <span class="nx">client</span><span class="p">.</span><span class="nx">Do</span><span class="p">(</span><span class="nx">req</span><span class="p">)</span>
</pre></div>
</div>
<div class="toctree-wrapper compound">
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="../index.html">Table Of Contents</a></h3>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../introduction.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="../datacenters/datacenters.html">Datacenters</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Authorization</a><ul class="simple">
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../titles/titles.html">Titles</a></li>
<li class="toctree-l1"><a class="reference internal" href="../makingrequests/makingrequests.html">Making Requests</a></li>
<li class="toctree-l1"><a class="reference internal" href="../receivingresponses/receivingresponses.html">Receiving Responses</a></li>
<li class="toctree-l1"><a class="reference internal" href="../matches/matches.html">Matches</a></li>
<li class="toctree-l1"><a class="reference internal" href="../match_data_summary/match_data_summary.html">Match Data Summary</a></li>
<li class="toctree-l1"><a class="reference internal" href="../players/players.html">Players</a></li>
<li class="toctree-l1"><a class="reference internal" href="../samples/samples.html">Samples</a></li>
<li class="toctree-l1"><a class="reference internal" href="../telemetry/telemetry.html">Telemetry</a></li>
<li class="toctree-l1"><a class="reference internal" href="../teams/teams.html">Teams</a></li>
<li class="toctree-l1"><a class="reference internal" href="../links/links.html">Links</a></li>
<li class="toctree-l1"><a class="reference internal" href="../community_sdks/community_sdks.html">Community SDKs</a></li>
<li class="toctree-l1"><a class="reference internal" href="../errors/errors.html">Errors</a></li>
<li class="toctree-l1"><a class="reference internal" href="../changelog/changelog.html">Changelog</a></li>
</ul>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related bottom">
<nav id="rellinks">
<ul>
<li>
←
<a href="../datacenters/datacenters.html" title="Previous document">Datacenters</a>
</li>
<li>
<a href="../titles/titles.html" title="Next document">Titles</a>
→
</li>
</ul>
</nav>
<nav id="breadcrumbs">
<ul>
<li><a href="../index.html">Battelrite 0.2 documentation</a></li>
</ul>
</nav>
</div>
</body>
</html>
|