how to create users through Galaxy API?

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

how to create users through Galaxy API?

xlwang
hello,
I want to create users through Galaxy API.For example, I can get users information through url like this(use postman):
But how to create a user?



___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
  http://lists.bx.psu.edu/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/
Reply | Threaded
Open this post in threaded view
|

Re: how to create users through Galaxy API?

Martin Čech
Hello,

to create a user through API you send a POST request to /api/users

More information about User API here:


Martin


On Fri, Dec 27, 2013 at 5:11 AM, xlwang <[hidden email]> wrote:
hello,
I want to create users through Galaxy API.For example, I can get users information through url like this(use postman):
But how to create a user?



___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
  http://lists.bx.psu.edu/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/


___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
  http://lists.bx.psu.edu/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/
Reply | Threaded
Open this post in threaded view
|

Re: how to create users through Galaxy API?

Martin Čech
Hi,

you specify username, password and email in the body (payload) of the POST as Key:Value pairs.

Code from the API method: ( https://galaxy-central.readthedocs.org/en/latest/_modules/galaxy/webapps/galaxy/api/users.html#UserAPIController.create )

username = payload[ 'username' ] email = payload[ 'email' ] password = payload[ 'password' ]

There are also other conditions that need to be fulfilled (e.g. user creation has to be turned on in the configuration) - you will find these when you look at the source code of the method (because the documentation is not perfect yet, sorry).

M.


On Sun, Dec 29, 2013 at 11:22 PM, xlwang <[hidden email]> wrote:
hi,
I still have some confusion.
post /api/users , when i use postman, it seems like this:


 No other parameters? How to confirm the new user's information?Such as user name, password.
Can you give me a example please?Thank you!

At 2013-12-30 06:04:15,"Martin Čech" <[hidden email]> wrote:
Hello,

to create a user through API you send a POST request to /api/users

More information about User API here:


Martin


On Fri, Dec 27, 2013 at 5:11 AM, xlwang <[hidden email]> wrote:
hello,
I want to create users through Galaxy API.For example, I can get users information through url like this(use postman):
But how to create a user?



___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
  http://lists.bx.psu.edu/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/





___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
  http://lists.bx.psu.edu/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/
Reply | Threaded
Open this post in threaded view
|

Re: how to create users through Galaxy API?

Peter Cock
Hi Martin,

I'd like to look into creating new users via the API (where we can control the email address and username format for integration with our cluster), and have the web-interface forbid users from self-registration.

The read-the-docs site you mentioned in this old email (below) doesn't exist anymore, and the API wiki page doesn't seem to link to something similar:


Where is the official API documentation now?

Thanks,

Peter

On Mon, Dec 30, 2013 at 4:34 AM, Martin Čech <[hidden email]> wrote:
Hi,

you specify username, password and email in the body (payload) of the POST as Key:Value pairs.

Code from the API method: ( https://galaxy-central.readthedocs.org/en/latest/_modules/galaxy/webapps/galaxy/api/users.html#UserAPIController.create )

username = payload[ 'username' ] email = payload[ 'email' ] password = payload[ 'password' ]

There are also other conditions that need to be fulfilled (e.g. user creation has to be turned on in the configuration) - you will find these when you look at the source code of the method (because the documentation is not perfect yet, sorry).

M.



___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
  https://lists.galaxyproject.org/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/
Reply | Threaded
Open this post in threaded view
|

Re: how to create users through Galaxy API?

Hans-Rudolf Hotz
Hi Peter

I guess it is here:

https://docs.galaxyproject.org/en/master/api_doc.html


Regards,  Hans-Rudolf

On 08/29/2016 05:27 PM, Peter Cock wrote:

> Hi Martin,
>
> I'd like to look into creating new users via the API (where we can
> control the email address and username format for integration with our
> cluster), and have the web-interface forbid users from self-registration.
>
> The read-the-docs site you mentioned in this old email (below) doesn't
> exist anymore, and the API wiki page doesn't seem to link to something
> similar:
>
> https://wiki.galaxyproject.org/Admin/API
>
> Where is the official API documentation now?
>
> Thanks,
>
> Peter
>
> On Mon, Dec 30, 2013 at 4:34 AM, Martin Čech <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Hi,
>
>     you specify username, password and email in the body (payload) of
>     the POST as Key:Value pairs.
>
>     Code from the API method: (
>     https://galaxy-central.readthedocs.org/en/latest/_modules/galaxy/webapps/galaxy/api/users.html#UserAPIController.create
>     <https://galaxy-central.readthedocs.org/en/latest/_modules/galaxy/webapps/galaxy/api/users.html#UserAPIController.create>
>     )
>
>     username=payload['username']email=payload['email']password=payload['password']
>
>     There are also other conditions that need to be fulfilled (e.g. user
>     creation has to be turned on in the configuration) - you will find
>     these when you look at the source code of the method (because the
>     documentation is not perfect yet, sorry).
>
>     M.
>
>
>
>
> ___________________________________________________________
> Please keep all replies on the list by using "reply all"
> in your mail client.  To manage your subscriptions to this
> and other Galaxy lists, please use the interface at:
>    https://lists.galaxyproject.org/
>
> To search Galaxy mailing lists use the unified search at:
>    http://galaxyproject.org/search/mailinglists/
>
___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
  https://lists.galaxyproject.org/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/
Reply | Threaded
Open this post in threaded view
|

Re: how to create users through Galaxy API?

Peter Cock
Thanks Hans-Rudolf,

Yes - you are right. The wiki does link there but it wasn't obvious to me.
Reading the UserAPIController link source code suggests as long as
I am authenticated as a Galaxy Admin, I could use this to create new
user accounts:

https://docs.galaxyproject.org/en/master/_modules/galaxy/webapps/galaxy/api/users.html#UserAPIController.create

Thank looks very promising...

Peter

On Mon, Aug 29, 2016 at 4:36 PM, Hans-Rudolf Hotz <[hidden email]> wrote:

> Hi Peter
>
> I guess it is here:
>
> https://docs.galaxyproject.org/en/master/api_doc.html
>
>
> Regards,  Hans-Rudolf
>
> On 08/29/2016 05:27 PM, Peter Cock wrote:
>>
>> Hi Martin,
>>
>> I'd like to look into creating new users via the API (where we can
>> control the email address and username format for integration with our
>> cluster), and have the web-interface forbid users from self-registration.
>>
>> The read-the-docs site you mentioned in this old email (below) doesn't
>> exist anymore, and the API wiki page doesn't seem to link to something
>> similar:
>>
>> https://wiki.galaxyproject.org/Admin/API
>>
>> Where is the official API documentation now?
>>
>> Thanks,
>>
>> Peter
>>
>> On Mon, Dec 30, 2013 at 4:34 AM, Martin Čech <[hidden email]
>> <mailto:[hidden email]>> wrote:
>>
>>     Hi,
>>
>>     you specify username, password and email in the body (payload) of
>>     the POST as Key:Value pairs.
>>
>>     Code from the API method: (
>>
>> https://galaxy-central.readthedocs.org/en/latest/_modules/galaxy/webapps/galaxy/api/users.html#UserAPIController.create
>>
>> <https://galaxy-central.readthedocs.org/en/latest/_modules/galaxy/webapps/galaxy/api/users.html#UserAPIController.create>
>>     )
>>
>>
>> username=payload['username']email=payload['email']password=payload['password']
>>
>>     There are also other conditions that need to be fulfilled (e.g. user
>>     creation has to be turned on in the configuration) - you will find
>>     these when you look at the source code of the method (because the
>>     documentation is not perfect yet, sorry).
>>
>>     M.
>>
>>
>>
>>
>> ___________________________________________________________
>> Please keep all replies on the list by using "reply all"
>> in your mail client.  To manage your subscriptions to this
>> and other Galaxy lists, please use the interface at:
>>    https://lists.galaxyproject.org/
>>
>> To search Galaxy mailing lists use the unified search at:
>>    http://galaxyproject.org/search/mailinglists/
>>
>
___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
  https://lists.galaxyproject.org/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/
