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
|
.. _authorization:
Authorization
=============
We require a JSON Web Token `JWT <https://jwt.io/>`_. 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:
Authorization: <Enter your API Key>
There's no need to create JWTs manually, they will be created for you when you register for the API - `Register Here! <https://developer.battlerite.com>`_. 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.
To specify the Headers, use this code:
**Shell**
.. code-block:: shell
//Shell
# With shell, you can just pass the correct header with each request
curl "<endpoint-url>" \
-H "Authorization: <api-key>"
-H "Accept: application/vnd.api+json"
.. code-block:: java
//Java
import java.io.*;
import java.net.*;
URL url = new URL("<endpoint-url>");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("Authorization","<api-key>");
conn.setRequestProperty("Accept", "application/vnd.api+json");
conn.getInputStream()
.. code-block:: python
//Python
import requests
url = "<endpoint-url>"
header = {
"Authorization": "<api-key>",
"Accept": "application/vnd.api+json"
}
r = requests.get(url, headers=header)
.. code-block:: go
//Go
import "net/http"
client := &http.Client{}
req, _ := http.NewRequest("GET","<endpoint-url>",nil)
req.Header.Set("Authorization", "<api-key>")
req.Header.Set("Accept", "application/vnd.api+json")
res, _ := client.Do(req)
.. toctree::
:maxdepth: 2
|