AnsweredAssumed Answered

Save multiple records through API REST

Question asked by Oscar Castro on Oct 24, 2016
Latest reply on Nov 3, 2016 by sidhu sidhu


I have a custom module related to Accounts module (Account - one to many - custom module records), i need to save those records from a custom sidecar controller. The records are in a structure like this:


I used the api previously to fetch the same records, but the REST API using GET method.

'getCuotas' => array(
                'noLoginRequired' => true,
                // What type of HTTP request to match against, we support GET/PUT/POST/DELETE
                'reqType' => 'GET',
                // This is the path you are hoping to match, it also accepts wildcards of ? and <module>
                'path' => array('opal_Cuotas', 'get_cuotas', '?'),
                // These take elements from the path and use them to populate $args
                'pathVars' => array('', '', 'record'),
                // This is the method name in this class that the url maps to
                'method' => 'getCuotas',
                // The shortHelp is vital, without it you will not see your endpoint in the /help
                'shortHelp' => 'Lista las cuotas de una poliza',
                // The longHelp points to an HTML file and will be there on /help for people to expand and show
                'longHelp' => '',

With this js function:'GET', App.api.buildURL('opal_Cuotas/get_cuotas/'+this.model.get('id')), null, {
            success: function (data) {
            error: function (e) {
        }, this);

Now, I need to save this records, using the REST API also.


How can i do that?

Thanks for the help.