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.

get
Composition

http://localhost:8080/sc/partial/composition?key={?}&ver={?}
Returns the HTML of a specific composition
Request
Response
Request
Query Parameters
key
required
string
The key of the composition.
ver
optional
string
The version of the composition.
Response
200: OK
The HTML of the requested 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>

post
Composition

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
Request
Response
Request
Query Parameters
key
required
string
The key of the composition.
ver
optional
string
The version of the composition.
Response
204: No Content

delete
Composition

http://localhost:8080/sc/partial/composition?key={?}&ver={?}
Deletes the composition with the specific key and version
Request
Response
Request
Query Parameters
key
required
string
The key of the composition. If the key is "all", all composition are deleted.
ver
optional
string
The version of the composition.
Response
204: No Content