API Portal Automation : User management

webMethods API Portal tutorial

API Portal offers CLI interfaces to manage the users available in the system. CLI can be used to automatically create provision the users with in the system using a simple scripting tool.  As part of this tutorial we will explore some of the options.

Creating users

We have a CLI for creating a new user with usermanagement console of API Portal. The CLI(y-tenantmgmt.bat/sh) located in $$SoftwareAG\API_Portal\server\bin\work\work_apiportalbundle_m\tools\bin

C:\SoftwareAG\API_Portal\server\bin\work\work_apiportalbundle_m\tools\bin>y-tenantmgmt.bat createUser
The following option is required: -au, --affectedUser
Create user
Usage: createUser [options]
  Options:
    -ad, --affectedDescription
      Description of affected user
    -ae, --affectedEmail
      E-mail address of affected user
    -af, --affectedFirstName
      First name of affected user
    -al, --affectedLastName
      Last name of affected user
    -ap, --affectedPassword
      Password of affected user
  * -au, --affectedUser
      User name of affected user
    -p, --password
      Password of editor
      Default: superuser
    -u, --user
      User name of editor
      Default: superuser

For example if you wanted to create a user named John Lewis with password "Welcome@123" you can invoke the CLI as follows

y-tenantmgmt.bat createuser -af John -al Lewis -au John,Lewis -ap Welcome@123 -u system -p manager

Response

Connected to User Management at end point 'http://SAG-4DPGRC2.eur.ad.sag/umc' for tenant 'default'.
Creating user...
Creation of user is complete.

Association user to a group

Now if you wanted to assign this newly created user to API Provider group, you use y-tenantmgmt.bat assignuser command,

C:\SoftwareAG\API_Portal\server\bin\work\work_apiportalbundle_m\tools\bin>y-tenantmgmt.bat assignuser
The following options are required: -ag, --affectedGroup -au, --affectedUser
Associate user with user group
Usage: assignUser [options]
  Options:
  * -ag, --affectedGroup
      Name of affected user group
  * -au, --affectedUser
      User name of affected user
    -p, --password
      Password of editor
      Default: superuser
    -u, --user
      User name of editor
      Default: superuser

For example let us assign John,Lewis to API Provider group

y-tenantmgmt.bat assignuser -au John,Lewis -ag "API Provider" -u system -p manager

Response:

Connected to User Management at end point 'http://SAG-4DPGRC2.eur.ad.sag/umc' for tenant 'default'.
Associating user with user group...
Associating user with user group is complete.

Removing a user from a group

Now if you wanted to remove a user from a group, you use y-tenantmgmt.bat unassignuser command,

C:\SoftwareAG\API_Portal\server\bin\work\work_apiportalbundle_m\tools\bin>y-tenantmgmt.bat unassignUser
The following options are required: -ag, --affectedGroup -au, --affectedUser
Remove user from user group
Usage: unassignUser [options]
  Options:
  * -ag, --affectedGroup
      Name of affected user group
  * -au, --affectedUser
      User name of affected user
    -p, --password
      Password of editor
      Default: superuser
    -u, --user
      User name of editor
      Default: superuser

For example below command removes the user John,Lewis from API Provider group.

y-tenantmgmt.bat unassignUser -ag "API Provider" -au John,Lewis -p manager -u system

Deleting a user

You can use y-tenantmgmt.bat deleteUser to remove a user from user management system.

C:\SoftwareAG\API_Portal\server\bin\work\work_apiportalbundle_m\tools\bin>y-tenantmgmt.bat deleteUser
The following option is required: -au, --affectedUser
Delete user
Usage: deleteUser [options]
  Options:
  * -au, --affectedUser
      User name of affected user
    -p, --password
      Password of editor
      Default: superuser
    -u, --user
      User name of editor
      Default: superuser

For example below command remove the John,Lewis user provisioned as part of this tutorial.

y-tenantmgmt.bat deleteUser -au John,Lewis -u system -p manager

Changing password

As a priviled user you can use y-tenantmgmt.bat changepassword to reset password for another user.

C:\SoftwareAG\API_Portal\server\bin\work\work_apiportalbundle_m\tools\bin>y-tenantmgmt.bat changepassword
The following options are required: -ap, --affectedPassword -au, --affectedUser
Change password
Usage: changePassword [options]
  Options:
  * -ap, --affectedPassword
      Password of affected user
  * -au, --affectedUser
      User name of affected user
    -p, --password
      Password of editor
      Default: superuser
    -u, --user
      User name of editor
      Default: superuser
 
For example below command changes the password for user John,Lewis.
 
y-tenantmgmt.bat changepassword -ap P@$$w0rd -au John,Lewis -p manager -u system