TAG LINE
SMALL TITLE

Metadata APIs

Last Updated: May 14, 2020

Each resource has two Metadata APIs that will allow you GET knowledge about the resource. In fact the API documentation is created using them. We will be using the Metadata/sql Let's look at a sample from Service Type:

{
    "trackingId": "24606ef7-7217-4fe8-91a9-7ff298e81d60",
    "dtoTypeKey": "serviceType",
    "dtoTypeTableKey": "ServiceType",
    "details": {
      "pagination": {
        "pageNumber": 1,
        "pageSize": 10
      },
      "searchRequest": {
        "groups": [
          {
            "filters": [
              {
                "name": "name",
                "value": "D",
                "operator": "startsWith",
                "condition": "and"
              }
            ],
            "condition": "and"
          }
        ],
        "orderBy": [
          {
            "name": "name"
          }
        ]
      },
      "updateRequest": {
        "filters": [
          "name",
          "serviceBaseTypeId"
        ]
      },
      "dataFlowPatchTypes": {
        "serviceType": [
          "create",
          "update",
          "delete"
        ]
      },
      "jsonDataSupport": false,
      "resourceRouting": {
        "name": "Service Type",
        "shortName": "serviceType",
        "prefix": "api/v1/ServiceType",
        "routes": [
          {
            "name": "ServiceType.Get",
            "template": ""
          },
          {
            "name": "ServiceType.Get",
            "template": "AvailableFor/SharePlans"
          },
          {
            "name": "ServiceType.GetPaged",
            "template": "Paged"
          },
          {
            "name": "ServiceType.Get",
            "template": "{id:int}"
          },
          {
            "name": "ServiceType.Post",
            "template": ""
          },
          {
            "name": "ServiceType.Put",
            "template": "{id:int}"
          },
          {
            "name": "ServiceType.Delete",
            "template": "{id:int}"
          },
          {
            "name": "ServiceType.Get",
            "template": "Metadata"
          },
          {
            "name": "ServiceType.GetMetadata",
            "template": "Metadata/{option}"
          }
        ]
      }
    },
    "sqlMetadata": {
      "databaseName": "EIP",
      "tableName": "ServiceType",
      "tableNameDtoTypeKey": "serviceType",
      "columns": [
        {
          "database": "EIP",
          "schema": "dbo",
          "table": "ServiceType",
          "tableDtoTypeKey": "serviceType",
          "column": "ID",
          "columnPropertyName": "Id",
          "columnDtoName": "id",
          "sortOrder": 1,
          "isNullable": false,
          "isIdentity": true,
          "dataType": "int",
          "dataSourceColumnDataTypeId": 1,
          "dataSourceColumnDataTypeName": "Number",
          "objectType": "System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
        },
        {
          "database": "EIP",
          "schema": "dbo",
          "table": "ServiceType",
          "tableDtoTypeKey": "serviceType",
          "column": "Name",
          "columnPropertyName": "Name",
          "columnDtoName": "name",
          "sortOrder": 2,
          "isNullable": false,
          "isIdentity": false,
          "dataType": "nvarchar",
          "dataSourceColumnDataTypeId": 4,
          "dataSourceColumnDataTypeName": "String",
          "objectType": "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
          "maxlength": 50
        },
        {
          "database": "EIP",
          "schema": "dbo",
          "table": "ServiceType",
          "tableDtoTypeKey": "serviceType",
          "column": "OwnerID",
          "columnPropertyName": "OwnerId",
          "columnDtoName": "ownerId",
          "sortOrder": 3,
          "isNullable": false,
          "isIdentity": false,
          "dataType": "int",
          "dataSourceColumnDataTypeId": 1,
          "dataSourceColumnDataTypeName": "Number",
          "objectType": "System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
        },
        {
          "database": "EIP",
          "schema": "dbo",
          "table": "ServiceType",
          "tableDtoTypeKey": "serviceType",
          "column": "ServiceBaseTypeID",
          "columnPropertyName": "ServiceBaseTypeId",
          "columnDtoName": "serviceBaseTypeId",
          "sortOrder": 4,
          "isNullable": false,
          "isIdentity": false,
          "dataType": "int",
          "dataSourceColumnDataTypeId": 1,
          "dataSourceColumnDataTypeName": "Number",
          "objectType": "System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
        }
      ],
      "primaryKeys": [
        {
          "database": "EIP",
          "schema": "dbo",
          "table": "ServiceType",
          "tableDtoTypeKey": "serviceType",
          "column": "ID",
          "columnPropertyName": "Id",
          "columnDtoName": "id",
          "constraint": "PKC_ServiceType",
          "sortOrder": 1
        }
      ],
      "foreignKeys": [
        {
          "fkTable": "ServiceType",
          "fkTableDtoTypeKey": "serviceType",
          "fkColumn": "OwnerID",
          "fkColumnPropertyName": "OwnerId",
          "fkColumnDtoName": "ownerId",
          "pkTable": "Owner",
          "pkTableDtoTypeKey": "owner",
          "pkColumn": "ID",
          "pkColumnPropertyName": "Id",
          "pkColumnDtoName": "id"
        },
        {
          "fkTable": "ServiceType",
          "fkTableDtoTypeKey": "serviceType",
          "fkColumn": "ServiceBaseTypeID",
          "fkColumnPropertyName": "ServiceBaseTypeId",
          "fkColumnDtoName": "serviceBaseTypeId",
          "pkTable": "ServiceBaseType",
          "pkTableDtoTypeKey": "serviceBaseType",
          "pkColumn": "ID",
          "pkColumnPropertyName": "Id",
          "pkColumnDtoName": "id"
        }
      ],
      "foreignKeyReferences": [
        {
          "pkDatabase": "EIP",
          "pkSchema": "dbo",
          "pkTable": "ServiceType",
          "pkTableDtoTypeKey": "serviceType",
          "pkColumn": "ID",
          "pkColumnPropertyName": "Id",
          "pkColumnDtoName": "id",
          "fkDatabase": "EIP",
          "fkSchema": "dbo",
          "fkTable": "Service",
          "fkTableDtoTypeKey": "service",
          "fkColumn": "ServiceTypeID",
          "fkColumnPropertyName": "ServiceTypeId",
          "fkColumnDtoName": "serviceTypeId",
          "fkConstraint": "FK_Service_ServiceType"
        },
        {
          "pkDatabase": "EIP",
          "pkSchema": "dbo",
          "pkTable": "ServiceType",
          "pkTableDtoTypeKey": "serviceType",
          "pkColumn": "ID",
          "pkColumnPropertyName": "Id",
          "pkColumnDtoName": "id",
          "fkDatabase": "EIP",
          "fkSchema": "dbo",
          "fkTable": "UsageBucketSharePlanParticipatingServiceTypeConnector",
          "fkTableDtoTypeKey": "usageBucketSharePlanParticipatingServiceTypeConnector",
          "fkColumn": "ServiceTypeID",
          "fkColumnPropertyName": "ServiceTypeId",
          "fkColumnDtoName": "serviceTypeId",
          "fkConstraint": "FK_UsageBucketSharePlanParticipatingServiceTypeConnector_ServiceType"
        }
      ]
    }
  }

Let's look at some of the fields:

Metadata Field

updateRequest.filters

"updateRequest.filters": string[ ]
Type: String
The filters array indicates fields that can be updated on the object

dataFlowPatchTypes

"dataFlowPatchTypes": ""serviceType": ["create","update","delete"]"
Type: String
A list of objects and the operations that can be used in a Data Flow.

resourceRouting.routes

"resourceRouting.routes": string[ ]
Type: String
This array specifies all of the RESTful operations available.

sqlMetadata.columns

"sqlMetadata.columns": column[ ]
Type: Column
The database properties for each column. Note isNullable and dataType properties.

sqlMetadata.primaryKeys

"sqlMetadata.primaryKeys": string[ ]
Type: String
Information about the primary key(s).

sqlMetadata.foreignKeys

"sqlMetadata.foreignKeys": string[ ]
Type: String
Information about any foreign keys.

sqlMetadata.foreignKeyReferences

"sqlMetadata.foreignKeyReferences": string[ ]
Type: String
A list of tables that reference the table by primary key.