Multi-select Enrichment Services

The ability to submit content items to an enrichment service by selecting a context menu entry opens the possibility of submitting multiple content items in one go. You can enable this possibility by specifying selection: ["multi"] or selection: ["single","multi"] when configuring a context menu entry, as described in Enrichment Service Context Menu Entries. However, in order for this to work the enrichment service must be able to handle multiple selections correctly. It must therefore differ from a single-select enrichment service in the following ways:

  • It must be designed to accept a text/uri-list holding the URIs of the selected content items rather than an Atom entry holding the selected content item itself.

  • If its purpose is to modify the selected content items, then it must do so by submitting GET and PUT requests to the Content Store web service for each URI in the list. It cannot include the modified content items in an HTTP 200 (OK) response (which is what a single-select enrichment service does).

These are the only differences between a multi-select enrichment service and a single-select enrichment service.

If your enrichment service needs to handle both single and multiple selections then you must design it as a multi-select service that handles text/uri-lists rather than Atom entries, and add a requestContentType property setting to the enrichment service's trigger configurations as follows:

  - name: print-article
    href: http://host:port/printArticle
    title: Print Article
    triggers:
      - name: on-click
        properties:
          requestContentType: text/uri-list
      - name: on-print-menu-item-click
        properties:
          requestContentType: text/uri-list

This property setting forces CUE to send a text/uri-list to the enrichment service rather than an Atom entry even for single content items.