Finding the Content Items in a Content Set

Problem

You want to obtain a list of all the previously created Content Items contained within a specific Content Set potentially for use in a Job Creation operation.

Solution

The solution is to create a request using the following URI and method type and submit it to the server via the Content Set Entity REST service:

Get Content Items for Content Set /rest/serverengine/entity/contentsets/{contentSetId} GET

Example

HTML5

cse-get-contentitems.html

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>Get Content Items for Content Set Example</title>
        <script src="../../common/lib/js/jquery-3.4.1.min.js"></script>
        <script src="../../common/js/common.js"></script>
        <script src="js/cse-get-contentitems.js"></script>
        <link rel="stylesheet" href="../../common/css/styles.css">
    </head>
    <body>
        <h2>Content Set Entity Service - Get Content Items for Content Set Example</h2>
        <form>
            <fieldset>
                <legend>Inputs</legend>
                <div>
                    <label for="contentset">Content Set ID:</label>
                    <input id="contentset" type="text" placeholder="1234" required>
                </div>
            </fieldset>
            <fieldset>
                <legend>Actions</legend>
                <div>
                    <input id="submit" type="submit" value="Submit">
                </div>
            </fieldset>
        </form>
    </body>
</html>

JavaScript/jQuery

cse-get-contentitems.js

/* Content Set Entity Service - Get Content Items for Content Set Example */
(function ($, c) {
    "use strict";
    $(function () {

        c.setupExample();

        $("form").on("submit", function (event) {

            event.preventDefault();
            if (!c.checkSessionValid()) return;

            var contentSetId = $("#contentset").val();

            $.ajax({
                type:   "GET",
                url:    "/rest/serverengine/entity/contentsets/" + contentSetId
            })
                .done(function (response) {
                    c.displayStatus("Request Successful");
                    c.displayHeading("Content Item IDs for Content Set '" + contentSetId + "'");
                    c.displaySubResult("Plain", c.jsonContentItemIDListToTable(response));
                    c.displaySubResult("JSON Content Item Identifier List", c.jsonPrettyPrint(response));
                })
                .fail(c.displayDefaultFailure);
        });
    });
}(jQuery, Common));

Screenshot & Output

Usage

To run the example simply enter the Content Set ID and select the Submit button to request a list of the all the content items contained within the specific content set in the server.

The resulting list will then be returned as a list of Content Item and Data Record ID pairs which will be displayed to the Results area in both Plain table and JSON Content Item Identifier List formats.

Further Reading

See the Content Set Entity Service page of the REST API Reference section for further detail.