Hey Guys
Hoping to get some help on something im currently using the API to POST metrics into a work space is there a way to do it in bulk as when i try to bulk POST a metric it says it can take an array of values does it have to be done one by one
m
Michael Ullock
08/28/2024, 8:27 AM
Hi Anthony, In GoodData Cloud, when you’re working with the API to POST metrics into a workspace, it is indeed possible to submit multiple metrics in a single request by providing them as an array. The following Doc should be able to help in creating your API call:
https://www.gooddata.com/docs/cloud/create-metrics/create-metrics-using-api/
a
anthony cooke
08/29/2024, 12:56 AM
Thanks mate but for some reason i get this response
when posing bulk values
j
Julius Kos
09/02/2024, 9:36 AM
Hi Anthony,
Apologies, you are actually right. With this particular endpoint, it is not possible to send an array of multiple metrics because it does not allow it.
However, you could use a declarative API instead and rewrite the whole workspace layout endpoint:
https://www.gooddata.com/docs/cloud/create-workspaces/declarative-interface/#WorkspaceDeclarativeAPIInterface-WorkspaceDeclarativeLayoutDocument
Here you can easily add multiple metrics into the JSON body. However, please be very careful while working with the whole workspace layout JSON and make sure that you are only amending the metrics (or whatever is actually needed).