Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • 3
    There is no right answer to this. Ask your consumers what they want. Will they always/sometimes/rarely need the additional fields? Whats the overhead on the response time and response size for including the additional fields? Do you have the bandwidth or desire to build/maintain multiple apis? You could build two endpoints, one for just event, one with evetything (not particularly RESTful, but if it meets the consumer needs..). So many ways to chop this up. Figure out the consumer's requirements by priority, figure out your own priorities and come to a decision/compramise.
    – K Mo
    Commented Mar 1, 2020 at 11:24
  • 1
    "I know that the person making the request needs the information" -- if can you tell this, then why would you force the person to make multiple calls?
    – Erik Eidt
    Commented Mar 1, 2020 at 12:32
  • 1
    Over the network, generally prefer to transfer data in a coarse grained way (more data at once), as the cost of making the call can accumulate over multiple calls and outweigh the cost of transfer (higher overall latency). However, take into consideration what data they actually need and when, under what scenarios, how are they going to use it (access patterns), consider paging, etc., and organize the API around that. It's a bit of a balancing act. Commented Mar 1, 2020 at 14:33
  • To add to the other comments, the objects that you transmit over your API should be driven by the requirements of your API consumers, not how you happen to currently store the required information in your database. It is entirely valid to send an object that is built from information that is stored across multiple database tables. Commented Mar 2, 2020 at 9:24