set {} should be used. When building the URL, escape characters
should be encoded as appropriate.
Next, let’s explore the Cisco UCS Director REST API by
using curl to construct API calls. Programming guides
and complete documentation of the Cisco UCS REST API
can be found at the following link:
https://www.cisco.com/c/en/us/support/servers-
unified-computing/ucs-director/products-
programming-reference-guides-list.html. The Cisco
DevNet team makes available a reservable sandbox
called “UCS Management” for learning purposes. This
sandbox contains an installation of Cisco UCS Director
and is available at https://developer.cisco.com/sandbox.
Cisco UCS Director version 6.7 has been used in the
following interactions with the REST API. The operation
with the name userAPIGetMyLoginProfile is used to
retrieve the profile of the user with the specific access key
that is passed in the request in order to identify the
group to which the user belongs. The curl command for
this operation looks as shown in Example 9-12.
Example 9-12 curl Command to Retrieve the User
Profile in Cisco UCS Director
Click here to view code image
curl -k -L -X GET \
-g 'https://10.10.10.66/app/api/rest?
formatType=json&opName=userAPIGetMyLoginProfi
le&opData={}' \
-H 'X-Cloupia-Request-Key:
8187C34017C3479089C66678F32775FE'
For this request, the -g parameter disables the curl
check for nested braces {}, the -k or -insecure
parameter allows curl to proceed and operate even if the
server uses self-signed SSL certificates, and the -L
parameter allows curl to follow the redirects sent by the
server. The URL for the request follows the requirements
discussed previously, using the /app/api/rest endpoint