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
Create a new Service Database Object record in Services Data object. Service Data Object (SDO) available in Web Services Application.
Name: Name given is genrally identical to name of database Object.it is used to accessing service data object.
SQL: it is SQL Object that should be executed. Here you can pass SQL query or any stored procedure name available in database.
Enable Application Filter: if we select enable application filter it will restrict to use SDO to a particular service application. If selected enable application filter option then we need to add alteast one Service Application on Application tab.
Enable Security: if you want to apply security you can select enable security option. If selected it will restrict the use of SDO to selected users, groups and web groups. So as to apply security we need to add atleast one record on security Tab.
If database object (Stored Procedure, SQL) require parameters then we need to add each parameter in parameter tab.
Finally you need to save the record to create Service Data Object. You can call it by Aptify Services API or via http request to Aptify Javascript API.
End Point
Cached? | Yes |
---|
Service Data Object uses GET action. parameter defined for the object.
https://<service base>/services/DataObjects/<Service DataObject Name>
Sample End Point
https://<service base>/services/DataObjects/spGetCompanyAccountSummary
Headers
In order to receive search results, you must send the AptifyAuthorization header.
Header Name | Header Value |
---|---|
AptifyAuthorization | <AuthType> <TokenId> |
For the Above sample End point expect two parameters which are defined in Web service Application.The parameters are CompanyId and Convermulticurrency.
Parameters
Parameter | Query Param? | Description | Example |
---|---|---|---|
CompanyId | Yes | ID of Company | 10 |
Convertmulticurrency | false | Boolean value represent Convert Multi currency | false |
Here is sample data from Company Entity
https://<service base>/services/DataObjects/spGetCompanyAccountSummary?CompanyID=10&Convertmulticurrency=false
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 above
{ "dataObjectName":"spGetCompanyAccountSummary", "results": [ { "OrderTotal":39414.6200, "PaymentTotal":4407.2000, "BalanceTotal":35007.4200 } ] }