Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

Assets API Update Rendition Mime Type

Avatar

Level 3

We migrated our assets from another system. Some file extension are not formatted correctly, like "filename.jpg (1)". AEM couldn't figured out mime type, so DAM Update Asset workflow couldn't generate renditions.

 

I tried to add mime type manually via Assets API but I'm getting "Forbidden" error. Any ideas?

 

Spoiler
PUT /api/assets/myfolder/myAsset.png/renditions/original -H"Content-Type: application/json" -d '{"properties":{"jcr:mimeType":"image/jpeg"}}'

 

 

7 Replies

Avatar

Community Advisor

Hi @btaymaz 

 

You can try in the below way:

  1. Use the PUT request with the asset URL e.g. http://localhost:4502/api/assets/wknd-events/wknd-events.jpg
  2. Set the Authorization type as "Basic Auth" with username and password.
  3. Set the "Content-Type" header as "application/json".
  4. Use the below request body:
{
"properties": {
"metadata" : {
"dam:MIMEtype":"image/jpeg"
}
}
}

 

This will set the mime type on metadata node.

 

Hope this helps!

Thanks 

Avatar

Level 3
This put it to asset level, thumbnail creation looks under "renditions/original"

Avatar

Community Advisor
All the metadata information are stored under "metadata" node. So you need to pass the information as mentioned above.

Avatar

Level 3
No, this is not true. Each rendition has it's own mimetype, including original

Avatar

Level 3
I'm passing credentials, it works at this level "/api/assets/myfolder/myAsset.png" but not "/api/assets/myfolder/myAsset.png/renditions/original""

Avatar

Community Advisor
but original node does not contains any meta property, when you need to set mime type there?


Arun Patidar