Comments (3)
I gave another approach in order to filter queries with multiple and more powerfull criterias (=, <=, >=, ...).
You can have a look to https://github.com/ogizanagi/ArrestDB#api-design :
...
limit
(LIMIT x
SQL clause)
offset
(OFFSET x
SQL clause)where
(WHERE x
SQL clause)
- array of:
col
(colum to filter)op
(SQL operator (e.g '=', '>=', ...))value
(value to filter)
As it lacks a concrete example, here is how to construct your urls:
#Get customers created after 2014-08-13 12:15 and where lastname is Doe
GET http://api.example.com/customers/?where[0][col]=date_created&where[0][op]=>=&where[0][val]=2014-08-13 12:15&where[1][col]=lastname&where[1][op]==&where[1][val]=Doe
I only did that first for an urgent need, it is not the best approach nor implementation but you'll find in this fork:
- the multiple where clauses
- more powerfull criterias
- another output for collections, with more informations about the request (current limit, offser, count & total).
Feel free to use this code and/or submit a PR about a similar way to handle it.
from arrestdb.
@ogizanagi & @alixaxel :
What are your thoughts about the OData URL conventions?
from arrestdb.
Of course, it's great. But it will drastically increment the complexity of the current implementation.
However, I'd like to see such a feature for this project if someone is willing to do so.
from arrestdb.
Related Issues (20)
- 503 : Service Unavailable HOT 5
- POST return ID of newly created record? HOT 2
- equal and like LINE 44 HOT 1
- Support for UUID
- Arrest PDO
- Use GET Params instead of Route
- Restangular with ArrestDB
- Unable to login with blank database password
- PHP 5.3 tips?
- getting service unavailable error HOT 1
- 409 for put / insert
- A question about numeric data
- HTTP_CONTENT_TYPE !!!
- 503 - Service Unavailable HOT 7
- ArrestDB + Postgresql + Nginx HOT 1
- New function for reporting table column names?
- No json data back at postgres request
- GET and support for NULL / NOT NULL column
- 400 - Bad Request HOT 2
- How to GET multiple records
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arrestdb.