Creatio development guide
This documentation is valid for Creatio version 7.14.0. We recommend using the newest version of Creatio documentation.

DataService. Adding records

Glossary Item Box

General information

The bpm'online DataService web service is a RESTfull service. RESTful is a quite simple information management interface that doesn't use any additional internal layers, i.e., the data doesn't need to be converted to any third-party format, such as XML. In a simple RESTful service, each record is uniquely identified by a global identifier such as URL. Each URL, in turn, has a strictly specified format. However, this service is not always convenient for transferring large amounts of data.

With the use of the DataService, the data can be automatically configured in various data formats such as XML, JSON, HTML, CSV, and JSV. The data structure is determined by data contracts. A complete list of data contracts used by the DataService, can be found in the "DataService web service" article.

InsertQuery data contract

The InsertQuery data contract is used to add records to sections. The data is transferred to the DataService via HTTP by using the POST request with the following URL:

// URL format of the POST query to add data to DataService.
http(s)://[Bpm'online application address]/[Configuration number]/dataservice/[Data fromat]/reply/InsertQuery
// URL example for the POST query to add data to DataService.
http(s)://example.bpmonline.com/0/dataservice/json/reply/InsertQuery

The InsertQuery data contract has a hierarchical structure with multiple nesting levels. In the bpm'online application server part, the InsertQuery data contract is represented by the InsertQuery class of the Terrasoft.Nui.ServiceModel.DataContract namespace of the Terrasoft.Nui.ServiceModel.dll class library. However, for simplicity, the hierarchical structure of the InsertQuery data contract is conveniently presented as a JSON format object:

{
    "RootSchemaName":"[Root object schema name]",
    "OperationType":[Record operation type],
    "ColumnValues":{
        "Items":{
            "Added column name":{
                "ExpressionType":[Expression type],
                "Parameter":{
                    "DataValueType":[Data type],
                    "Value":"[Column value]"
                }
            }...
        }
    }
}

The basic properties of the InsertQuery class and their possible values are presented in table 1.

Table 1. InsertQuery class properties.

Property Description
RootSchemaName A string containing the name of the root object schema of the added record.
OperationType

Operation type is set by the QueryOperationType namespace Terrasoft.Nui.ServiceModel.DataContract namespace enumeration value. For the InsertQuery theQueryOperationType.Insert value is set.

QueryOperationType enumeration values:

Select 0
Insert 1
Update 2
Delete 3
Batch 4
ColumnValues Contains a collection of column values of the added record. Its ColumnValues type is defined in the Terrasoft.Nui.ServiceModel.DataContract namespace.

The ColumnValues class has a single Items property that is defined as a collection of the Dictionary<string, ColumnExpression> keys and values. The key is a string with the added column title, and the value is the object with the ColumnExpression type defined in theTerrasoft.Nui.ServiceModel.DataContract namespace. The basic properties of the ColumnExpression class used when adding records, are given in table 2.

Table 2. ColumnExpression class main properties

Property Description
ExpressionType

The expression type that defines the value that will be contained in the added column.  Set by the EntitySchemaQueryExpressionType enumeration of the Terrasoft.Core.Entities namespace defined in the Terrasoft.Core class library. For the InsertQuery the EntitySchemaQueryExpressionType.Parameter value is set.

EntitySchemaQueryExpressionType enumeration type:

SchemaColumn 0
Function 1
Parameter 2
SubQuery 3
ArithmeticOperation 4
Parameter

Defines the value that will be contained in the added column. Its Parameter type is defined in the Terrasoft.Nui.ServiceModel.DataContract namespace.

The Parameter class has multiple properties, two of which are used to add records (table 3).

Table 3 Parameter class main properties

Property Description
DataValueType

The data value type that defines the value that will be contained in the added column. Set by the DataValueType enumeration value of theTerrasoft.Nui.ServiceModel.DataContract namespace.

DataValueType enumeration type:

Guid 0
Text 1
Integer 4
Float 5
Money 6
DateTime 7
Date 8
Time 9
Lookup 10
Enum 11
Boolean 12
Blob 13
Image 14
ImageLookup 16
Color 18
Mapping 26
Value

The object that contains the added column value.

 

See Also

© bpm'online 2002-2019.

Did you find this information useful?

How can we improve it?