Skip to content

Create a code graphic

POST/v2/themes/{themeId}/code-graphics

POST
/v2/themes/{themeId}/code-graphics
curl --request POST \
--url https://api.ligr.live/rest/v2/themes/1/code-graphics \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "name": "example", "sports": [ "example" ], "stateMachine": { "additionalProperty": "example" } }'

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

Creates an empty code graphic in the theme. Upload the bundle files in a later request, and leave out stateMachine to get the standard code graphic state.

themeId
required

Entity identifier

integer format: int32
>= 1

The theme identifier

Media typeapplication/json

Leave out stateMachine to get the standard code graphic state.

object
name
required
string
sports

Sports the graphic supports. Defaults to the sports of the theme.

Array<string>
stateMachine

Runtime, control variables and user expressions of a code graphic.

The index signature keeps the keys. tsoa strips every key of a Record<string, unknown>, because that type declares no properties.

object
key
additional properties
Examplegenerated
{
"name": "example",
"sports": [
"example"
],
"stateMachine": {
"additionalProperty": "example"
}
}

Created

Media typeapplication/json

A working code graphic.

id is the row identifier of the working copy. It changes on every publish. stateMachine holds the runtime, the control variables and the user expressions. lock is null when no one holds the graphic.

object
graphicId
required

Stable graphic identifier. It does not change between versions.

string
id
required

Entity identifier

integer format: int32
>= 1
name
required
string
type
required
string
Allowed values: code
version
required

Version number of the editable working copy.

integer format: int32
sports
required
Array<string>
stateMachine
required

Runtime, control variables and user expressions of a code graphic.

The index signature keeps the keys. tsoa strips every key of a Record<string, unknown>, because that type declares no properties.

object
key
additional properties
assets
required

Files of the bundle, sorted by name.

Array<object>
object
name
required

Path of the file inside the bundle, for example assets/app.js.

string
mime
required

Content type recorded for the file.

string
size
required

Size of the file in bytes.

integer format: int32
hash
required

Content hash the client sent. Compare it to skip an unchanged upload.

string
version
required

Revision counter of this file. It increases every time the hash changes.

integer format: int32
updatedAt
required

Time of the last change, in ISO 8601.

string
publishedVersions
required

Published version numbers, in ascending order.

Array<integer>
lock
required
object
userName
required

Name of the lock holder. An API key shows as API key <name>.

string
Example
{
"type": "code"
}

The code graphic breaks a rule

Media typeapplication/json

Body of a 400 answer for a code graphic the service refuses.

code is always CODE_GRAPHIC_INVALID. details lists every broken rule. A malformed request body returns the ValidationError shape instead.

object
message
required
string
code
required
string
details
required
Array<string>
Examplegenerated
{
"message": "example",
"code": "example",
"details": [
"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 graphic 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"
}