Using REST API to get a proxyticket

Hi all, I'm attempting to use the REST API to get a proxy ticket as BZ1181030 [0] has added support for, but I am unable to find _any_ documentation on how to use this new API call. All I've found is the git commit message in gerrit [1]. Not quite understanding how to interpret this, I've attempted to POST the following: <action/> As well as: <action> <proxy_ticket> <value>ticket_content</value> </proxy_ticket> </action> Both of these, and indeed using any other data I can think of, results in an NPE being logged in engine.log. I've uploaded my engine.log [2] which is produced when I POST "<action/>" to the endpoint. Is anyone able to tell me how to use this endpoint? I'm assuming I get the NPE because I'm not POSTing the correct data. The overall goal of this is to be able to embed a NoVNC console in our own web UI, this is the last piece of the puzzle for me to implement this. Thanks, Ollie [0] https://bugzilla.redhat.com/show_bug.cgi?id=1181030 [1] https://gerrit.ovirt.org/#/c/42412/ [2] http://ix.io/uVP

Hi Ollie, I was able to get the proxy ticket with curl like this: # curl -k -X POST \ -H "Authorization: Basic YWRLKDFLKnfLfdNLDKDFnsldssL2" \ -H "Accept: application/xml" \ -H "Content-Type: application/xml" \ -d "<action><proxy_ticket><value>ticket_content</value></proxy_ticket></action>" \ -L https:// {engine}:443/ovirt-engine/api/vms/{vm:id}/graphicsconsoles/{graphicsconsole:id}/proxyticket Hope this helps. Cheers, Gonza.- On Thu, Mar 24, 2016 at 4:44 PM, Ollie Armstrong <ollie@fubra.com> wrote:
Hi all,
I'm attempting to use the REST API to get a proxy ticket as BZ1181030 [0] has added support for, but I am unable to find _any_ documentation on how to use this new API call.
All I've found is the git commit message in gerrit [1]. Not quite understanding how to interpret this, I've attempted to POST the following:
<action/>
As well as:
<action> <proxy_ticket> <value>ticket_content</value> </proxy_ticket> </action>
Both of these, and indeed using any other data I can think of, results in an NPE being logged in engine.log. I've uploaded my engine.log [2] which is produced when I POST "<action/>" to the endpoint.
Is anyone able to tell me how to use this endpoint? I'm assuming I get the NPE because I'm not POSTing the correct data. The overall goal of this is to be able to embed a NoVNC console in our own web UI, this is the last piece of the puzzle for me to implement this.
Thanks, Ollie
[0] https://bugzilla.redhat.com/show_bug.cgi?id=1181030 [1] https://gerrit.ovirt.org/#/c/42412/ [2] http://ix.io/uVP _______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users

Thanks for the reply Gonza. When you've quoted what you've used, what should I use for "ticket_content" in this case? Is that the literal string there? On 24 March 2016 at 17:52, Gonzalo Rafuls <gonza@redhat.com> wrote:
I was able to get the proxy ticket with curl like this:
# curl -k -X POST \ -H "Authorization: Basic YWRLKDFLKnfLfdNLDKDFnsldssL2" \ -H "Accept: application/xml" \ -H "Content-Type: application/xml" \ -d "<action><proxy_ticket><value>ticket_content</value></proxy_ticket></action>" \ -L https://{engine}:443/ovirt-engine/api/vms/{vm:id}/graphicsconsoles/{graphicsconsole:id}/proxyticket

On Thu, Mar 24, 2016 at 6:59 PM, Ollie Armstrong <ollie@fubra.com> wrote:
Thanks for the reply Gonza. When you've quoted what you've used, what should I use for "ticket_content" in this case? Is that the literal string there?
Apparently you can get it as well with something like "<action><proxy_ticket></proxy_ticket></action>". Only thing to change then is between curly brackets {}.
On 24 March 2016 at 17:52, Gonzalo Rafuls <gonza@redhat.com> wrote:
I was able to get the proxy ticket with curl like this:
# curl -k -X POST \ -H "Authorization: Basic YWRLKDFLKnfLfdNLDKDFnsldssL2" \ -H "Accept: application/xml" \ -H "Content-Type: application/xml" \ -d
"<action><proxy_ticket><value>ticket_content</value></proxy_ticket></action>"
\ -L https:// {engine}:443/ovirt-engine/api/vms/{vm:id}/graphicsconsoles/{graphicsconsole:id}/proxyticket

