Go to Post Great things don't just happen to HoF teams; HoF teams make great things happen. - Siri [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 14-03-2015, 14:12
ceb515's Avatar
ceb515 ceb515 is offline
Registered User
AKA: Charlie
FRC #2607 (Robovikings)
 
Join Date: Jan 2015
Rookie Year: 2012
Location: Pennsylvania, United States
Posts: 19
ceb515 is an unknown quantity at this point
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?
__________________

2015 - MAR Championship 3rd Place, Qualified for CMP
Blue Banners: 2010 Philadelphia Reigonal, 2014 Virginia Reigonal, 2015 Hatboro-Horsham, 2015 Upper Darby
SEE US AT THESE COMPETITONS:
Hatboro-Horsham District Event 2017, Seneca District Event 2017

Electrical Lead, Programmer, Designer, Pneumatics, Prototyping, All-Out-Geek




Reply With Quote
  #2   Spotlight this post!  
Unread 14-03-2015, 14:32
Jon Stratis's Avatar
Jon Stratis Jon Stratis is online now
Mentor, LRI, MN RPC
FRC #2177 (The Robettes)
Team Role: Mentor
 
Join Date: Feb 2007
Rookie Year: 2006
Location: Minnesota
Posts: 3,827
Jon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond repute
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!
__________________
2007 - Present: Mentor, 2177 The Robettes
LRI: North Star 2012-2016; Lake Superior 2013-2014; MN State Tournament 2013-2014, 2016; Galileo 2016; Iowa 2017
2015: North Star Regional Volunteer of the Year
2016: Lake Superior WFFA
Reply With Quote
  #3   Spotlight this post!  
Unread 14-03-2015, 14:40
ceb515's Avatar
ceb515 ceb515 is offline
Registered User
AKA: Charlie
FRC #2607 (Robovikings)
 
Join Date: Jan 2015
Rookie Year: 2012
Location: Pennsylvania, United States
Posts: 19
ceb515 is an unknown quantity at this point
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
__________________

2015 - MAR Championship 3rd Place, Qualified for CMP
Blue Banners: 2010 Philadelphia Reigonal, 2014 Virginia Reigonal, 2015 Hatboro-Horsham, 2015 Upper Darby
SEE US AT THESE COMPETITONS:
Hatboro-Horsham District Event 2017, Seneca District Event 2017

Electrical Lead, Programmer, Designer, Pneumatics, Prototyping, All-Out-Geek




Reply With Quote
  #4   Spotlight this post!  
Unread 14-03-2015, 16:29
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,102
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Implementing TBA Api in Java

Quote:
Originally Posted by Jon Stratis View Post
Why use the Blue Alliance API and not the official FIRST API that the Blue Alliance most likely uses to populate their own data?
If your goal is to a) write an app that uses FRC's API and b) share that app widely... you may want to get FIRST's approval before you do so.



Last edited by Ether : 14-03-2015 at 16:39. Reason: typo
Reply With Quote
  #5   Spotlight this post!  
Unread 14-03-2015, 16:30
ceb515's Avatar
ceb515 ceb515 is offline
Registered User
AKA: Charlie
FRC #2607 (Robovikings)
 
Join Date: Jan 2015
Rookie Year: 2012
Location: Pennsylvania, United States
Posts: 19
ceb515 is an unknown quantity at this point
Re: Implementing TBA Api in Java

Quote:
Originally Posted by Ether View Post
If your goal it to a) write an app that uses FRC's API and b) share that app widely... you may want to get FIRST's approval before you do so.


My purpose is to make an app to use for myself and for my team, I would go to first before I go widespread
__________________

2015 - MAR Championship 3rd Place, Qualified for CMP
Blue Banners: 2010 Philadelphia Reigonal, 2014 Virginia Reigonal, 2015 Hatboro-Horsham, 2015 Upper Darby
SEE US AT THESE COMPETITONS:
Hatboro-Horsham District Event 2017, Seneca District Event 2017

Electrical Lead, Programmer, Designer, Pneumatics, Prototyping, All-Out-Geek




Reply With Quote
  #6   Spotlight this post!  
Unread 14-03-2015, 16:33
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,102
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Implementing TBA Api in Java

Quote:
Originally Posted by ceb515 View Post
...and for my team
Quote:
This token is meant for personal development, if you intend to use it for any significant volume, you must inform us and associated an organization and contact information or the token will be disabled.
.
.
.
Reply With Quote
  #7   Spotlight this post!  
Unread 14-03-2015, 17:28
Jon Stratis's Avatar
Jon Stratis Jon Stratis is online now
Mentor, LRI, MN RPC
FRC #2177 (The Robettes)
Team Role: Mentor
 
Join Date: Feb 2007
Rookie Year: 2006
Location: Minnesota
Posts: 3,827
Jon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond repute
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.
__________________
2007 - Present: Mentor, 2177 The Robettes
LRI: North Star 2012-2016; Lake Superior 2013-2014; MN State Tournament 2013-2014, 2016; Galileo 2016; Iowa 2017
2015: North Star Regional Volunteer of the Year
2016: Lake Superior WFFA
Reply With Quote
  #8   Spotlight this post!  
Unread 14-03-2015, 18:11
plnyyanks's Avatar
plnyyanks plnyyanks is offline
Data wins arguments.
AKA: Phil Lopreiato
FRC #1124 (The ÜberBots), FRC #2900 (The Mighty Penguins)
Team Role: College Student
 
Join Date: Apr 2010
Rookie Year: 2010
Location: NYC/Washington, DC
Posts: 1,114
plnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond repute
Re: Implementing TBA Api in Java

Quote:
Originally Posted by ceb515 View Post
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?

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
__________________
Phil Lopreiato - "It's a hardware problem"
Team 1124 (2010 - 2013), Team 1418 (2014), Team 2900 (2016)
FRC Notebook The Blue Alliance for Android
Reply With Quote
  #9   Spotlight this post!  
Unread 14-03-2015, 21:36
plnyyanks's Avatar
plnyyanks plnyyanks is offline
Data wins arguments.
AKA: Phil Lopreiato
FRC #1124 (The ÜberBots), FRC #2900 (The Mighty Penguins)
Team Role: College Student
 
Join Date: Apr 2010
Rookie Year: 2010
Location: NYC/Washington, DC
Posts: 1,114
plnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond repute
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
__________________
Phil Lopreiato - "It's a hardware problem"
Team 1124 (2010 - 2013), Team 1418 (2014), Team 2900 (2016)
FRC Notebook The Blue Alliance for Android
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 12:57.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi