Skip to main content

read

It will return all records in json format and fast. method will use GET.

Read Paramters and Usage#

parameterdescriptionexample
blankif you not passing any parameter it will retrive all data from table---
columnIt will work like where clause, it will retrive all data where column = value, its can take multiple value also.name=Rohit or name=Rohit&city=Ajmer
onlyIf you want to retrive data for perticular column so here user can use only parameter and can give column by comma, so it will return only perticular column recordsonly=name,city
notIf you want to ignore some columns from record so user can pass column in not parameternot=phone_number,password
querySometime maybe you will expect own records, so this is special parameter here you can direcly give SQL Queryquery=select * from users
singleIf you want to get only one single data so you can use single parametersingle=true or id=1&single=true
columnsIf you want know column name, datatype of tablecolumns=true
_embedIf you use this param it automatticaly detect image from json and convert ito full image path?_embed

Here the parameter for joins [NEW]

parameterdescriptionexample
leftjointo apply left joinsleftjoin=foreign_table
rightjointo apply right joinsrightjoin=foreign_table
innerjointo apply inner joinsinnerjoin=foreign_table
leftouterjointo apply left outer joinsleftouterjoin=foreign_table
rightouterjointo apply right outer joinsrightouterjoin=foreign_table
fullouterjointo apply full outer joinsfullouterjoin=foreign_table
onon is must with joins parameter, its use connect columns for both tableon=self_column,foreign_column

Join Example:

GET | api.example.com/users?innerjoin=address&on=id,user_id

Read Parameter examples#

Example Table and Records, table name is users

idnameemailpassword
1Rohitrohit@gmail.comRohit321
2Rahulrahul@gmail.com123Rahul
3Komalkomal@gmail.comXyz123
4Nehakomal@gmail.comiloveyou
5Poojapooja@gmail.comiampooja

Blank#

GET | api.example.com/users
[  {    "id": "1",    "name": "Rohit",    "email": "rohit@gmail.com",    "password": "Rohit321"  },  {    "id": "2",    "name": "Rahul",    "email": "rahul@gmail.com",    "password": "123Rahul"  },  {    "id": "3",    "name": "Komal",    "email": "komal@gmail.com",    "password": "Xyz123"  },  {    "id": "4",    "name": "Neha",    "email": "neha@gmail.com",    "password": "iloveyou"  },  {    "id": "5",    "name": "Pooja",    "email": "pooja@gmail.com",    "password": "iampooja"  }]

Column#

GET | api.example.com/users?name=Rohit

or

GET | api.example.com/users?name=Rohit&id=1
[  {    "id": "1",    "name": "Rohit",    "email": "rohit@gmail.com",    "password": "Rohit321"  }]

Only#

GET | api.example.com/users?only=id,name
[  {    "id": "1",    "name": "Rohit"  },  {    "id": "2",    "name": "Rahul"  },  {    "id": "3",    "name": "Komal"  },  {    "id": "4",    "name": "Neha"  },  {    "id": "5",    "name": "Pooja"  }]

Not#

GET | api.example.com/users?not=email,password
[  {    "id": "1",    "name": "Rohit"  },  {    "id": "2",    "name": "Rahul"  },  {    "id": "3",    "name": "Komal"  },  {    "id": "4",    "name": "Neha"  },  {    "id": "5",    "name": "Pooja"  }]

query#

GET | api.example.com/users?query=select * from users where id!=1
[  {    "id": "2",    "name": "Rahul",    "email": "rahul@gmail.com",    "password": "123Rahul"  },  {    "id": "3",    "name": "Komal",    "email": "komal@gmail.com",    "password": "Xyz123"  },  {    "id": "4",    "name": "Neha",    "email": "neha@gmail.com",    "password": "iloveyou"  },  {    "id": "5",    "name": "Pooja",    "email": "pooja@gmail.com",    "password": "iampooja"  }]

Single#

GET | api.example.com/users?name=Rohit&single=true
{  "id": "1",  "name": "Rohit",  "email": "rohit@gmail.com",  "password": "Rohit321"}

Columns#

If you want to know what columns are in table and what data type here we use columns parameter.

GET | api.example.com/users?columns=true

Response

[  {    "name": "id",    "datatype": "int",    "columntype": "int(11)",    "length": null  },  {    "name": "name",    "datatype": "varchar",    "columntype": "varchar(15)",    "length": "15"  },  {    "name": "email",    "datatype": "varchar",    "columntype": "varchar(35)",    "length": "35"  },  {    "name": "password",    "datatype": "varchar",    "columntype": "varchar(35)",    "length": "35"  }]

Embed#

Normal#
GET | api.example.com/users
[  {    "id": "1",    "name": "Rohit",    "email": "rohit@gmail.com",    "password": "Rohit321",    "profile_pic":"rohit-image.jpg"  }]
With _Embed#
GET | api.example.com/users?_embed
[  {    "id": "1",    "name": "Rohit",    "email": "rohit@gmail.com",    "password": "Rohit321",    "profile_pic":"http://media.example.com/rohit-image.jpg"  }]