Retrieve APIs
This page describes different Java APIs to retrieve a record (also referred to as object) by primary key, queries.
Get
Gets an object of the given class by its primary key (id).
DSApi.get(className, id)Parameters
className: the str name of class as created using the workbench
(correspond to the table)
id: primary key (pass stringified value of the BigInteger/ long value)Sample Code
# fetch product information from the product table
className = 'shared.common.product'
id = '12'
res = DSApi.get(className, id)Returns
A dictionary containing the retrieved data.queryOne - whereClause (includeDeleted)
Gets an object of the given class by the condition provided in the where clause (constructed with the columns of the same table. For complex SQL queries, use the API with SQL query as a parameter). If multiple are found then the first is returned.
Parameters
Sample Code
Returns
queryOne - sqlQuery
Gets an object using SQL query. If multiple are found then the first is returned.
Parameters
Sample Code
Returns
queryMany - whereClause (includeDeleted)
Gets all objects of the given class by the condition provided in the where clause.
Parameters
Sample Code
Returns
queryMany (SQL)
Gets all objects returned by the SQL query. This API should be used when you expect the result to be small (up to a few thousand). For a larger data set, use the DataIterator.
Parameters
Sample Code
Returns
tenantByName
Retrieve the tenant details by searching its name.​
Parameters
Sample Code
Returns
tenantByQuery
get the tenant details by executing a query.​
Parameters
Sample Code
Returns
getUser
Returns user information by its ID
Parameters
Sample Code
Returns
userByEmail
Returns the user information with associated email
Parameters
Sample Code
Returns
userByUserId
Returns the user with the ID
Parameters
Sample Code
Returns
valueByKey
Returns the value of the key associated with the provided type
Parameters
Sample Code
Returns
Last updated