iwanndie Posted November 4, 2021 Share Posted November 4, 2021 (edited) So, I am querying https://developers.whmcs.com/api-reference/validatelogin/ which returns a user id. However, when using https://developers.whmcs.com/api-reference/getclientsdetails/ with that user id, it returns another clients details. I've checked the responses, for one account, the user id is different to the client id, why is this? There's no way of converting user id to client id and visa versa, and the API doesn't return consistent data. The API will either return user id or client id, for example validate returns user_id, however getClientDetails requires clientid. There's no consistency with the API at all, it seems very half-baked. Why? Edited November 4, 2021 by iwanndie 1 Quote Link to comment Share on other sites More sharing options...
steven99 Posted November 8, 2021 Share Posted November 8, 2021 (edited) Are you logging in with the client user login or with a sub user / invited user? Or is the client a sub user? If with a sub / invited user, you are basically running in to the Client != Logged in User / auth user. The ID returned from validatelogin isn't the ID of the client but the ID of the user that login belongs to. https://developers.whmcs.com/advanced/authentication/ Welcome to the world of WHMCS 8. yay!...? So now you have the user's id and you want the client, but a user can have multiple clients tied to it and how are you suppose to know which is which? Well, using the CurrentUser->client() function should return the current client logged in to, however, that only applies when logged in to WHMCS. When using remote api, you will need to know the client beforehand for a sub / invited user. You can get the list of clients a user is attached to via CurrentUser->user()->clients . Then on your remote side, before doing actions, confirm which client the action should go to. EDIT: and as for half-baked the docs are at least that as I don't think the above is listed any where official and devs have to look around via vardump or get class method or other ways to get class info. Edited November 8, 2021 by steven99 1 Quote Link to comment Share on other sites More sharing options...
xyzulu Posted November 9, 2021 Share Posted November 9, 2021 (edited) This is also an issue for WHMCS as the activity log links to clients/users (8.3.1) still is not using the correct links in all cases. Edited November 9, 2021 by xyzulu 0 Quote Link to comment Share on other sites More sharing options...
BatteryLove Posted June 7 Share Posted June 7 Exactly the same issue. I never thought someone else encountered this. @iwanndie did you find a solution? I know its an old topic but please let me know if you found any solution. Im stuck with this! Thanks! 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.