You are building a RESTful API with Express to serve a mobile application. The mobile development team has asked for the ability to retrieve condensed responses to minimize data usage. How would you accommodate this request while maintaining the integrity of your API?

  • Create separate endpoints for condensed and full responses.
  • Use query parameters to allow clients to specify the response format.
  • Disable compression to send smaller payloads.
  • Use WebSocket instead of REST for real-time updates.
Using query parameters to allow clients to specify the response format is a common and RESTful approach to accommodating different client needs. Creating separate endpoints for each format can lead to redundancy and maintenance challenges. Disabling compression would likely increase, not decrease, data usage. Using WebSockets is for real-time communication and doesn't directly address response format concerns.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *