@phpmick There is nothing wrong with using query strings to specify your date range, that is how most cloud APIs handle GET requests. The format you use depends on your requirements. If you're just looking for a simple range, and don't have to consider time or timezones, you can just go with a Y-m-d format. In your backend, you can grab the values via request('to_date') (or whatever you named the query string fields) and/or parse them into Carbon instances.
Nov 25, 2020
1
Level 15
Specifying date range for index page of API.
Hi,
My API index page needs from and to parameters.
What is the best way to do this and what date format should I pass (selecting against created_at).
I have started using a GET with URL parameters (because nothing changes on the server) but this doesn't feel right.
Mick
Please or to participate in this conversation.