insertRows() to core users

LabKey Support Forum (Inactive)
insertRows() to core users martin  2015-01-03 10:42
Status: Closed
 
hi,

i'm trying to create a new user with Python's insertRows() command but it seems that UserId column is read only and the operation fails.

i want to avoid using JavaScript API's createUser() method because i'm trying to do this externally and i don't know how to use JavaScript API externally (is it possible?)

is there a way to modify query in core schema or are they somehow locked?
thank you very much

Martin
 
 
jeckels responded:  2015-01-04 16:03
Hi Martin,

The users table supports updating existing users via updateRows(), but not creating new users with insertRows(). We don't have a Python binding for creating a new user. However, it would be fairly simple to implement it by patterning on the JavaScript or Java client API implementations. They post a JSON body with two properties: email (a string which is the new user's email address) and sendEmail (a boolean, which indicates if the user should get an email to set up their account).

Thanks,
Josh
 
martin responded:  2015-01-05 00:08
That's great news, thank you very much:)

Wwould it be possible to delete users the similar way via Python?
And what about groups creating/deleting, membership modifying, will all this be possible too?

Is there something to keep in mind when working with groups and membership?
I see there is Users and Groups query...also Members query...are any of those tables connected and get updated automatically or do I need to take care of all this table management manually?

I mean, if I implement Java API's function in Python by patterning is there something else to do to make it work correctly?

Thank you
Martin
 
jeckels responded:  2015-01-05 17:58
Hi Martin,

Yes, a similar approach in terms of adding a Python wrapper for the same underlying HTTP API will work for groups, memberships, etc. Each separate API call expects different arguments, but the pattern is the same.

Once a user is created, they'll automatically show up in the core.users query. The same goes for groups, etc.

If you create the new Python APIs, equivalent to the Java or JavaScript implementations, please consider attaching the code to this thread. We'd love to add more capabilities to the Python API, and could accept it as a code contribution if you're interested.

Thanks,
Josh