Returning Unformatted Data (or Label) from Structured Metadata
I am trying to add two custom structured meta data fields – city and country – to photos in my folder. When I fetch that data I get the ID's (e.g. Usa instead of USA, Puerto_montt instead of Puerto Montt). Is there a way to fetch the labels without trying to transform or map these locally?
Answers
-
correction: I am of course getting "usa" and "puerto_montt"…it was css that was uppercasing them. Still – the question stands :)
0 -
update: I should also add these are "Single-selection list" items… which seems preferable to a text field for controlling spelling, etc… but maybe doesn't provide the option for just pulling the label?
0 -
Hi there,
Thanks for reaching out.
You can use the
metadata_field_by_field_id
method, as mentioned here:
https://cloudinary.com/documentation/metadata_api#get_a_metadata_field_by_external_idFor example:
cloudinary.v2.api.metadata_field_by_field_id('city').then(function(error,result){console.log(util.inspect(error,false,null,true));});
This will return a list of data source values. Can you give that a try and let me know how it goes? If you have any questions, do not hesitate to ask.
Kind regards,
Tia
Developer Support Engineer
Cloudinary--
💡 Improve your site's performance by applying optimization features when delivering assets💬 Community Forums | 🧑💻 Discord Server
🧑🎓 Academy Training | 📖 Documentation | 📰 Blog0