API design/approach

Posted 2 years ago by adelin


Target: I am working on an app and i want to design it's API a bit like in "incremental-api-development" series. []

Problem: I want the API to be used directly by the web-app, but the API design means that i need to make multiple requests in order to retrieve more information about one entity. E.g.: One post can have multiple tags, but i don't want the tags that belong to that post to be retrieved in a 2nd request when the request is made "by the webapp"

Question: Is it a way to design the API so that i can leverage eloquent's relations? Would this be a "normal" thing to do in order to not double the work load? Am i over-complicating things?

I'm opened to suggestions and ideas or techniques you've used/you'd use in this kind of situations.

Thank you.

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.