Hi
Can the user somehow configure, which metadata fields will be returned via asset API?
I need some additional fields, but unfortunately, I can't see them in returned JSON.
Thank you in advance for any tips.
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @marcinn
Have you added the additional matadata to assets? If it's added to the assets, it will be fetched by assets API.
Such as if you have an additional field as "something" which is having a value of "Somevalue" in the metadata node of the asset, when you try to fetch the metadata for the perticular asset, it will fetch the additional metadata and will show in the JSON response.
http://localhost:4502/api/assets/wknd-events/wknd-events.jpg.json
Thanks!
Hi @marcinn
Have you added the additional matadata to assets? If it's added to the assets, it will be fetched by assets API.
Such as if you have an additional field as "something" which is having a value of "Somevalue" in the metadata node of the asset, when you try to fetch the metadata for the perticular asset, it will fetch the additional metadata and will show in the JSON response.
http://localhost:4502/api/assets/wknd-events/wknd-events.jpg.json
Thanks!
Hi
many thanks for your answer, unfortunately, it doesn't look like in my case. I've added many fields to metadata, but I'm getting only few.
but my asset in CRX looks like this
I've also Dynamic Media configured there, and frankly speaking, I need few scene7 fields.
Views
Replies
Total Likes
Hi @marcinn
I see you have all the property starting with dam:* any property starting with dam:* are not getting pulled into the JSON response whereas any custom property will be pulled into the response. Can you try it and see if it works for you or not by adding any custom property?
Thanks!
Views
Replies
Total Likes
Hi
thx for your comment. I did some tests, and you're right additional metadata filed (which I've added) works
but unfortunately, I need those values in dam namespace. (especially dam:scene7Domain, dam:scene7Type,
Views
Replies
Total Likes
Hi @marcinn ,
According to the below link, the asset HTTP API is unable to read metadata from a custom namespace.
Using a simple HTTP API, you can retrieve the complete custom metadata of any asset by accessing the following URL. As this is working for me.
http://localhost:4502/content/dam/we-retail/en/people/womens/women_6.jpg/jcr:content.3.json
Views
Replies
Total Likes
Hi @marcinn
Unfortunately there is no such config to allow it.
But you can try the sync metadata approach like below:
var workflowData = workItem.getWorkflowData();
if (workflowData.getPayloadType() == "JCR_PATH")
{
var path = workflowData.getPayload().toString();
var node = workflowSession.getSession().getItem(path);
var metadataNode = node.getNode("jcr:content/metadata");
var jcrcontentNode = node.getNode("jcr:content");
if (jcrcontentNode.hasProperty("jcr:title"))
{
var jcrTitle = jcrcontentNode.getProperty("jcr:title");
metadataNode.setProperty("dc:title", jcrTitle.toString());
metadataNode.save();
}
}
You can try the same steps for your custom property.
Here is the detailed article:
Hope this helps!
Thanks
Views
Replies
Total Likes
This thread is confirming the API can't even return AEM's own metadata fields...?
Even the documentation is **bleep** - "To obtain a full representation of the entity, clients should retrieve the contents of the URL pointed to by the link with a rel of self." No mention of only returning custom metadata fields.
Views
Replies
Total Likes