Get all fields of a type through Metadata APIs


When using TagMetadataStore.readType to get the fields defined on the type, it only returns fields that are directly defined on the type, but not fields that are defined on its mixes type.

For example, given following type,

entity type myType schema name 'name' {
  fieldA: string
  fieldB: string

TagMetadataStore.readType('myType') only returns fields fieldA and fieldB, but not fields defined on Persistable.

Do we have another Metadata API that could return all fields on a type?


Try myType.fieldTypes()


fieldTypes is a client side API, and it is not defined on the type.

So we couldn’t call it through /api/1/tenant/tag/myType?action=fieldTypes, and it will return error function metadata was not found for action Target [tenant/tag/myType?action=fieldTypes]


Below is what I’ve used in the past to get the list of fields for a type. You can discard the schema name check, but I did need to explicitly filter out methods.

 * Returns a map of fields and their corresponding schema names for a type.
function lookupFieldSchema(typeName) {
	var fieldSchemaMap = [];
	var typ = c3Type(typeName);

	_.each(typ.fieldTypes(), function(ft) { 
			if (!ft.valueType().isMethod())  {
				if (ft.extensions() != undefined ) {
					if (ft.extensions() != "") {
						fieldSchemaMap.push({, schemaName: ft.extensions()});

	return fieldSchemaMap;


In case type system is not available, and the only way we could talk with platform is through URL, like How could we get all fields in that case?


FYI, this is use case where we communicate with the platform through URL from another provider, like MicroStrategy, where type system is not available.


Using REST APIs you can do the following:

The body of the response should contain:

  "this": {},
  "typeName": "<<typeName>>"

The response from the platform will look like (abbreviated):

  "name": "User",
  "fields": [
      "name": "firstname",
      "valueType": {
        "type": "PrimitiveType",
        "name": "string"

You will need to do some filtering, but the metadata should exist.