read
It will return all records in json format and fast. method will use GET
.
#
Read Paramters and Usageparameter | description | example |
---|---|---|
blank | if you not passing any parameter it will retrive all data from table | --- |
column | It 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 |
only | If 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 records | only=name,city |
not | If you want to ignore some columns from record so user can pass column in not parameter | not=phone_number,password |
query | Sometime maybe you will expect own records, so this is special parameter here you can direcly give SQL Query | query=select * from users |
single | If you want to get only one single data so you can use single parameter | single=true or id=1&single=true |
columns | If you want know column name, datatype of table | columns=true |
_embed | If you use this param it automatticaly detect image from json and convert ito full image path | ?_embed |
Here the parameter for joins [NEW]
parameter | description | example |
---|---|---|
leftjoin | to apply left joins | leftjoin=foreign_table |
rightjoin | to apply right joins | rightjoin=foreign_table |
innerjoin | to apply inner joins | innerjoin=foreign_table |
leftouterjoin | to apply left outer joins | leftouterjoin=foreign_table |
rightouterjoin | to apply right outer joins | rightouterjoin=foreign_table |
fullouterjoin | to apply full outer joins | fullouterjoin=foreign_table |
on | on is must with joins parameter, its use connect columns for both table | on=self_column,foreign_column |
Join Example:
GET | api.example.com/users?innerjoin=address&on=id,user_id
#
Read Parameter examplesExample Table and Records, table name is users
id | name | password | |
---|---|---|---|
1 | Rohit | rohit@gmail.com | Rohit321 |
2 | Rahul | rahul@gmail.com | 123Rahul |
3 | Komal | komal@gmail.com | Xyz123 |
4 | Neha | komal@gmail.com | iloveyou |
5 | Pooja | pooja@gmail.com | iampooja |
#
BlankGET | 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" }]
#
ColumnGET | 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" }]
#
OnlyGET | 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" }]
#
NotGET | 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" }]
#
queryGET | 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" }]
#
SingleGET | api.example.com/users?name=Rohit&single=true
{ "id": "1", "name": "Rohit", "email": "rohit@gmail.com", "password": "Rohit321"}
#
ColumnsIf 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" }]
#
EmbedNormal
#
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" }]