Reply | Threaded
Open this post in threaded view
|

Re: how to create users through Galaxy API?

Nicola Soranzo-2
Hi Peter,
why not use BioBlend?

https://bioblend.readthedocs.io/en/latest/api_docs/galaxy/all.html#module-bioblend.galaxy.users

Cheers,
Nicola

---- Peter Cock ha scritto ----

>Thanks Hans-Rudolf,
>
>Yes - you are right. The wiki does link there but it wasn't obvious to me.
>Reading the UserAPIController link source code suggests as long as
>I am authenticated as a Galaxy Admin, I could use this to create new
>user accounts:
>
>https://docs.galaxyproject.org/en/master/_modules/galaxy/webapps/galaxy/api/users.html#UserAPIController.create
>
>Thank looks very promising...
>
>Peter
>
>On Mon, Aug 29, 2016 at 4:36 PM, Hans-Rudolf Hotz <[hidden email]> wrote:
>> Hi Peter
>>
>> I guess it is here:
>>
>> https://docs.galaxyproject.org/en/master/api_doc.html
>>
>>
>> Regards,  Hans-Rudolf
>>
>> On 08/29/2016 05:27 PM, Peter Cock wrote:
>>>
>>> Hi Martin,
>>>
>>> I'd like to look into creating new users via the API (where we can
>>> control the email address and username format for integration with our
>>> cluster), and have the web-interface forbid users from self-registration.
>>>
>>> The read-the-docs site you mentioned in this old email (below) doesn't
>>> exist anymore, and the API wiki page doesn't seem to link to something
>>> similar:
>>>
>>> https://wiki.galaxyproject.org/Admin/API
>>>
>>> Where is the official API documentation now?
>>>
>>> Thanks,
>>>
>>> Peter
>>>
>>> On Mon, Dec 30, 2013 at 4:34 AM, Martin Čech <[hidden email]
>>> <mailto:[hidden email]>> wrote:
>>>
>>>     Hi,
>>>
>>>     you specify username, password and email in the body (payload) of
>>>     the POST as Key:Value pairs.
>>>
>>>     Code from the API method: (
>>>
>>> https://galaxy-central.readthedocs.org/en/latest/_modules/galaxy/webapps/galaxy/api/users.html#UserAPIController.create
>>>
>>> <https://galaxy-central.readthedocs.org/en/latest/_modules/galaxy/webapps/galaxy/api/users.html#UserAPIController.create>
>>>     )
>>>
>>>
>>> username=payload['username']email=payload['email']password=payload['password']
>>>
>>>     There are also other conditions that need to be fulfilled (e.g. user
>>>     creation has to be turned on in the configuration) - you will find
>>>     these when you look at the source code of the method (because the
>>>     documentation is not perfect yet, sorry).
>>>
>>>     M.
>>>
>>>
>>>
>>>
>>> ___________________________________________________________
>>> Please keep all replies on the list by using "reply all"
>>> in your mail client.  To manage your subscriptions to this
>>> and other Galaxy lists, please use the interface at:
>>>    https://lists.galaxyproject.org/
>>>
>>> To search Galaxy mailing lists use the unified search at:
>>>    http://galaxyproject.org/search/mailinglists/
>>>
>>
>___________________________________________________________
>Please keep all replies on the list by using "reply all"
>in your mail client.  To manage your subscriptions to this
>and other Galaxy lists, please use the interface at:
>  https://lists.galaxyproject.org/
>
>To search Galaxy mailing lists use the unified search at:
>  http://galaxyproject.org/search/mailinglists/
___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
  https://lists.galaxyproject.org/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/
