Assets client

The SDK offers an Assets client to provide asset-specific operations.

Note

The client variable in the following code examples refers to the IMClient instance. When using the Web SDK, the variable name can be chosen freely, but it is also called client at instantiation in the documentation.

Managing the final life cycle status

The final life cycle status of an asset can be managed using the FinalLifeCycleManager of the client.

To modify the life cycle status, the following methods are available:

  • ApproveAsync: moves the asset to the approved state.

  • ArchiveAsync: moves the asset to the archived state.

  • DirectPublishAsync: moves the asset to the approved state.

  • RejectAsync: moves the asset to the rejected state (with an optional reason for rejection).

  • RestoreAsync: moves the asset to the approved state.

  • SubmitAsync: moves the asset to the underreview state.

These methods require the id of an existing asset. When the provided id is not that of an Asset entity, or when the transition from the current state to the requested state is not allowed, the client throws a ForbiddenException.

For example, approve the asset with the id 1000:

RequestResponse

await MClient.Assets.FinalLifeCycleManager.ApproveAsync(1000);

Additionally, it is easy to get the entity id of a final life cycle status entity (this works with an enum constant or with the status string value):

RequestResponse

long? id = await MClient.Assets.FinalLifeCycleManager.GetFinalLifeCycleStatusIdAsync(FinalLifeCycleStatus.StatusValues.Approved);

For example, the following snippet creates a public link for the preview rendition of the asset with id 12345:

RequestResponse

var publicLinkId = await MClient.Assets.CreatePublicLinkAsync(12345, "preview");

Additional arguments allow you to specify the expiration date and relative URL for the public link.

Do you have some feedback for us?

If you have suggestions for improving this article,