|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Implementing TBA Api in Java
Okay guys I need some help
, I'm creating a Java Program and I want it to be able to access match data from TBA and store it somewhere. I have absolutely NO idea how to access the data from the API or how to store or display (JFrame) the data. Any help or suggestions? |
|
#2
|
||||
|
||||
|
Re: Implementing TBA Api in Java
Why use the Blue Alliance API and not the official FIRST API that the Blue Alliance most likely uses to populate their own data? You can find out more about the FIRST Event API on their TeamForge page: https://usfirst.collab.net/sf/projec...ty_developers/
If you decide to go that route, get signed up and I can share some of the work I've done with you... It's all in Java, designed to pull all of the data needed to calculate rankings for the MN State Championship invites - basically, a slightly modified version of the District ranking formula. It would at least give you a framework for making requests and parsing the results. Past that, you'll have to decide what your requirements are for storing and displaying data. On the complex side of things, you could read all of the data into a database, and run a local webhost to put it in a browser, or a local app customized to display and navigate the data. On the easy side, you could spit it out into a CSV file and open it in Excel to play around with. In the middle, you can actually write the data directly to a nicely formatted, multi-tab spreadsheet (there's an apache library that makes this relatively easy to do, once you get it figured out). This is one of the things I love most about programming... there are a hundred ways to do what you want, you just have to decide which way to use! |
|
#3
|
||||
|
||||
|
Re: Implementing TBA Api in Java
Okay so I created an account on TeamForge, how would you like to share the code that you currently have?
-Charlie |
|
#4
|
||||
|
||||
|
Re: Implementing TBA Api in Java
Quote:
Last edited by Ether : 14-03-2015 at 16:39. Reason: typo |
|
#5
|
||||
|
||||
|
Re: Implementing TBA Api in Java
My purpose is to make an app to use for myself and for my team, I would go to first before I go widespread
|
|
#6
|
||||
|
||||
|
Re: Implementing TBA Api in Java
Quote:
. . |
|
#7
|
||||
|
||||
|
Re: Implementing TBA Api in Java
Each registered user/team gets a unique token that's used on every request - in other words, if you spam the server a ridiculous amount (for example, sticking it in an app like FRC Spyder and having every client hit the FRC servers) then FIRST can identify the offending developer and work with them to reduce the impact on the FRC servers (for example, by periodic polling of the servers and storage of results on a 3rd party server for further distribution from there).
Once FIRST accepts you in the group and issues you a token, message me on TeamForge and I'll send you some stuff to get you started there. |
|
#8
|
|||||
|
|||||
|
Re: Implementing TBA Api in Java
Quote:
If you still want to see a Java implementation of the TBA API, the Android app implements all the endpoints. You can check out the code here https://github.com/the-blue-alliance...liance-android |
|
#9
|
|||||
|
|||||
|
Re: Implementing TBA Api in Java
Here's a little more detailed info about the TBA API, now that I'm no longer trying to keep a regional on schedule...
The TBA API is pretty fully featured - it's got a lot of data you can pull in multiple ways. The simplest is the main API (documentation is here). You hit a url for the data you want, and get a response back. This is what the TBA Android app implements for its data source. Here are some links to getting started: - Where API urls are built - Where the HTTP Request is built - All the model deserializers (to bring the json response into Java objects). I've been meaning to rip this out and make it into a library we can publish on maven central for other people to use, but that'll happen when I get the time... TBA can also push live updates to a server of your choosing (documentation is here). This is how the Android app handles its push notifications. You subscribe your account to whatever you want (teams, events, everything, etc) and pick the notification types you would like to receive updates for, and TBA will push a POST request to a server you've registered every time something updates. Here is an example project that implements a webhook receiver, and here specifically is where webhooks come in |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|