PATCH
Update asset
PATCH /asset/:id -d { }
can be used to modify any asset
that was uploaded
with On Demand. It is a single endpoint that can update only the following
mutable properties of an asset:
name
storage
Update Stored Asset
Updating Asset Name
This will allow the name of the stored asset in Livepeer Studio to be changed.
Request
curl -X PATCH https://livepeer.studio/api/asset/{id} \
-H 'content-type: application/json' \
-H 'authorization: Bearer {api-key}' \
-d { "name": "New name" }
Updating Storage
This allows to add additional storage location of where the assets are to be stored.
NOTE:
- Currently assets cannot be deleted from the default Livepeer Studio storage. You can customize any additional storage though.
- Only IPFS is supported as an additional storage at the moment. We are currently working on support for other decentralized storages like Arweave and Storj.
Request
curl -X PATCH https://livepeer.studio/api/asset/{id} \
-H 'content-type: application/json' \
-H 'authorization: Bearer {api-key}' \
-d {"storage": {"ipfs": {}}}
Response
Storing a file on IPFS is a long-running operation, which can take a few seconds
to complete. As such, you won't get an immediate result on the response, but
should check the storage.status
object of the asset (e.g. polling) until it
phases to ready
. Then you will have the corresponding CIDs of the asset inside
the storage.ipfs
object.
You can also use the asset.updated
webhook to get notified when the asset
changes, both for the intermediate progress updates and the final update with
the CIDs added to the object.
Setting NFT Metadata
When you save a file to IPFS Livepeer Studio also exports a metadata file that can be used to mint NFTs from the video. This way you don't need to have a separate IPFS provider only for storing your NFT metadata.
Since each marketplace has their own standard for the metadata
of the NFT, it
is up to you to determine which standard to use and fields to include.
NOTE:
- Livepeer Studio includes a couple of fields by default which are deep merged with the provided NFT metadata, with the provided values having precedence.
"name": , // Populated with the same name of the asset in the API
"description": , // A default description referring to the above asset name
"image": // A default image including the Livepeer logo as a thumbnail
"animation_url": // IPFS URL for an immutable version of the lvpr.tv player with the video
"external_url": // Mutable URL for the lvpr.tv player with the video
"properties": {
"video": // CID of the original video file saved on IPFS
"com.livepeer.playbackId": // playback ID of the asset in Livepeer Studio
}
NOTICE that you can change the value or delete any of these default fields by providing a value for it in the
nftMetadata
object, which have precedence over whatever is set by default. You can delete any of the above fields by specifying them asnull
in your overrides.
Example: "animation_url": null
Request
curl -X PATCH https://livepeer.studio/api/asset/{id} \
-H 'content-type: application/json' \
-H 'authorization: Bearer {api-key}' \
-d '{
"storage": {
"ipfs": {
"spec": {
"nftMetadata": {
"title": "My awesome video",
"description": "This is a video of my awesome life",
"tags": "awesome,life,video"
}
}
}
}
}'
Response
Same as before, saving the NFT metadata on IPFS will be a long-running
operation. You can track the progress the same way as the simple IPFS request,
with the NFT metadata CID showing up in the storage.ipfs.nftMetadata
object.
Updating Multiple parameters
You can also specify multiple fields to update in a single PATCH
request.
Request
curl -X PATCH https://livepeer.studio/api/asset/{id} \
-H 'content-type: application/json' \
-H 'authorization: Bearer {api-key}' \
-d {
"name": "New name",
"storage": {"ipfs": {}}
}
Response
Returns a 200 OK
response with an object containing the updated properties
indicates that the asset
was successfully updated.