Go to Post the jocks may have muscle, but we have extruded aluminum :D - [527]phil [more]
Home
Go Back   Chief Delphi > FIRST > General Forum
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 07-03-2013, 07:29
jasongb jasongb is offline
Registered User
FRC #1706
 
Join Date: Mar 2012
Location: Wentzville MO
Posts: 7
jasongb is an unknown quantity at this point
Team List RSS?

I'm looking to import a list of teams so I can populate this season's scouting database.

Does anyone know where I can get access to a list like that, in a format that lends itself to import?

I tried perusing https://my.usfirst.org/frc/tims, but it's currently broken with Error -9995. I also visited thebluealliance.com, but didn't see anything obvious there. Lastly, I did search the forum, but couldn't find anything relevant in a timely manner.

Any suggestions for a team list, and/or an event list, would be appreciated. Feel free to contact me via pm or via email: jason dot buxton @t gmail DOT com.
Reply With Quote
  #2   Spotlight this post!  
Unread 07-03-2013, 09:54
vinnie's Avatar
vinnie vinnie is offline
Registered User
FRC #3309 (Friarbots)
Team Role: College Student
 
Join Date: Oct 2010
Rookie Year: 2010
Location: Los Angeles / Anaheim
Posts: 107
vinnie has a reputation beyond reputevinnie has a reputation beyond reputevinnie has a reputation beyond reputevinnie has a reputation beyond reputevinnie has a reputation beyond reputevinnie has a reputation beyond reputevinnie has a reputation beyond reputevinnie has a reputation beyond reputevinnie has a reputation beyond reputevinnie has a reputation beyond reputevinnie has a reputation beyond repute
Re: Team List RSS?

Check out The FIRST Alliance API
http://thefirstalliance.com/apidoc.php
__________________
Student (3309) 2010-2013
Mentor (597) 2014
Mentor (3309) 2013-Present
Reply With Quote
  #3   Spotlight this post!  
Unread 07-03-2013, 10:37
jasongb jasongb is offline
Registered User
FRC #1706
 
Join Date: Mar 2012
Location: Wentzville MO
Posts: 7
jasongb is an unknown quantity at this point
Re: Team List RSS?

Thanks!

Either I did it wrong, or something's amiss:

http://www.thefirstalliance.org/api/...ion=list-teams

This returns an error, although I think the complete XML document is included in the source....

[EDIT]:

Ah, it looks like some teams' names are unparseable in XML:

<br />
<b>Warning</b>: SimpleXMLElement::addChild() [<a href='simplexmlelement.addchild'>simplexmlelement. addchild</a>]: unterminated entity reference Gadget Engineering) in <b>/homepages/26/d409590785/htdocs/first-api/first_scraper_web/api/api.xml.php</b> on line <b>36</b><br />
<br />
<b>Warning</b>: SimpleXMLElement::addChild() [<a href='simplexmlelement.addchild'>simplexmlelement. addchild</a>]: unterminated entity reference Irish Bots in <b>/homepages/26/d409590785/htdocs/first-api/first_scraper_web/api/api.xml.php</b> on line <b>36</b><br />
<br />
<b>Warning</b>: SimpleXMLElement::addChild() [<a href='simplexmlelement.addchild'>simplexmlelement. addchild</a>]: unterminated entity reference Machines (M&amp;Ms) in <b>/homepages/26/d409590785/htdocs/first-api/first_scraper_web/api/api.xml.php</b> on line <b>36</b><br />
<br />
<b>Warning</b>: SimpleXMLElement::addChild() [<a href='simplexmlelement.addchild'>simplexmlelement. addchild</a>]: unterminated entity reference Bolts of Fury in <b>/homepages/26/d409590785/htdocs/first-api/first_scraper_web/api/api.xml.php</b> on line <b>36</b><br />
<br />
<b>Warning</b>: SimpleXMLElement::addChild() [<a href='simplexmlelement.addchild'>simplexmlelement. addchild</a>]: unterminated entity reference Bots in <b>/homepages/26/d409590785/htdocs/first-api/first_scraper_web/api/api.xml.php</b> on line <b>36</b><br />
<br />
<b>Warning</b>: SimpleXMLElement::addChild() [<a href='simplexmlelement.addchild'>simplexmlelement. addchild</a>]: unterminated entity reference Wayne County Robotics in <b>/homepages/26/d409590785/htdocs/first-api/first_scraper_web/api/api.xml.php</b> on line <b>36</b><br />
<br />
<b>Warning</b>: SimpleXMLElement::addChild() [<a href='simplexmlelement.addchild'>simplexmlelement. addchild</a>]: unterminated entity reference Colts in <b>/homepages/26/d409590785/htdocs/first-api/first_scraper_web/api/api.xml.php</b> on line <b>36</b><br />

