Closed elgg-gitbot closed 11 years ago
cash wrote on 2012-03-06
PHP is not Python so we cannot skip optional functional parameters. You need to set the default value in expose_function(). Someday, we'll have a better web services API that uses a params array.
trac user markharding wrote on 2012-03-06
Suppose $username is not being passed because they are wanting to get the logged in users values, how would you go about that?
cash wrote on 2012-03-08
The problem is with your function. If username is an optional parameter, it should occur after context in the list.
Original ticket http://trac.elgg.org/ticket/4399 on 2012-03-06 by trac user markharding, assigned to unknown.
Elgg version: 1.8.1b1
I am having a problem with web services. If a parameter is not passed and it is listed in the exposed function higher, its value is taken by a lower one. Basically, the parameters don't seem to be matching their values if one is missing.
For example. My function
and my expose function.
If $username is not passed but $context is then the context value actually becomes the $username value.
I don't know if there are any plans for this but I think it would be great if there could be a simple $params array that we could post instead of having to manually list them all.