feat(api): return uuid in POST response for dataset, chart, and dashboard#37806
feat(api): return uuid in POST response for dataset, chart, and dashboard#37806cezudas wants to merge 1 commit into
Conversation
…oard The auto-generated uuid was missing from the POST creation response for datasets, charts, and dashboards, making it impossible for API consumers to reference newly created resources by UUID without a subsequent GET request. The database endpoint already returns uuid in its POST response (via `item["uuid"] = new_model.uuid`). This change brings the other three resource types in line with that precedent by adding `uuid=new_model.uuid` to the `self.response()` call in each endpoint. This is needed for programmatic workflows such as cross-environment dashboard imports that use `dataset_mapping` and `database_mapping` parameters, which require UUIDs to map resources across instances. Closes apache#15456 Co-authored-by: Cursor <cursoragent@cursor.com>
|
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR). Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Code Review Agent Run #ac2c4fActionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
There was a problem hiding this comment.
Pull request overview
This PR updates Superset’s REST create endpoints so API consumers receive the server-generated UUID immediately after creating datasets, charts, and dashboards—removing the need for a follow-up GET to obtain the UUID.
Changes:
- Include
uuidin POST (201) responses for dataset, chart, and dashboard create endpoints. - Add integration test assertions verifying
uuidis present and matches the persisted model UUID.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
superset/datasets/api.py |
Adds uuid to the dataset POST response payload. |
superset/charts/api.py |
Adds uuid to the chart POST response payload. |
superset/dashboards/api.py |
Adds uuid to the dashboard POST response payload. |
tests/integration_tests/datasets/api_tests.py |
Verifies dataset POST response includes uuid. |
tests/integration_tests/charts/api_tests.py |
Verifies chart POST response includes uuid. |
tests/integration_tests/dashboards/api_tests.py |
Verifies dashboard POST response includes uuid. |
| try: | ||
| new_model = CreateChartCommand(item).run() | ||
| return self.response(201, id=new_model.id, result=item) | ||
| return self.response(201, id=new_model.id, result=item, uuid=new_model.uuid) |
There was a problem hiding this comment.
The POST endpoint now includes a top-level uuid in the 201 response, but the OpenAPI docstring for this endpoint still documents only id and result under responses: 201. Please update the response schema docs to include the uuid field so generated API docs match the actual payload.
| try: | ||
| new_model = CreateDashboardCommand(item).run() | ||
| return self.response(201, id=new_model.id, result=item) | ||
| return self.response(201, id=new_model.id, result=item, uuid=new_model.uuid) |
There was a problem hiding this comment.
The POST endpoint now returns a top-level uuid in the 201 response, but the OpenAPI docstring for this route still lists only id and result in the 201 schema. Update the documented response properties to include uuid to keep the OpenAPI spec accurate.
| try: | ||
| new_model = CreateDatasetCommand(item).run() | ||
| return self.response(201, id=new_model.id, result=item, data=new_model.data) | ||
| return self.response(201, id=new_model.id, result=item, data=new_model.data, uuid=new_model.uuid) |
There was a problem hiding this comment.
This POST now includes uuid in the 201 response payload, but the OpenAPI docstring still only documents id and result under responses: 201. Please add uuid to the documented response schema so the generated API docs match behavior.
| try: | ||
| new_model = CreateDatasetCommand(item).run() | ||
| return self.response(201, id=new_model.id, result=item, data=new_model.data) | ||
| return self.response(201, id=new_model.id, result=item, data=new_model.data, uuid=new_model.uuid) |
There was a problem hiding this comment.
This self.response(...) call exceeds typical line-length/Black formatting used in the repo. Reformat this call onto multiple lines (with trailing commas) so it stays Black-compliant and avoids CI formatting failures.
| return self.response(201, id=new_model.id, result=item, data=new_model.data, uuid=new_model.uuid) | |
| return self.response( | |
| 201, | |
| id=new_model.id, | |
| result=item, | |
| data=new_model.data, | |
| uuid=new_model.uuid, | |
| ) |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #37806 +/- ##
===========================================
+ Coverage 0 66.22% +66.22%
===========================================
Files 0 647 +647
Lines 0 49579 +49579
Branches 0 5577 +5577
===========================================
+ Hits 0 32833 +32833
- Misses 0 15443 +15443
- Partials 0 1303 +1303
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Cover remaining 6.1 features across existing and new pages: MCP server: - Add MCP_PARSE_REQUEST_ENABLED to configuration reference - Add Audit Events section (MCP tool calls appear in Action Log) - Add Tool Pagination section documenting cursor-based pagination (#37674) Using AI with Superset: - Expand Available Tools Reference into categorized sections covering all new tools added in the MCP tool library expansion - Document preview-first workflow for generate_chart / update_chart Creating Your First Dashboard: - AG Grid server-side column filters (#35683): filter types, AND/OR logic, pagination interaction - Time Shift for AG Grid Interactive Table (#37072) - Dynamic currency formatting via currency_code_column dataset field (#36416) - ECharts option editor in Explore for JSON overrides (#37868) - Table chart: export behavior with search filter active (#36281) - Dataset folders: organizing datasets into groups (#36239) - PWA file handler: opening CSV/XLS/Parquet from OS file manager (#36191) - Share database connection option when adding a new database (#37940) Exploring Data: - Dialect-aware Format SQL (applies selected database dialect) (#39393) - SQL Lab tips section and time range natural language expressions (consolidates content from batch 4 for master branch) Importing/Exporting: - Dashboard import overwrite behavior: charts are replaced not duplicated (#36551) - UUID in REST API POST responses for dataset/chart/dashboard (#37806) New pages: - docs/docs/using-superset/embedding.mdx: embedded SDK quick start, resolvePermalinkUrl callback (#36924), DISABLE_EMBEDDED_SUPERSET_LOGOUT feature flag (#37537), URL parameters, guest token security notes - docs/admin_docs/configuration/aws-iam.mdx: cross-account IAM authentication for Aurora and Redshift via STS AssumeRole (#37585), configuration reference, trust policy setup guide Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
SUMMARY
The auto-generated uuid was missing from the POST creation response for datasets, charts, and dashboards, making it impossible for API consumers to reference newly created resources by UUID without a subsequent GET request.
The database endpoint already returns uuid in its POST response (via
item["uuid"] = new_model.uuid). This change brings the other three resource types in line with that precedent by addinguuid=new_model.uuidto theself.response()call in each endpoint.This is needed for programmatic workflows such as cross-environment dashboard imports that use
dataset_mappinganddatabase_mappingparameters, which require UUIDs to map resources across instances.Closes #15456 (Issue was already marked as closed due to inactivity)
TESTING INSTRUCTIONS
For each of these following endpoints ensure uuid field exist in the response:
ADDITIONAL INFORMATION