I'll work with the JSON syntax!

Last edited by jasongb : 07-03-2013 at 10:41. Reason: Further research
Reply With Quote
  #4   Spotlight this post!  
Unread 07-03-2013, 14:25
vinnie's Avatar
vinnie vinnie is offline
Registered User
FRC #3309 (Friarbots)
Team Role: College Student
 
Join Date: Oct 2010
Rookie Year: 2010
Location: Los Angeles / Anaheim
Posts: 107
vinnie has a reputation beyond reputevinnie has a reputation beyond reputevinnie has a reputation beyond reputevinnie has a reputation beyond reputevinnie has a reputation beyond reputevinnie has a reputation beyond reputevinnie has a reputation beyond reputevinnie has a reputation beyond reputevinnie has a reputation beyond reputevinnie has a reputation beyond reputevinnie has a reputation beyond repute
Re: Team List RSS?

Quote:
Originally Posted by jasongb View Post
Thanks!
I'll work with the JSON syntax!
I generally find JSON data easier to work with.
If you're using Java I have a simple class to work with the FIRST Alliance APIs.

If you use this and don't use AppEngine, then you need to replace the JSON imports with JSON classes found elsewhere.
Code:
package org.team3309.scout;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;

import com.google.appengine.labs.repackaged.org.json.JSONArray;
import com.google.appengine.labs.repackaged.org.json.JSONException;
import com.google.appengine.labs.repackaged.org.json.JSONObject;

public class FirstAlliance {

	private static final String API = "http://www.thefirstalliance.org/api/api.json.php?action=";

	public static Event[] getEvents(String teamNumber) {
		Event[] competitions = new Event[0];
		String url = API + "team-events&team-number=3309";
		JSONArray events = getArray(url);
		competitions = new Event[events.length()];
		try {
			for (int i = 0; i < events.length(); i++) {
				JSONObject event = events.getJSONObject(i);
				competitions[i] = new Event(event);
			}
		} catch (JSONException ex) {
			ex.printStackTrace();
		}
		return competitions;
	}
	
	public static Event getEventById(int id){
		String url = API+ "event-details&event-id="+id;
		JSONObject json = getJson(url);
		return new Event(json);
	}
	
	private static JSONArray getArray(String url) {
		try {
			HttpURLConnection c = (HttpURLConnection) new URL(url)
					.openConnection();
			BufferedReader reader = new BufferedReader(new InputStreamReader(
					c.getInputStream()));
			String line;
			String input = "";
			while ((line = reader.readLine()) != null)
				input += line;
			JSONObject json = new JSONObject(input);
			return json.getJSONArray("data");
		} catch (Exception ex) {
			ex.printStackTrace();
		}
		return null;
	}
	
	private static JSONObject getJson(String url){
		try {
			HttpURLConnection c = (HttpURLConnection) new URL(url)
					.openConnection();
			BufferedReader reader = new BufferedReader(new InputStreamReader(
					c.getInputStream()));
			String line;
			String input = "";
			while ((line = reader.readLine()) != null)
				input += line;
			JSONObject json = new JSONObject(input);
			return json.getJSONObject("data");
		} catch (Exception ex) {
			ex.printStackTrace();
		}
		return null;
	}

	public static class Event{
		
		private String name;
		private int id;
		private JSONArray rankingsJson;
		private ArrayList<Ranking> rankings;
		
		private Event(JSONObject json){
			this.name = json.optString("name");
			this.id = json.optInt("id");
			this.rankingsJson = json.optJSONArray("rankings");
		}
		public String getName(){
			return name;
		}
		public int getId(){
			return id;
		}
		public ArrayList<Ranking> getRankings(){
			if(rankings != null)
				return rankings;
			ArrayList<Ranking> list = new ArrayList<Ranking>();
			for(int i=0; i<rankingsJson.length(); i++){
				JSONObject json = rankingsJson.optJSONObject(i);
				list.add(new Ranking(json.optString("Team"), json.optInt("Rank"), json.optString("Record (W-L-T)")));
			}
			return list;
		}
		
