Hi, I've been using the API to apply WDF settings...
# gooddata-cloud
p
Hi, I've been using the API to apply WDF settings to child workspaces in my GoodData Cloud instance. For some reason across two of the WDFs I cannot see the values I inputted on the UI despite them existing via the API. See thread for detailed API responses. Any help would be appreciated 🙂 .
GET Get all settings for Workspace Data Filters result:
Copy code
{
  "data": [
    {
      "id": "wdf__local_government_area_setting",
      "type": "workspaceDataFilterSetting",
      "attributes": {
        "title": "Local Government Area",
        "filterValues": [
          "Derby-West Kimberley",
          "Wydnham-East Kimberley"
        ]
      },
      "links": {
        "self": "<https://app.localis.co/api/v1/entities/workspaces/0d2509eba46445779244f43917eb4f26/workspaceDataFilterSettings/wdf__local_government_area_setting>"
      },
      "meta": {
        "origin": {
          "originType": "NATIVE",
          "originId": "0d2509eba46445779244f43917eb4f26"
        }
      }
    },
    {
      "id": "wdf__reporting_area_setting",
      "type": "workspaceDataFilterSetting",
      "attributes": {
        "title": "Reporting Area",
        "filterValues": [
          "Kimberley - North",
          "Kimberley - South"
        ]
      },
      "links": {
        "self": "<https://app.localis.co/api/v1/entities/workspaces/0d2509eba46445779244f43917eb4f26/workspaceDataFilterSettings/wdf__reporting_area_setting>"
      },
      "meta": {
        "origin": {
          "originType": "NATIVE",
          "originId": "0d2509eba46445779244f43917eb4f26"
        }
      }
    },
    {
      "id": "wdf__tourism_region_setting",
      "type": "workspaceDataFilterSetting",
      "attributes": {
        "title": "Tourism Region",
        "filterValues": [
          "Australia's North West"
        ]
      },
      "links": {
        "self": "<https://app.localis.co/api/v1/entities/workspaces/0d2509eba46445779244f43917eb4f26/workspaceDataFilterSettings/wdf__tourism_region_setting>"
      },
      "meta": {
        "origin": {
          "originType": "NATIVE",
          "originId": "0d2509eba46445779244f43917eb4f26"
        }
      }
    }
  ],
  "links": {
    "self": "<https://app.localis.co/api/v1/entities/workspaces/0d2509eba46445779244f43917eb4f26/workspaceDataFilterSettings?page=0&size=20>",
    "next": "<https://app.localis.co/api/v1/entities/workspaces/0d2509eba46445779244f43917eb4f26/workspaceDataFilterSettings?page=1&size=20>"
  }
}
UI showing none for the first two WDFs but showing for the final one
Been tracing back my steps and I can't seem to find any issues... I did the same thing across 2 other parent workspaces and it worked fine.
m
Hello Paiwand, you will need to make sure that the data filter id you are using were correctly set and are unique. More specifically, I would check that the filter was mapped and enabled in the corresponding datasets for the filters in your screenshot, by following the steps outlined in our documentation. Also if you are using the same attribute names accross different datasets, you will have to double check the filter was applied to the correct dataset where the filters in your dashboard reside.
p
Do they need to be unique across different parent workspaces?
It's also working for one child workspace and not the other 11
m
Yes, the ID must be unique across different parent workspaces, otherwise it will not work as expected. Could you please try adjusting the ID?
p
Will try
Fixed thank you. Quick follow up -
Copy code
{
  "data": {
    "id": "wdf__tourism_region_setting",
    "type": "workspaceDataFilterSetting",
    "attributes": {
      "filterValues": [
        "Central Murray",
        "Murray East",
        "Murray River, Lakes and Coorong",
        "The Murray"
      ],
      "title": "Tourism Region"
    },
    "relationships": {
      "workspaceDataFilter": {
        "data": {
          "id": "wdf__tourism_region",
          "type": "workspaceDataFilter"
        }
      }
    }
  }
}
The parsing for this payload on a WDF settings POST call specifically for the third filter value seems to split the string. How can i work around this? Response from POST for WDF setting where it splits:
Copy code
{
    "data": {
        "id": "wdf__tourism_region_setting",
        "type": "workspaceDataFilterSetting",
        "attributes": {
            "title": "Tourism Region",
            "filterValues": [
                "Central Murray",
                "Murray East",
                "Murray River",
                "Lakes and Coorong",
                "The Murray"
            ]
        },
        "meta": {
            "origin": {
                "originType": "NATIVE",
                "originId": "44544c93d62249cea68d73d3b0479b8c"
            }
        }
    },
    "links": {
        "self": "<https://app.localis.co/api/v1/entities/workspaces/44544c93d62249cea68d73d3b0479b8c/workspaceDataFilterSettings/wdf__tourism_region_setting>"
    }
}
m
Could you please confirm
"Murray River, Lakes and Coorong"
is supposed to be one same attribute? Could you try using a blank space instead of the comma?
p
yes its meant to be one and the row value has the comma in it hence its required
m
As discussed internally, you sent the request with the same payload again and it decided not to separate it that time. But it seemed to occasionally split the values into individual attributes if the string itself is comma separated.