Difference between revisions of "OData URIs"
Yvonne.milne (Talk | contribs) |
Yvonne.milne (Talk | contribs) |
||
Line 18: | Line 18: | ||
<pre>http://localhost/odata/southwind/customers?$skip=10&$top=5</pre> | <pre>http://localhost/odata/southwind/customers?$skip=10&$top=5</pre> | ||
+ | |||
+ | When using the $sql [[#Arguments|argument]], the URI does not include a table reference: | ||
+ | |||
+ | <pre><server>/odata/<database>?$sql=<sql statement></pre> | ||
+ | |||
+ | e.g. | ||
+ | |||
+ | <pre>http://localhost:8001/odata/southwind?$sql=select * from shippers</pre> | ||
+ | |||
+ | Note: the OData Read and Update services can be enabled/disabled in the [[Lianja Server Manager on Windows#Security|Lianja Server Manager Security Settings]]. | ||
===OData Functions=== | ===OData Functions=== | ||
Line 26: | Line 36: | ||
e.g. | e.g. | ||
− | <pre>/southwind/customers?$skip=10&$top=5</pre> | + | <pre>odata_read("/southwind/customers?$skip=10&$top=5")</pre> |
+ | |||
+ | When using the $sql [[#Arguments|argument]], the URI does not include a table reference: | ||
+ | |||
+ | <pre>/<database>?$sql=<sql statement></pre> | ||
+ | |||
+ | e.g. | ||
+ | <pre>odata_read("/southwind?$sql=select * from shippers order by companyname")</pre> | ||
===Arguments=== | ===Arguments=== |
Revision as of 12:40, 1 February 2017
Under Construction
See Also
OData Operators, ODATA_CREATE(), ODATA_DELETE(), ODATA_READ(), ODATA_UPDATE(), Working with JSON and JQL,Working with OData in Lianja Cloud Server
OData URIs
Lianja Cloud Server
When used with the Lianja Cloud Server, the URI is formed as follows:
<server>/odata/<database>/<table>?<arg1>&<arg2>&<arg3>...
e.g.
http://localhost:8001/odata/southwind/customers?$skip=10&$top=5
Or, if the Lianja Server is listening on port 80 or the ISAPI Extension for IIS is installed:
http://localhost/odata/southwind/customers?$skip=10&$top=5
When using the $sql argument, the URI does not include a table reference:
<server>/odata/<database>?$sql=<sql statement>
e.g.
http://localhost:8001/odata/southwind?$sql=select * from shippers
Note: the OData Read and Update services can be enabled/disabled in the Lianja Server Manager Security Settings.
OData Functions
When using the OData Functions from the Lianja App Builder Console or from a Lianja/VFP program (.prg), Lianja/VFP Server Page (.rsp) or JavaScript Server Page (.jssp), the URI is formed as follows:
/<database>/<table>?<arg1>&<arg2>&<arg3>...
e.g.
odata_read("/southwind/customers?$skip=10&$top=5")
When using the $sql argument, the URI does not include a table reference:
/<database>?$sql=<sql statement>
e.g.
odata_read("/southwind?$sql=select * from shippers order by companyname")
Arguments
The following URI arguments are available:
Argument | Description | Example |
---|---|---|
$callback | Specify a callback function that will wrap the data returned. This is used with JSONP calls to bypass SOP issues in the browser |
$callback=your_javascript_function |
$count | Don't return any data just tell me how many records would have been selected | $count |
$filter | Selects only those records that match the specified filter | $filter=contactname eq 'A' and amount gt 0 |
$format | The output format | $format=ado $format=attachment $format=csv $format=excel $format=html $format=img $format=json $format=jsonarray $format=jsongrid |
$metadata | Returns metadata describing the columns in the table; name, type, width and decimals. | $metadata |
$nocount | Don't return the __count member which details the total number of rows that match the query. This improves performance on Virtual Tables |
$nocount |
$orderby | Specify a column or expression that the data should be ordered by | $orderby=contactname |
$rowid | Add the unique rowid into the output ( __rowid ) which can be used to update data later | $rowid |
$select | Selects only the specified columns (or expressions) | $select=customerid,contactname |
$skip | Skips a number of selected records | $skip=50 |
$sql | Evaluate a SQL SELECT statement directly and return the results. | $sql=select * from customers |
$top | Selects the specified number of records | $top=10 |