API page canonical field name guide

Properties
LC0063 Info Design Code Fix Ignore Obsolete

When exposing table fields on an API page, it is natural to mirror the source field name — no for "No.", name for Name. Microsoft’s standard Business Central APIs use canonical names for these common fields. An API consumer integrating your endpoint alongside the standard APIs will encounter inconsistent field names, forcing field-by-field mapping where a single convention would have sufficed.

Rename flagged fields to their canonical equivalents:

Source table fieldCanonical API field name
SystemIdid
NamedisplayName
SystemModifiedAtlastModifiedDateTime
Fields containing No.Replace no/No with number/Number

Example

page 50100 "Customer API"
{
    PageType = API;
    EntityName = 'customer';
    EntitySetName = 'customers';
    SourceTable = Customer;

    layout
    {
        area(Content)
        {
            repeater(General)
            {
                field(no; Rec."No.") // API page canonical field name guide [LC0063]
                {
                }
            }
        }
    }
}

Rename the field to its canonical name:

page 50100 "Customer API"
{
    PageType = API;
    EntityName = 'customer';
    EntitySetName = 'customers';
    SourceTable = Customer;

    layout
    {
        area(Content)
        {
            repeater(General)
            {
                field(number; Rec."No.")
                {
                }
            }
        }
    }
}

When the diagnostic is reported

  • The page has PageType = API.
  • The field expression references Rec (the source table).
  • The source field name matches one of the canonical mappings and the current API field name does not use the expected canonical name.

AZ AL Dev Tools

The alOutline.apiFieldNamesConversion setting of the AZ AL Dev Tools/AL Code Outline extension can assist with assigning field names:

"alOutline.apiFieldNamesConversion": [
    {
        "searchRegExp": "^no$",
        "newValue": "number"
    },
    {
        "searchRegExp": "No$",
        "newValue": "Number"
    },
    {
        "searchRegExp": "^systemId$",
        "newValue": "id"
    },
    {
        "searchRegExp": "^systemModifiedAt$",
        "newValue": "lastModifiedDateTime"
    }
]

See also