So as mentioned in other posts I want to breakdown the building blocks of using curl to send HTTP requests so that we can consume network appliance APIs. In our case, we will be breaking down curl commands against ISE ERS APIs. See more about Curl: CURL, REST, & CRUD Tidbit
Ok so below we have two curl commands that we will use to consume to ISE APIs. The first one allows us to gather information on a specific endpoint group we have already created in ISE. The second one is similar, but focuses on consuming the networkdevice API using a different type of filter. Note that in order to understand proper syntax needed to consume ISE APIs you should reference the Software Development Kit (SDK).
curl -k --include --header 'Content-Type:application/json' --header 'Accept: application/json' --user <user/pass> --request GET https://<ise_pan_node>:9060/ers/config/endpointgroup?filter=name.EQ.Cifelli_Lab_EP_Group
curl -k --include --header 'Content-Type:application/json' --header 'Accept: pplication/json' --user <user/pass> --request GET https://<ise_pan_node>:9060/ers/config/networkdevice?filter=location.STARTSW.Cifelli
Curl commands breakdown:
-k = explicitly allows curl to perform insecure TLS connections and transfers. This is not best practice nor recommended. However, if you are in a test environment it is a quick and dirty way to obtain information you are seeking without the need to verify trusts, etc.
-i, --include = include HTTP response headers in the output. Response headers include items such as server name, date, HTTP version, cookies, etc.
-H, --header = extra header to include in the request when sending HTTP requests to remote server
-u, --user = specifies the username and password to use for server authentication. In our case/demo ISE accepts basic authentication for ISE ERS API consumption;
-X, --request = specifies the custom request method to use when communicating with remote server. See appliance SDKs for support/examples.
Cheers!