Something went wrong while setting issue due date.
Find a better way to pass array parameter in REST calls
Closed
Find a better way to pass array parameter in REST calls
Actual behavior
We can't simply pass an array parameter to REST call as GET parameters. For example 'https://fd.pfptnbdev.io/rest.php/v1/objects/user?base=uid=coudot1,ou=users,dc=kroqi,dc=fr&scope=base&attrs={"sn":1,"mail":1}' do not work.
The REST client PHP code is:
// Allow passing parameters as a pre-encoded string (or something that
// allows casting to a string). Parameters passed as strings will not be
// merged with parameters specified in the default options.
if (is_array($parameters)) {
$parameters = array_merge($client->options['parameters'],
$parameters);
$parameters_string = http_build_query($parameters);
// http_build_query automatically adds an array index to repeated
// parameters which is not desirable on most systems. This hack
// reverts "key[0]=foo&key[1]=bar" to "key[]=foo&key[]=bar"
if (!$client->options['build_indexed_queries']) {
$parameters_string = preg_replace(
"/%5B[0-9]+%5D=/simU", "%5B%5D=", $parameters_string);
}
}
Expected behavior
Find a way to serialize array values in GET parameter so we can call REST services from any language.