You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 28, 2025. It is now read-only.
Java client library to retrieve data from The Blue Alliance using TBA API v3
4
4
5
-
Work in progress
5
+
The library is essentially complete, but documentation is in progress.
6
+
7
+
## Usage
8
+
9
+
Begin by creating a TBA object with your Read TBA API Key. This can be found or generated on your [account dashboard](https://www.thebluealliance.com/account).
10
+
11
+
String authKey = // your TBA API read key
12
+
TBA tba = new TBA(authKey);
13
+
14
+
### Regular Usage
15
+
16
+
The library allows access to almost all of the calls in [The Blue Alliance API v3 documentation](https://www.thebluealliance.com/apidocs/v3). They are grouped into requests with team, event, district, or match parameters:
17
+
18
+
**`tba.teamRequest`**
19
+
20
+
*`getTeam(teamNumber)`: Gets a `Team` object for the team referenced by the given number (an `int`).
21
+
*`getSimpleTeam(teamNumber): Gets a `SimpleTeam` object for the team referenced by the given number.
22
+
* `getYearsParticipated(teamNumber): Gets a list of years in which the team participated in at least one competition.
23
+
* getDistricts(teamNumber): Gets a list of `District` objects for each year the team was in a district. Will return `null` if the team was never in a district.
24
+
* to be continued
25
+
26
+
**`tba.eventRequest`**
27
+
28
+
* to be continued
29
+
30
+
**`tba.districtRequest`**
31
+
32
+
* to be continued
33
+
34
+
**`tba.matchRequest`**
35
+
36
+
* to be continued
37
+
38
+
### Advance Usage
39
+
40
+
If you want to utilize the `If-Modified-Since` and `Last-Modified` headers, you will need to make a direct URL request (following the documentation). This will return an `APIResponse` object with JSON data, the HTTP response code, and the `Last-Modified` header.
41
+
42
+
The JSON data will need to be deserialized into an object model with a method in the `Deserializer` class before being used.
43
+
44
+
Here is an (extremely inefficient) example of continuously fetching the `Team` objects for an event (`2017njfla`), if they have been updated.
Most of the object models follow those on The Blue Alliance API documentation, with appropriately named getter methods:
61
+
62
+
**Award**
63
+
64
+
*`String getName()`: The name of the award as provided by FIRST. May vary for the same award type.
65
+
*`int getAwardType()`: Type of award given. See [here](https://github.com/the-blue-alliance/the-blue-alliance/blob/master/consts/award_type.py#L6) for details.
66
+
*`String getEventKey()`: The `event_key` of the event the award was won at.
67
+
*`AwardRecipient[] getRecipientList()`: A list of recipients of the award at the event. Either team_key and/or awardee for individual awards.
68
+
*`int getYear()`: The year this award was won.
69
+
70
+
## Contact
71
+
72
+
Feel free to contact me at sng1488@gmail.com or create a pull request if you have any questions, fixes, or suggestions. This library is (currently) unaffiliated with [FRC Team 25](http://raiderrobotix.org).
0 commit comments