1
Hello, I’m using the android library Volley to make a GET call (https) to return to me the Json of the videos of a specific playlist. Basically my current GET request is this:
String url ="https://youtube.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=PLl-K7zZEsYLlRjj-mSComCq3Vd4IJese1&key="+YoutubeConfig.getApiKey();
Where YoutubeConfig.getApiKey();
is my API key created on the developer console with AUTH 2.0 key and registered in the application’s SHA-1.
When trying to do GET in the solution, the code returns me an Errorresponse and "null" as message code, like this:
// Instantiate the RequestQueue.
RequestQueue queue = Volley.newRequestQueue(this);
String url ="https://youtube.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=PLl-K7zZEsYLlRjj-mSComCq3Vd4IJese1&key="+YoutubeConfig.getApiKey();
// Request a string response from the provided URL.
StringRequest stringRequest = new StringRequest(Request.Method.GET, url,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
// Display the first 500 characters of the response string.
Log.i("onResponse", "onResponse: "+response);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.i("ErrorOnResponse", "onErrorResponse: "+error.getLocalizedMessage());
}
});
// Add the request to the RequestQueue.
queue.add(stringRequest);
logCat:
2020-11-17 10:04:22.256 23662-23662/com.appX.a2f20 I/ErrorOnResponse: onErrorResponse: null
That is, the GET request could not be validated, I’m not understanding why, the format seems to me to be correct and the playlistID is valid, someone knows why this error happens?