How am I supposed to use a webhook notification with the notification_type: restore_asset_version?

Zimple
Zimple Member Posts: 1
edited November 6 in Developer APIs

When you restore an old asset version the url for that image/file changes (only the version number changes), but the webhook notification does not contain the url or the version number so I'm not sure how I'm supposed to use the restore_asset_version webhook notification to update anything on my end.

Am I supposed to do an API call using the asset_id to fetch the new url?

This is the information contained in the webhook notification:

{
"notification_type": "restore_asset_version",
"timestamp": "2024-11-05T03:15:58+00:00",
"request_id": "XXX",
"restored_resources": [
{
"asset_id": "XXX",
"public_id": "XXX",
"resource_type": "image",
"type": "upload"
}
],
"notification_context": {
"triggered_at": "2024-11-05T03:15:57.331300Z",
"triggered_by": {
"source": "ui",
"id": "XXX"
}
},
"signature_key": "XXX"
}

Tagged:

Best Answer

  • Tamara
    Tamara Member, Cloudinary Staff Posts: 124
    Answer ✓

    Hi @Zimple

    To retrieve the updated version URL for the restored asset, you can take the public_id from the webhook payload and make a call to the Admin API’s resource details endpoint. This will allow you to retrieve the current asset’s version number and updated URL.

    Let us know if you have further questions or need additional assistance with implementing this approach.

    Best regards,

    Tamara