Updated on 2022-07-11 GMT+08:00

Run the curl Command to Access REST APIs

Description

Users can run the openssl version command to view the OpenSSL version of the system. If the version is earlier than OpenSSL 1.0.1, install the OpenSSL of a later version for the operating system so that TLSv1.1 and TLSv1.2 can be used to interact with the cluster system.

Operation example and procedure

  • Send the GET method to access the user list query interface and save jsessionid to the jessionid.txt file.

    curl -k -i --basic -u <user name>:<password> -c /tmp/jsessionid.txt 'https://x.x.x.x:28443/web/api/v2/permission/users?limit=10&offset=0&filter=&order=ASC&order_by=userName'

  • Use jsessionid to access the user group interface to add, modify, and delete user groups.
    • Send the POST method to add a user.

      curl -k -i -b /tmp/jsessionid.txt -X POST -HContent-type:application/json -d '{"userName":"user888","userType":"HM","password":"xxx","confirmPassword":"xxx","userGroups":["supergroup"],"userRoles":[],"primaryGroup":"supergroup","description":"Add user"}' 'https://x.x.x.x:28443/web/api/v2/permission/users'

    • Send the PUT method to modify the user information.

      curl -k -i -b /tmp/jsessionid.txt -X PUT -HContent-type:application/json -d '{"userName":"user888","userType":"HM","password":"","confirmPassword":"","userGroups":["supergroup","hadoopmanager"],"primaryGroup":"supergroup","userRoles":[],"description":"Modify user"}' 'https://x.x.x.x:28443/web/api/v2/permission/users/user888'

    • Send a DELETE method to delete a user.

      curl -k -i -b /tmp/jsessionid.txt -X DELETE -HContent-type:application/json -d '{"userNames":["user888"]}' 'https://x.x.x.x:28443/web/api/v2/permission/users