Update Scenario

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:

Change Product status to Draft:

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"

Update the Product's featuring artist:

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"

Re-activate the Product:

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"

Retrieve the default Offer:

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

Change default Offer's status to Draft:

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"

Update the default Offer's release date:

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"

Reactivate the default Offer:

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"

And, finally, send a metadata update to the relevant platforms, by creating an 'update' type of SendTask:

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

Last updated