GET Data - GeekyTheory/Automatic-API-REST GitHub Wiki
Automatic API Rest has a URI structure which allows create specific queries to provide information to the end-user
##Output Data
Automatic API REST Beta Version provide the information in JSON format, the structure of the output data is always the same structure for basic queries.
{
"data": [
{
"0": "Column0Row0",
"ColumnName0": "Column0Row0",
"1": "Column1Row0",
"ColumnName1": "Column1Row0",
"2": "Column2Row0",
"ColumnName2": "Column2Row0",
"3": "Column3Row0",
"ColumnName3": "Column3Row0",
"MoreData" : "... More Columns Data ..."
},
{
"0": "Column0Row1",
"ColumnName0": "Column0Row1",
"1": "Column1Row1",
"ColumnName1": "Column1Row1",
"2": "Column2Row1",
"ColumnName2": "Column2Row1",
"3": "Column3Row1",
"ColumnName3": "Column3Row1",
"MoreData" : "... More Columns Data ..."
},
{
"MoreRows" : "More Rows Data"
}
],
"dbInfo": [
"ColumnName0",
"ColumnName1",
"ColumnName2",
"MoreColumnsNames"
]
}
The structure of the URIs are like:
http://[DOMAIN]/api/[METHOD]/[TABLE]/[COLUMN1-COLUMN2-COLUMN3-...]/?[EXTRA-PARAMETERS>]
Example:
http://localhost/api/get/city/Name-CountryCode/?w=ID:1000
This example returns the values of the columns Name and CountryCode of the table city where ID = 1000.
| Name | [Table] |
|---|---|
| Method | GET/POST |
| Description | Get information from a table |
| Example | http://domaim.com/api/get/tableName/ |
| Live Example | See Demo Example |
| Name | [COLUMNS] |
|---|---|
| Method | GET/POST |
| Description | Get information from column, this parameter must be used with /[Table]/ parameter |
| Example | http://domaim.com/api/get/tablename/column1-column2/ |
| Live Example | See Demo Example |
| Name | o,s |
|---|---|
| Method | GET/POST |
| Description | Order By (ASC/DESC) parameter |
| Example | http://domaim.com/api/get/tableName/columnName1-columnName2/?o=ColumnName&s=asc |
| Live Example | TO-RENEW - See Demo Example |
| Name | l |
|---|---|
| Method | GET/POST |
| Description | Limit |
| Example | http://domaim.com/api/get/tableName/columnName1-columnName2/?l=limit |
| Live Example | See Demo Example |
| Name | w |
|---|---|
| Method | GET/POST |
| Description | Where condition |
| Example | http://domaim.com/api/get/tableName/columnName1-columnName2/?w=columnName:'String' |
| Live Example | See Demo Example |
- Note 1: The conversion of = is : in our URI
- Note 2: We can add more where parameter with AND/OR clausure ie: [http://automaticapirest.info/api/get/Country/Code-Name/?w=Code:'ATF' AND Name:'French Southern territories']( http://automaticapirest.info/api/get/Country/Code-Name/?w=Code:'ATF' AND Name:'French Southern territories')
| Name | f |
|---|---|
| Method | GET/POST |
| Description | Format, default: json ; This parameter will be used for choice between xml or json format |
| Example | http://domaim.com/api/get/tableName/?f=json |
| Live Example | TO-RENEW - See Demo Example |
| Name | opt |
|---|---|
| Method | GET/POST |
| Description | opt parameter is used for optional function |
| Optional Functions | numItem: Return number of items of the query |
| Example | http://domaim.com/api/get/tableName/?opt=numItem |
| Live Example | TO-RENEW - See Demo Example |
- Output Format for numItem
{"data":239,"dbInfo":""}