Goal
Adobe Experience Manager 2023.5.12142.20230526T152858Z-230400
Post explains how to trigger bulk import using PostMan (so in a way programmatically)
Storage Container in Azure
Bulk Import Config
Before Import - No Assets in the Folder
Get Bearer Token From Developer Console
Set the Token in Postman
Run Bulk Import from Postman
Asset Imported
Asset Processed
@Reference
private SlingRequestProcessor slingRequestProcessor;
@Reference
private RequestResponseFactory requestResponseFactory;
private static final String IMPORT_JOB_URL = "/conf/global/settings/dam/import/bulk-import-config-name.importJob.json";
private void runBulkImport(final ResourceResolver resolver){
final Map<String, Object> requestParams = new ConcurrentHashMap<>();
requestParams.put("operation", "run");
final HttpServletRequest request = requestResponseFactory.createRequest("POST", IMPORT_JOB_URL,
requestParams);
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
final HttpServletResponse response = this.requestResponseFactory.createResponse(bos);
try {
slingRequestProcessor.processRequest(request, response, resolver);
} catch (ServletException | IOException e) {
logger.error("Error while running bulk import ", e);
}
}
No comments:
Post a Comment