17.4.3. Data presentation
The data returned by the standard OData interface can be represented as an XML document or a JSON document. It depends on the format of the data to be requested.
The following correlation between the 1C:Enterprise type and the OData type is used for various data types:
|
1C:Enterprise type |
OData property type |
|
String |
Edm.String |
|
Date |
Edm.DateTime |
|
Number (integer) |
|
|
Number (fraction) |
Edm.Double |
|
Boolean |
Edm.Boolean |
|
Ref, UUID |
Edm.Guid |
|
Enum |
Edm.String |
|
ValueStorage |
Consists of three properties *: |
|
Reference type |
Two properties:
|
|
Flexible types |
Two properties of the Edm.String type:
|
The symbol * in the table means that:
- You can get the data stored in the attribute using the navigational property:
- The <Property name>_Base64Data property stores the data that can be received using the navigational property, but only encoded in Base64. You can edit the data of an attribute of the ValueStorage type only using this property.
- The <Property name>_Type property describes the type of data stored in the attribute. It can take one of three values:
- application/octet-stream. Binary data.
- application/xml+xdto. XDTO serialized object.
- Value of the content-type HTTP header matching the image stored in the attribute, for example, image/jpeg for a JPEG image.
Other types are not supported. An attempt to read them will generate a 501 error.
Property names can end with various suffixes. Such properties have a specific meaning. The possible suffixes will be discussed in more detail below:
- Key
- Type
- Base64Data
- ____Presentation
Key
A property with such suffix contains the key value of the relevant object reference attribute (without such suffix) or an independent information register without dimensions. The name with such suffix is used to set the filter as the name of the attribute for which the filter is made. For example, to set the filter by the Counterparty reference field, the condition will look as follows: Counterparty_Key=guid'value'. The Counterparty property will contain a presentation of the counterparty with the specified reference value.
Type
This suffix is used to describe an attribute of a flexible type. So, if the data has a field of the Counterparty flexible type, then in the document that returns the standard OData interface, this field will match two properties:
- Counterparty_Type. It will contain a description of the attribute value type as a string (the Edm.String type, the dispatcher property).
- Counterparty. It will contain the attribute value of (the relevant type).
The list of valid types that can be used in a field with such suffix is determined by the schema of the service that you can get once you request the full description of the standard OData interface. Thus, when you need to set the Document.GoodsConsumption type, the StandardODATA.Document_GoodsConsumption value must be written to the item with the _Type suffix.
If the value of an attribute of a flexible type in the 1C:Enterprise infobase has the Undefined value, the dispatcher property will have the StandardODATA.Undefined value, and the value of the property should be ignored.
An example of representing an attribute of a flexible type:
<d:AttributeFlexible/> <d:AttributeFlexible_Type>StandardODATA.Undefined</d:AttributeFlexible_Type>
Base64Data
This suffix is used to specify the name of the property containing data located in an attribute of the ValueStorage type as a Base64 string. So, if a configuration object has the File attribute that has the ValueStorage type, two properties will match this field in the document that returns the standard OData interface:
- File_Type. Contains the name of the data type stored by the attribute.
- File_Base64Data. Contains the Base64 string containing the data.
____Presentation
The <Property name>____Presentation property contains the attribute presentation. There are 4 characters "_" between the property name and Presentation. The value of the field is equal to the value resulting from the operation of the Presentation() query language function.
Presentation fields are not included in query results with an empty $select parameter and when the $select parameter is set to * and **. So, if you need to get all attributes of the object and presentations of some attributes, specify the * value. Then list the fields of the presentations of the required attributes, separating them with commas: $select=*, AttributeRef____Presentation.
To get presentations of all object attributes, specify the *____Presentation: $select=*____Presentation value in the $select parameter.
To get values of all fields and presentations for all fields, use the following expression: $select=*, *____Presentation.
To get a presentation of the current entity, specify the following field in the list of requested fields: Presentation: $select=Ref_Key, Presentation. In this case, the value of the reference and the presentation of this reference will be retrieved.
Presentation fields are not included in the metadata description returned in the standard OData interface description (the $metadata parameter). Getting a presentation is not supported for tables and attributes of the ValueStorage type. Modification of values for presentation fields is not supported.