Create a theme variable
POST/v2/themes/{themeId}/variables
const url = 'https://api.ligr.live/rest/v2/themes/1/variables';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"ifUnchangedSince":"example","name":"example","type":"string","defaultValue":"example","description":"example","enumOptions":["example"],"isStyle":true}'};
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/variables \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "ifUnchangedSince": "example", "name": "example", "type": "string", "defaultValue": "example", "description": "example", "enumOptions": [ "example" ], "isStyle": true }'Beta. This operation can change between minor versions. See Beta status.
Adds one variable to a theme. The id takes the value of the name. A name already used in the theme answers 400.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The theme identifier
Request Bodyrequired
Section titled “Request Bodyrequired”Body of POST /v2/themes/{themeId}/variables.
object
Unique within the theme. The id takes the same value.
Required for enum, at least one option.
Responses
Section titled “Responses”Created
Response of POST and PATCH on a theme variable.
updatedAt is the theme’s new updatedAt after this write. Send it back as
ifUnchangedSince on the next write, in place of a fresh list read.
object
Equal to name for a variable this API created.
The value in force when a competition sets nothing. Null means no default.
Allowed values of an enum variable. Null for the other types.
True when the variable holds a colour, a font or another style value.
Example
{ "type": "string"}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 variable not found
object
Examplegenerated
{ "message": "example"}IfUnchangedSince no longer matches the theme
Body of a 409 answer when the caller’s ifUnchangedSince no longer matches.
code is always TARGET_CHANGED. Read the resource again and send the write once more.
object
Examplegenerated
{ "message": "example", "code": "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"}