RoyaleAPI / cr-api

Clash Royale Analytics, Profiles and Insights. We no longer publish a public API. Please use the official API from Supercell.
https://RoyaleAPI.com
167 stars 20 forks source link

Improve error handling in batch requests #391

Closed Anton3 closed 6 years ago

Anton3 commented 6 years ago

Idea

Add "exists" field for /player and /clan endpoints. For batch requests, if some players or clans don't exist, the response should still include other players.

Rationale

Currently, in a request for multiple players or clans, if any of them does not exist, the API returns error for the whole request. I try to use batch requests with many tags whenever possible, but if the API returns error, I have to send individual requests instead, trying to find out, which account was banned, or which clan no longer exists. This leads to longer delays.

Affected endpoints

Request Details:

https://api.royaleapi.com/player/0V0Q00VV

Response Details:

Code: 200
{
  "exists": false,
}

Request Details:

https://api.royaleapi.com/player/9VQUCULU,0V0Q00VV

Response Details:

Code: 200
[
  {
    "exists": true,
    <the rest of info goes here>
  },
  {
    "exists": false
  }
]
fourjr commented 6 years ago

I feel that 404 should still be returned in both cases

selfish commented 6 years ago

I feel the same, but more importantly, since not all multi requests return the id requested, in the current way the api works, keeping the order is the reason to fail the request.