Add documentation for binary output in rpc, Fix #84 (#92)

This commit is contained in:
Steve Chávez
2017-07-20 00:06:57 -05:00
committed by Joe Nelson
parent cdf5dece65
commit 4be05649f4
+23
View File
@@ -278,6 +278,29 @@ and select a single column :code:`?select=bin_data`.
GET /items?select=bin_data&id=eq.1 HTTP/1.1 GET /items?select=bin_data&id=eq.1 HTTP/1.1
Accept: application/octet-stream Accept: application/octet-stream
You can also request binary output when calling stored procedures and since they can return a scalar value you are not forced to use :code:`select`
for this case.
.. code:: sql
CREATE FUNCTION closest_point(..) RETURNS bytea ..
.. code:: http
POST /rpc/closest_point HTTP/1.1
Accept: application/octet-stream
If the stored procedure returns non-scalar values, you need to do a :code:`select` in the same way as for GET binary output.
.. code:: sql
CREATE FUNCTION overlapping_regions(..) RETURNS SETOF TABLE(geom_twkb bytea, ..) ..
.. code:: http
POST /rpc/overlapping_regions?select=geom_twkb HTTP/1.1
Accept: application/octet-stream
.. note:: .. note::
If more than one row would be returned the binary results will be concatenated with no delimiter. If more than one row would be returned the binary results will be concatenated with no delimiter.