How can I correspond a request with a response?

When requesting with the following name array with Get game api,

name = ["Dark Souls", "quux", "魔界村", "VALORANT"]
(“魔界村” is a Japanese word for “Ghosts 'n Goblins”)

the response is as follows.

{
  :data=>
  [
    {
      :id=>"15619",
      :name=>"Ghosts 'n Goblins",
      :box_art_url=>"https://static-cdn.jtvnw.net/ttv-boxart/15619-{width}x{height}.jpg"
    },
    {
      :id=>"29433",
      :name=>"Dark Souls",
      :box_art_url=>"https://static-cdn.jtvnw.net/ttv-boxart/29433-{width}x{height}.jpg"
    },
    {
      :id=>"516575",
      :name=>"VALORANT",
      :box_art_url=>"https://static-cdn.jtvnw.net/ttv-boxart/516575-{width}x{height}.jpg"
    }
  ]
}
  1. Does the order of the requested name and the order of the response do not correspond?
  2. Is there a way to identify the request that couldn’t be retrieved?
    (in this case, “quux” could not be retrieved, so I want remove it from name array)

Is there any way other than checking with a single name request instead of a name array request?

No

quux isn’t in the response so you match your input array with the output array by looping.

Since this is “Get Game” it doesn’t direct matches. You’ll jsut have some fun with the non english names

quux isn’t in the response so you match your input array with the output array by looping.

But how can program know that the result of “魔界村” is “Ghosts 'n Goblins” ?

I would like to request 100 game names array and remove the game name that I couldn’t get from the array and rewrite the game name to response’s name (“魔界村” to “Ghosts 'n Goblins”).

Is it impossible since “Get Game” doesn’t direct match?

If trying to lookup translated names probably easier do those one to one.

Yeah for all the “I submitted 100 things” the output order is not gonna be the same as the input order.

I want a name that exactly matches the “name” in the response of “Get game”, not just a translation.

OK, The number of requests will be 100 times, but I am going to request one game with one request instead of multiple. Thank you.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.