-
Notifications
You must be signed in to change notification settings - Fork 26
2.2.0) Requests: GET
Retrieve data from dataset
-
Fetch all:
/[token]/[database]/[table].[format] -
Fetch all with limit:
/[token]/[database]/[limit]/[table].[format] -
Fetch:
/[token]/[database]/[table]/[ID].[format] -
Fetch search by column:
/[token]/[database]/[table]/[column]/[value].[format] -
Fetch all joining table:
join[table] = array( 'on' => <column_id>, // Column of the table joined 'value' => <value>, // Column of main table or value 'method' => (left|inner|right) // Optional )
Example with value:
join[users]['on'] = id join[users]['value'] = 1 join[users]['method'] = 'INNER'
Example with column:
join[users]['on'] = id // Column of the table joined join[users]['value'] = user_id // Column of the main table (no users) join[users]['method'] = 'INNER'
-
Additional parameters
ex: /[database]/[table]/[column]/[value].[format]?order_by=[column]&direction=[direction]
Examples of GET requests:
GET /dataset/users.json HTTP/1.1
Host: localhostGET /dataset/10/users.json HTTP/1.1
Host: localhostGET /dataset/users/1.json HTTP/1.1
Host: localhostGET /dataset/users/is_active/1.json?order_by=username&direction=desc HTTP/1.1
Host: localhostNote: These examples are valid only for GET and PUT requests
Search single value
where[column] = 1 // column = 1
where[column][=] = 1 // column = 1
where[column][!] = 1 // column != 1
where[column][>] = 1 // column > 1
where[column][<] = 1 // column < 1
where[column][%] = "%1" // column LIKE "%1"Search multiple values
where[column] = array(1,5,7) // IN (...) (IN can be equal to an OR)
where[column][=] = array(1,5,7) // IN (...)
where[column][!] = array(1,5,7) // NOT IN (...)
where[column][>] = array(1,2) // column > 1 AND column > 2
where[column][<] = array(1,2) // column < 1 AND column < 2
where[column][%] = array("%1","%2") // column LIKE "%1" AND column LIKE "%2"Specify column's table
where['table.column'][=] = array(1,5,7)Compare between two different table columns
where['table_a.column_a'] = 'table_b.column_b'Compare between different columns of main table
where['column_a'] = 'table_a.column_b'
// OR
where['table_a.column_a'] = 'table_a.column_b'
// WRONG
where['column_a'] = 'column_b'-
order_by: column_nameCan be and array or a string
order_by = 'username, name, surname' // OR order_by = array('username', 'name', 'surname')
for more specific order direction
order_by['users.username'] = 'DESC'
-
direction:ASCorDESC(defaultASC) -
limit: max elements to retrieve
ex: /[database]/[tabel]/[colomn]/[value].[format]?order_by=[column]&direction=[direction]