Use REST services with related content items

NOTE: With the introduction of Content as a service API based on OData protocol in Sitefinity CMS 9.0, the OData Web Services are the recommended way to go when consuming Sitefinity  CMS content. The operations described in this article are fully supported by the OData services, for more information see: Related data. If your use case requires sticking to  the ServiceStack services, described below, you can continue doing so, but please keep in mind that unlike the OData services, these services work with objects in status Temp.

You can use two ServiceStack services for the Related data functionality: 

  • RelatedDataService 
    This class represents a service that the Related data functionality uses. The service defines the following endpoints:  
    • GET /restapi/sitefinity/related-data/child-items 
      Gets related child items for a specific item.
      Returns RelatedItemsResponse.
    • GET /restapi/sitefinity/related-data/parent-items 
      Gets related parent items for a specific item.
      Returns RelatingItemsResponse.
    • GET /restapi/sitefinity/related-data/data-types 
      Gets all available data types with available providers, which a relation can be created to. Used in the custom field designer, when RelatedDataField is added.
      Returns List<DataTypeResponse>.
    • PUT /restapi/sitefinity/related-data/relations 
      Applies changes that are made to item relations in Temp status. 
  • GenericDataService 
    This class is used to retrieve a list of data items that can be related to the current item. 
    • GET /restapi/sitefinity/generic-data/data-items 
      Gets list of available items to be related. If RelatedItemId, RelatedItemType, RelatedItemProvider, and FieldName are provided, items related to the specified item are marked with a property IsRelated=true in the returned response of type DataItemsResponse.
    • DELETE /restapi/sitefinity/generic-data/temp-items 
      Deletes all temp items of the provided item.

Was this article helpful?