Hi community,
I need to retrieve all metadata fields that start with a specific prefix (e.g., nameMetadata_) from all metadata schemas in AEM.
Current situation:
I'm currently using this endpoint to get fields from a specific schema:
{{Instance}}/conf/global/settings/dam/adminui-extension/metadataschema/default.infinity.jsonWith a script, I can process the JSON and filter the metadata fields I need, but this endpoint only points to the default schema.
What I've tried:
I know I can use:
/conf/global/settings/dam/adminui-extension/metadataschema.infinity.jsonThis endpoint returns all schemas, but it requires iterating through each one and querying their fields individually.
My question:
Is there a more direct endpoint or method that allows me to:
Basically, I'm looking to optimize the process and avoid having to make multiple server calls iterating schema by schema.
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @EstebanTr,
Unfortunately, AEM does not provide a single endpoint that returns every metadata field across every metadata schema in one JSON.
And there is no built-in selector or query parameter that filters fields by name (e.g., nameMetadata_*) at /conf nodes.
You might want to explore these options:
1. Make one call: .infinity.json and parse locally
/conf/global/settings/dam/adminui-extension/metadataschema.infinity.json
This returns the entire schema tree.
This is the recommended method.
2. Use QueryBuilder/Groovy Script Console
Run a script under /conf to scan all schemas:
Example Groovy:
def root = resourceResolver.getResource("/conf/global/settings/dam/adminui-extension/metadataschema")
root.listChildren().each { schema ->
schema.adaptTo(Node).recurse { node ->
node.getProperties().each { p ->
if (p.name.startsWith("nameMetadata_")) {
println("${node.path} -> ${p.name}")
}
}
}
}
This avoids client-side looping, but still requires recursion.
3. Create a custom endpoint (Servlet / Sling Model Exporter)
If you need a “single JSON output,” you can create a custom servlet:
/bin/metadata-fields?prefix=nameMetadata_
Your servlet walks the /conf tree and returns exactly what you want.
Hi @EstebanTr,
Unfortunately, AEM does not provide a single endpoint that returns every metadata field across every metadata schema in one JSON.
And there is no built-in selector or query parameter that filters fields by name (e.g., nameMetadata_*) at /conf nodes.
You might want to explore these options:
1. Make one call: .infinity.json and parse locally
/conf/global/settings/dam/adminui-extension/metadataschema.infinity.json
This returns the entire schema tree.
This is the recommended method.
2. Use QueryBuilder/Groovy Script Console
Run a script under /conf to scan all schemas:
Example Groovy:
def root = resourceResolver.getResource("/conf/global/settings/dam/adminui-extension/metadataschema")
root.listChildren().each { schema ->
schema.adaptTo(Node).recurse { node ->
node.getProperties().each { p ->
if (p.name.startsWith("nameMetadata_")) {
println("${node.path} -> ${p.name}")
}
}
}
}
This avoids client-side looping, but still requires recursion.
3. Create a custom endpoint (Servlet / Sling Model Exporter)
If you need a “single JSON output,” you can create a custom servlet:
/bin/metadata-fields?prefix=nameMetadata_
Your servlet walks the /conf tree and returns exactly what you want.