Reply | Threaded
Open this post in threaded view
|

Re: how to create users through Galaxy API?

Peter Briggs
Hello Peter

Following on from Nicola's suggestion: a while ago I had a go at writing
some command line tools using Bioblend to try and do some of my Galaxy
admin tasks via the API, including creating new user accounts so I'd
also recommend this route as much much easier than attempting to
interact with the API directly.

The tools I wrote are here if you'd like to look at some an example of
using Bioblend for this, to get you started:

https://github.com/pjbriggs/nebulizer/blob/master/nebulizer/users.py

As long as the user that the API key belongs to is an admin user (or if
you're using a master API key) this works fine.

HTH

Best wishes

Peter

On 29/08/16 17:37, Nicola Soranzo wrote:

> Hi Peter,
> why not use BioBlend?
>
> https://bioblend.readthedocs.io/en/latest/api_docs/galaxy/all.html#module-bioblend.galaxy.users
>
> Cheers,
> Nicola
>
> ---- Peter Cock ha scritto ----
>
>> Thanks Hans-Rudolf,
>>
>> Yes - you are right. The wiki does link there but it wasn't obvious to me.
>> Reading the UserAPIController link source code suggests as long as
>> I am authenticated as a Galaxy Admin, I could use this to create new
>> user accounts:
>>
>> https://docs.galaxyproject.org/en/master/_modules/galaxy/webapps/galaxy/api/users.html#UserAPIController.create
>>
>> Thank looks very promising...
>>
>> Peter
>>
>> On Mon, Aug 29, 2016 at 4:36 PM, Hans-Rudolf Hotz <[hidden email]> wrote:
>>> Hi Peter
>>>
>>> I guess it is here:
>>>
>>> https://docs.galaxyproject.org/en/master/api_doc.html
>>>
>>>
>>> Regards,  Hans-Rudolf
>>>
>>> On 08/29/2016 05:27 PM, Peter Cock wrote:
>>>>
>>>> Hi Martin,
>>>>
>>>> I'd like to look into creating new users via the API (where we can
>>>> control the email address and username format for integration with our
>>>> cluster), and have the web-interface forbid users from self-registration.
>>>>
>>>> The read-the-docs site you mentioned in this old email (below) doesn't
>>>> exist anymore, and the API wiki page doesn't seem to link to something
>>>> similar:
>>>>
>>>> https://wiki.galaxyproject.org/Admin/API
>>>>
>>>> Where is the official API documentation now?
>>>>
>>>> Thanks,
>>>>
>>>> Peter
>>>>
>>>> On Mon, Dec 30, 2013 at 4:34 AM, Martin Čech <[hidden email]
>>>> <mailto:[hidden email]>> wrote:
>>>>
>>>>     Hi,
>>>>
>>>>     you specify username, password and email in the body (payload) of
>>>>     the POST as Key:Value pairs.
>>>>
>>>>     Code from the API method: (
>>>>
>>>> https://galaxy-central.readthedocs.org/en/latest/_modules/galaxy/webapps/galaxy/api/users.html#UserAPIController.create
>>>>
>>>> <https://galaxy-central.readthedocs.org/en/latest/_modules/galaxy/webapps/galaxy/api/users.html#UserAPIController.create>
>>>>     )
>>>>
>>>>
>>>> username=payload['username']email=payload['email']password=payload['password']
>>>>
>>>>     There are also other conditions that need to be fulfilled (e.g. user
>>>>     creation has to be turned on in the configuration) - you will find
>>>>     these when you look at the source code of the method (because the
>>>>     documentation is not perfect yet, sorry).
>>>>
>>>>     M.
>>>>
>>>>
>>>>
>>>>
>>>> ___________________________________________________________
>>>> Please keep all replies on the list by using "reply all"
>>>> in your mail client.  To manage your subscriptions to this
>>>> and other Galaxy lists, please use the interface at:
>>>>    https://lists.galaxyproject.org/
>>>>
>>>> To search Galaxy mailing lists use the unified search at:
>>>>    http://galaxyproject.org/search/mailinglists/
>>>>
>>>
>> ___________________________________________________________
>> Please keep all replies on the list by using "reply all"
>> in your mail client.  To manage your subscriptions to this
>> and other Galaxy lists, please use the interface at:
>>  https://lists.galaxyproject.org/
>>
>> To search Galaxy mailing lists use the unified search at:
>>  http://galaxyproject.org/search/mailinglists/
> ___________________________________________________________
> Please keep all replies on the list by using "reply all"
> in your mail client.  To manage your subscriptions to this
> and other Galaxy lists, please use the interface at:
>   https://lists.galaxyproject.org/
>
> To search Galaxy mailing lists use the unified search at:
>   http://galaxyproject.org/search/mailinglists/
>

