Answer. Make a PATCH /v2/sites/site_id/media/media_id/ call that excludes the custom parameter.
If you have a media resource that has existing metadata.custom_params
key-value pairs that you want to remove, create a PATCH /v2/sites/site_id/media/media_id/
that excludes the metadata.custom_param
key-value pairs that should be removed.
Example scenario
Assume you have a media resource with the following custom_params
object shown below.
{
"metadata": {
"custom_params": {
"annimal": "dog",
"animal": "dog"
},
}
}
The first key-value pair, "annimal": "dog"
, is incorrect. The second key-value pair, "animal": "dog"
, is correct. Because the first key-value pair is incorrect, you want to remove it from the media resource.
Coding the solution
- Create a
metadata
object that does not contain"annimal": "dog"
.
{
"metadata": {
"custom_params": {
"animal": "dog"
},
}
}
- Make a PATCH /v2/sites/site_id/media/media_id/ call that includes the corrected
metadata.custom_params
object.
curl -X PATCH https://api.jwplayer.com/v2/sites/{site_id}/media/{media_id} \
-H 'Authorization: Bearer {v2_api_secret}' \
-H 'Content-Type: application/json' \
-d '{"metadata":{"custom_params":{"animal":"dog"}}}'