I'm looking to build a solid API for my clients and I'm starting from scratch with Laravel, which uses JSON by default. I'm not a big fan of GraphQL, but I might be missing its benefits. I want to understand what's considered standard these days in API development.
I've come across various API schemes, but I'm not quite sure what they are or what they should include. For example, if I create a TV API, should I include a scheme as a key in the response? Alternatively, I prefer to link to a scheme that outlines the fields like title, genre, tags, etc. My goal is to adhere to some sort of standard while keeping it flexible. Any insights would be appreciated!
3 Answers
Going with REST and documenting your API using Open API specs can really help create clarity in your design. It provides a blueprint for both your users and yourself as you develop.
REST is pretty much the go-to standard for APIs these days. It’s simple and widely adopted! Just make sure you implement versioning in your API endpoints, like `website.com/api/v1/resource`, so you can manage changes easily down the line.
Absolutely include versioning and implement rate limiting. You'll want to track how many requests each account makes daily, which will help you identify any spammy activity easily. Naming your endpoints clearly is key—consider sticking to a straightforward structure like `api/v1/posts` and `api/v1/posts/` for content access.
Thanks for the tips! I'm using `api/v1` too, but I'm unsure how to set up a good response. Shouldn’t the route stay the same even if the content does?
Any recommended courses I should follow? I like REST too, but I want to make sure my solution is future-proof!