Hi I am trying to exectute easy export bot somehow...
# gooddata-cn
m
Hi I am trying to exectute easy export bot somehow I am getting an error ({“detail”:“Server-side problem. Contact support.“,”status”500,“title”“Internal Server Error”,“traceId”:“d23568305b5f18bdb1c3f0e83e7826c4"}% ) : curl https://OUR_ADDRESS/api/v1/actions/workspaces/WORKSPACE_ID/export/tabular \ -H “Content-Type: application/json” \ -H “Authorization: Bearer API_TOKEN” \ -X POST \ -d ‘{ “executionResult”: “RESULT_ID”, “fileName”: “csv_export”, “format”: “CSV”, “visualizationObject”: “OBJECT_ID” }’ | jq . curl https://OUR_ADDRESS/api/v1/actions/workspaces/WORKSPACE_ID/export/tabular/RESULT_ID \ -H “Content-Type: application/json” \ -H “Authorization: Bearer API_TOKEN” \ -X GET
f
Hi Markéta, I checked our logs (thanks for sharing the TraceId, by the way), and located this 404 error right before the 500 is thrown:
Copy code
"The requested endpoint does not exist or you do not have permission to access it."
You mentioned using the
easy export bot
, can you tell me a bit more about this? I’m afraid I’m not familiar with it. If you are working via the APIs, I would recommend double checking our documentation on the Tabular Export endpoint, to ensure it’s being leveraged correctly. Based on the error, I would start by confirming that the
exportId
(and thus the Endpoint) being used on the GET call is correct.
m
It was meant to be “Easy export, but” 🙂 I checked one more time permission and I am admin so it should be ok, I am getting exportId directly as result of first request which seems to be ok: % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 228 100 59 100 169 141 405 -- -- -- -- -- -- 548 { “exportResult”: “6732f65bb3bbf75a58f5a40fc5d1f35857d69a73” }
😅 1
But with this export result, I am not getting results with GET request 🙂
What should be filled in Execution result during POST?
And Python api call to same object works ok: from pathlib import Path from gooddata_sdk import GoodDataSdk host = “OUR_ADDRESS” token = “API_TOKEN” sdk = GoodDataSdk.create(host, token) sdk.export.export_tabular_by_visualization_id( workspace_id=“WORKSPACE_ID”, visualization_id=“OBJECT_ID”, file_format=“CSV”)
I tried, visual export and that worked, I have problem only with Tabular one.
👀 1
f
Hi Markéta, thanks for the extra details! I checked a bit further and think I have found the issue. On your original post call, you are passing both the
executionResult
and
visualizationObject
objects; The endpoint can only accept one or the other.
executionResult
is in case you are executing a Custom Report via the APIs (in which case the result of that process will be an executionResult ID).
visualizationObject
is for exporting Visualizations/Insights that already exist on your end (something you created via the Analytical Designer, for example). The POST call didn’t error out, but the resulting
exportResult
ID was not valid (hence the 404). Here is an article that describes this in more detail: Export Data in Tabular Format. Please take a look there and try rebuilding your POST call, and let me know how it goes! • Note that, according to the article, only PDF and HTML formats are supported for the export of
visualizationObject
.
m
You are right, I updated it but I am getting another issue - I am having issue with including measurement sum into tabular export. I am first defining export (when I am not including measures - then everything is going thru successfully to export): curl https://cruxo.cloud.gooddata.com/api/v1/actions/workspaces/WORKSPACE_ID/execution/afm/execute \ -H ‘Authorization: Bearer APP_ID’ \ -H ‘Content-Type: application/json’ \ -X POST \ -d ‘{ “execution”: { “measures”: [ { “localIdentifier”: “b_sum_views”, “definition”: { “measure”: { “item”: { “identifier”:{ “id”: “views”, “type”:“fact” } }, “aggregation”: “SUM” } } } ], “attributes”: [ { “label”: { “identifier”: { “id”: “datum.day”, “type”: “label” } }, “localIdentifier”: “a_datum” }, { “label”: { “identifier”: { “id”: “flightname”, “type”: “label” } }, “localIdentifier”: “a_flightname” }, { “label”: { “identifier”: { “id”: “flightid”, “type”: “label” } }, “localIdentifier”: “a_flightid” }, { “label”: { “identifier”: { “id”: “flightcreativeid”, “type”: “label” } }, “localIdentifier”: “a_flightcreativeid” }, { “label”: { “identifier”: { “id”: “saleslogin”, “type”: “label” } }, “localIdentifier”: “a_saleslogin” } ], “filters”: [], “auxMeasures”:[] }, “resultSpec”: { “dimensions”: [ { “itemIdentifiers”: [“a_datum”, “a_flightname”, “a_flightid”, “a_flightcreativeid”, “a_saleslogin”, “measureGroup”], “localIdentifier”: “export” } ], “totals”: [] }, “settings”:{} }’ | jq . Then creating export: curl https://cruxo.cloud.gooddata.com/api/v1/actions/workspaces/WORKSPACE_ID/export/tabular \ -H “Content-Type: application/json” \ -H “Authorization: Bearer ID” \ -X POST \ -d ‘{ “format”: “CSV”, “fileName”: “test_csv_export”, “executionResult”: “RESULT_ID” }’ | jq . (all successfully) and then export it: curl https://cruxo.cloud.gooddata.com/api/v1/actions/workspaces/WORKSPACE_ID/export/tabular/RESULT_ID_2 \ -H “Authorization: Bearer ID” \ -X GET --output “test.csv” ---- I also tried to export metric - but also didnt work out (in first step include in measurements): { “localIdentifier”: “a_sum_views”, “definition”: { “measure”: { “item”: { “identifier”: { “id”: “sum_views”, “type”: “metric” } } } } }, — there is no error on the way, but in last step I am getting: {“detail”:“Server-side problem. Contact support.“,”status”500,“title”“Internal Server Error”,“traceId”:“bb35620ddc9faf1b099c9e2a639e8d6e”}% (when not insluding measurements, all working properly)
f
Hi Markéta, thanks for following up. If I understand this correctly, the Tabular Export fails when you add a Sum aggregation to the Custom Execution. May I ask, are you able to test out the newly-created Execution by using this API Call? In this example, it would be a GET to:
<https://cruxo.cloud.gooddata.com/api/v1/actions/workspaces/WORKSPACE_ID/execution/afm/execute/result/RESULT_ID>
Where
RESULT_ID
is your
afm/execute
response. This should provide you a response with the computed data. If this one doesn’t work out, I would double-check the Custom Execution’s definitions, to ensure that they are correct in both Syntax and valid in your LDM.
m
Via this GET I am able to get data bat not in CSV format as wanted, I am getting one line.
Is there any hint how to achieve getting Metric export within visualisation to CSV via Core API? :)
f
Hi Markéta! I haven’t got much experience with Core API (none, in fact 🙂 ), so I’m afraid I can’t help much 😕. But, by looking at Core AI Documentation, it would most likely work, the real question is how! Regarding your previous message (sorry for not replying to it in time!), when an export looks like only one line, like that, it suggests that the Execution’s columns and rows are switched - so instead of one column with all the values in rows, you ended up with one row with all the values in columns. If you’re still struggling with that, I’d recommend checking the expressions of the execution in the first place, to see if the formatting might be switched around somewhere 🙂 One last thing, I would really recommend opening new threads to ensure you get visibility on your questions! This way, the whole team (and the rest of the community) will have an opportunity to interact with it. Responses on older threads are much harder to see 😉