I'm new working with API's and I'm making a tiny project with Java, I want to use a searchbar to search for a game title and get like, the first 5 results from this API. Then I want to click in the game I'm interested from those 5 results and get the information of that game.
I though, that it should be easy, I just have to request a /search/ and then when I click a game I should request a /game/ using the id I get from the search. But I'm having trouble with how this API works.
When I make a request to an API, I want to get that request in a JSON format and then turn that JSON into an object using a POJO class that contains the attributes shown in that JSON.
The problem is that no matter what I request to this API it just give me the same atributes: "error", "limit", "offset"... and then "results". And the information I want is in results. Now imagine I make a POJO class called "response" where I store those atributes, then I would have to create another POJO class called "results" to get the information I want. The main problem is that the "results" class needs some specific attributes if I request a game and completely different attributes if I request a Search.
So what I'm seeing is that if I want to use this api I can only request one thing, either a Search or a game, I must be wrong for sure, Have you tried to use this API with Java? What did you do? Am I asking a stupid question with an obvius answer? Can someone help me?
Log in to comment