Call Update User API return OK but value not updated.

27215

hi everyone,

I call an API which is used to update an existing user in the system Update User API :  https://<highqinstance_name>/api/13/users/194 

Here's the request payload:

{  "lastlogindate": "30 Nov 2022 04:01",  "invalidlogins": "0",  "org": "3",  "sites": {    "sitecount": 1,    "site": [      {        "id": 48,        "sitename": "NashTech Dev Site 3"      }    

 

After that, I check the data using the Get User API : https://<highqinstance_name>/api/13/users/194?type=id 

But the field 'lastlogindate' doesn't match the value that I updated before:

 

I need to know the details of usage of this API. In case this is a bug is there another API that I can use?

Thanks you.

]]>
  • Ha Nguyen Danh, things like:

    • userid
    • invitationsent
    • createdby
    • createddate
    • modifiedby
    • modifieddate
    • lastlogindate
    • invalidlogins
    • resetpassworddate
    • followingcount
    • followercount

    are all implicitly read-only. They are operationally set by the system, based on certain actions. Only the system can update lastlogindate and invalidatelogins in response to the user logging in, and entering an invalid password more than 3 times.

    In Computer Science parlance, these are often call derived attributes, as they are commonly "calculated" properties of an object.

    Question is why are you trying to spoof when the user logged in? As a would-be hacker, this feature would be marvellous - in covering my tracks!

  • thanks Andrew Quinn,

    There is a use case that I captured on the system, when I logged in and I navigated to different sites, each site will update the last login date & time of my account.
    Therefore I'd like to know if the last login date & time by site is able to update using the API ?

  • Ha Nguyen Danh, I'm not seeing that in my tests.

    I have two browsers running:

    • Chrome (logged in as Me = Sys Admin)
    • Firefox (logging in as Normal User)

    Then, given the following test workflow:

    • [FF
    • [Chrome] I search for the user in Collaborate System Admin, User Administration module
      • Shows user Last Logged In:
        • 30 Nov 2022 19:21:53 (in ADST, GMT+11)
      • Use Get User API call to verify above, it too reports:
        •  "lastlogindate": "30 Nov 2022 08:21" (in UTC)
    • [FF] ...Wait > 1min, then click on one of the sites user has access to
    • [Chrome] Re-run searches..
      • No changes to reported login date/times
    • [FF] ...Wait > 1min, then click on another one of the sites user has access to

    • [Chrome] Re-run searches..
      • No changes to reported login date/times

     

    However, if I call the Get All Site Users API call, passing in the site(s) just visited by the user, then for that user, I get:

    • Called for 1st site: "lastlogin": "30 Nov 2022 08:26"
    • Called for 2nd site: "lastlogin": "30 Nov 2022 08:28"

    This is expected behaviour.

    Get All Site Users returns a collection of Site User objects, which is a superset of User objects in that there are additional attributes that are only applicable to a Site User, e.g. invited, lastlogin, and role. The other attributes are inherited from the subset User object, e.g. name, email, jobtitle.

    So whether you search for a user by using Get User, or by using Get All Site Users, you will get different values for "last logged in", as one is for the (instance) User, the other for the Site User.

    Andrew

    ]]>