i am trying to access gaana api from java side by using mashape api i am trying from a localhost. but, i am getting issues while trying to connect gaana api. Below is my code in one of my rest service ( I am using spring-security and java8). I am Btech-CSE final year student.
@RestController
@RequestMapping("/api/ideas")
public class IdeaController {
@RequestMapping(method = RequestMethod.GET)
public void invokeGaanaAPI() throws UnirestException {
System.out.println("hello");
// These code snippets use an open-source library.
// HttpServletResponse<JsonNode> response =
Unirest.get("https://community-gaana.p.mashape.com/index.php?subtype=most_popular&type=song")
.header("X-Mashape-Key", "iWEvla5JyCmshafdpHdjoSdtPsHPp1Ily4qjsnCEiVxbQsY5tn")
.header("Accept", "application/json")
.asJson();
Unirest.get("https://community-gaana.p.mashape.com/user.php?type=registrationtoken")
.header("X-Mashape-Key", "iWEvla5JyCmshafdpHdjoSdtPsHPp1Ily4qjsnCEiVxbQsY5tn")
.header("Accept", "application/json")
.asJson();
System.out.println("hello");
}
}
I need help to proceed in this situation. any kind of help is fine for me. i am getting data as null. so, json conversion is throwing null pointer exception. I am passionate to do this project.