
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

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 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

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", ...) 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
-- 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.

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. 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

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.

Am 29.04.2014 17:05, schrieb Vojtech Szocs:
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.
I really thing you named this thread the wrong way as you can utilize rest api from way more things than just UI plugins. This is relevant to any third party webservice which wants or needs to interact with the api. :) -- Mit freundlichen Grüßen / Regards Sven Kieske Systemadministrator Mittwald CM Service GmbH & Co. KG Königsberger Straße 6 32339 Espelkamp T: +49-5772-293-100 F: +49-5772-293-333 https://www.mittwald.de Geschäftsführer: Robert Meyer St.Nr.: 331/5721/1033, USt-IdNr.: DE814773217, HRA 6640, AG Bad Oeynhausen Komplementärin: Robert Meyer Verwaltungs GmbH, HRB 13260, AG Bad Oeynhausen

On 04/30/2014 11:17 AM, Sven Kieske wrote:
Am 29.04.2014 17:05, schrieb Vojtech Szocs:
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.
I really thing you named this thread the wrong way as you can utilize rest api from way more things than just UI plugins.
This is relevant to any third party webservice which wants or needs to interact with the api. :)
Actually Vojtech is correct, as this is a problem only for UI plugins, because they share the session created by webadmin. Webadmin creates the session using /ovirt-engine/api, so it won't work if UI plugins try to use it with /api. For any other clients using the RESTAPI this isn't a problem, both /api and /ovirt-engine/api work correctly. Anyhow, it is good if you update your clients to use /ovirt-engine/api instead of /api, as /api may be deprecated in the future. But at the moment /api is 100% supported, except for UI plugins. -- 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.

Thanks for the clarification! Am 30.04.2014 12:05, schrieb Juan Hernandez:
Actually Vojtech is correct, as this is a problem only for UI plugins, because they share the session created by webadmin. Webadmin creates the session using /ovirt-engine/api, so it won't work if UI plugins try to use it with /api.
For any other clients using the RESTAPI this isn't a problem, both /api and /ovirt-engine/api work correctly.
Anyhow, it is good if you update your clients to use /ovirt-engine/api instead of /api, as /api may be deprecated in the future. But at the moment /api is 100% supported, except for UI plugins.
-- Mit freundlichen Grüßen / Regards Sven Kieske Systemadministrator Mittwald CM Service GmbH & Co. KG Königsberger Straße 6 32339 Espelkamp T: +49-5772-293-100 F: +49-5772-293-333 https://www.mittwald.de Geschäftsführer: Robert Meyer St.Nr.: 331/5721/1033, USt-IdNr.: DE814773217, HRA 6640, AG Bad Oeynhausen Komplementärin: Robert Meyer Verwaltungs GmbH, HRB 13260, AG Bad Oeynhausen
participants (4)
-
Juan Hernandez
-
Keith Robertson
-
Sven Kieske
-
Vojtech Szocs