		public String toString(){
			return name;
		}
	}
	
	public static class Ranking{
		
		private String team, record;
		private int ranking;
		
		private Ranking(String team, int ranking, String record){
			this.team = team;
			this.ranking = ranking;
			this.record = record;
		}
		
		public String getRecord(){
			return record;
		}
		
		public int getWins(){
			return Integer.parseInt(record.substring(0, record.indexOf("-")));
		}
		
		public int getLosses(){
			return Integer.parseInt(record.substring(record.indexOf("-")+1, record.indexOf("-", record.indexOf("-")+1)));
		}
		
		public int getTies(){
			return Integer.parseInt(record.substring(record.lastIndexOf("-")+1));
		}
		
		public String getTeam(){
			return team;
		}
		
		public int getRank(){
			return ranking;
		}
	}
}
__________________
Student (3309) 2010-2013
Mentor (597) 2014
Mentor (3309) 2013-Present
Reply With Quote
  #5   Spotlight this post!  
Unread 08-03-2013, 00:17
jasongb jasongb is offline
Registered User
FRC #1706
 
Join Date: Mar 2012
Location: Wentzville MO
Posts: 7
jasongb is an unknown quantity at this point
Re: Team List RSS?

I'm exploring the rest of the API, and I was wondering if you had a guide to all of the acronyms used in the 'rankings'?
Reply With Quote
  #6   Spotlight this post!  
Unread 08-03-2013, 00:31
vinnie's Avatar
vinnie vinnie is offline
Registered User
FRC #3309 (Friarbots)
Team Role: College Student
 
Join Date: Oct 2010
Rookie Year: 2010
Location: Los Angeles / Anaheim
Posts: 107
vinnie has a reputation beyond reputevinnie has a reputation beyond reputevinnie has a reputation beyond reputevinnie has a reputation beyond reputevinnie has a reputation beyond reputevinnie has a reputation beyond reputevinnie has a reputation beyond reputevinnie has a reputation beyond reputevinnie has a reputation beyond reputevinnie has a reputation beyond reputevinnie has a reputation beyond repute
Re: Team List RSS?

Quote:
Originally Posted by jasongb View Post
I'm exploring the rest of the API, and I was wondering if you had a guide to all of the acronyms used in the 'rankings'?
Can you give me an example so that I can try to help you?
__________________
Student (3309) 2010-2013
Mentor (597) 2014
Mentor (3309) 2013-Present
Reply With Quote
  #7   Spotlight this post!  
Unread 08-03-2013, 05:54
jasongb jasongb is offline
Registered User
FRC #1706
 
Join Date: Mar 2012
Location: Wentzville MO
Posts: 7
jasongb is an unknown quantity at this point
Re: Team List RSS?

Sure:

{"Rank":"2","DQ":"0","CP":"0","QS":"18.00","BP":"2 10.00","TP":"200.00","Record (W-L-T)":"9-1-0","HP":"214.00","Team":"138","Played":"10"}

DQ? CP? QS? BP? TP? HP?
Reply With Quote
  #8   Spotlight this post!  
Unread 08-03-2013, 16:36
John Sabath's Avatar
John Sabath John Sabath is offline
LabVIEW Software Developer
FRC #3792 (The Army Ants)
Team Role: Alumni
 
Join Date: Mar 2012
Rookie Year: 2012
Location: Columbia, MO
Posts: 53
John Sabath is a splendid one to beholdJohn Sabath is a splendid one to beholdJohn Sabath is a splendid one to beholdJohn Sabath is a splendid one to beholdJohn Sabath is a splendid one to beholdJohn Sabath is a splendid one to beholdJohn Sabath is a splendid one to beholdJohn Sabath is a splendid one to behold
Re: Team List RSS?

Here are the tab separated lists from FIRST

Teams
https://my.usfirst.org/frc/scoring/i...?page=teamlist

Events
https://my.usfirst.org/frc/scoring/i...page=eventlist
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 21:49.

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