Attach an import candidate
POST/v2/themes/{themeId}/rive-graphics/candidates/{candidateId}/graphics
const url = 'https://api.ligr.live/rest/v2/themes/1/rive-graphics/candidates/example/graphics';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"example","selection":{"artboardIndex":1,"stateMachineIndex":1},"configuration":{"bindings":[{"id":"example","expression":"example","defaultValue":true,"sourceArrayPath":"example","exposed":{"name":"example","expression":"example","required":true,"entityType":"player","width":1,"height":1},"imageTransform":{"outWidth":1,"outHeight":1,"fit":"cover","scaleX":1,"scaleY":1,"rotateDeg":1,"skewXDeg":1,"skewYDeg":1,"translateX":1,"translateY":1,"padding":{"top":1,"right":1,"bottom":1,"left":1},"background":{"r":1,"g":1,"b":1,"a":1},"anchor":"center"}}],"inputs":[{"id":"example","expression":"example"}],"assets":[{"id":"example","expression":"example","exposed":{"name":"example","defaultFileId":1,"required":true,"expression":"example","entityType":"player"}}],"controlVariables":[{"id":"example","name":"example","type":"string","defaultValue":true,"description":"example","options":["example"],"exitMode":"immediate"}],"userExpressions":[{"id":"example","name":"example","expression":"example","description":"example"}],"renderer":"webgl2","deferInitialShow":true,"scale":1,"x":1,"y":1},"lockToken":"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/rive-graphics/candidates/example/graphics \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "example", "selection": { "artboardIndex": 1, "stateMachineIndex": 1 }, "configuration": { "bindings": [ { "id": "example", "expression": "example", "defaultValue": true, "sourceArrayPath": "example", "exposed": { "name": "example", "expression": "example", "required": true, "entityType": "player", "width": 1, "height": 1 }, "imageTransform": { "outWidth": 1, "outHeight": 1, "fit": "cover", "scaleX": 1, "scaleY": 1, "rotateDeg": 1, "skewXDeg": 1, "skewYDeg": 1, "translateX": 1, "translateY": 1, "padding": { "top": 1, "right": 1, "bottom": 1, "left": 1 }, "background": { "r": 1, "g": 1, "b": 1, "a": 1 }, "anchor": "center" } } ], "inputs": [ { "id": "example", "expression": "example" } ], "assets": [ { "id": "example", "expression": "example", "exposed": { "name": "example", "defaultFileId": 1, "required": true, "expression": "example", "entityType": "player" } } ], "controlVariables": [ { "id": "example", "name": "example", "type": "string", "defaultValue": true, "description": "example", "options": [ "example" ], "exitMode": "immediate" } ], "userExpressions": [ { "id": "example", "name": "example", "expression": "example", "description": "example" } ], "renderer": "webgl2", "deferInitialShow": true, "scale": 1, "x": 1, "y": 1 }, "lockToken": "example" }'Beta. This operation can change between minor versions. See Beta status.
Create, fill, or replace a working Rive graphic from a ready candidate.
Send the x-ligr-edit-session header while an edit session is open.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
object
On replacement, submit only bindings, inputs, assets and controlVariables. A submitted
control variable updates the control variable with the same name and keeps its id. User
expressions and layout are edited through the operation routes.
object
object
object
object
object
object
object
object
object
object
Responses
Section titled “Responses”Created
object
A replace only: the ids of the draft’s bindings that the new file does not have. The replace removed them with their expressions. A repeated attach answers the same list.
Set when an enum binding of the draft reads a theme variable that has options the Rive enum does not list.
A warning, not an error: the write succeeded. The binding expression reads one enum theme variable, and some options of that variable are not values of the Rive enum. Rive ignores such a value, so on air the property keeps its last value. Make the options and the enum values the same, or change the expression.
object
The data binding id, for example Main.Typeface.
The theme variable that the expression reads, for example Typeface for $t.Typeface.
Options of the theme variable that the Rive enum does not list.
Values of the Rive enum that no option of the theme variable sets.
Examplegenerated
{ "candidateId": "example", "themeId": 1, "graphicId": "example", "assetId": "example", "droppedBindings": [ "example" ], "enumMismatches": [ { "bindingId": "example", "themeVariable": "example", "optionsNotInEnum": [ "example" ], "enumValuesNotInOptions": [ "example" ] } ]}Invalid Rive request
object
Examplegenerated
{ "message": "example", "code": "example"}Theme, import, graphic, version, or file not found
object
Examplegenerated
{ "message": "example", "code": "example"}Rive import or graphic state conflict
object
Examplegenerated
{ "message": "example", "code": "example"}Rive candidate or source is no longer available
object
Examplegenerated
{ "message": "example", "code": "example"}Rive file or configuration cannot be used
object
Examplegenerated
{ "message": "example", "code": "example"}Rive source imports are unavailable
object
Examplegenerated
{ "message": "example", "code": "example"}