Experiencing an issue while creating a child works...
# gooddata-cloud
m
Experiencing an issue while creating a child workspace 🧵
1
I have a parent workspace with ID X, that I want to create a child space for. From the docs here, I try to create a workspace by sending the following request
Copy code
{
  "data": {
    "id": "<child-workspace-id>",
    "type": "workspace",
    "attributes": {
      "description": "y",
      "name": "z"
    },
    "relationships": {
      "parent": {
        "data": {
          "id": "X",
          "type": "workspace"
        }
      }
    }
  }
}
The workspace is successfully created but when I try to render the parent insights inside the
analyze
tab, I get the following error. Error trace id: a29a3473e3664dcb
What's wrong with it? Take into account that I haven't yet provided the filtering
m
Hi Menelaos, based on the Error trace id: a29a3473e3664dcb - we can see the following issue in our logs:
message=Workspace data filter values for workspace='****' are empty and the current workspace='****' does not match the WDF workspace. This check is in place to prevent you from forgetting to filter values in a new child workspace. Either remove the workspace data filter or add some filtered values.
I will also send you a direct message where the mentioned workspace=‘****’ ID’s will be mentioned.
m
Thank you for your response. What I think that's wrong. 1. I created the workspace 2. Added a filter 3. Deleted the workspace. 4. Created the workspace with the same id For that, I assumed that the filters would be deleted, but probably they didn't. Is that the case?
m
I believe as long as the workspace ID is the same, it should not be an issue. Can you please provide herr the definition of the workspace data filter? Maybe there is some typo or something that prevents the filter from being recognized for this workspace.
m
This is the request for the data filter
Copy code
{
  "workspaceDataFilters": [
    {
      "id": "shipco-id",
      "title": "Shipco ID",
      "columnName": "shipco_id",
      "workspace": {
        "id": "X",
        "type": "workspace"
      },
      "workspaceDataFilterSettings": [
        {
          "id": "y",
          "title": " shipco",
          "filterValues": [
            "***"
          ],
          "workspace": {
            "id": "***",
            "type": "workspace"
          }
        }
      ]
    }
  ]
}
At any case, how can I remove a data filter if I don't want it anymore?
I just created a new example workspace
Copy code
{
  "data": {
    "id": "example",
    "type": "workspace",
    "attributes": {
      "description": "Example workspace",
      "name": "Example"
    },
    "relationships": {
      "parent": {
        "data": {
          "id": "***",
          "type": "workspace"
        }
      }
    }
  }
}
With the following request and I'm getting the error with id: d4388b2790b554a8 related to workspace data filters, but I haven't set up any filters for that workspace.
f
Hi Menelaos, you can remove a Workspace Data Filter via This API call. As for the error you got, here is its error message:
Copy code
Workspace data filter values for workspace='****' are empty and the current workspace='example' does not match the WDF workspace. This check is in place to prevent you from forgetting to filter values in a new child workspace. Either remove the workspace data filter or add some filtered values.
So it is expected to see it on a child workspace with no filters set up yet. 🙂
m
Just to clarify - as far as I understand the workspace data filters (WDFs) and how they work with the workspace hierarchies: • the WDF itself (its name, title and name of database column) is defined on the parent workspace (but the parent workspace itself is not being filtered by it) • the workspaceDataFilterSettings are defined for each of the child workspaces in the hierarchy. And it defines in filterValues that should be used for filtering of this particular workspace • If a particular parent workspace has a WDF defined, any its child workspace must be included in the workspaceDataFilterSettings with some filterValues. Otherwise you receive the error mentioned above. So if I have these workspaces in a hierarchy: • A (parent) • B (child of A) • C (child of A) and I also have • a WDF defined for A • workspaceDataFilterSettings value ‘bbb’ set for workspace B then all this should be true: • workspace A displays all data • workspace B only displays data for “bbb” • workspace C does not display anything and throws the error mentioned above
m
Hey @Michal Hauzírek, thank you for your detailed explanation. Following up on this I want to ask the following: I want to separate for the same column in different workspaces meaning. I have the workspaces: • A (parent) • B (child of A) • C (child of A) and If I set the WDF defined for A, then I can set 'bbb' for B and 'ccc' for C for the same table column, right? Thanks in advance!
👍 1
If so, could you please give me an example of the postman requests I need to send, since I may have misunderstood while following the docs.
@Michal Hauzírek could you follow up on this?
m
Yes, you understood it right, You can have the WDF defined for A, then I can set ‘bbb’ for B and ‘ccc’ for C for the same table column. I am not using postman, but here are API calls I used in my sample domain: Let’s assume I already have a parent workspace with id
parent-master
. 1) First I create a WDF in the
parent-master
workspace defined on top of a database column
wdf_client_id
At this moment I can not define the values yet, since the child workspaces do not exist.
Copy code
PUT /api/v1/layout/workspaceDataFilters

