Expand Expression Format

Expand Expression Format

The expand expression format depends on which side of the relation you are querying. In both cases, it aims to specify the relation field and the related content type.

Each expand expression is a JSON object that contains one or more expand definitions with the following structure:

  • When querying the content type that holds the relation:

    {
        "<RelationField1>": {
            "TargetTypeName": "<RelatedContentType1>",
            "<Option1>": "<value1>",
            "<Option2>": "<value2>",
            "<Option3>": {...
            },
            ...
        },
        "<RelationField2>": {
            "TargetTypeName": "<RelatedContentType2>",
            ...
        },
        ...
    }
    
  • When querying the content type that does not hold the relation:

    {
        "<ContentType1.RelationField1>": {
            "<Option1>": "<value1>",
            "<Option2>": "<value2>",
            "<Option3>": {...
            },
            ...
        },
        "<ContentType2.RelationField2>": {
            ...
        },
        ...
    }
    

    or you can use the shorthand syntax:

    {
        "<ContentType1.RelationField1>": true,
        "<ContentType2.RelationField2>": true,
        ...
    }
    

Where:

  • RelationFieldN is the name of the field from the queried content type that you want to expand (the relation field). It is used only when querying the content type that holds the relation.
  • ContentTypeN.RelationFieldN is a relation field that contains IDs from the queried content type, prepended with the name of its content type. It is used only when querying the content type that does not hold the relation.
  • OptionN is one of the following options:
Option name Description
TargetTypeName Specifies the related content type name when querying the content type that holds the relation.
ReturnAs Renames the expanded field in the request result. If this option is not specified, the relation field name is used instead (RelationField or ContentType.RelationField).
Fields Returns an object with a subset of the expanded data's fields. The value of this option must be a valid Telerik Platform fields expression. Cannot be used with SingleField.
SingleField Replaces the return object with the value of a single field of that object. Note that this differs from Fields which can also return a single field but enclosed in an object. Cannot be used with Fields.
Filter Filters the array of expanded data in case of one-to-many relations. The value of this option must be a valid Telerik Platform filter expression. Note that you can't filter the base request by an expanded data field.
Sort Sorts the array of the expanded data in case of one-to-many relations. The value of this option must be a valid Telerik Platform sorting expression. Note that you can't sort the base request by an expanded data field.
Skip When implementing paging, this option specifies the number of items to skip before returning the rest. Only accepts integers.
Take When implementing paging, this option specifies the number of items to return. Only accepts integers. Cannot exceed 50.
Expand Specifies a nested expand expression. The value of this option must be a valid expand expression.
Aggregate Specifies an aggregation expression. It allows you to aggregate or group the expanded data in case of one-to-many relations. Not supported in nested expand expressions.

See Also

To see examples of expand expressions, see Expand Expression Examples.

To learn how to define an expand expressions, see Defining an Expand Expression.

Start a free trial Request a demo
Contact us: +1-888-365-2779
sales@telerik.com
Copyright © 2016-2017, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.