I am creating a custom Rest v10 endpoint. I have created an API accepting GET method of request. Now I need to create an API with POST method, and send it data from my record.js file, which I have extended from contacts module.
My API code is as following.
My API is placed in:
public function registerApiRest()
'MyContactsAPI' => array(
'reqType' => 'GET',
'noLoginRequired' => true,
'path' => array('MyContactsAPI', 'GetData', '?'),
'pathVars' => array('', '', 'data'),
//method to call
'method' => 'GetDuplicates',
//short help string to be displayed in the help documentation
'shortHelp' => 'An API to get activity report of an account and all its related modules',
//long help to be displayed in the help documentation
'longHelp' => 'custom/clients/base/api/help/MyEndPoint_MyGetEndPoint_help.html',
public function GetData($api, $args)
// logic will be here
Now I don't know, how to convert the same API to accept POST requests and how to call it from record.js file using App.api.call and sending JSON data to API.
Any help will be appriciated.