Simplified Declarative API In GoodData.CN 2.0
Version Compatibility Notice
The content of this article is valid for the version of GoodData that was current as of 12 August 2022. Features or behavior in newer versions may differ.
If you manage your data model using APIs, you might appreciate that we have simplified the declarative API in GoodData.CN 2.0. It is no longer necessary to create a “primary label” definition. By design, primary labels will be automatically available in attributes of an entity API (with the same ID).
If you are not using our Logical Data Model (LDM) modeler UI but manage your model manually via API, please ensure that your primary labels and attributes have the same ID. Otherwise, you may find that your dashboard will stop working with messages like:
{
"status": 400,
"detail": "An error has occurred during the calculation of the result",
"resultId": "b61422c23443",
"reason": "Cannot find label with id='label/label.gooddata.name/28cdfs43dw221134' in LDM"
}
Steps to avoid the mentioned problem
-
GET
/api/v1/entities/workspaces/<id>/labels?filter=primary==true&include=attribute
- this will list all primary labels and attributes. You will get a similar response:{ "attributes": { "title": "Status", "description": "Status id", "tags": [ "Activity" ], "primary": true, "sourceColumn": "ls__status_id__nm_status" }, "id": "incorrect_id_f_activity.status_id", "links": { "self": "https://mycompany.gooddata.com/api/v1/entities/workspaces/a5c8731be9d54fbdb61f67c6050d5625/labels/f_activity.status_id" }, "relationships": { "attribute": { "data": { "id": "f_activity.status_id", "type": "attribute" } } } }
-
Change the primary label identifier and its existing references to match the identifier of the related attribute.
-
PUT this changed model back.
-
Also, make sure that all attribute IDs and primary labels correspond to the analytical model (dashboards, visualization, and metrics).
You can check by GET https://mycompany.gooddata.com/api/v1/layout/workspaces/
/analyticsModel -
Change the primary label identifier and its existing references to match the identifier of the related attribute.
-
PUT this changed model back.
Notes
- Doing these steps before upgrading to version 2.0 will make the mapping easier.
Please also keep in mind that with the 2.0 version, we also have API versioning
v1
—the older version does not havev1
in the URI. - In case you are already on the 2.0 CN version - we recommend using a backup from 1.7 and comparing the ID there. Also, you can modify the backup (change the primary label identifier and its existing references to match with the identifier of the related attribute) and PUT this modified backup to 2.0.
If you are interested in GoodData.CN, please contact us.
Alternatively, test a trial version of GoodData Cloud: