onelogin / onelogin-php-sdk

MIT License
12 stars 18 forks source link

Isssue when trying to sort getUsers() #17

Open lewisstancer opened 2 years ago

lewisstancer commented 2 years ago

From the OneLogin API Reference: OneLogin API - Users

Return users sorted by firstname. Use + to sort in ascending order or - to sort in descending order: https://api.us.onelogin.com/api/2/users?sort=+firstname

Attempted code

$queryParameters = [
    "sort" => "+firstname"
];
$userList = $oneLoginApi->getUsers($queryParameters);

Returns: Empty array (blank)

For now the workaround is to just leave sort blank but I assume I am either doing this wrong or it is something to do with character encoding but as it isn't documented I can't be sure

$queryParameters = [
    "sort" => ""
];
$userList = $oneLoginApi->getUsers($queryParameters);
lewisstancer commented 2 years ago

Getting similar errors when trying to use some of the query parameters mentioned in the API reference. Another example is user_ids set to a comma separated string of OneLogin ID's. returns blank from the SDK, no exception or errors.

fields works but throws warnings: Warning: Undefined property: stdClass::$email in /var/www/vendor/onelogin/api/src/models/User.php on line 120

pitbulk commented 2 years ago

API Get Users V1 which is the one that covers this SDK right now does not support sort by the firstname value. Only the id by providing id or -id

Leaving sort blank does not execute any sort at all.

user_ids is a valid parameter of the V2 API, but this SDK uses V1.

This commit fixes the warning you experienced: https://github.com/onelogin/onelogin-php-sdk/commit/d605f3ceb375ee30e7f124cdff4f20c915cd5250

lewisstancer commented 2 years ago

Do you know if and when the SDK will be updated to support V2? Thanks

pitbulk commented 2 years ago

There are plans to release a new version of thr SDK, supporting V2.

Months ago the Python SDK was released, this month is supposed to be released the updated version of the Java SDK. Then Ruby and PHP SDKs will be implemented. I cant provide to you an exact release date atm.

lewisstancer commented 2 years ago

Ok thank you. Has the commit been pushed to Packagist so it is available as an update through composer?