This post is a wiki post.
All users can edit this post to improve its documentation.
When a project is shared with lots of users, the UI may slow down and/or become unresponsive.
The solution below can be used as a workaround to assign permissions to many users at once.
Requirements:
- A REST client (e.g.: Postman, Insomnia etc…).
- To be comfortable with advanced use of an API
First you need to retrieve your API token
With your browser, go to https://kf.kobotoolbox.org/token/ and copy the token you get.
(You can replace kf.kobotoolbox.org by your domain if needed)
You should see something like:
{
"token": "aa1111111aaaaaaaaaa11aa1a1aaaa"
}
Your token is aa1111111aaaaaaaaaa11aa1a1aaaa
In this example, we are using Insomnia as the RESt client.
Go to Download - Insomnia
Download “Insomnia Core” for your operating system.
When install the software and open it.
-
Create a new request
- Click the
+symbol - Create new request
- Change
GETtoPOST - Change
No BodytoJSON - Use the name you want
- Click create
- Click the
-
Click on
Authtab- Change the type by clicking on the arrow from
No authenticationtoBearer Token - In token field: enter the token you got at the beginning
- Prefix: Type
Token
- Change the type by clicking on the arrow from
-
Change API endpoint
- On the textbox on the top, enter the url of the API endpoint used for permissions:
https://kf.kobotoolbox.org/api/v2/assets/<asset_uid>/permission-assignments/bulk/
2.<asset_uid>is the unique string of the project.
- On the textbox on the top, enter the url of the API endpoint used for permissions:
-
Build the permissions for API requests
This part is a little tricky when you are not used to and it could look like more complicated than it is really.
Let’s assume this:
-
user1is allowed to seeuser2anduser3submissions -
user2can only add data -
user3can only add data -
user1,user2,user3are usernames1. OpenJSONtab and copy and paste this json below
[
{
"permission": "https://kf.kobotoolbox.org/api/v2/permissions/add_submissions/",
"user": "https://kf.kobotoolbox.org/api/v2/users/user2/"
},
{
"permission": "https://kf.kobotoolbox.org/api/v2/permissions/add_submissions/",
"user": "https://kf.kobotoolbox.org/api/v2/users/user3/"
},
{
"partial_permissions": [
{
"filters": [
{"_submitted_by": {"$in": ["user2", "user3"]}}
],
"url": "https://kf.kobotoolbox.org/api/v2/permissions/view_submissions/"
}
],
"permission": "https://kf.kobotoolbox.org/api/v2/permissions/partial_submissions/",
"user": "https://kf.kobotoolbox.org/api/v2/users/user1/"
}
]
2. Click Send.
I hope it helps

