I am interested in applying a user data filter to ...
# gooddata-cloud
g
I am interested in applying a user data filter to one of our workspaces as a test to see if the resulting data filtering will work for the client. I have created the json file but I would like help in verifying it is correct/complete and I would also like help in adding it to the workspace if anyone can assist it is much appreciated.
j
Hi Greg, You can simply try to POST your already created JSON to the below API endpoint
Copy code
$HOST_URL/api/v1/entities/workspaces/<workspace-id>/userDataFilters
Or PUT via layout API:
Copy code
$HOST_URL/api/v1/layout/workspaces/<workspace-id>/userDataFilters
The body should look like this:
Copy code
{
  "data": {
    "type": "userDataFilter",
    "id": "country",
    "attributes": {
      "maql": "{label/CUSTOMER_COUNTRY} = \"Canada\"",
      "title": "tenant filtered to Canada Only"
    },
    "relationships": {
      "user": {
        "data": {
          "id": "john.doe_tenant",
          "type": "user"
        }
      }
    }
  }
}
In case the body is incorrect, you should receive an error quote
Have you encountered any issue while trying that?
g
yes, I just got this error - { "detail": "[Path '/data/relationships/user/data/type'] Instance value ('userGroup') not found in enum (possible values: 'user')", "status": 400, "title": "Bad Request", "traceId": "d943895637ffa08f37a6d469b55f7817" }
j
pls DM me with your whole JSON body
@Greg Lindstrom just for the record here, solved via DM
g
yes!
d
@Julius Kos I got the same error
m
Hi Doug, could you please share with us the traceId?
d
I figured it out. Its not clear in the documentations that Users -> UsersGroup for both Relation Key and type Value. I had it as just type Value
So for anyone else running into this - this is likely the error
m
Thank you for this feedback!