Difference between revisions of "REST API:execSQL Resource"
imported>Aeric |
imported>Aeric m (Text replace - '{{permissions|Customize Objects|' to '{{permissionRef|Customize Objects|') |
||
Line 3: | Line 3: | ||
===Permissions=== | ===Permissions=== | ||
{{ | {{permissionRef|Customize Objects|use this resource.}} | ||
===Execute a SQL Query=== | ===Execute a SQL Query=== |
Revision as of 00:17, 23 October 2012
Use the SQL query language to access Object tables, using the REST API.
- Learn more: REST API Conventions and Considerations.
Permissions
Users that have the Customize Objects permission can use this resource..
Execute a SQL Query
Use the SQL query language to execute a query against Object tables.
Learn more:
- Method
- GET
- URI
- https://{yourDomain}/networking/rest/execSQL?sql={query}
- Query Parameters
- sql - The SQL language query to execute.
- For more information, see: Specifying Query Parameters in REST APIs
Note:
When specifying a URL in code, any special characters (characters other than letters and numbers) need to be encoded. For example, a space character can be encoded using either + or %20.(Browsers typically take care of encoding URLs entered into the address bar--so the URL displayed after visiting a page may differ somewhat from the one that was initially entered.)
Here are some typical encodings:
space
+
%%20 or +
%2B
%25
So:
Instead of Use & (A&B)
space (A B)%26 (A%26B)
%20 (A%20B)
It can be hard to get be hard to get the encoding right, so it's desirable to use a language library designed for the purpose.
Learn more:- URL Encoding in HTML
- Encode a URL in JavaScript
- URLEncoder class for Java
- Response
The tag names (shown here as field1, field2, etc.) are the column names specified in the query, or their aliases.
<platform> <record> <field1>...data...</field1> <field2>...data...</field2> ... </execSQL> <message> <code>0</code> <description>Success</description> </message> <recordCount>N</recordCount> <!-- Number of records returned by the query --> </platform>
- See also: REST API:Error Codes