Additional REST API Resources
This chapter contains
the following sections:
Creating and Testing API Request Code using XML or Java
Before You Begin
To use this procedure, you must have the Enable Developer Menu option selected, and you must already have navigated to the
API Browser tab so that the list of tasks appears. Refer to the procedure for accessing the REST API Browser, which is provided earlier in this section.
featuring three tabs should appear, with the
Examples tab open, showing some API data corresponding to your task selection. The HTTP Method and URL information should appear.
task folder to display the API information, then double-click a row showing an API
resource and operation that interests you. If the operation and
resource support the creation of new API requests, the API
Examples tab will provide data entry boxes for the parameter
values that you will be able to use to construct a successful request. If no data entry box appears, then you cannot enter data to create a new API request using this procedure.
Examples tab shows API data corresponding to and
confirming your selection, and the HTTP Method and URL information appear, you can use the data provided.|
If a data entry box
Select..., click it to open data search-filters and use them to sort out and select the data you need to enter.
||As necessary, define a new
API request by providing the missing data (API request parameters) in theAPI Examples tab.
Refer to the
Details tab for useful information about
- You can click
XML to see a sample of the request.
Details tab to see the API resource and operation
name, and to see data formats and definitions for the request and the response data.
||To execute the
API with the REST API Browser, click the
Details tab, then click
Important: You can also
Java Code tabs to submit API examples and sample Java code.
|| To see Java code that is equivalent to your REST API request
code, open the
Java Code tab.
What to Do Next
Keep a copy of code used to submit a successful, useful API request, and use it in your application where appropriate.
Importing a Custom
||Encode the .wfdx
file of the custom task to an encoded script. For example, the
To encode the
.wfdx file, do the following:
- Open the
.wfdx file with a Text Editor or Notepad.
- Copy the
content of the .wfdx file and paste it to the
to be encoded or decoded text box in the
- From the
drop-down list, choose
XML is encoded to the required format to be passed through the RESTClient
RestClient add-on in the Mozilla FireFox browser.
Method drop-down list, choose
|| In the
URL field, enter the server URL.
The format of
the server URL is:
||Enter the REST
API Access key of the required server in the API request header.
procedure to get an API access key, see the
Generating an API Access Key.
encoded script in the
following tags to the beginning of the encoded script:
<importText> ---------- encoded text-------
following tags to the end of the encoded script:
Body (Raw) tabs to verify the response header and body.
The imported custom task
Cisco UCS Director. Log in to
Cisco UCS Director by hostname or IP address and choose
. Click the
Workflow Tasks tab. The imported custom task appears in the Custom
Workflow Tasks table, and is available for use in the workflow.