Creating READynamic API calls using alternatives to cURL

While we illustrate API function calls by offering sample cURL commands, you are more likely to use program languages or scripts to interact with the READynamic APIs. We offer a format for using Ajax, a JavaScript language, to send a command to READynamic.

$("#upload").submit(function(event) {
            var url = domainUrl + "portal/api/books";
            var bookData = new FormData();
            var bookName = $("#upload input[name=book-name]").val();
            var file = $("#upload input[name=book-file]")[0].files[0];
            bookData.append("book[name]", bookName);
            bookData.append("book[backing_file]", file);
            function success(data) {
                        setResult("Success: Book ID",;
               = data.default_annotation_set_id;
                        if (formCreated) {
                        } else {
                                    formCreated = true;
                        url: url,
                        data: bookData,
                        processData: false,
                        contentType: false,
                        type: 'POST',
                        xhrFields: {
                                    withCredentials: true
                        success: success,
                        error: error