Introduction
Purpose of Service Data Objects is to provide the ability to execute SQL on the server from Aptify Web and Aptify SOA, returning the results to the caller, while controlling what can be executed and who can execute it. Service Data Objects provide a way to identify the SQL statements that can be executed and they will be called by Name, not by the SQL that executes. Aptify SOA looks up the Service Data Object, confirms that the current platform and User are allowed to execute Service Data Object, retrieve the SQL statement from the Service Data Object record, executes it and returns the results.
Service Data Objects can be any valid SQL statement, which can include stored procedures and/or functions that are defined in Aptify as Database Objects but Service Data Objects are not limited to Aptify Database Objects.
Generally Service Data Objects are well suited when need dynamic data.
How to Create Service Data Object
End Point
Cached? | Yes |
---|
Service Data Object uses GET action. parameter defined for the object.
https://<service base>/services/DataObjects/<Service DataObject Name>
Parameters defined in SDO object need to append as query string. Parameters should be same
https://<service base>/services/DataObjects/<Service DataObject Name>?ParameterName1=value1&ParameterName2=Value2....
Headers
In order to receive search results, you must send the AptifyAuthorization header.
Header Name | Header Value |
---|---|
AptifyAuthorization | <AuthType> <TokenId> |
Sample End Point
Following example illustrate how to execute "spGetCompanyAccountSummary" stored procedure as end point
https://<service base>/services/DataObjects/spGetCompanyAccountSummary
For the Above sample End point expect two parameters which are defined in Web service Application.The parameters are CompanyId and Convermulticurrency.
Here is sample data from Company Entity
https://<service base>/services/DataObjects/spGetCompanyAccountSummary?CompanyID=10&Convertmulticurrency=false
Sample Response Body
The search results are represented as a JSON array of JSON objects, where each object contains record data. The properties of the objects will be some of the fields of the record, always including the ID and Name field.
Here is sample result for spGetCompanyAccountSummary data object.
{ "dataObjectName":"spGetCompanyAccountSummary", "results": [ { "OrderTotal":39414.6200, "PaymentTotal":4407.2000, "BalanceTotal":35007.4200 } ] }