Thanks. Unfortunately that still gives me the same NPE in the engine.log that I uploaded in my first email. I think I'll report this on BZ as it isn't working for me when it works for you. On 24 March 2016 at 18:11, Gonzalo Rafuls <gonza@redhat.com> wrote:
Apparently you can get it as well with something like "<action><proxy_ticket></proxy_ticket></action>".
Only thing to change then is between curly brackets {}.

On 03/24/2016 07:17 PM, Ollie Armstrong wrote:
Thanks.
Unfortunately that still gives me the same NPE in the engine.log that I uploaded in my first email. I think I'll report this on BZ as it isn't working for me when it works for you.
This is the effect of the following bug: sign websocket proxy ticket via RESTapi when VM have VNC graphics protocol https://bugzilla.redhat.com/1305837 It should be fixed in version 3.6.5 of the engine. To clarify how to use the action, you don't have to send anything, just "<action/>", and it will return you the ticket. For example, using curl: ---8<--- #!/bin/sh -ex url="https://engine.example.com/ovirt-engine/api" user="admin@internal" password="..." vmid="..." consoleid="..." curl \ --verbose \ --cacert /etc/pki/ovirt-engine/ca.pem \ --request POST \ --user "${user}:${password}" \ --header "Content-Type: application/xml" \ --header "Accept: application/xml" \ --data ' <action/> ' \ "${url}/vms/${vmid}/graphicsconsoles/${consoleid}/proxyticket" --->8--- This will return a response like this: <action> <proxy_ticket> <value>ey..A1==</value> </proxy_ticket> </action> That long "value" is the Base64 encoded ticket.
On 24 March 2016 at 18:11, Gonzalo Rafuls <gonza@redhat.com> wrote:
Apparently you can get it as well with something like "<action><proxy_ticket></proxy_ticket></action>".
Only thing to change then is between curly brackets {}.
-- 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.

Ah brilliant! I never thought to try using SPICE instead. Thanks, Juan. On 25 March 2016 at 09:11, Juan Hernández <jhernand@redhat.com> wrote:
On 03/24/2016 07:17 PM, Ollie Armstrong wrote:
Thanks.
Unfortunately that still gives me the same NPE in the engine.log that I uploaded in my first email. I think I'll report this on BZ as it isn't working for me when it works for you.
This is the effect of the following bug:
sign websocket proxy ticket via RESTapi when VM have VNC graphics protocol https://bugzilla.redhat.com/1305837
It should be fixed in version 3.6.5 of the engine.
To clarify how to use the action, you don't have to send anything, just "<action/>", and it will return you the ticket. For example, using curl:
---8<--- #!/bin/sh -ex
url="https://engine.example.com/ovirt-engine/api" user="admin@internal" password="..." vmid="..." consoleid="..."
curl \ --verbose \ --cacert /etc/pki/ovirt-engine/ca.pem \ --request POST \ --user "${user}:${password}" \ --header "Content-Type: application/xml" \ --header "Accept: application/xml" \ --data ' <action/> ' \ "${url}/vms/${vmid}/graphicsconsoles/${consoleid}/proxyticket" --->8---
This will return a response like this:
<action> <proxy_ticket> <value>ey..A1==</value> </proxy_ticket> </action>
That long "value" is the Base64 encoded ticket.
On 24 March 2016 at 18:11, Gonzalo Rafuls <gonza@redhat.com> wrote:
Apparently you can get it as well with something like "<action><proxy_ticket></proxy_ticket></action>".
Only thing to change then is between curly brackets {}.
-- 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.
-- Ollie Armstrong Web Developer / Sysadmin ollie@fubra.com fubra.com Fubra is a company limited by shares and registered in England and Wales with number 3967214 at Manor Coach House, Church Hill, Aldershot, Hampshire, GU12 4RQ. We are registered for VAT with number GB733667024, and as a data controller with number Z5193400. We are members of RIPE, Nominet, the Italian RA and registered with OfCom as a provider of electronic communications services. *Calls to this number will cost 5p per minute plus your network access charge
participants (3)
-
Gonzalo Rafuls
-
Juan Hernández
-
Ollie Armstrong