REST API and security

Posted by: Fabrice.Mainguene on 7 July 2023, 10:15 am EST

  • Posted 7 July 2023, 10:15 am EST

    Hi,

    I want to use the DataManager.addTable to access my tables through a REST service.

    But I need to add some values in the HTTP headers for security reason.

    How can I do that?

    Thanks

  • Posted 10 July 2023, 5:19 am EST

    Hi,

    You may define your own callback to request the server. Please refer to the following code sni[ppet and the attached demo that explains the same.

    var myTable = dataManager.addTable("myTable", {
        // ... other settings
        autoSync: true // enable the autoSync mode
        remote: {
            read: function (): Promise<any[]>{
                return requestToServer();
            },
            update: function (item): Promise<any>{ // the updated data change
                return requestToServer(item);
            },
            create: function (item): Promise<any>{ // the created data change
                return requestToServer(item);
            },
            delete: function (item): Promise<boolean>{ // the deleted data change
                return requestToServer(item);
            },
        }
    });

    demo: https://www.grapecity.com/spreadjs/demos/features/table-sheet/auto-sync-and-batch/handle-requests/purejs

    Regards,

    Avinash

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels