Link Resources with References
Connect your resources and fetch related data in one API call. Use reference fields to link articles to authors, products to categories, or any resources that belong together — then retrieve them with the populate parameter.
What are Reference Fields?
Reference fields create associations between resources in different folders:
- Reference — Links to a single resource in another folder
- Relation — Links to multiple resources in another folder
Common use cases include:
- Author field on articles pointing to a Users folder
- Category field on products pointing to a Categories folder
- Related articles linking to other articles in the same folder
Reference fields are different from strict reference which creates a parent-child ownership relationship. Use regular references when resources can exist independently.
Prerequisites
Before creating reference fields, you need:
- Two collection folders — one to hold the reference field, another as the target
- At least one published resource in the target folder
- Appropriate permissions to modify schemas in the target environment
Step 1 – Create the Target Folder
First, create the folder that will be referenced. For this example, we'll create a Users folder:
- Open your environment in the FoxNose dashboard.
- Click Database in the sidebar.
- Click Add folder and configure:
| Field | Value |
|---|---|
| Folder Name | Users |
| Folder Alias | users |
| Folder Type | Collection |
- Add fields to the schema (e.g.,
name,nickname). - Click Publish version to activate the schema.
- Add at least one resource to the Users folder.
Step 2 – Add Reference Field to Source Folder
Now add a reference field to the folder that will link to Users:
- Navigate to the source folder (e.g., Comments).
- Switch to the Schema tab.
- Click Add field and select Reference as the field type.
- Configure the reference field:
| Field | Description | Example |
|---|---|---|
| Field Name | Display name | Author |
| Field Key | API identifier | author |
| Target Folder | Folder to reference | Users |
- Click Add field to add the reference.
- Click Publish version to apply the schema changes.
Step 3 – Set Reference Values
When editing a resource with a reference field:
- Navigate to the source folder and open a resource.
- Find the reference field (e.g., Author).
- Use the dropdown to search and select a resource from the target folder.
- Save and publish the resource.
The reference stores the target resource's key internally (e.g., b5qarwj6we70).
Step 4 – Connect Folders to Flux API
For the populate feature to work, both folders must be connected to your Flux API:
- Go to Delivery → Flux API in the sidebar.
- Select your API.
- In the Connected Folders tab, ensure both the source folder (Comments) and target folder (Users) are connected.
- Enable both List/Search and Get Resource access methods for each folder.
If the target folder isn't connected to the API, the populate feature will silently return just the resource key instead of the expanded object.
Step 5 – Use Populate in API Requests
By default, reference fields return only the target resource's key:
GET /content/articles/{article_key}/comments
{
"results": [
{
"_sys": { "key": "6en834phv3uj", "folder": "comments" },
"data": {
"body": "Great article!",
"author": "b5qarwj6we70"
}
}
]
}
Add populate=author to expand the reference into the full object:
GET /content/articles/{article_key}/comments?populate=author
{
"results": [
{
"_sys": { "key": "6en834phv3uj", "folder": "comments" },
"data": {
"body": "Great article!",
"author": {
"name": "Alice Johnson",
"nickname": "alice_j"
}
}
}
]
}
Populate Multiple Fields
Populate multiple reference fields by separating them with commas:
GET /content/articles?populate=author,category
Nested Population
Populate nested references using dot notation (up to 3 levels deep):
GET /content/articles?populate=author.company,category.parent
This expands:
- The
authorreference, then the author'scompanyreference - The
categoryreference, then the category'sparentreference
Population Limits
| Limit | Value | Notes |
|---|---|---|
| Depth | 3 levels | Deeper paths are ignored |
| Response size | ~1 MiB | Reduce populate fields if exceeded |
Reference vs Strict Reference
| Feature | Reference | Strict Reference |
|---|---|---|
| Relationship | Association | Ownership |
| Independence | Resources exist independently | Child requires parent |
| API URLs | Separate endpoints | Nested under parent |
| Use case | Author on article | Comments on article |
Choose Reference when:
- Resources can exist without each other
- You need many-to-many relationships
- Resources are managed independently
Choose Strict Reference when:
- Child has no meaning without parent
- You want nested URL structure
- Child lifecycle depends on parent
Best Practices
- Connect all referenced folders to your Flux API before using populate
- Use specific populate paths — only request fields you need to minimize response size
- Consider response size — deeply nested population can create large responses
- Cache populated responses — they require additional database lookups
Next Step
References work great for associations where both sides can exist independently. But what about true ownership — where a child resource has no meaning without its parent? Comments belong to articles. Order items belong to orders.