curl --request PUT \
--url https://api.royalti.io/product/{id}/assets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"assets": [
{
"asset": "asset-id-1",
"number": 1
},
{
"asset": "asset-id-2",
"number": 2
}
]
}
'{
"message": "Assets added to Products"
}/product//assets
curl --request PUT \
--url https://api.royalti.io/product/{id}/assets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"assets": [
{
"asset": "asset-id-1",
"number": 1
},
{
"asset": "asset-id-2",
"number": 2
}
]
}
'{
"message": "Assets added to Products"
}/product/{id}/assets endpoint updates the assets associated with a specific product. It replaces all existing asset associations with the provided list.
Method:PUT
Path Parameter:
| Parameter | Type | Description |
|---|---|---|
| id | string | The unique identifier of the product. |
| Parameter | Type | Description |
|---|---|---|
| assets | array | Array of asset objects to associate with the product. |
| Parameter | Type | Description |
|---|---|---|
| asset | string | The ID of the asset to associate. |
| number | integer | The track number for this asset in the product. |
const response = await fetch('https://api.royalti.io/product/example-id/assets', {
method: 'PUT',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
"assets": [
{
"asset": "sample-asset",
"number": 1
}
]
})
});
const data = await response.json();
console.log(data);