Rows
/rows
List Rows
URL: /tables/{name}/rows
Method: GET
Protocol: HTTP, HTTPS
Parameters:
- name – table name
Returns one of:
- 200 (OK) + collection of rows
- 404 (Not Found)
Example:
$ curl -X GET http://api.giscloud.com/1/tables/mytable/rows <rows total="2" page="1"> <script id="tinyhippos-injected"/> <row> <wkb_geometry>0101000020E6100000F6FFFFBF0E4E50C0253FCDBF1D733AC0</wkb_geometry> <ogc_fid>1</ogc_fid> <__created>2014-09-26 13:17:04</__created> <__modified>2014-09-26 13:17:04</__modified> <__owner>2</__owner> <name>myFirstNickname</name> <myname>myFirstName</myname> </row> <row> <wkb_geometry>0101000020E6100000F5FFFFAF3B4F50C0E51BFBE7BE733AC0</wkb_geometry> <ogc_fid>2</ogc_fid> <__created>2014-09-26 13:36:14</__created> <__modified>2014-09-26 13:36:14</__modified> <__owner>2</__owner> <name>mySecondNickname</name> <myname/> </row> </rows>
You can also chose format of geometry column using geometry parameter. Geometry parameter can be “false”, “wkt” or “wkb”.
Example:
$ curl -X GET http://api.giscloud.com/1/tables/mytable/rows?geometry=false <rows total="2" page="1"> <script id="tinyhippos-injected"/> <row> <wkb_geometry/> <ogc_fid>1</ogc_fid> <__created>2014-09-26 13:17:04</__created> <__modified>2014-09-26 13:17:04</__modified> <__owner>2</__owner> <name>myFirstNickname</name> <myname>myFirstName</myname> </row> ... </rows> $ curl -X GET http://api.giscloud.com/1/tables/mytable/rows?geometry=wkt <rows total="2" page="1"> <script id="tinyhippos-injected"/> <row> <wkb_geometry>POINT(-65.2196502685545 -26.4496726871577)</wkb_geometry> <ogc_fid>1</ogc_fid> <__created>2014-09-26 13:17:04</__created> <__modified>2014-09-26 13:17:04</__modified> <__owner>2</__owner> <name>myFirstNickname</name> <myname>myFirstName</myname> </row> ... </rows> $ curl -X GET http://api.giscloud.com/1/tables/mytable/rows?geometry=wkb <rows total="2" page="1"> <script id="tinyhippos-injected"/> <row> <wkb_geometry>0101000020E6100000F6FFFFBF0E4E50C0253FCDBF1D733AC0</wkb_geometry> <ogc_fid>1</ogc_fid> <__created>2014-09-26 13:17:04</__created> <__modified>2014-09-26 13:17:04</__modified> <__owner>2</__owner> <name>myFirstNickname</name> <myname>myFirstName</myname> </row> ... </rows>
Create Row
URL: /tables/{name}/rows
Method: POST
Protocol: HTTPS
Parameters:
- name – table name
Returns:
- 201
Example:
curl -X POST https://api.giscloud.com/1/tables/mytable/rows
Data can be sent in body in JSON format, e.g.
{ "data": { "attribute_string": "some text", "attribute_int": 5, "attribute_real": 3.14 } }
Example of creating a row with data:
curl --header "Content-Type: application/json" \ --request POST \ --data '{"data": {"attribute_string": "some text", "attribute_int": 5, "attribute_real": 3.14}}' \ https://api.giscloud.com/1/tables/mytable/rows
Here’s an example of geometry (wkt) being sent:
{ "data": { "city": "Zagreb", }, "geometry": "POINT(15.9796142578125 45.809657649974)" }
…or in curl statement:
curl --header "Content-Type: application/json" \ --request POST \ --data '{"data": {"city": "Split"}, "geometry": "POINT(16.446533203125 43.5127049046481)"}' \ https://api.giscloud.com/1/tables/mytable/rows
Update Row
URL: /tables/{name}/rows/{id}
Method: POST
Protocol: HTTPS
Parameters:
- name – table name
- id – row id
Returns:
- 204 if successful
- 404 if the resource wasn’t found
Example:
curl -X POST https://api.giscloud.com/1/tables/mytable/rows/1
Delete Row
URL: /tables/{name}/rows/{id}
Method: DELETE
Protocol: HTTPS
Parameters:
- name – table name
- id – row to be deleted
Example:
curl -X DELETE https://api.giscloud.com/1/tables/mytable/rows/1
Returns one of:
- 204 if successful
- 404 if the resource wasn’t found