Add/Modify/Remove user details using API
search cancel

Add/Modify/Remove user details using API

book

Article ID: 375158

calendar_today

Updated On:

Products

VMware Smart Assurance

Issue/Introduction

How to Add/Modify/Remove user details using API.

Environment

Watch4Net/M&R 7.X

Resolution

NOTE: 

1). Before using below APIs check if APG-REST-API module is installed using the command: manage-modules.sh list installed|grep APG-REST-API

2). If APG-REST-API module is not installed, install the same using the command: manage-modules.sh install rest-api

 

  • Save user details:

    • API
      /admin/user
    • Parameters
      username : String
      password : String
      title : String
      firstName : String
      lastName : String
      emailAddress : String
      roles: Array
  •  
    • URL
      POST /admin/user
  •  
    • Request Body
      {
          "username":"username",
          "password":"password",
          "title":"tilte",
          "firstName":"firstname",
          "lastName":"lastname",
          "emailAddress":"emailaddress",
          "roles":[
          "Full Control Users",
          "Storage Administrator Users",
          "Network Administrator Users",
          "NOC Operator Users",
          "Datacenter Administrator Users",
          "Web Service Role"
          ]
      }
  •  
    • curl example:
      curl -v -k -u admin:changeme -X POST "https://<Frontend-Server>:58443/APG-REST/admin/user" -H "accept: application/json" -H "content-type: application/json" -d '{
          "username":"username",
          "password":"password",
          "title":"<Title should be one of Mr., Mrs., Miss., Dr.>",
          "firstName":"firstname",
          "lastName":"lastname",
          "emailAddress":"emailaddress",
          "roles":[
          "Full Control Users",
          "Storage Administrator Users",
          "Network Administrator Users",
          "NOC Operator Users",
          "Datacenter Administrator Users",
          "Web Service Role"
          ]
      }'

 

 

  • Update password and roles for user:

    • API
      /admin/user/{username}
    • Parameters
      username : String
      password : String
      roles : Array
  •  
    • URL
      PATCH /admin/user/{username}
  •  
    • Request Body
      {
          "password":"password",
          "roles":[
          "Full Control Users",
          "Storage Administrator Users",
          "Network Administrator Users",
          "NOC Operator Users",
          "Datacenter Administrator Users",
          "Web Service Role"
          ]
      }
  •  
    • curl example:
      curl -v -k -u admin:changeme -X PATCH "https://<Frontend-Server>:58443/APG-REST/admin/user/<username_to_be_updated>" -H "accept: application/json" -H "content-type: application/json" -d '{
          "password":"password",
          "roles":[
          "Full Control Users",
          "Storage Administrator Users",
          "Network Administrator Users",
          "NOC Operator Users",
          "Datacenter Administrator Users",
          "Web Service Role"
          ]
      }'

 

 

  • Delete user:

    • API
      /admin/user/{username}
    • Parameters
      username : String
  •  
    • URL
      DELETE /admin/user/{username}
  •  
    • curl example:
      curl -v -k -u admin:changeme -X DELETE "https://<Frontend-Server>:58443/APG-REST/admin/user/<username_to_be_deleted>"