Keboola WIKI‎ > ‎Old Articles‎ > ‎GoodData Writer‎ > ‎

GoodData User Management by Keboola GoodData Writer API

by tomas.trnka@keboola.com
---

Note that all bellow will only work when you work with users created within Keboola Domain in GoodData.
So for example - if you've invited other users directly to GoodData, you won't be able to manage them by Keboola GoodData Writer API.

1) How to list the current list of users

a) Open a terminal on Mac
b) Place this in there:

curl --include \
     --header "X-StorageApi-Token: your-token" \
 'https://syrup.keboola.com/gooddata-writer/users?writerId={your-gooddata-writer-id}' 

c) Result should look like this:

{"users":[{"email":"653-blahblah-55210cd598659@clients.keboola.com","uid":"4651c319b090501d5b9ffa258aac031b","main":true},{"email":"tomas.trnka@keboola.com","uid":"42aa65e482f6bf011758dd497c366650"}],"status":"ok","duration":383}

2) Create a user

Note 1: Please note that creating a user basically does "nothing" visible and you have to assign him a role and a project later
Note 2: User must not exist nowhere across the GoodData platform, otherwise its already in another domain

a) Open a terminal on Mac
b) Place this in there:

curl --include \--request POST \
--header "X-StorageApi-Token: your-token" \
--header "Accept: application/json" \
--data-binary '{ "writerId": "your-gooddata-writer-id","email": "tt@keboola.com","password": "complicated_password","firstName": "Tomas","lastName": "Test" }' \
'https://syrup.keboola.com/gooddata-writer/users'

c) After hitting enter, you will get a reply that its (probably) fine.
Also - you can check how did the job go in the job queue in your writer in Keboola Connection.

d) Just to make sure, you can run the "1)" API call to see whether it returns your newly created user.


3) Finale - Assign existing user to a project and assign him a role

a) Open a terminal on Mac
b) Place this in there:
curl --include \
     --request POST \
     --header "X-StorageApi-Token: your-token" \
     --header "Accept: application/json" \
     --data-binary '{ "writerId": "your-gooddata-writer-id", "pid": "your-gooddata-project-id", "email": "tt@keboola.com", "role": "editor" }' \
     'https://syrup.keboola.com/gooddata-writer/project-users'

(Possible roles: admin, editor, readOnly, dashboardOnly)

c) That should return something like this: 
{"id":104134990,"batch":104134990,"job":104134990,"url":"https:\/\/syrup.keboola.com\/gooddata-writer\/batch?writerId=blahblah\u0026batchId=104134990"}

d) You can double-check the created user by checking the users in the GoodData projects:
-- 
To be more detailed or connected with other wiki articles:

4) Creating a user filter in GoodData

 curl --include \
     --request POST \
     --header "X-StorageApi-Token: your-token" \
     --header "Accept: application/json" \
     --data-binary '{ 
    "writerId": "CCS", 
    "pid": "your-gooddata-project-id", 
    "name": "your-filter-name", 
    "attribute": "out.c-bucket_name.table_name.column_name",
    "operator":"IN", 
    "value": ["25548433","25186183","49433601"]
}' \
     'https://syrup.keboola.com/gooddata-writer/filters'
     
 5) Assigning the filter to a user
    
curl --include \
     --request POST \
     --header "X-StorageApi-Token: your-token" \
     --header "Accept: application/json" \
     --data-binary '{ 
    "writerId": "your-gooddata-writer-id", 
    "email": "tt@keboola.com",
    "filters": ["your-filter-name"]
}' \
     'https://syrup.keboola.com/gooddata-writer/filters-users'

6) Listing all project filters

curl --include \
     --header "X-StorageApi-Token: your-token" \
 'https://syrup.keboola.com/gooddata-writer/filters?writerId={your-gooddata-writer-id}'
 
7) Listing all assigned filters&users

 curl --include \
     --header "X-StorageApi-Token: your-token" \
 'https://syrup.keboola.com/gooddata-writer/filters-projects?writerId={your-gooddata-writer-id}'

You can check the filters and whether they are assigned at this beta app:
https://secure.gooddata.com/labs/apps/filters/index.html


have fun!
more info at:
http://docs.keboolagooddatawriter.apiary.io/
https://developer.gooddata.com/article/lets-get-started-with-data-permissions

Comments