You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@guacamole.apache.org by ochamber <ol...@gmail.com> on 2019/01/04 08:49:15 UTC

Is there a way to get the list of guacamole users thru API?

Hi,

I'm wondering what would be the best way to get the list of guacamole users
from an external system? Is there any existing authenticated API? (The idea
is to have something similar with what is available for gitlab :
https://docs.gitlab.com/ee/api/)

Do you have any sample of API or guacamole extension I could use?

Thanks for your help & best regards. Olivier.



--
Sent from: http://apache-guacamole-general-user-mailing-list.2363388.n4.nabble.com/

Re: Is there a way to get the list of guacamole users thru API?

Posted by Nick Couchman <ni...@gmail.com>.
On Fri, Jan 4, 2019 at 10:21 AM Duarte Rocha <du...@gmail.com> wrote:

> There is already this:
>
> https://github.com/pschmitt/guacapy
>
>
Very cool, thank you!

-Nick

Re: Is there a way to get the list of guacamole users thru API?

Posted by Duarte Rocha <du...@gmail.com>.
There is already this:

https://github.com/pschmitt/guacapy



On Fri, Jan 4, 2019 at 2:54 PM Nick Couchman <vn...@apache.org> wrote:

>
>
> On Fri, Jan 4, 2019 at 9:51 AM Olivier Chamberaud <
> olivier.chamberaud@gmail.com> wrote:
>
>> Excellent! Many thanks for your help.
>>
>
> Forgot to include the link to the Python code, in case you're interested:
>
> https://github.com/necouchman/guacamole-python
>
> -Nick
>


-- 
Com os melhores cumprimentos

--

Duarte Rocha <du...@gmail.com>
_______________________________________
Programming today is a race between software
engineers striving to build bigger and better
idiot-proof programs, and the Universe trying to
produce bigger and better idiots.
So far, the Universe is winning.

Re: Is there a way to get the list of guacamole users thru API?

Posted by Olivier Chamberaud <ol...@gmail.com>.
Many thanks Nick.

I was able to do it with your Python app and created a php curl sample
available at https://github.com/ochamber/guacamole_users

BR. Olivier.

Le lun. 7 janv. 2019 à 12:13, Nick Couchman <vn...@apache.org> a écrit :

>
>
> On Mon, Jan 7, 2019 at 6:01 AM Olivier Chamberaud <
> olivier.chamberaud@gmail.com> wrote:
>
>> Hi,
>>
>> I was able to get information thru curl & php but the token has a time to
>> live of 60 minutes.
>>
>> Is there a way to login to Guacamole with username/password and get a
>> valid token?
>>   if yes, can you please provide a sample URL on the way to do it (I've
>> tried
>> https://baseURL/guacamole/api/tokens/get?username=username&password=password
>> without succes)
>> or better a way to set a token that never expires (until revocation)?
>>
>
> Please see:
>
>
> https://github.com/necouchman/guacamole-python/blob/9ac3f9ff7728d976d6107809700cbdd6f0c97fdd/guacamole-cli.py#L21-L32
>
> I do not believe you can do it with an HTTP GET request, but you can do it
> with the HTTP POST request as used in the above code.
>
> -Nick
>


-- 
Cordialement. Olivier Chamberaud

Re: Is there a way to get the list of guacamole users thru API?

Posted by Nick Couchman <vn...@apache.org>.
On Mon, Jan 7, 2019 at 6:01 AM Olivier Chamberaud <
olivier.chamberaud@gmail.com> wrote:

> Hi,
>
> I was able to get information thru curl & php but the token has a time to
> live of 60 minutes.
>
> Is there a way to login to Guacamole with username/password and get a
> valid token?
>   if yes, can you please provide a sample URL on the way to do it (I've
> tried
> https://baseURL/guacamole/api/tokens/get?username=username&password=password
> without succes)
> or better a way to set a token that never expires (until revocation)?
>

Please see:

https://github.com/necouchman/guacamole-python/blob/9ac3f9ff7728d976d6107809700cbdd6f0c97fdd/guacamole-cli.py#L21-L32

I do not believe you can do it with an HTTP GET request, but you can do it
with the HTTP POST request as used in the above code.

-Nick

Re: Is there a way to get the list of guacamole users thru API?

Posted by Olivier Chamberaud <ol...@gmail.com>.
Hi,

I was able to get information thru curl & php but the token has a time to
live of 60 minutes.

Is there a way to login to Guacamole with username/password and get a valid
token?
  if yes, can you please provide a sample URL on the way to do it (I've
tried
https://baseURL/guacamole/api/tokens/get?username=username&password=password
without succes)
or better a way to set a token that never expires (until revocation)?

Thanks again for your help. Regards. Olivier.

Le ven. 4 janv. 2019 à 15:54, Nick Couchman <vn...@apache.org> a écrit :

>
>
> On Fri, Jan 4, 2019 at 9:51 AM Olivier Chamberaud <
> olivier.chamberaud@gmail.com> wrote:
>
>> Excellent! Many thanks for your help.
>>
>
> Forgot to include the link to the Python code, in case you're interested:
>
> https://github.com/necouchman/guacamole-python
>
> -Nick
>


-- 
Cordialement. Olivier Chamberaud

Re: Is there a way to get the list of guacamole users thru API?

Posted by Nick Couchman <vn...@apache.org>.
On Fri, Jan 4, 2019 at 9:51 AM Olivier Chamberaud <
olivier.chamberaud@gmail.com> wrote:

> Excellent! Many thanks for your help.
>

Forgot to include the link to the Python code, in case you're interested:

https://github.com/necouchman/guacamole-python

-Nick

Re: Is there a way to get the list of guacamole users thru API?

Posted by Olivier Chamberaud <ol...@gmail.com>.
Excellent! Many thanks for your help.

Le ven. 4 janv. 2019 à 15:02, Nick Couchman <vn...@apache.org> a écrit :

> On Fri, Jan 4, 2019 at 3:49 AM ochamber <ol...@gmail.com>
> wrote:
>
>> Hi,
>>
>> I'm wondering what would be the best way to get the list of guacamole
>> users
>> from an external system? Is there any existing authenticated API? (The
>> idea
>> is to have something similar with what is available for gitlab :
>> https://docs.gitlab.com/ee/api/)
>>
>>
> Yes, just about everything that is part of the Guacamole Client operates
> via an API.  My best suggestion for seeing these calls would be to use the
> Developer Console in a web browser (e.g. Chrome Developer Console) to view
> the network calls while going through the web interface and you'll be able
> to pick out the API calls and see the various responses.  For retrieving
> the current users, you should see calls to the following endpoint:
>
> http://hostname:8080/guacamole/api/session/data/<DATASOURCE>/users?token=<LOGIN
> TOKEN>
>
> Where <DATASOURCE> is the name of the location where the users are stored
> (e.g. postgresql, ldap, etc.) and <LOGIN TOKEN> is the login token you
> received from logging into the Guacamole interface.  I also wrote some
> sample Python code that leverages the API - you can take a look at that and
> see an example of programmatically logging into the interface and getting a
> token, and then gathering data from various endpoints.  I don't think I did
> anything with users, but it should be pretty easy to see how it works.
>
> -Nick
>


-- 
Cordialement. Olivier Chamberaud

Re: Is there a way to get the list of guacamole users thru API?

Posted by Nick Couchman <vn...@apache.org>.
On Fri, Jan 4, 2019 at 3:49 AM ochamber <ol...@gmail.com>
wrote:

> Hi,
>
> I'm wondering what would be the best way to get the list of guacamole users
> from an external system? Is there any existing authenticated API? (The idea
> is to have something similar with what is available for gitlab :
> https://docs.gitlab.com/ee/api/)
>
>
Yes, just about everything that is part of the Guacamole Client operates
via an API.  My best suggestion for seeing these calls would be to use the
Developer Console in a web browser (e.g. Chrome Developer Console) to view
the network calls while going through the web interface and you'll be able
to pick out the API calls and see the various responses.  For retrieving
the current users, you should see calls to the following endpoint:

http://hostname:8080/guacamole/api/session/data/<DATASOURCE>/users?token=<LOGIN
TOKEN>

Where <DATASOURCE> is the name of the location where the users are stored
(e.g. postgresql, ldap, etc.) and <LOGIN TOKEN> is the login token you
received from logging into the Guacamole interface.  I also wrote some
sample Python code that leverages the API - you can take a look at that and
see an example of programmatically logging into the interface and getting a
token, and then gathering data from various endpoints.  I don't think I did
anything with users, but it should be pretty easy to see how it works.

-Nick