When a report loads data from a protected JSON endpoint, you may need to send authentication headers.

Preparing the data. Read or create the data source, register it in the report dictionary, synchronize the schema, and render with the supplied records.
const Stimulsoft = require('stimulsoft-reports-js');
const report = new Stimulsoft.Report.StiReport();

report.onBeginProcessData = function (args) {
    if (args.database === "JSON" && args.command === "GetData" &&
        args.pathData && args.pathData.endsWith("/ProtectedDemo.json")) {
        args.headers.push({ key: "X-Auth-Token", value: "*YOUR TOKEN*" });
    }
};

report.loadFile("SimpleListWithProtectedJson.mrt");
report.renderAsync(function () { report.saveDocumentFile("out.mdc"); });
The onBeginProcessData event fires before each data request; its args.headers array lets you attach any HTTP headers, so a server-side report can authenticate to secured JSON or REST endpoints.

Используя этот сайт, вы соглашаетесь на использование файлов Cookie для аналитики и персонализированного контента. Файлы Cookie хранят полезную информацию на вашем компьютере, чтобы помочь нам повысить эффективность и удобство использования. Для получения дополнительной информации, пожалуйста, прочтите Конфиденциальность и Использование Cookie.