For the complete documentation index, see llms.txt. This page is also available as Markdown.

Linkages

1. Minimal Payload Structure

The minimal payload structure for a linkage is defined by the BasicLinkage schema:

{
  "meta_id": "string",
  "category": "string"
}

Required Fields

  • meta_id (string): The meta_id of the record to link to (e.g., FE00000001, SE00000001, SH00000001)

  • category (string): The category of the linked record (e.g., "Feature", "Show", "Season", "Episode")

2. CRUD Operations

Create

Linkages are created as part of record creation or update operations. Include the linkage array in your request payload:

Endpoint: PUT /record/{metaId} or POST /record/create

Example - Creating a Feature with linkage:

{
  "original_title": "My Feature Film",
  "category": "Feature",
  "first_release_year": 2023,
  "linkage": [
    {
      "meta_id": "FE00000002",
      "category": "Feature"
    }
  ]
}

Example - Linking an existing Feature to another record:

Read

Retrieve linkages for a record:

Endpoint: GET /record/{metaId}

The response includes a linkage array with linked records:

Example - Get Feature linkages:

Specific Linkage Endpoints:

  • POST /record/linkage - Get records linkage with additional data

  • POST /record/linkage/full - Get full record linkage

Example - Get linkage by category (Feature):

Update

Update linkages by including the linkage array in your update request:

Endpoint: PUT /record/{metaId}

Example - Updating Feature linkages:

The system will automatically:

  • Create new linkages that don't exist

  • Update existing linkages

  • Remove linkages that are not included in the array (depending on implementation)

Example - Updating a Feature record and its linkages:

Delete

Delete linkages by either:

  1. Excluding from array: Remove the linkage from the linkage array in an update request

  2. Setting deleted flag: Include "deleted": true in the linkage object:

Example - Deleting a Feature linkage:

Example - Removing all linkages from a Feature:

Note: When a record is deleted, all its linkages are automatically removed.

3. Show Season Episode Relationship

The Show → Season → Episode relationship is a hierarchical structure where:

  • Show is the top-level record

  • Season is linked to a Show

  • Episode is directly linked to both a Season and a Show

  • The Episode's Show linkage is automatically managed based on the Episode's Season relationship

Creating the Hierarchy

Step 1: Create the Show

Resulting meta_id: SH00000001

Resulting meta_id: SE00000001

Important: When you link an Episode to a Season, the system automatically:

  • Creates a direct linkage between the Episode and the Season's parent Show

  • The Episode now has two direct linkages: one to the Season and one to the Show

  • The Show linkage is automatically defined/managed based on the Season relationship

Response Structure for Show Season Episode

When retrieving a Show, Season, or Episode with linkages, the response includes:

For Show:

For Season:

For Episode:

Note: The Episode has direct linkages to both the Season and the Show. The Show linkage is automatically created and managed based on the Season's parent Show.

Key Features

  1. Automatic Show Linkage: When an Episode is linked to a Season, the system automatically creates a direct linkage between the Episode and the Season's parent Show.

  2. Direct Linkages: Episodes have direct linkages to both Season and Show in the database. The Show linkage is automatically managed based on the Episode's Season relationship.

  3. Numbering:

    • Seasons use season_number from season_numbering

    • Episodes use episode_number from episode_numbering and inherit season_number from their parent Season

  4. Episode Count: Seasons include number_of_episodes which counts all linked Episodes.

Updating Show Season Episode Relationships

To change an Episode's Season:

The system will:

  • Detach the Episode from the old Season

  • Attach the Episode to the new Season

  • Automatically update the Episode's Show linkage to match the new Season's parent Show

To change a Season's Show:

All Episodes in the Season will automatically have their Show linkages updated to match the new Show.

Important Constraint

An Episode should only link to 1 Season.

4. FAQ

Q: Why is an Episode de-linked from both the Season and the Show when de-linking it from a Season only?

Answer:

The primary linkage exists between Season and Episode. The Show–Episode linkage is inherited through the Season.

When an Episode is de-linked from a Season, the inherited Show–Episode linkage is also removed to maintain data consistency.

Last updated