Skip Navigation Links | |
Exit Print View | |
![]() |
Oracle® ZFS Storage Appliance RESTful Application Programming Interface |
Example Python code to create a new resource:
>>> action = {'category': 'network'} >>> post_data = json.dumps(action) >>> request = urllib2.Request("https://zfssa:215/api/alert/v1/actions", post_data) >>> request.add_header('Content-Type', 'application/json') >>> response = opener.open(request) >>> response.getcode() 201 >>> response.info().getheader('Location') '/api/alert/v1/actions/actions-001' >>> body = json.loads(response.read()) >>> print json.dumps(body, sort_keys=True, indent=4) { "actions": { "category": "network", "datalink_failed": true, "datalink_ok": true, "href": "/api/alert/v1/actions/actions-001", "ip_address_conflict": true, "ip_address_conflict_resolved": true, "ip_interface_degraded": true, "ip_interface_failed": true, "ip_interface_ok": true, "network_port_down": true, "network_port_up": true } }