--
Peter Briggs [hidden email]
Bioinformatics Core Facility University of Manchester
B.1083 Michael Smith Bldg Tel: (0161) 2751482
___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
  https://lists.galaxyproject.org/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/
Reply | Threaded
Open this post in threaded view
|

Re: how to create users through Galaxy API?

Peter Cock
Thanks Nicola & Peter B.,

I was hoping we could script new-user creation like this, and
that someone else had already done this with the Galaxy API
(and Bioblend). This looks great!

Thank you both,

Peter C.

On Tue, Aug 30, 2016 at 10:43 AM, Peter Briggs
<[hidden email]> wrote:

> Hello Peter
>
> Following on from Nicola's suggestion: a while ago I had a go at writing
> some command line tools using Bioblend to try and do some of my Galaxy admin
> tasks via the API, including creating new user accounts so I'd also
> recommend this route as much much easier than attempting to interact with
> the API directly.
>
> The tools I wrote are here if you'd like to look at some an example of using
> Bioblend for this, to get you started:
>
> https://github.com/pjbriggs/nebulizer/blob/master/nebulizer/users.py
>
> As long as the user that the API key belongs to is an admin user (or if
> you're using a master API key) this works fine.
>
> HTH
>
> Best wishes
>
> Peter
>
>
> On 29/08/16 17:37, Nicola Soranzo wrote:
>>
>> Hi Peter,
>> why not use BioBlend?
>>
>>
>> https://bioblend.readthedocs.io/en/latest/api_docs/galaxy/all.html#module-bioblend.galaxy.users
>>
>> Cheers,
>> Nicola
>>
>> ---- Peter Cock ha scritto ----
>>
>>> Thanks Hans-Rudolf,
>>>
>>> Yes - you are right. The wiki does link there but it wasn't obvious to
>>> me.
>>> Reading the UserAPIController link source code suggests as long as
>>> I am authenticated as a Galaxy Admin, I could use this to create new
>>> user accounts:
>>>
>>>
>>> https://docs.galaxyproject.org/en/master/_modules/galaxy/webapps/galaxy/api/users.html#UserAPIController.create
>>>
>>> Thank looks very promising...
>>>
>>> Peter
>>>
>>> On Mon, Aug 29, 2016 at 4:36 PM, Hans-Rudolf Hotz <[hidden email]> wrote:
>>>>
>>>> Hi Peter
>>>>
>>>> I guess it is here:
>>>>
>>>> https://docs.galaxyproject.org/en/master/api_doc.html
>>>>
>>>>
>>>> Regards,  Hans-Rudolf
>>>>
>>>> On 08/29/2016 05:27 PM, Peter Cock wrote:
>>>>>
>>>>>
>>>>> Hi Martin,
>>>>>
>>>>> I'd like to look into creating new users via the API (where we can
>>>>> control the email address and username format for integration with our
>>>>> cluster), and have the web-interface forbid users from
>>>>> self-registration.
>>>>>
>>>>> The read-the-docs site you mentioned in this old email (below) doesn't
>>>>> exist anymore, and the API wiki page doesn't seem to link to something
>>>>> similar:
>>>>>
>>>>> https://wiki.galaxyproject.org/Admin/API
>>>>>
>>>>> Where is the official API documentation now?
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Peter
>>>>>
>>>>> On Mon, Dec 30, 2013 at 4:34 AM, Martin Čech <[hidden email]
>>>>> <mailto:[hidden email]>> wrote:
>>>>>
>>>>>     Hi,
>>>>>
>>>>>     you specify username, password and email in the body (payload) of
>>>>>     the POST as Key:Value pairs.
>>>>>
>>>>>     Code from the API method: (
>>>>>
>>>>>
>>>>> https://galaxy-central.readthedocs.org/en/latest/_modules/galaxy/webapps/galaxy/api/users.html#UserAPIController.create
>>>>>
>>>>>
>>>>> <https://galaxy-central.readthedocs.org/en/latest/_modules/galaxy/webapps/galaxy/api/users.html#UserAPIController.create>
>>>>>     )
>>>>>
>>>>>
>>>>>
>>>>> username=payload['username']email=payload['email']password=payload['password']
>>>>>
>>>>>     There are also other conditions that need to be fulfilled (e.g.
>>>>> user
>>>>>     creation has to be turned on in the configuration) - you will find
>>>>>     these when you look at the source code of the method (because the
>>>>>     documentation is not perfect yet, sorry).
>>>>>
>>>>>     M.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ___________________________________________________________
>>>>> Please keep all replies on the list by using "reply all"
>>>>> in your mail client.  To manage your subscriptions to this
>>>>> and other Galaxy lists, please use the interface at:
>>>>>    https://lists.galaxyproject.org/
>>>>>
>>>>> To search Galaxy mailing lists use the unified search at:
>>>>>    http://galaxyproject.org/search/mailinglists/
>>>>>
>>>>
>>> ___________________________________________________________
>>> Please keep all replies on the list by using "reply all"
>>> in your mail client.  To manage your subscriptions to this
>>> and other Galaxy lists, please use the interface at:
>>>  https://lists.galaxyproject.org/
>>>
>>> To search Galaxy mailing lists use the unified search at:
>>>  http://galaxyproject.org/search/mailinglists/
>>
>> ___________________________________________________________
>> Please keep all replies on the list by using "reply all"
>> in your mail client.  To manage your subscriptions to this
>> and other Galaxy lists, please use the interface at:
>>   https://lists.galaxyproject.org/
>>
>> To search Galaxy mailing lists use the unified search at:
>>   http://galaxyproject.org/search/mailinglists/
>>
>
> --
> Peter Briggs [hidden email]
> Bioinformatics Core Facility University of Manchester
> B.1083 Michael Smith Bldg Tel: (0161) 2751482
>
> ___________________________________________________________
> Please keep all replies on the list by using "reply all"
> in your mail client.  To manage your subscriptions to this
> and other Galaxy lists, please use the interface at:
>  https://lists.galaxyproject.org/
>
> To search Galaxy mailing lists use the unified search at:
>  http://galaxyproject.org/search/mailinglists/
___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
  https://lists.galaxyproject.org/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/
