
On 04/29/2014 07:59 PM, Keith Robertson wrote:
On 4/29/14, 1:26 PM, Juan Hernandez wrote:
On 04/29/2014 07:17 PM, Keith Robertson wrote:
Are the REST libraries[1,2] being updated to point to the new URL by default?
[1] http://www.ovirt.org/Python-sdk [2] http://www.ovirt.org/Java-sdk
Keith
No they aren't, as that would break backwards compatibility for users that connect to old engines that only support /api. However, the URL of the entry point of the API is a parameter to the API constructor, so users can (and should) specify the complete URL:
Python: api = API(url="https://whatever/ovirt-engine/api", ...)
Not sure about the Java API, but the Python API actually supports both forms. So it must be attempting to add the path element if not present.
You are right, in the Python SDK option b) used to work, and must be preserved for backwards compatibility. So newer versions of the Python SDK automatically append '/api' if no path is included in the URL.
a)
from ovirtsdk.api import API api = API(url='https://localhost/api', username='admin@internal', password='sec', ca_file='/etc/pki/ovirt-engine/ca.pem') ver = api.get_product_info().get_version() print '%s.%s.%s' % (ver.get_major(), ver.get_minor(), ver.get_revision()) 3.3.0
b)
from ovirtsdk.api import API api = API(url='https://localhost/', username='admin@internal', password='sec', ca_file='/etc/pki/ovirt-engine/ca.pem') ver = api.get_product_info().get_version() print '%s.%s.%s' % (ver.get_major(), ver.get_minor(), ver.get_revision()) 3.3.0
Java: api = new API("https://whatever/ovirt-engine/api", ...)
On 4/29/14, 11:05 AM, Vojtech Szocs wrote:
Hi guys,
just a quick note on UI plugin vs. REST API integration, there are currently two ways to work with REST API:
* (standard) /ovirt-engine/api * (legacy) /api
Please don't use the legacy URL, since "sessionId" that is acquired via RestApiSessionAcquired event handler [1] works only for the standard URL.
(Also, don't forget to include "Prefer:persistent-auth" header when making calls that shouldn't close the session.)
[1] http://www.ovirt.org/Features/UIPlugins#REST_API_integration
Regards, Vojtech _______________________________________________ Devel mailing list Devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/devel
_______________________________________________ Devel mailing list Devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/devel
_______________________________________________ Devel mailing list Devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/devel
-- Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, planta 3ºD, 28016 Madrid, Spain Inscrita en el Reg. Mercantil de Madrid – C.I.F. B82657941 - Red Hat S.L.