Headers and TBA API v3

Greetings all, first time back in a while… I am running into a bit of an issue with the headers on the TBA api. I am trying to migrate some stuff from API v2, which used a different format (The Blue Alliance - API Docs)

I have logged in and set up an appropriate read key, and tested that key on TBA page. I was following the header structure from here: FRC Events API Valid User Token

I am using Java, an old codebase from a while ago mind you, but I am running into authentication errors which I can only imagine are from incorrectly set up headers on my end:

Here is the relevant code:

(the url passed is: “http://www.thebluealliance.com/api/v3/team/frc254/2019/events”)

import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

public class Utility {
	/*
	 * getJsonFromUrl
	 */
public static String getJsonFromUrl(String url) {
		OkHttpClient client = new OkHttpClient();
		String tba_key = "<my key string>";
		String accept_header = "application/json";

		Request request = new Request.Builder().url(url)
				.addHeader("accept", accept_header)
				.addHeader("X-TBA-Auth-Key", tba_key)
				.addHeader("User-Agent", "frcScouter").build();

		System.out.println(request);

   ....
}
}

This request shows up as:
Request{method=GET, url=http://www.thebluealliance.com/api/v3/team/frc254/2019/events, tag=null}

This returns a JSON with:
Error "Invalid endpoint"

Any guidance would be appreciated. Thank you

The endpoint is /team/{team_key}/events/{year}. You have “events” and the year reversed.

Thanks, I knew it was some stupid small thing I was overlooking. Community for the win. :slight_smile:
working now

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.