Skip to content

Create a data source template

POST/v2/themes/{themeId}/data-source-templates

POST
/v2/themes/{themeId}/data-source-templates
curl --request POST \
--url https://api.ligr.live/rest/v2/themes/1/data-source-templates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "alias": "example", "sourceType": "csv", "shape": "cell", "config": "example", "sample": "example", "sampleBase64": "example", "schema": "example", "description": "example" }'

Beta. This operation can change between minor versions. See Beta status.

Creates a data source template. The server parses the sample, infers the JSON schema and stores the first rows as the preview sample. Send sample text for CSV, or sampleBase64 bytes for XLSX.

themeId
required
number format: double

The theme identifier

Media typeapplication/json

Body of POST /v2/themes/{themeId}/data-source-templates.

Send the sample as sample text for CSV, or as sampleBase64 bytes for XLSX. The server parses the sample, infers the JSON schema, and stores both.

object
alias
required

Lowercase letters, digits and underscores. It must start with a letter. Unique in the theme.

string
/^[a-z][a-z0-9_]*$/
sourceType
required
string
Allowed values: csv xlsx
shape
required
string
Allowed values: cell kv rows
config

Parse options, for example { "headerRow": 1, "dataStartRow": 2 }.

sample

Sample content as text. Use it for CSV.

string
sampleBase64

Sample content as base64 bytes. Use it for XLSX.

string
schema

JSON schema to store instead of the inferred one. Leave it out in nearly every case.

description
string

Created

Media typeapplication/json

One data source template. The alias names the schema a graphic selects, and an operator pushes rows into it with POST /v2/data-sources/{competitionThemeSettingId}/{alias}.

object
id
required
integer format: int32
alias
required
string
sourceType
required
string
Allowed values: csv xlsx
shape
required
string
Allowed values: cell kv rows
config
required

Parse options, for example headerRow and dataStartRow. Null when the defaults apply.

schema
required

JSON schema of the pushed data. The server infers it from the sample.

sample
required

First rows of the sample, so the builder can preview the shape.

description
required
string
nullable
updatedAt
required

ISO 8601 timestamp.

string
Example
{
"sourceType": "csv",
"shape": "cell"
}

Request is invalid

Media typeapplication/json
object
message
required
string
details
required
object
key
additional properties
Examplegenerated
{
"message": "example",
"details": {
"additionalProperty": "example"
}
}

Missing or invalid api key

Media typeapplication/json
object
message
required
string
Examplegenerated
{
"message": "example"
}

Api key provides insufficient access for the request

Media typeapplication/json
object
message
required
string
Examplegenerated
{
"message": "example"
}

Theme or data source template not found

Media typeapplication/json
object
message
required
string
Examplegenerated
{
"message": "example"
}

Api key has made too many requests

Media typeapplication/json
object
message
required
string
Examplegenerated
{
"message": "example"
}

An unexpected error has occured. If problems persist please contact support

Media typeapplication/json
object
message
required
string
Examplegenerated
{
"message": "example"
}