I’m trying to access the FRC Events API, and I keep running into the error 401 unauthorized. I think I’ve followed the instructions from the Apiary documentation, yet I’m still running into the error.
I’ve tried sending a request to a randomly selected endpoint given as an example in the documentation, with the correct authorization header. (with the key being “Authorization”, and the value being the base64 encoded string “username:authorizationtoken” format)
I’ve tried using both Postman and just writing a request using Java. The Java code is below.
URL url = new URL("https://frc-api.firstinspires.org/v2.0/2017/CMPMO"); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); String clearAuth = "-snipped pls don't ban me from the API FIRST-"; String encodedAuth = new String(Base64.getEncoder().encode(clearAuth.getBytes())); connection.setRequestProperty("Authorization", encodedAuth); connection.setRequestMethod("GET"); connection.connect();
I condensed the code, removing everything regarding the input of data. I’d appreciate it if someone could point out what I’m doing wrong. Thanks.