Update Scenario
Last updated
Last updated
In some cases, there's a need to modify the metadata of an album that's already delivered to the platforms.
In this tutorial, we'll modify the album's featuring artist and change its default offer's release date.
To do this, follow these steps:
response = RestClient.put(
"https://api.idol.io/api/v2/products/214477",
{
"data": {
"id": "214477",
"attributes": {
"status": "draft"
},
"type": "products"
}
}.to_json,
"Content-Type": 'application/vnd.api+json',
"Authorization": "Bearer <token>"
)
status = JSON.parse(response)['data']['attributes']['status']
// => "draft"
response = RestClient.put(
"https://api.idol.io/api/v2/products/214477",
{
"data": {
"id": "214477",
"attributes": {
"featuring": "Album Test Featuring"
},
"type": "products"
}
}.to_json,
"Content-Type": 'application/vnd.api+json',
"Authorization": "Bearer <token>"
)
featuring = JSON.parse(response)['data']['attributes']['featuring']
// => "Album Test Featuring"
response = RestClient.put(
"https://api.idol.io/api/v2/products/214477",
{
"data": {
"id": "214477",
"attributes": {
"status": "active"
},
"type": "products"
}
}.to_json,
"Content-Type": 'application/vnd.api+json',
"Authorization": "Bearer <token>"
)
status = JSON.parse(response)['data']['attributes']['status']
// => "active"
response = RestClient.get(
"https://api.idol.io/api/v2/offers?filter[product_id]=214477&filter[is_default]=true",
"Content-Type": 'application/vnd.api+json',
"Authorization": "Bearer <token>"
)
offer_id = JSON.parse(response)['data'].first['id']
// => 377099
response = RestClient.put(
"https://api.idol.io/api/v2/offers/377099",
{
"data": {
"id": "377099",
"attributes": {
"status": "draft"
},
"type": "offers"
}
}.to_json,
"Content-Type": 'application/vnd.api+json',
"Authorization": "Bearer <token>"
)
status = JSON.parse(response)['data']['attributes']['status']
// => "draft"
response = RestClient.put(
"https://api.idol.io/api/v2/offers/377099",
{
"data": {
"id": "377099",
"attributes": {
"release-date": "2025-03-12"
},
"type": "offers"
}
}.to_json,
"Content-Type": 'application/vnd.api+json',
"Authorization": "Bearer <token>"
)
release_date = JSON.parse(response)['data']['attributes']['release-date']
// => "2025-03-12"
response = RestClient.put(
"https://api.idol.io/api/v2/offers/377099",
{
"data": {
"id": "377099",
"attributes": {
"status": "active"
},
"type": "offers"
}
}.to_json,
"Content-Type": 'application/vnd.api+json',
"Authorization": "Bearer <token>"
)
status = JSON.parse(response)['data']['attributes']['status']
// => "active"
response = RestClient.post(
"https://api.idol.io/api/v2/send-tasks",
{
"data": {
"attributes": {
"deliverable": "true",
"delivery-type": "update"
},
"relationships": {
"product": {
"data": {
"type": "products",
"id": "214477"
}
},
"dsp-upload-identification": {
"data": {
"type": "dsp-upload-identifications",
"id": "374"
}
}
},
"type": "send-tasks"
}
}.to_json,
"Content-Type": 'application/vnd.api+json',
"Authorization": "Bearer <token>"
)
send_task_id = JSON.parse(response)['data'][id]
// => 7434479