HP Insight Control Server Provisioning 7.2 Administrator Guide

True
If the request fails, you will be returned an error diagnostics. Common errors are HTTP error 404
not found, if the URL is not correct, or an exception if the associated user is not authorized to
enable/disable services access.
Below is an example Linux shell script using cURL that logs into the appliance, enables or disables
support access and logs out.
#!/bin/sh
# login
AUTH=`curl -k -X POST -H "accept:application/json" -H "content-type: application/json"
https://<appliance-hostname-or-address>/rest/login-sessions?action=logout
-d '{"userName":"<administrator-name>","password":"<administrator-password>"}' | perl -e 'while (<>)
{/{"sessionID":"(.*)"}/ && print $1;}'`
# This REST call either enables or disables support access to the appliance.
curl -i -k -H "accept:application/json" -H "content-type:application/json"
-H "accept-language:en-us"
-H "auth: ${AUTH}" -X PUT
https://<appliance-hostname-or-address>/rest/appliance/settings/enableServiceAccess
-d "<true/false>"
# logout
curl -k -i -X DELETE -H "auth:${AUTH}"
https://<appliance-hostname-or-address>/rest/login-sessions?action=logout
5.1.4 REST call to add a server via iLO
You can use REST calls to add a server via its iLO.
Programmatically, one will need to make three REST calls to the Insight Control server provisioning
appliance. The first call is used to obtain an authentication token or session ID, then using this
session ID, you make the REST call to perform the actual registration. Finally, the third call logs out
of the session.
See “REST call to create the user session and get the authentication token (page 34) for details
on making the first REST call to create the user session.
The second REST call is to add a server via iLO. In this REST call you will need to provide the
<user-authentication-token> you received from the login REST call, and you will need to
pass the IP address of the iLO as well as the iLO administrator user/password.
Finally, see “REST call to logout of the user session (page 35) for details on making the third REST
call to logout of the user session.
There are two REST calls that can be used to add a server via its iLO: one is used to add the server
and boot it into a maintenance mode, the other is used to add the server and not boot into a
maintenance mode. If optional request parameter addstyle is specified, the server will be added
without putting the server into a maintenance mode. If this parameter is not present, the server will
be booted into a maintenance mode.
REST call to add a server via iLO and server will boot into a maintenance mode:
A list of the components of the REST call is shown below:
DescriptionREST component
https://<appliance-hostname-or-address>/rest/os-deployment-ilos
where you supply <appliance-hostname-or-address>
URL:
POSTMessage Type:
accept: application/jsonHTTP Headers:
content-type: application/json
accept-language: en-us (optional)
auth: <user-authorization-token>
where you supply <user-authorization-token>
5.1 REST APIs to enable HP Support access or add a server via iLO 37