Skip to content

feat(api): return uuid in POST response for dataset, chart, and dashboard#37806

Open
cezudas wants to merge 1 commit intoapache:masterfrom
cezudas:feat/uuid-in-post-response
Open

feat(api): return uuid in POST response for dataset, chart, and dashboard#37806
cezudas wants to merge 1 commit intoapache:masterfrom
cezudas:feat/uuid-in-post-response

Conversation

@cezudas
Copy link

@cezudas cezudas commented Feb 9, 2026

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 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 #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:

  • POST /api/v1/dataset/ -- Create a dataset
Screenshot 2026-02-09 at 16 57 44
  • POST /api/v1/chart/ -- Create a chart
Screenshot 2026-02-09 at 16 58 05
  • POST /api/v1/dashboard/ -- Create a dashboard
Screenshot 2026-02-09 at 16 58 51

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

…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>
@github-actions github-actions bot added the api Related to the REST API label Feb 9, 2026
@cezudas cezudas marked this pull request as ready for review February 9, 2026 15:19
@bito-code-review
Copy link
Contributor

AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

@bito-code-review
Copy link
Contributor

Code Review Agent Run #ac2c4f

Actionable Suggestions - 0
Review Details
  • Files reviewed - 6 · Commit Range: 6e76231..6e76231
    • superset/charts/api.py
    • superset/dashboards/api.py
    • superset/datasets/api.py
    • tests/integration_tests/charts/api_tests.py
    • tests/integration_tests/dashboards/api_tests.py
    • tests/integration_tests/datasets/api_tests.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 uuid in POST (201) responses for dataset, chart, and dashboard create endpoints.
  • Add integration test assertions verifying uuid is 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)
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
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)
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
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)
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
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)
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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,
)

Copilot uses AI. Check for mistakes.
@codecov
Copy link

codecov bot commented Feb 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.22%. Comparing base (15b3c96) to head (6e76231).
⚠️ Report is 30 commits behind head on master.

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     
Flag Coverage Δ
hive 41.72% <0.00%> (?)
mysql 64.26% <100.00%> (?)
postgres 64.33% <100.00%> (?)
presto 41.74% <0.00%> (?)
python 66.19% <100.00%> (?)
sqlite 64.02% <100.00%> (?)
unit 100.00% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Related to the REST API size/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chart UUID not exposed in API but required when creating dashboard via API

2 participants