You have the option to disable the WHERE clauses or even predefined WHERE clauses through the Web.config file.
Settings for WHERE clauses and predefined WHERE clauses in the Web.config file
<restapi>
...
<!-- Plain WHERE clauses as parameters are forbidden -->
<!--<add key="nowhereclause" value="true" />-->
<!-- Using predefined WHERE clauses as parameter is forbidden -->
<!--<add key="nolimitedsql" value="true" />-->
</restapi>
To get a list of entities, you have the option to use a GET or POST request against the REST API. Both methods support to query by example. Simply provide the columns to query in the form Name=Value in the URL.
Detailed information about this topic
To get a list of entities using the GET method, use the URL <baseURL>/api/entities/{table}.
Query parameters to be used in WHERE clauses and predefined WHERE clauses can be provided in the form @paramname=value. Per default they have the type string. Additionally, it is possible to pass the type with the name: @otherParam[int]=3. Types originate from DbVal class.
Table 16: Get collection (GET) request
Get |
<BaseURL>/api/entities/{table} |
None |
Table 17: Get collection (GET) parameters
table |
Table name (required). |
path |
string |
where |
WHERE clause. |
query |
string |
whereKey |
Predefined WHERE clause from QBMLimitedSQL (Key [UID] or ID [Ident_QBMLimitedSQL]). |
query |
string |
orderBy |
ORDER BY clause. |
query |
string |
offset |
Offset of first item. |
query |
integer |
limit |
Maximum number of results. |
query |
integer |
displayColumns |
Additional display columns, semicolon separated. |
query |
string |
loadType |
Collection load type. Specify one of the values:
-
Default: Loads read-only entities according to the supplied query. Loaded columns include the primary key, display columns according to the display pattern, some special columns, and the columns defined in the select clause of the query. The entries are sorted by the defined display or the optional orderBy clause of the query. This load type is the default and be omitted.
-
Slim: Works mostly like Default but does not load display columns and does not build an orderBy clause per default. This type is useful when loading data not intended for display and can save much time by using database indexes.
-
BulkReadOnly: Loads read-only entities with all columns filled. The columns defined in the query are overridden.
-
ForeignDisplays: Loads display values for foreign keys contained in the display pattern. This allows showing displays instead of UIDs for foreign keys.
-
ForeignDisplaysForAllColumns: Like ForeignDisplays, but loads displays for all foreign keys contained in the select clauses of the query, not only columns referenced in the display pattern. |
query |
string |
noUrls |
Allow to omit the URI property from the response to reduce the response size especially if used while retrieving large M:N tables like PersonHasObject. |
query |
boolean |
Response schema:
CollectionEntry {
uri(string),
display(string, optional),
longDisplay(string, optional),
values(SampleValues, optional)
}
SampleValues {
StringColumn(string, optional),
IntColumn(integer, optional),
DateColumn(date - time, optional),
BoolColumn (boolean, optional)
}
Example 1:
This sample demonstrates the use of the query by example parameters.
https://<Hostname>/AppServer/api/entities/Person?lastname=adams&limit=2
Response:
[{
"uri": "https://<Hostname>/AppServer/api/entity/Person/7f6bcca9-05dc-4857-9dc5-eff915590752",
"display": "Adams, Alexander (ALEXANDERA)",
"longDisplay": "Adams, Alexander (ALEXANDERA)",
"values": {
"CentralAccount": "ALEXANDERA",
"InternalName": "Adams, Alexander",
"UID_Person": "7f6bcca9-05dc-4857-9dc5-eff915590752",
"XMarkedForDeletion": 0
}},
{
"uri": "https://<Hostname>/AppServer/api/entity/Person/f79c30fd-87bb-4958-a812-0683ddcac7c9",
"display": "Adams, David (DAVIDA)",
"longDisplay": "Adams, David (DAVIDA)",
"values": {
"CentralAccount": "DAVIDA",
"InternalName": "Adams, David",
"UID_Person": "f79c30fd-87bb-4958-a812-0683ddcac7c9",
"XMarkedForDeletion": 0
}]
Example 2:
This sample demonstrates the use of the loadType=Slim.
https://<Hostname>/AppServer/api/entities/Person?lastname=adams&limit=2&loadType=Slim
Response:
[{
"uri": "https://<Hostname>/AppServer/api/entity/Person/18e51519-f751-4df6-8f39-24ed065c80a9",
"values": {
"UID_Person": "18e51519-f751-4df6-8f39-24ed065c80a9"
}},
{
"uri": "https://<Hostname>/AppServer/api/entity/Person/26822a10-32bb-4268-ac59-36188301b768",
"values": {
"UID_Person": "26822a10-32bb-4268-ac59-36188301b768"
}
}]
Example 3:
This sample demonstrates the use of the parameter noUrls=true while using the same parameters as in example 2.
https://<Hostname>/AppServer/api/entities/Person?lastname=adams&limit=2&loadType=Slim&noUrls=true
Response:
[{
"values": {
"UID_Person": "18e51519-f751-4df6-8f39-24ed065c80a9"
}},
{
"values": {
"UID_Person": "26822a10-32bb-4268-ac59-36188301b768" }
}]
To get a list of entities using the POST method, use the URL <baseURL>/api/entities/{table}.
Table 18: Get collection (GET) request
Get |
<BaseURL>/api/entities/{table} |
{"where": "", "orderBy": ""} |
Table 19: Get collection (GET) parameters
table |
Table name (required). |
path |
string |
where |
WHERE clause. |
body |
string |
whereKey |
Predefined WHERE clause from QBMLimitedSQL (Key [UID] or ID [Ident_QBMLimitedSQL]). |
body |
string |
queryParameters |
Parameters to be used in where or whereKey clause. |
body |
string |
queryByExample |
Sample values to filter the entries. |
body |
string |
orderBy |
ORDER BY clause. |
body |
string |
offset |
Offset of first item. |
body |
integer |
limit |
Maximum number of results. |
body |
integer |
displayColumns |
Additional display columns, semicolon separated. |
body |
string |
loadType |
Collection load type. Specify one of the values:
-
Default: Loads read-only entities according to the supplied query. Loaded columns include the primary key, display columns according to the display pattern, some special columns, and the columns defined in the select clause of the query. The entries are sorted by the defined display or the optional orderBy clause of the query. This load type is the default and be omitted.
-
Slim: Works mostly like Default but does not load display columns and does not build an orderBy clause per default. This type is useful when loading data not intended for display and can save much time by using database indexes.
-
BulkReadOnly: Loads read-only entities with all columns filled. The columns defined in the query are overridden.
-
ForeignDisplays: Loads display values for foreign keys contained in the display pattern. This allows showing displays instead of UIDs for foreign keys.
-
ForeignDisplaysForAllColumns: Like ForeignDisplays, but loads displays for all foreign keys contained in the select clauses of the query, not only columns referenced in the display pattern. |
body |
string |
noUrls |
Allow to omit the URI property from the response to reduce the response size especially if used while retrieving large M:N tables like PersonHasObject. |
body |
boolean |
Body schema:
CollectionQueryParms{
where string
whereKey string
Predefined WHERE clause from QBMLimitedSQL.
orderBy string
offset integer
limit integer($int32)
Maximum number of results.
displayColumns [...]
loadType string
default: Default
Collection load type.
Enum:
Array [ 6 ]
queryParameters {
Parameters to be used in where or whereKey clause.
}
queryByExample {
Sample values to filter the entries.
}
noUrls boolean
Do not return URLs for the entries.
}
Response schema:
CollectionEntry {
uri(string),
display(string, optional),
longDisplay(string, optional),
values(SampleValues, optional)
}
SampleValues {
StringColumn(string, optional),
IntColumn(integer, optional),
DateColumn(date - time, optional),
BoolColumn (boolean, optional)
Example: Body
{
"where": "string",
"whereKey": "string",
"orderBy": "string",
"offset": 0,
"limit": 0,
"displayColumns": [
],
"loadType": "Default",
"queryParameters": {
"lastname": "Miller",
"age": 42
},
"queryByExample": {
"lastname": "Einstein",
"firstname": "Albert"
},
"noUrls": true
}
Example 1:
This sample demonstrates the use of the where and orderBy parameters in the body.
https://<Hostname>/AppServer/api/entities/Person?limit=2
Body:
{
"where": "UID_Department in (Select UID_Department from Department where DepartmentName = 'Service & Support')",
"orderBy": "LastName ASC, FirstName DESC"
}
Response:
[{
"uri": "https://<Hostname>/AppServer/api/entity/Person/20bac746-2121-4b24-a4dc-918b69584272",
"display": "Ackermann, Steffen (STEFFENA)",
"longDisplay": "Ackermann, Steffen (STEFFENA)",
"values": {
"CentralAccount": "STEFFENA",
"FirstName": "Steffen",
"InternalName": "Ackermann, Steffen",
"LastName": "Ackermann",
"UID_Person": "20bac746-2121-4b24-a4dc-918b69584272",
"XMarkedForDeletion": 0
}},
{
"uri": "https://<Hostname>/AppServer/api/entity/Person/f45092af-4725-4f99-b87c-00de84b7dcd7",
"display": "Becker, Robert (ROBERTB4)",
"longDisplay": "Becker, Robert (ROBERTB4)",
"values": {
"CentralAccount": "ROBERTB4",
"FirstName": "Robert",
"InternalName": "Becker, Robert",
"LastName": "Becker",
"UID_Person": "f45092af-4725-4f99-b87c-00de84b7dcd7",
"XMarkedForDeletion": 0
}]
Example 2:
This sample demonstrates the use of the parameter noUrls=true while using the same parameters as in example 1.
https://<Hostname>/AppServer/api/entities/Person?limit=2&noUrls=true
Body:
{
"where": "UID_Department in (Select UID_Department from Department where DepartmentName = 'Service & Support')",
"orderBy": "LastName ASC, FirstName DESC"
}
Response:
[{
"display": "Ackermann, Steffen (STEFFENA)",
"longDisplay": "Ackermann, Steffen (STEFFENA)",
"values": {
"CentralAccount": "STEFFENA",
"FirstName": "Steffen",
"InternalName": "Ackermann, Steffen",
"LastName": "Ackermann",
"UID_Person": "20bac746-2121-4b24-a4dc-918b69584272",
"XMarkedForDeletion": 0
}},
{
"display": "Becker, Robert (ROBERTB4)",
"longDisplay": "Becker, Robert (ROBERTB4)",
"values": {
"CentralAccount": "ROBERTB4",
"FirstName": "Robert",
"InternalName": "Becker, Robert",
"LastName": "Becker",
"UID_Person": "f45092af-4725-4f99-b87c-00de84b7dcd7",
"XMarkedForDeletion": 0
}
}]