SpaceTradersAPI / issues-and-suggestions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Suggestion: Add `flightPlanId` to `/users/:username` response, OR remove `ships` and `loans` from `/users/:username` altogether

nhowell opened this issue · comments

Currently, /users/:username returns your ships, but it is missing the flightPlanId property. I would suggest adding it so that the response matches /users/:username/ships. This would help clients avoid making an extra API call. However, it wouldn't be my preferred solution.

Ideally, in my opinion, the "duplicate" data (ships and loans) should be removed from /users/:username altogether. Having them there seems to violate REST principles. It would be fine to aggregate some metadata there, like shipCount or something, if that were desired, though.

Some other current duplication in the API that I think should be addressed, too:

  • As mentioned, the ships that are returned from /users/:username are a duplicate of /users/:username/ships (minus the flightPlanId currently)
  • The loans that are returned from /users/:username are a duplicate of /users/:username/loans
  • The locations that are returned from /game/systems are a duplicate of /game/systems/:symbol/locations

Thanks for the thoughtful issue! You've covered a bunch of things which should be discussed and decided upon.