Replace a bundle
PUT/v2/themes/{themeId}/code-graphics/{graphicId}/bundle
const url = 'https://api.ligr.live/rest/v2/themes/1/code-graphics/example/bundle';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"uploadSessionId":"823d14c6-ef4e-4d72-932e-20d8ed422e3c","files":[{"name":"index.html","mime":"text/html","size":1240,"hash":"sha256:6f1c"},{"name":"assets/app.js","mime":"application/javascript","size":8300,"hash":"sha256:9b02"}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://api.ligr.live/rest/v2/themes/1/code-graphics/example/bundle \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "uploadSessionId": "823d14c6-ef4e-4d72-932e-20d8ed422e3c", "files": [ { "name": "index.html", "mime": "text/html", "size": 1240, "hash": "sha256:6f1c" }, { "name": "assets/app.js", "mime": "application/javascript", "size": 8300, "hash": "sha256:9b02" } ] }'Beta. This operation can change between minor versions. See Beta status.
Records the complete file set of the code graphic. The request deletes each file you leave out,
and stateMachine applies a new manifest at the same time.
Upload every changed file first, then send the uploadSessionId that POST .../uploads
returned. The request moves each named file of that session into the graphic, and clears the
session afterwards. It reads no other session, so a file another session left behind is never
promoted. A file you name but do not upload in this session is kept only when the graphic
already holds it from an earlier bundle. Otherwise the request fails with
CODE_GRAPHIC_INVALID and names the file.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Entity identifier
The theme identifier
The graphic identifier
Request Bodyrequired
Section titled “Request Bodyrequired”Leave out stateMachine to keep the stored one.
object
The complete file set of the bundle. A file left out is deleted.
object
Path of the file inside the bundle.
Content type of the file.
Size of the file in bytes.
Content hash of the file.
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
The session the files were uploaded in, from the POST .../uploads answer. The request moves
the files of this session into the graphic, and clears the session afterwards. Leave it out
only when every named file is already in the graphic from an earlier bundle.
Example
{ "uploadSessionId": "823d14c6-ef4e-4d72-932e-20d8ed422e3c", "files": [ { "name": "index.html", "mime": "text/html", "size": 1240, "hash": "sha256:6f1c" }, { "name": "assets/app.js", "mime": "application/javascript", "size": 8300, "hash": "sha256:9b02" } ]}Responses
Section titled “Responses”Ok
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"}The graphic is locked by another editor
Body of a 409 answer. The graphic is open in another editor.
code is always LOCKED. holder is null when the lock expired between the check and the
answer.
object
object
Name of the lock holder. An API key shows as API key <name>.
Examplegenerated
{ "message": "example", "code": "example", "holder": { "userName": "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"}