justsanjeev's Posts

HTTP Error 500: Server Error ERRROR 500 <?xml version="1.0" encoding="UTF-8"?> <Error xmlns="http://www.vmware.com/vcloud/v1.5" minorErrorCode="INTERNAL_SERVER_ERROR" message="Unable to perf... See more...
HTTP Error 500: Server Error ERRROR 500 <?xml version="1.0" encoding="UTF-8"?> <Error xmlns="http://www.vmware.com/vcloud/v1.5" minorErrorCode="INTERNAL_SERVER_ERROR" message="Unable to perform this action. Contact your cloud administrator." majorErrorCode="500" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://10.10.51.8/api/v1.5/schema/master.xsd"></Error>
i am doing it using python, however i am able to do it successfully using the firefox rest client. Is there any incorrect thing i have done in my python program ?
In the blow request, am i doing anything wrong, please help!! However my vapp is getting instantiated Through Rest Client.                 method  = "POST"                 url = self.Organiza... See more...
In the blow request, am i doing anything wrong, please help!! However my vapp is getting instantiated Through Rest Client.                 method  = "POST"                 url = self.OrganizationRefLink+'/action/instantiateVAppTemplate'                 print url                 print xmlTemplate                 handler = urllib2.HTTPSHandler()                 opener = urllib2.build_opener(handler)                 request = urllib2.Request(url)                 request.add_header("Accept",'application/*+xml;version=1.5')                 request.add_header("Content-Type",'application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml')                 print "Adding "+str(self.xVcloudAuthorization)                 request.add_header("x-vcloud-authorization",self.xVcloudAuthorization)                 hdl = open(xmlTemplate)                 data = hdl.read()                 print data                 print "--------------"+data+"----------"                 request.add_data(data)                 request.get_method = lambda: method                 try:                     connection = opener.open(request)                 except urllib2.HTTPError,e:                     connection = e Response: [xyz@localhost vcloud-vapp]$ python vCloudClient.py aVZYNCKtUG4hp1DFJDdYbAhb/xW7v3FyGH5k3pLhHYE= Returning the Ref Link : https://10.10.51.8/api/org/fb412f68-1278-40a1-bda7-48b2716ad4f7for Ref: Scenerio2 . Returning the Ref Link : https://10.10.51.8/api/vdc/f69a3b83-45d8-4863-8e7d-49e76e619043for Ref: Scenerio2 . https://10.10.51.8/api/vdc/f69a3b83-45d8-4863-8e7d-49e76e619043 Returning the Ref Link : https://10.10.51.8/api/catalog/d8f6f580-3d15-47e9-8ece-dde4232828a9for Ref: testCatalog . Returning the Ref Link : https://10.10.51.8/api/catalogItem/4651a27a-3559-442c-8905-3e75a315fed4for Ref: test_vAppTemplate . Returning the Ref Link : https://10.10.51.8/api/vAppTemplate/vappTemplate-645b13f5-b4af-45d1-829d-cb62f71286b9for Ref: test_vAppTemplate . Creating xml :vAppSanjeev_XML.xml from xml template :vAppTemplate.xml https://10.10.51.8/api/vdc/f69a3b83-45d8-4863-8e7d-49e76e619043/action/instantiateVAppTemplate vAppSanjeev_XML.xml Adding aVZYNCKtUG4hp1DFJDdYbAhb/xW7v3FyGH5k3pLhHYE= <?xml version="1.0" ?><InstantiateVAppTemplateParams deploy="false" name="vAppSanjeev" powerOn="false" xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"> <Description>Created with the Automation Script</Description> <Source href="https://10.10.51.8/api/vAppTemplate/vappTemplate-645b13f5-b4af-45d1-829d-cb62f71286b9"/> </InstantiateVAppTemplateParams> --------------<?xml version="1.0" ?><InstantiateVAppTemplateParams deploy="false" name="vAppSanjeev" powerOn="false" xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"> <Description>Created with the Automation Script</Description> <Source href="https://10.10.51.8/api/vAppTemplate/vappTemplate-645b13f5-b4af-45d1-829d-cb62f71286b9"/> </InstantiateVAppTemplateParams>---------- ERRROR 500 [xyz@localhost vcloud-vapp]$
Thanks for help but i am getting error even through curl
import requests import base64 session = requests.Session() session.verify = False credentials = str.encode("%s@%s:%s" % ('administrator','Scenerio2','nopasswd'), "UTF-8") encoded_credentia... See more...
import requests import base64 session = requests.Session() session.verify = False credentials = str.encode("%s@%s:%s" % ('administrator','Scenerio2','nopasswd'), "UTF-8") encoded_credentials = base64.b64encode(credentials) auth_header_value = "Basic %s" % encoded_credentials authorization_header = {"Authorization": auth_header_value} session.headers.update(authorization_header) url = "http://10.10.51.8/api/v1.5/login" response = session.post(url) print response if response.status_code == 200:         uth_token = response.headers["x-vcloud-authorization"]         session.headers.update({"x-vcloud-authorization": auth_token})         del session.headers["Authorization"] -------Its giving the error code 406,please help
could some one please help me on the issue below, i am using the vcloud director 5.5 [xxxxxx@localhost newVapp]$ python newVApp.py base_url:https://10.10.51.8/api/v1.0 Traceback (most recent... See more...
could some one please help me on the issue below, i am using the vcloud director 5.5 [xxxxxx@localhost newVapp]$ python newVApp.py base_url:https://10.10.51.8/api/v1.0 Traceback (most recent call last):   File "newVApp.py", line 37, in <module>     resp = urllib2.urlopen(base_url + '/login')   File "/usr/local/lib/python2.7/urllib2.py", line 126, in urlopen     return _opener.open(url, data, timeout)   File "/usr/local/lib/python2.7/urllib2.py", line 397, in open     response = meth(req, response)   File "/usr/local/lib/python2.7/urllib2.py", line 510, in http_response     'http', request, response, code, msg, hdrs)   File "/usr/local/lib/python2.7/urllib2.py", line 435, in error     return self._call_chain(*args)   File "/usr/local/lib/python2.7/urllib2.py", line 369, in _call_chain     result = func(*args)   File "/usr/local/lib/python2.7/urllib2.py", line 518, in http_error_default     raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) urllib2.HTTPError: HTTP Error 406: Not Acceptable
hi, i am new to vcd api, how can i start working with rest api. any sample code in python will help a lot.