Skip to content

Create upload URLs

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

POST
/v2/themes/{themeId}/code-graphics/{graphicId}/uploads
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.

themeId
required

Entity identifier

integer format: int32
>= 1

The theme identifier

graphicId
required
string

The graphic identifier

Media typeapplication/json
object
files
required

Files to upload.

Array<object>
<= 200 items
object
name
required

Path of the file inside the bundle. It must stay inside the bundle folder.

string
contentType
required
string
uploadSessionId

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.

string
/[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}/
Examplegenerated
{
"files": [
{
"name": "example",
"contentType": "example"
}
],
"uploadSessionId": "example"
}

Ok

Media typeapplication/json
object
uploadSessionId
required

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.

string
/[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}/
uploads
required

One entry per requested file, in request order.

Array<object>
object
name
required

Path of the file inside the bundle.

string
url
required

Signed URL. Send the file body to it.

string
method
required
string
Allowed values: PUT
expiresInSeconds
required

Lifetime of the signed URL in seconds.

integer format: int32
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

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 graphic not found

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

The graphic is locked by another editor

Media typeapplication/json

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
message
required
string
code
required
string
holder
required
object
userName
required

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

string
Examplegenerated
{
"message": "example",
"code": "example",
"holder": {
"userName": "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"
}