Have a look to the comments at the top of every function declared in mdl_baseserver.class.php .See https://github.com/patrickpollet/moodlews/blob/master/wspp/mdl_baseserver.class.php if you do not have access to source code
Every time OK Tech request an entity identifier xxxxid (ie course, user, group,grouping...) you have the choice of the field used to uniquely identify the entity that is the purpose of the parameter idfield . 'idnumber' is almost always used as default value if absent
For a course it can be the Moodle id, the id number or the short name
for an user it can be an username, id, idnumber, email
for a group it can be id or name
Thus get_users_bycourse() can be called with
get_users_bycourse($client,$sess, 46,'id' ...
get_users_bycourse($client,$sess, 'CHEM 101,'shortname' ...
get_users_bycourse($client,$sess, 46,'AZ123' ,'idnumber' ...
The optional roleid parameter can be used to filter out users by role as they are declared in table mdl_role (1=admin, 2 creator, 3=teacher ...)