# Content

*Content* is a term used to describe different types of data within a CMS. By default, content is not used anywhere in Ucommerce. By using the definition system, it can be added to any definition-driven entity, by giving it a field with the **Content** or **ContentPickerMultiSelect** data types.

To make use of content within Ucommerce, you will need to implement your content service based on the `IContentService` interface.

## Prerequisites

Before implementing your custom content service, ensure the following:

* **External Data Source:** You need access and necessary permissions to fetch and format data from an external source and into Ucommerce. If you are using a CMS, it will most likely have some form of content management API that requires authentication.

### **IContentService**

When you implement `IContentService`, you will be faced with four distinct methods for retrieving and managing content.

#### **`GetContent` Method**

This method has two variants: one that accepts a single content ID and another that accepts a list of IDs. Both should retrieve the content associated with the specified ID(s), whether individual or multiple.

#### **`GetChildren` Method**

This method should retrieve all content items that have the specified content ID as their parent.

Additionally, if the ID given is null, this method should return the root level content (the content with no parent).

#### **`DownloadContent` Method**

This method should return a complete HTML file for the specified content input. By default, it is used in a single location: the `DefaultSendConfirmationEmailPipelineTask`, where it populates an email with HTML content. So if there is no need for this functionality, ignore this method and consider removing/altering that task.

All methods should fetch and filter data based on the configured external data source.

{% hint style="info" %}
The `DefaultContentService` implementation built into Ucommerce already implements the `DownloadContent` method in a meaningful way. By inheriting from `DefaultContentService` instead of `IContentService` you can skip implementing `DownloadContent` and focus on overriding the other methods that the `DefaultContentService` does not implement in a meaningful way (it always returns a content object representing *Not found*).
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dev.ucommerce.net/readme/extensions/change-service-behavior/content.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
