Create a code graphic
POST/v2/themes/{themeId}/code-graphics
const url = 'https://api.ligr.live/rest/v2/themes/1/code-graphics';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"example","sports":["example"],"stateMachine":{"additionalProperty":"example"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Entity identifier
The theme identifier
Request Bodyrequired
Section titled “Request Bodyrequired”Leave out stateMachine to get the standard code graphic state.
object
Sports the graphic supports. Defaults to the sports of the theme.
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
Examplegenerated
{ "name": "example", "sports": [ "example" ], "stateMachine": { "additionalProperty": "example" }}Responses
Section titled “Responses”Created
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
Stable graphic identifier. It does not change between versions.
Entity identifier
Version number of the editable working copy.
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
Files of the bundle, sorted by name.
object
Path of the file inside the bundle, for example assets/app.js.
Content type recorded for the file.
Size of the file in bytes.
Content hash the client sent. Compare it to skip an unchanged upload.
Revision counter of this file. It increases every time the hash changes.
Time of the last change, in ISO 8601.
Published version numbers, in ascending order.
object
Name of the lock holder. An API key shows as API key <name>.
Example
{ "type": "code"}The code graphic breaks a rule
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
Examplegenerated
{ "message": "example", "code": "example", "details": [ "example" ]}Missing or invalid api key
object
Examplegenerated
{ "message": "example"}Api key provides insufficient access for the request
object
Examplegenerated
{ "message": "example"}Theme or graphic not found
object
Examplegenerated
{ "message": "example"}Api key has made too many requests
object
Examplegenerated
{ "message": "example"}An unexpected error has occured. If problems persist please contact support
object
Examplegenerated
{ "message": "example"}