Forum Discussion

Adam_sims's avatar
4 years ago

Additional User Properties for API Calls

I'm looking for a way to manage our user groups via the API. At the moment, I don't see a way to move a user between groups, add groups, or delete groups. This would especially come in handy in combination with the SSO login option. Most of our roles are automatically assigned when a user logs in. However, they will always land in the Ungrouped folder. If the User object returned the group the user belonged to, we could use the patch method to move the user to the group that matches their role. In another instance, we use a python script implemented as a config source that suspends users if they haven't logged in in 90 days. I have a "suspended" users group that I currently manually move those users to. We could implement the move automatically in the script if that piece of information was returned by the API. 

 

Returned user model: 

{
  "acceptEULA": true,
  "acceptEULAOn": 0,
  "apiTokens": [
    {
      "accessId": "string",
      "accessKey": "string",
      "adminId": 0,
      "adminName": "string",
      "createdBy": "string",
      "createdOn": 0,
      "id": 0,
      "lastUsedOn": 0,
      "note": "John Doe's API Token",
      "roles": [
        "string"
      ],
      "status": 2
    }
  ],
  "apionly": false,
  "contactMethod": "email",
  "createdBy": "Chief Admin",
  "email": "john.doe@logicmonitor.com",
  "firstName": "John",
  "forcePasswordChange": true,
  "id": 0,
  "lastAction": "string",
  "lastActionOn": 0,
  "lastActionOnLocal": "string",
  "lastLoginOn": 0,
  "lastName": "Doe",
  "note": "John Doe is an Admin on this Portal",
  "password": "JohnDoe1",
  "phone": "8054445555",
  "roles": [
    {
      "acctRequireTwoFA": true,
      "associatedUserCount": 0,
      "customHelpLabel": "Internal Support Resources",
      "customHelpURL": "https://logicmonitor.com/support",
      "description": "Administrator can do everything, including security-sensitive actions",
      "enableRemoteSessionInCompanyLevel": true,
      "id": 0,
      "name": "administrator",
      "privileges": [
        {
          "objectId": "123",
          "objectName": "string",
          "objectType": "dashboard group",
          "operation": "write",
          "subOperation": "string"
        }
      ],
      "requireEULA": true,
      "twoFARequired": true
    }
  ],
  "smsEmail": "8054445555@logicmonitor.com",
  "smsEmailFormat": "sms",
  "status": "active",
  "timezone": "America/Los Angeles",
  "trainingEmail": "string",
  "twoFAEnabled": false,
  "username": "John",
  "viewPermission": "{\n\n\"Hosts\" : true,\n\"Services\" : true,\n\"Reports\" : true,\n\"Dashboards\" : true,\n\"Alerts\" : true,\n\"Settings\" : true\n}"
}

2 Replies

  • Yeah @Stuart Weenig is right.
    We had this type of need in the past (doing some sort of user management) when automating some processes at our company.

    Unfortunately I no longer have the script ?
    But, this was accomplished on Python & exploring the API v3. What allowed me discover the calls I needed was performing the operation on the browser & then analyzing the calls/etc... with the dev. tools (F12 on Chrome for example).

  • Anonymous's avatar
    Anonymous

    User group management doesn't exist in v2 of the API. You can try v3 of the API, which is completely undocumented, unpublished, and unsupported (but pretty easy to reverse engineer using developer tools in your browser).