Reference Guide

Table Of Contents
</execution>
</executions>
</plugin>
</plugins>
</build>
...
Trying the REST API with Curl
The following information illustrates a method to try the REST API created previously in Creating
Domain Service Resource (REST Interface of Business Logic Service) on page 169 using Curl [17].
See Figure 6 for installation instructions. Build and install the application as described in Building
the Application on page 146 and Installing the Application on page 147.
Execute the following command CURL Authentication Command to authenticate (And get an
authentication token). Then use the authentication token in the CURL GET Command to execute a
GET on the REST API described in Table 9. Figure 54 shows an execution example using
15.255.126.49 as the SDN controller address. The response returned by SwitchResource can be
seen as the output of the CURL GET Command.
NOTE
Use the correct password if it was changed following instructions from
Authentication Configuration
on
page 7.
CURL Authentication Command:
$ curl --noproxy [SDN_CONTROLLER_ADDRESS] -X POST --fail -ksSfL \
--url "https://[SDN_CONTROLLER_ADDRESS]:8443/sdn/v2.0/auth" \
-H "Content-Type: application/json" \
--data-binary \
'{"login":{"user":"sdn","password":"skyline","domain":"sdn"}}'
CURL GET Command:
$ curl --noproxy [SDN_CONTROLLER_ADDRESS] \
--header "X-Auth-Token:[AUTHENTICATION_TOKEN]" \
--fail -ksS -L f \
--request GET \
--url "https://[SDN_CONTROLLER_ADDRESS]:8443/sdn/hm/v1.0/switches"
177