C# Coding example to use OData

<< Click to Display Table of Contents >>

Navigation:  Low-code Process Automation > Studio Cloud - Authoring environment > Bizagi Studio > Bizagi from external applications > Bizagi API > OData RESTful services > Bizagi API examples >

C# Coding example to use OData

Overview

Bizagi features OData services, which handle a comprehensive set of resources related to the Experience design, as described at Bizagi API.

For certain scenarios, typically where you need invoke a service via an HTTP POST, you may need to send out specific information while ensuring that the format and structure you use, comply with what Bizagi expectes.

The most common data type is Text, which does not need any special treatment or format (other than specifying values inside quotes).

 

This section describes how to send information when considering dates (i.e, typically the DateTime data type), files in general (either the Image or Upload data type), and other common data types such as Booleans and Numeric.

 

Values and formats for common data types

When sending values for common data types, consider:

For Boolean parameters, use "true" or "false" values.

For Numeric parameters, specify numbers without any formatting such as thousands separator and use a dot (.) as the decimal separator.

 

Values and format for dates

For parameters of DateTime type, specify dates by using the standard format for interoperability, in either of two forms:

To send a date without a specific time, use YYYY-MM-DD (year, month, day in numerals).

 

OData_SendDate2

 

To send a date with an exact time, use YYYY-MM-DDThh:mm:ss, appending at the end the Time Zone Designator.

The Time Zone Designator takes up 6 characters and starts off with a + or - sign indicating the UTC time zone. For example: +00:00 for time based in London (UK),  +05:30 for time based in Delhi (India), and  -07:00 for time based in San Francisco (US).

 

OData_SendDate1

 

YYYY-MM-DD implies year, month and day, as detailed above.

T represents the time component in standard ISO 8601 format (https://www.w3.org/TR/NOTE-datetime.html).

As detailed in the example in the link, 1994-11-05T08:15:30-05:00 corresponds to November 5, 1994, 8:15:30 am, US Eastern Standard Time (US Eastern Standard Time being UTC -5).

 

Values and format for images and uploads

For Image or Upload parameters, the same format of bytes encoded in base 64 is used.

When handling Images (*.png, *.jpg, etc). a subset of an upload (any file with any extension), is simply that Image attributes in Bizagi can hold only one file each; while an Upload may hold an unlimited number of files.

 

OData_Files

 

This example is applicable to data of the type Upload exclusively. You send values according to this format:

{

 "startParameters": [

         {

                   "xpath": "ContractManagement.Attachments",

         "files": [

                             {

                                 "fileName": "MyFile.jpg",

                                 "data": "/9j/4Q3BRXhpt3jj5Sv...........p9U039vxSXlaSSn/9k="

                             },

                       {

                                 "fileName": "MyDocument.doc",

                                 "data": "/9j/4Q3BRXhpt3jj5Sv...........p9U039vxSXlaSSy/6k="

                       }

                 ]

           }

 ]

}

 

A similar example applicable to Image data types would be:

{

 "startParameters": [

         {

                   "xpath": "PolicyUnderwriting.Customer.Photo",

         "files": [

                             {

                                 "fileName": "MyPhoto.png",

                                 "data": "/9j/52Hy6Xhpt3jj5Sv...........p9U039vxSXlaSSn/9k="

                             }

                 ]

           }

 ]

}

 

Customization:

fileName: Should specify the name of the file or image, including its extension.

data: Should have the value in base 64 encoding for the bytes of the file or image.

 

Values and format for entities and collections

When sending values which are entity references in Bizagi (i.e, the Entity or for the Collection data types), consider:

Entity references receive the value or GUID these should be assigned with. This value or GUID is the one queried beforehand as described at Related entities values.

Collections can receive multiple rows. Make sure the values for each column are explicitly defined as queried beforehand, as described at Columns in collections.


Last Updated 1/11/2022 4:12:30 PM