Finding the Data Records in a Data Set

Problem

You want to obtain a list of all the previously created Data Records contained within a specific Data Set potentially for use in a Content 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 Data Set Entity REST service:

Get Data Records for Data Set /rest/serverengine/entity/datasets/{dataSetId} GET

Example

HTML5

dse-get-datarecords.html

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>Get Data Records for Data 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/dse-get-datarecords.js"></script>
        <link rel="stylesheet" href="../../common/css/styles.css">
    </head>
    <body>
        <h2>Data Set Entity Service - Get Data Records for Data Set Example</h2>
        <form>
            <fieldset>
                <legend>Inputs</legend>
                <div>
                    <label for="dataset">Data Set ID:</label>
                    <input id="dataset" 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

dse-get-datarecords.js

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

        c.setupExample();

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

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

            var dataSetId = $("#dataset").val();

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

Screenshot & Output

Usage

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

The resulting list will then be returned and displayed to the Results area in both Plain list and JSON Identifier List formats.

Further Reading

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