HTML Compositions

Introduction

When you want to deploy your custom HTML composition, you have two options:

REST API for HTML Compositions

The HTML composition REST API is deprecated from Starcounter 2.3.1. Compositions can still be accessed through the class HTMLComposition

The REST API allows importing compositions for sets of blended HTML partials. The CompositionEditor has to run for this API to work.

Composition

GET http://localhost:8080/sc/partial/composition?key={?}&ver={?}

Returns the HTML of a specific composition

Query Parameters

NameTypeDescription

key

string

The key of the composition.

ver

string

The version of the composition.

<style>:host{display:block}</style>
<style>
    .kitchensink-layout {
        display: flex;
    }

    .kitchensink-layout__column-left {
        flex: 0 0 160px;
        margin-right: 20px;
    }

    .kitchensink-layout__column-right {
        flex: 0 1 600px;
    }
</style>
<div class="kitchensink-layout">
    <nav class="kitchensink-layout__column-left">
        <slot name="kitchensink/nav"></slot>
    </nav>
    <div class="kitchensink-layout__column-right">
        <slot name="kitchensink/current"></slot>
    </div>
</div>

Composition

POST http://localhost:8080/sc/partial/composition?key={?}&ver={?}

Creates a new composition at the specified key if there's no composition there. The body consists of the composition HTML

Query Parameters

NameTypeDescription

key

string

The key of the composition.

ver

string

The version of the composition.

Composition

DELETE http://localhost:8080/sc/partial/composition?key={?}&ver={?}

Deletes the composition with the specific key and version

Query Parameters

NameTypeDescription

key

string

The key of the composition. If the key is "all", all composition are deleted.

ver

string

The version of the composition.

Last updated