Retrieving Object Properties, Captions, and Other Details via the Creatio REST API

If you need to retrieve the details for a Creatio object/entity, you can easily access this information via the REST API. The DataService has an endpoint that will provide all the details for an object such as the caption, the primary display column, what sort of access rights is defined for the object, as well as details for all the properties/columns for the object such as captions (in all defined translations), whether a column is required, the column’s data type, etc.

First, a bit of background for the Creatio API. There’s two APIs that can be used with Creatio, which are OData and DataService. Either one of these APIs can be used once authenticated via the AuthService. As an overview and very general sense, to login and use the APIs, you’d issue a POST to:

POST: /ServiceModel/AuthService.svc/Login

and include the following body:

{ "UserName": "MyUserName", "UserPassword": "MyPassword" }

You’ll get back a 200/OK response whether the login was successful or not. However, you’ll also get back a json body with a “Code” with a value of 0 (zero) if it was successful. If unsuccessful the body will also contain an exception or message. Once that returns successfully, you’ll copy cookies to all subsequent requests and also read the returned “BPMCSRF” cookie value and include that in the header of subsequent requests as BPMCSRF. You can now use either OData or DataService interchangeably. For this purpose to retrieve an object’s details, we’ll be using a DataService endpoint named RuntimeEntitySchemaRequest.

For this example, we’ll be requesting the Account object’s details. To request this, we’ll login as described above, then we’ll issue a POST to the following endpoint:

POST: /0/DataService/json/SyncReply/RuntimeEntitySchemaRequest/

and include the following body:

{"Name": "Account"}

This will return the following in the response body (edited, I’ve only left the first 3 columns just to keep it short)

{
    "schema": {
        "parentUId": "1bab9dcf-17d5-49f8-9536-8e0064f1dce0",
        "isVirtual": false,
        "isDBView": false,
        "isTrackChangesInDB": false,
        "administratedByOperations": false,
        "administratedByColumns": false,
        "administratedByRecords": true,
        "useMasterRecordRights": false,
        "masterRecordSchemaName": "",
        "columns": {
            "Items": {
                "ae0e45ca-c495-4fe7-a39d-3ab7278e1617": {
                    "uId": "ae0e45ca-c495-4fe7-a39d-3ab7278e1617",
                    "name": "Id",
                    "caption": {
                        "en-US": "Id",
                        "ru-RU": "Id"
                    },
                    "description": {},
                    "dataValueType": 0,
                    "isInherited": true,
                    "isOverride": false,
                    "isRequired": true,
                    "isVirtual": false,
                    "isValueCloneable": false,
                    "isMultilineText": false,
                    "isSimpleLookup": false,
                    "isCascade": false,
                    "usageType": 0,
                    "status": 0,
                    "isIndexed": false,
                    "isWeakReference": false
                },
                "7c81a01e-f59b-47df-830c-8e830f1bf889": {
                    "uId": "7c81a01e-f59b-47df-830c-8e830f1bf889",
                    "name": "Name",
                    "caption": {
                        "en-US": "Name",
                        "ru-RU": "Название"
                    },
                    "description": {},
                    "dataValueType": 28,
                    "isInherited": false,
                    "isOverride": false,
                    "isRequired": true,
                    "isVirtual": false,
                    "isValueCloneable": true,
                    "isMultilineText": false,
                    "isSimpleLookup": false,
                    "isCascade": false,
                    "usageType": 0,
                    "status": 0,
                    "isIndexed": true,
                    "isWeakReference": false
                },
                "7c85a229-8cfa-4c29-8ab9-9463560a92ec": {
                    "uId": "7c85a229-8cfa-4c29-8ab9-9463560a92ec",
                    "name": "Owner",
                    "referenceSchemaName": "Contact",
                    "caption": {
                        "en-US": "Owner",
                        "ru-RU": "Ответственный"
                    },
                    "description": {},
                    "dataValueType": 10,
                    "isInherited": false,
                    "isOverride": false,
                    "referenceSchemaUId": "16be3651-8fe2-4159-8dd0-a803d4683dd3",
                    "isRequired": false,
                    "isVirtual": false,
                    "isValueCloneable": true,
                    "isMultilineText": false,
                    "isSimpleLookup": false,
                    "isCascade": false,
                    "usageType": 0,
                    "status": 0,
                    "isIndexed": true,
                    "isWeakReference": false
                },
                /* etc ......... */
            }
        },
        "primaryColumnUId": "ae0e45ca-c495-4fe7-a39d-3ab7278e1617",
        "primaryDisplayColumnUId": "7c81a01e-f59b-47df-830c-8e830f1bf889",
        "uId": "25d7c1ab-1de0-4501-b402-02e0e5a72d6e",
        "realUId": "25d7c1ab-1de0-4501-b402-02e0e5a72d6e",
        "name": "Account",
        "caption": {
            "en-US": "Account",
            "ru-RU": "Контрагент"
        },
        "description": {},
        "extendParent": false
    },
    "success": true
}

Notice the captions in all translations, the details such as the defined display column and primary Id column, whether a column is required, the column datatypes, etc.

A note about the data type values. If you want to know what a “dataValueType” of 28 means, all you need to do is bring up your browser dev tools on a Creatio window and type Terrasoft.DataValueType and hit enter. You’ll see the complete list of possible data types and their numeric values. This list is the following:

  • 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
  • CustomObject = 15
  • ImageLookup = 16
  • Collection = 17
  • Color = 18
  • LocalizableString = 19
  • Entity = 20
  • EntityCollection = 21
  • EntityColumnMappingCollection = 22
  • HashText = 23
  • SecureText = 24
  • File = 25
  • Mapping = 26
  • ShortText = 27
  • MediumText = 28
  • MaxSizeText = 29
  • LongText = 30
  • Float1 = 31
  • Float2 = 32
  • Float3 = 33
  • Float4 = 34
  • LocalizableParameterValuesList = 35
  • MetaDataText = 36
  • StageIndicator = 37
  • ObjectList = 38
  • CompositeObjectList = 39
  • Float8 = 40
  • FileLocator = 41
ABOUT THE AUTHOR

Ryan Farley

Ryan Farley is the Director of Development for Customer FX and creator of slxdeveloper.com. He's been blogging regularly about SalesLogix, now Infor CRM, since 2001 and believes in sharing with the community. His new passion for CRM is Creatio, formerly bpm'online. He loves C#, Javascript, web development, open source, and Linux. He also loves his hobby as an amateur filmmaker.

Submit a Comment

Your email address will not be published.

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!

You have Successfully Subscribed!