Sage CRM 2021 R1: RESTful API Expansion - Metadata discovery

Sage CRM is a metadata-driven application. It holds the definitions of its screens in tables within the database. The database tables detail which columns should be included in which lists or screens.

The power of Sage CRM's metadata is very obvious to partners and customers who have created customizations for Sage CRM using its .NET API or classic ASP API. The metadata does the 'heavy lifting'. The code that a partner writes explains how to build the screen but it is the metadata that decides which field goes where. The metadata determines the layout of the fields and determines each fields property.

When the Sage CRM REST API was introduced it provided a mechanism by which application records (company, person etc) could be viewed, inserted, updated and deleted. But there was no interaction with metadata. A developer could retrieve a record from the company table but they could not know which of the fields needed to be displayed within a custom app or portal.

The Sage CRM 2021 R1 release has added metadata discovery to the RESTful API. A developer can now read the metadata for a screen such as companyboxlong and know which fields from the company table should be displayed when they are retrieved. The use of the metadata separates the application code from the display code and should mean that it is easier to create apps and portals that access Sage CRM data.

Using getCustomObject

The example below shows how the endpoint is used.

http://{{server}}/sdata/{{install}}j/metadata/-/$service/getCustomObject?name=CaseGrid&SID={{sid}}

I have looked for the list object 'CaseGrid'. The result returns information on the Case table and the columns that are included in the CaseGrid definition in metadata.

To help me explore this I have dropped the returned JSON into another viewer.
I used https://codebeautify.org/jsonviewer

I have opened up the entity detail and this shows the information provided about the table.

The image below shows where I have closed up the details of the entity and I can see the properties of the CaseGrid and its columns.
You can see here that I can tell whether custom_content has been included in the definition and all the properties of each field.

Using getTrans

Another aspect of schema and metadata discovery is the discovery of translations of captions. Sage CRM provides a multilingual interface. Out of the box, it provides a user interface translated into English, German, French and Spanish. A developer will need to be able to bot just know the database columns included in a screen or list, they will need to be able to present these to a user in that users own language.

The Sage CRM 2021 R1 release has added translation to the RESTful API.

A developer can post a set of caption family data to an endpoint and then have the translations returned.

http://{{server}}/sdata/{{install}}j/metadata/-/$service/getTrans?SID={{sid}}

The metadata discovery methods of getCustomObject and getTrans, together with the other endpoints newly supported in Sage CRM 2021 R1 should provide to be invaluable to developers who are creating new extensions and integrations with Sage CRM.

Anonymous