I am trying to access google Knowledge graph API except am encountering the error com.google.api.client.http.HttpResponseException: 400 Bad Request
"message": "API key not valid. Please pass a valid API key."
, but I do not get it, my API key is the right one I obtained based on the instructions supplied here
HttpTransport httpTransport = new NetHttpTransport();
HttpRequestFactory requestFactory = httpTransport.createRequestFactory();
JSONParser parser = new JSONParser();
GenericUrl url = new GenericUrl("https://kgsearch.googleapis.com/v1/entities:search");
url.put("query", "Taylor Swift");
url.put("limit", "10");
url.put("indent", "true");
url.put("key",R.string.API_KEY);
HttpRequest request = requestFactory.buildGetRequest(url);
HttpResponse httpResponse = request.execute();