How to find the json config :
Python script:
import requests
def main():
base_url = "https://10.3.101.59:9440/PrismGateway/services/rest/v1/"
s = requests.Session()
s.auth = ('admin', 'admin')
s.headers.update({'Content-Type': 'application/json; charset=utf-8'})
data1 = {
"port": 9443,
"name": "testservice",
"userName": "support",
"ipAddress": "10.10.10.10"
}
s.post(base_url + 'service_centers' ,data=json.dumps(data1))
print s.get(base_url + 'service_centers/testservice', verify=False).json()
if __name__ == "__main__":
main()
Python script:
import requests
def main():
base_url = "https://10.3.101.59:9440/PrismGateway/services/rest/v1/"
s = requests.Session()
s.auth = ('admin', 'admin')
s.headers.update({'Content-Type': 'application/json; charset=utf-8'})
data1 = {
"port": 9443,
"name": "testservice",
"userName": "support",
"ipAddress": "10.10.10.10"
}
s.post(base_url + 'service_centers' ,data=json.dumps(data1))
print s.get(base_url + 'service_centers/testservice', verify=False).json()
if __name__ == "__main__":
main()
thank you for the blog visit us forSAN Solutions in Dubai
ReplyDelete