Create upload URLs
POST/v2/themes/{themeId}/code-graphics/{graphicId}/uploads
const url = 'https://api.ligr.live/rest/v2/themes/1/code-graphics/example/uploads';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"files":[{"name":"example","contentType":"example"}],"uploadSessionId":"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/example/uploads \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "files": [ { "name": "example", "contentType": "example" } ], "uploadSessionId": "example" }'Beta. This operation can change between minor versions. See Beta status.
Creates one signed PUT URL for each file you name. Each call opens one upload session and
returns its uploadSessionId, unless you send the id of an open session to add files to it. Every URL writes into that session, which holds the files until
you record them. Send each file body to its own URL, then call PUT .../bundle with the same
uploadSessionId. That request moves the files of the session into the graphic and records
the file set. A session id is never reused, and a publish never affects a URL you already
hold.
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”object
Files to upload.
object
Path of the file inside the bundle. It must stay inside the bundle folder.
An open upload session from an earlier call, to add more files to it. Leave it out to open a new session. Use it when a bundle changes more than 200 files: call this route once per batch of 200 with the same id, then record the bundle once with that id.
Examplegenerated
{ "files": [ { "name": "example", "contentType": "example" } ], "uploadSessionId": "example"}Responses
Section titled “Responses”Ok
object
Identifier of this upload session, a UUID v4. Send it as uploadSessionId to
PUT .../bundle, which moves the files of this session into the graphic. Each call returns a
new id. An id is never reused.
One entry per requested file, in request order.
object
Path of the file inside the bundle.
Signed URL. Send the file body to it.
Lifetime of the signed URL in seconds.
Example
{ "uploadSessionId": "823d14c6-ef4e-4d72-932e-20d8ed422e3c", "uploads": [ { "name": "index.html", "url": "https://assets.example.com/203/6a1c.../_uploads/823d14c6.../index.html?X-Amz-Signature=...", "method": "PUT", "expiresInSeconds": 600 } ]}Request is invalid
object
object
Examplegenerated
{ "message": "example", "details": { "additionalProperty": "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"}