The RESTful interface can be accessed by any HTTP client that supports UNIX domain sockets. The rad:local-http RAD service instance that is enabled by default facilitates communication with the HTTP clients.
The following example provides a quick look at the interaction with RAD by using REST.
Example 56 Interacting With RAD by Using RESTThis example assumes that you have installed the pkg:/library/python/pycurl developer package.
Create a new authentication session.
# curl -X POST -c cookie.txt -b cookie.txt \ --header 'Content-Type:application/json' --data '{"username":"username","password":"password","scheme":"pam","timeout":-1, "preserve":true}' \ localhost/api/com.oracle.solaris.rad.authentication/1.0/Session/ \ --unix-socket /system/volatile/rad/radsocket-http
Request a list of all the zones running on your system.
# curl -H 'Content-Type:application/json' -X GET \ localhost/api/com.oracle.solaris.rad.zonemgr/1.0/Zone?_rad_detail \ --unix-socket /system/volatile/rad/radsocket-http -b cookie.txt
If your system has zones, you will get a response similar to the following:
{ "status": "success", "payload": [ { "href": "api/com.oracle.solaris.rad.zonemgr/1.2/Zone/testzone1", "Zone": { "auxstate": [], "brand": "solaris", "id": 1, "uuid": "b54e20c1-3ecb-407f-ad26-befed9221860", "name": "testzone1", "state": "running" } }, { "href": "api/com.oracle.solaris.rad.zonemgr/1.2/Zone/testzone2", "Zone": { "auxstate": [], "brand": "solaris", "id": 2, "uuid": "358b43ba-32f9-4f27-9efa-de15ae4100a6", "name": "testzone2", "state": "running" } } ] }