AJS.RestfulTable is not a constructor

Currently writing a Java plugin for Jira Server.
I am trying to create a REST-ful table with AJS and connect it to my RestService.
But when I copy the example form here I get this Javascript error.

myPageXyz?projectKey=TEST:1858 Uncaught TypeError: AJS.RestfulTable is not a constructor
    at HTMLDocument.<anonymous> (myPageXyz?projectKey=TEST:1858)
    at fire (jquery.js:3192)
    at Object.fireWith [as resolveWith] (jquery.js:3322)
    at Function.ready (jquery.js:3541)
    at HTMLDocument.completed (jquery.js:3557)

This is my code

<div>
    <table id="rest-table"></table>
    <script>
        AJS.$(document).ready(function () {
            new AJS.RestfulTable({
                el: jQuery("#rest-table"),
                autoFocus: true,
                resources: {
                    all: "rest/project/HSP/versions?expand=operations",
                    self: "rest/version"
                },
                deleteConfirmationCallback: function(model) {
                    AJS.$("#restful-table-model")[0].innerHTML = "<b>ID:</b> " + model.id + " <b>status:</b> " + model.status + " <b>description:</b> " + model.description;
                    AJS.dialog2("#delete-confirmation-dialog").show();
                    return new Promise(function(resolve, reject) {
                        AJS.$("#dialog-submit-button").on('click', function (e) {
                            resolve();
                            e.preventDefault();
                            AJS.dialog2("#delete-confirmation-dialog").hide();
                        });
                        AJS.$(".aui-dialog2-header-close, #warning-dialog-cancel").on('click', function (e) {
                            reject();
                            e.preventDefault();
                            AJS.dialog2("#delete-confirmation-dialog").hide();
                        });
                    });
                },
                columns: [
                    {
                        id: "status",
                        header: ""
                    },
                    {
                        id: "name",
                        header: "Version name"
                    },
                    {
                        id: "description",
                        header: "Description"
                    },
                    {
                        id: "releaseDate",
                        header: "Release date",
                        inputAriaLabel: "Release date field"
                    }
                ]
            });
        });
    </script>
</div>