I am trying to pass an array using Python to a custom controller action. I'm not able to get an array out of the request object regardless of what I try. The last array item seems to be accessible, but nothing before it. In the example below, I'm expecting to get the following array in PHP: ['a', 'b', 'c', 'd', 'e']
Here is the python request:
which produces this in the Python log:
This is the code in the controller:
which produces this in the EspoCRM log:
I don't know if I'm doing something wrong in the code in Python or PHP. How is the EspoCRM API setup to pass array parameters into controllers? I can't find an example anywhere.
Here is the python request:
Code:
def getJobData(self, jobNumber, exclude, dateStart, dateEnd): params = { "jobNumber": jobNumber, "exclude": ['a', 'b', 'c', 'd', 'e'], "dateStart": dateStart, "dateEnd": dateEnd } endpoint = "Invoice/action/CollectJobData" logging.debug(f"Collectiong job data ({endpoint}, {params})") self.makeRequest(endpoint, params)
Code:
Making a request (Invoice/action/CollectJobData, {'jobNumber': '18-0089', 'exclude': ['a', 'b', 'c', 'd', 'e'], 'dateStart': '2000-01-01', 'dateEnd': '2020-02-05'}
This is the code in the controller:
PHP Code:
public function getActionCollectJobData($params, $inpData, $request) {
$jobNumber = $request->get('jobNumber');
$exclude = $request->get('exclude');
$dateStart = $request->get('dateStart');
$dateEnd = $request->get('dateEnd');
$GLOBALS['log']->error("params",[$jobNumber, $exclude, $dateStart, $dateEnd],[]);
}
Code:
[2020-02-06 01:10:23] Espo.ERROR: params ["18-0089","e","2000-01-01","2020-02-05"] []
Comment