Authorization: Bearer $GD_API_TOKEN
Content-Type:application/json

{
  "workspaceDataFilters": [
    {
      "id": "MY_WDF",
      "title": "MY WDF Example",
      "columnName": "wdf_client_id",
      "workspace": {
        "id": "parent-master",
        "type": "workspace"
      },
      "workspaceDataFilterSettings": []
    }
  ]
}
Now I can create first child workspace with ID
child-albert
.
Copy code
POST /api/v1/entities/workspaces

Authorization: Bearer $GD_API_TOKEN
Content-Type: application/vnd.gooddata.api+json
Accept: application/vnd.gooddata.api+json

{
  "data": {
    "id": "child-albert",
    "type": "workspace",
    "attributes": {
      "description": "Albert child workspace.",
      "name": "CHILD - Albert"
    },
    "relationships": {
      "parent": {
        "data": {
          "id": "parent-master",
          "type": "workspace"
        }
      }
    }
  }
}
Since it will be a child of a workspace with WDF defined and there is no value defined for it, it will now not display anything until I define its WDF value, to prevent any unwanted data leak. To define the WDF value for it, I will call the WDF API again, this time I add the WDF value for
child-albert
workspace. Note that I am repeating the previous call and just adding the new workspace to the
workspaceDataFilterSettings
section. I want this workspace to only show data rows that have value “albert” in the wdf_client_id column:
Copy code
PUT /api/v1/layout/workspaceDataFilters

Authorization: Bearer $GD_API_TOKEN
Content-Type:application/json

{
  "workspaceDataFilters": [
    {
      "id": "MY_WDF",
      "title": "MY WDF Example",
      "columnName": "wdf_client_id",
      "workspace": {
        "id": "parent-master",
        "type": "workspace"
      },
      "workspaceDataFilterSettings": [
        {
          "id": "my_wdf_albert",
          "title": "my wdf Albert",
          "filterValues": [
            "albert"
          ],
          "workspace": {
            "id": "child-albert",
            "type": "workspace"
          }
        }
      ]
    }
  ]
}
After this the child-albert workspace should start showing data and it should be only those with the value “albert” in the “wdf_client_id” column. If I want to add another workspace with different WDF value, I just repeat those steps. First add a new child workspace (
child-oscar
):
Copy code
POST /api/v1/entities/workspaces

Authorization: Bearer $GD_API_TOKEN
Content-Type: application/vnd.gooddata.api+json
Accept: application/vnd.gooddata.api+json

{
  "data": {
    "id": "child-oscar",
    "type": "workspace",
    "attributes": {
      "description": "Oscar child workspace.",
      "name": "CHILD - Oscar"
    },
    "relationships": {
      "parent": {
        "data": {
          "id": "parent-master",
          "type": "workspace"
        }
      }
    }
  }
}
And then again define the WDF value for it. Again - we repeat the previous call (including WDF values for the existing workspaces) and just add the new workspace to the
workspaceDataFilterSettings
section:
Copy code
PUT /api/v1/layout/workspaceDataFilters

Authorization: Bearer $GD_API_TOKEN
Content-Type:application/json

{
  "workspaceDataFilters": [
    {
      "id": "MY_WDF",
      "title": "MY WDF Example",
      "columnName": "wdf_client_id",
      "workspace": {
        "id": "parent-master",
        "type": "workspace"
      },
      "workspaceDataFilterSettings": [
        {
          "id": "my_wdf_albert",
          "title": "my wdf Albert",
          "filterValues": [
            "albert"
          ],
          "workspace": {
            "id": "child-albert",
            "type": "workspace"
          }
        },
        {
          "id": "my_wdf_oscar",
          "title": "my wdf Oscar",
          "filterValues": [
            "oscar"
          ],
          "workspace": {
            "id": "child-oscar",
            "type": "workspace"
          }
        }
      ]
    }
  ]
}
Note that creating a workspace is using entity API, that means you define a single workspace, while for the WDF you are using layout API where you provide the configuration for all workspaces. I believe some entity version of the WDF API is being developed at the moment. I hope this helps.
m
Thank you very much, it's not everything set. What I used to do is that I didn't understand I had to set the filters for all workspaces at the same request, that's why every time I submitted a new one, it used to overwrite the previous configuration. Please add to your docs too, since it wasn't clear.
👍 1