Reply | Threaded
Open this post in threaded view
|

Re: how to create users through Galaxy API?

Björn Grüning-3
Hi,

and here a script used by the Galaxy Docker project:

https://github.com/bgruening/docker-galaxy-stable/blob/master/galaxy/setup_postgresql.py

Cheers,
Bjoern

Am 30.08.2016 um 11:56 schrieb Peter Cock:

> Thanks Nicola & Peter B.,
>
> I was hoping we could script new-user creation like this, and
> that someone else had already done this with the Galaxy API
> (and Bioblend). This looks great!
>
> Thank you both,
>
> Peter C.
>
> On Tue, Aug 30, 2016 at 10:43 AM, Peter Briggs
> <[hidden email]> wrote:
>> Hello Peter
>>
>> Following on from Nicola's suggestion: a while ago I had a go at writing
>> some command line tools using Bioblend to try and do some of my Galaxy admin
>> tasks via the API, including creating new user accounts so I'd also
>> recommend this route as much much easier than attempting to interact with
>> the API directly.
>>
>> The tools I wrote are here if you'd like to look at some an example of using
>> Bioblend for this, to get you started:
>>
>> https://github.com/pjbriggs/nebulizer/blob/master/nebulizer/users.py
>>
>> As long as the user that the API key belongs to is an admin user (or if
>> you're using a master API key) this works fine.
>>
>> HTH
>>
>> Best wishes
>>
>> Peter
>>
>>
>> On 29/08/16 17:37, Nicola Soranzo wrote:
>>>
>>> Hi Peter,
>>> why not use BioBlend?
>>>
>>>
>>> https://bioblend.readthedocs.io/en/latest/api_docs/galaxy/all.html#module-bioblend.galaxy.users
>>>
>>> Cheers,
>>> Nicola
>>>
>>> ---- Peter Cock ha scritto ----
>>>
>>>> Thanks Hans-Rudolf,
>>>>
>>>> Yes - you are right. The wiki does link there but it wasn't obvious to
>>>> me.
>>>> Reading the UserAPIController link source code suggests as long as
>>>> I am authenticated as a Galaxy Admin, I could use this to create new
>>>> user accounts:
>>>>
>>>>
>>>> https://docs.galaxyproject.org/en/master/_modules/galaxy/webapps/galaxy/api/users.html#UserAPIController.create
>>>>
>>>> Thank looks very promising...
>>>>
>>>> Peter
>>>>
>>>> On Mon, Aug 29, 2016 at 4:36 PM, Hans-Rudolf Hotz <[hidden email]> wrote:
>>>>>
>>>>> Hi Peter
>>>>>
>>>>> I guess it is here:
>>>>>
>>>>> https://docs.galaxyproject.org/en/master/api_doc.html
>>>>>
>>>>>
>>>>> Regards,  Hans-Rudolf
>>>>>
>>>>> On 08/29/2016 05:27 PM, Peter Cock wrote:
>>>>>>
>>>>>>
>>>>>> Hi Martin,
>>>>>>
>>>>>> I'd like to look into creating new users via the API (where we can
>>>>>> control the email address and username format for integration with our
>>>>>> cluster), and have the web-interface forbid users from
>>>>>> self-registration.
>>>>>>
>>>>>> The read-the-docs site you mentioned in this old email (below) doesn't
>>>>>> exist anymore, and the API wiki page doesn't seem to link to something
>>>>>> similar:
>>>>>>
>>>>>> https://wiki.galaxyproject.org/Admin/API
>>>>>>
>>>>>> Where is the official API documentation now?
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Peter
>>>>>>
>>>>>> On Mon, Dec 30, 2013 at 4:34 AM, Martin Čech <[hidden email]
>>>>>> <mailto:[hidden email]>> wrote:
>>>>>>
>>>>>>     Hi,
>>>>>>
>>>>>>     you specify username, password and email in the body (payload) of
>>>>>>     the POST as Key:Value pairs.
>>>>>>
>>>>>>     Code from the API method: (
>>>>>>
>>>>>>
>>>>>> https://galaxy-central.readthedocs.org/en/latest/_modules/galaxy/webapps/galaxy/api/users.html#UserAPIController.create
>>>>>>
>>>>>>
>>>>>> <https://galaxy-central.readthedocs.org/en/latest/_modules/galaxy/webapps/galaxy/api/users.html#UserAPIController.create>
>>>>>>     )
>>>>>>
>>>>>>
>>>>>>
>>>>>> username=payload['username']email=payload['email']password=payload['password']
>>>>>>
>>>>>>     There are also other conditions that need to be fulfilled (e.g.
>>>>>> user
>>>>>>     creation has to be turned on in the configuration) - you will find
>>>>>>     these when you look at the source code of the method (because the
>>>>>>     documentation is not perfect yet, sorry).
>>>>>>
>>>>>>     M.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> ___________________________________________________________
>>>>>> Please keep all replies on the list by using "reply all"
>>>>>> in your mail client.  To manage your subscriptions to this
>>>>>> and other Galaxy lists, please use the interface at:
>>>>>>    https://lists.galaxyproject.org/
>>>>>>
>>>>>> To search Galaxy mailing lists use the unified search at:
>>>>>>    http://galaxyproject.org/search/mailinglists/
>>>>>>
>>>>>
>>>> ___________________________________________________________
>>>> Please keep all replies on the list by using "reply all"
>>>> in your mail client.  To manage your subscriptions to this
>>>> and other Galaxy lists, please use the interface at:
>>>>  https://lists.galaxyproject.org/
>>>>
>>>> To search Galaxy mailing lists use the unified search at:
>>>>  http://galaxyproject.org/search/mailinglists/
>>>
>>> ___________________________________________________________
>>> Please keep all replies on the list by using "reply all"
>>> in your mail client.  To manage your subscriptions to this
>>> and other Galaxy lists, please use the interface at:
>>>   https://lists.galaxyproject.org/
>>>
>>> To search Galaxy mailing lists use the unified search at:
>>>   http://galaxyproject.org/search/mailinglists/
>>>
>>
>> --
>> Peter Briggs [hidden email]
>> Bioinformatics Core Facility University of Manchester
>> B.1083 Michael Smith Bldg Tel: (0161) 2751482
>>
>> ___________________________________________________________
>> Please keep all replies on the list by using "reply all"
>> in your mail client.  To manage your subscriptions to this
>> and other Galaxy lists, please use the interface at:
>>  https://lists.galaxyproject.org/
>>
>> To search Galaxy mailing lists use the unified search at:
>>  http://galaxyproject.org/search/mailinglists/
> ___________________________________________________________
> Please keep all replies on the list by using "reply all"
> in your mail client.  To manage your subscriptions to this
> and other Galaxy lists, please use the interface at:
>   https://lists.galaxyproject.org/
>
> To search Galaxy mailing lists use the unified search at:
>   http://galaxyproject.org/search/mailinglists/
>
___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
  https://lists.galaxyproject.org/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/