﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc	difficulty
2072	Optional API arguments cannot be skipped	ewinslow	cash	"I have exposed the following function:

{{{
function rest_test($one = 1, $two = 2)
{
	return $two/$one;
}

expose_function(
	'system.api.test',
	'rest_test',
	array(
		'one' => array('type' => 'int', 'required' => FALSE),
		'two' => array('type' => 'int', 'required' => FALSE),
	)
);
}}}

If I call
{{{
...?method=system.api.test&two=1&one=2
}}}
it does what you think it should, returns 0.5.  However, 
{{{
...?method=system.api.test&two=1
}}}
does not do what you think it should.  Instead of returning 1, it still returns two, because the argument for one is completely missing.

Right now to get around this I'm having my users do 
{{{
?method=api.func&opts[arg1]=val1&opts[arg2]=val2
}}}
but this is hardly ideal.  It seems so unnecessary when they're already named arguments to have to specify them as an array like that.
"	Defect	closed	high	Elgg 1.7.2	Core	1.7	major	worksforme		brettp ewinslow	
