Back to BlogBackend
Building REST APIs for Mobile Apps
2024-04-10
APIs for mobile have different constraints than web: intermittent connectivity, battery, and smaller screens.
Versioning: Use path or header versioning. Avoid breaking changes; support old clients during transitions.
Pagination: Cursor-based pagination is often better than offset for large datasets. Return next_cursor and has_more.
Errors: Return consistent shapes. Use HTTP status codes. Include a code for client-side handling and a human-readable message.
Payload Size: Compress responses. Return only fields the client needs. Consider GraphQL for flexible queries.