Giter Site home page Giter Site logo

tba-api-v2's Introduction

V2 is Deprecated

Check out the V3 library here: https://github.com/wdavies973/TBA-API-V3.

TBA-API

A Java API for pulling robotics data from www.thebluealliance.com.

I made this API because none of the other Java APIs were working for me. I hope that this will be the last place you have to go for your TBA API needs. Thanks!

Installation

Download the .jar file from https://github.com/techguy9984/TBA-API/releases.

Add the jar as a dependency in your project. Let me know if you'd like Maven or Gradle download support, although currently, it seems like it's easiest just to use a .jar.

Dependencies

This API requires the use of JSON-Simple. Make sure you download the .jar file at https://code.google.com/archive/p/json-simple/ and add the jar as a dependency as well.

Android troubleshooting

Make sure you have internet permissions declared in the manifest:

<uses-permission android:name="android.permission.INTERNET"/> 
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

Make sure you run this line of code before calling any API commands:

StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitNetwork().build(); StrictMode.setThreadPolicy(policy);

Tutorial

Find it at https://www.github.com/techguy9984/TBA-API/wiki. The API is designed to be easy to use and fairly idiot-proof (no offense, I wish everyone designed their software like that).

Other

Report any bugs or suggestions to [email protected] If you'd like any more functionality as far as ways you can pull data, and what you can pull, let me know and I'll add it right away.

Roblu

This API is using in my scouting app Roblu. It's an all-in-one solution to scouting. Check it out at: https://github.com/techguy9984/Roblu

tba-api-v2's People

Contributors

mlavrent avatar techno11 avatar widavies avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

tba-api-v2's Issues

Update to 2017, and possibly keep 2016?

If it is possible, (I know finals are coming up so don't fret it) could you update the API for Blue Alliance 2017 (When it's released, I can't seem to find any docs for it anywhere yet) but still keep all of the 2016 functionality? I will link the documentation to it when I find it.

Additional Rankings Data Missing

image

When making a Rankings Request from the blue alliance, it return more data than last year, causing many things to become out of order, and therfore not returning what need to be returned.

Ex:
team.played
Will return the Record(W-L-T)

Please refer to the Table I create above for more info.

getTeamEvents doesn't exist

So, I am using the latest release of TBA-API. After I've done the initial setup, I try to call:

tba.getTeamEvents(4468, 2016);

It states that the method doesn't exist in the tba object. I've looked in the Github code and am sure that I am calling it correctly, so what is wrong with my code?

getEvents() not working in Android Studio

Whenever I try to use the getEvents() method in my team's Android Studio app, it always throws this exception.

                  Process: com.fernbanklinks.frcscore, PID: 4412
                  java.lang.RuntimeException: Unable to start activity ComponentInfo{com.fernbanklinks.frcscore/com.fernbanklinks.frcscore.TBAEvents}: java.lang.NullPointerException: Attempt to invoke virtual method 'int org.json.simple.JSONArray.size()' on a null object reference
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
                      at android.app.ActivityThread.-wrap11(ActivityThread.java)
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
                      at android.os.Handler.dispatchMessage(Handler.java:102)
                      at android.os.Looper.loop(Looper.java:148)
                      at android.app.ActivityThread.main(ActivityThread.java:5417)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                   Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int org.json.simple.JSONArray.size()' on a null object reference
                      at com.cpjd.requests.EventRequest.getEvents(EventRequest.java:26)
                      at com.cpjd.main.TBA.getEvents(TBA.java:158)
                      at com.fernbanklinks.frcscore.TBAEvents.onCreate(TBAEvents.java:84)
                      at android.app.Activity.performCreate(Activity.java:6237)
                      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                      at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
                      at android.os.Handler.dispatchMessage(Handler.java:102) 
                      at android.os.Looper.loop(Looper.java:148) 
                      at android.app.ActivityThread.main(ActivityThread.java:5417) 
                      at java.lang.reflect.Method.invoke(Native Method) 
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 

However, if I try running this in Dr. Java or any other Java compiler, there will be a delay, but it will return an array of every event. I think that the Android phone is just freaking out over the fact that there is no initial return, but how can I make it wait?

SAMPLE CODE that is being ran in onCreate():

        TBA.setID("Fernbank LINKS Robotics", "FRC Score Android App", "2017");
        TBA tba = new TBA();

        if(tba != null){
            System.out.println("TBA Initialized");
        }
        //A list of all 160 FRC Competitions
        events = tba.getEvents(2017);

Issues with rankings and Rankings Related Data

Event e = tba.getEvent(eventKey, year);
for(Team team : e.teams){
if(team.team_number == teamNumber){
break;
}
i++;
}
Team tr = e.teams[i];
System.out.print(tr.rank);
System.out.print(tr.rankingScore);

When printing ranking data, I get a 0, however when printing any other data I get the correct response (moto, name, etc). Is there something I am doing wrong?

Parsing Matches in wrong order?

I, again, may be doing something wrong, but I have a for loop running, and if the match contains my team number, it collects all the data from the match. All is well with that. However, when I go to list the matches, it orders them like so:
Q12
Q26
Q47
Q69
Q7
Q76

Qualifier 7 should be at the beginning, not between 69 and 70.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.