Qambitions opened a new issue, #29871:
URL: https://github.com/apache/superset/issues/29871
### Bug description
### Description
When i call the **"/api/v1/dashboard/{dashboard_id}/copy/"** API, with the
duplicate_slices is true, I receive this error.
Here is my code and the error. And when i come to the code and check. When i
come to the code and check the code need the "positions" fields as input.
However, the api dont allow to put this fields.
### Code and bug notification

```
dashboard_id = 1
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {self.access_token}",
"X-CSRFToken": self.csrf_token
}
dashboard_response =
requests.get(f"{superset_url}/api/v1/dashboard/{dashboard_id}",
headers=headers, cookies=self.cookies)
dashboard_data = dashboard_response.json()["result"]
json_meta = dashboard_data.get("json_metadata", "")
json_meta = json.loads(json_meta)
# json_meta["position_json"] = dashboard_data.get("position_json",
"")
reuqest_payload = {
"dashboard_title": "intergrate_test",
"duplicate_slices": True,
"json_metadata":json.dumps(json_meta)
}
payload_json = json.dumps(reuqest_payload)
# r =
session.post(f'{superset_url}/api/v1/dashboard/{dashboard_id}/copy/',
data=payload_json)
r =
requests.post(f'{superset_url}/api/v1/dashboard/{dashboard_id}/copy/',
json=reuqest_payload,
headers=headers, cookies=self.cookies)
print(r.json())
```
### These part of code you should check and change
<img width="520" alt="image"
src="https://github.com/user-attachments/assets/9e4317da-2388-4336-9614-88d8eeab3bc5">
### How to reproduce the bug
1. using "{superset_url}/api/v1/dashboard/{dashboard_id}" API to get the
json_metadata
2. take it the parameter of
'{superset_url}/api/v1/dashboard/{dashboard_id}/copy/' API
[code.txt](https://github.com/user-attachments/files/16507114/code.txt)
3. you can use this for easy to check,
### Screenshots/recordings
_No response_
### Superset version
master / latest-dev
### Python version
3.9
### Node version
16
### Browser
Chrome
### Additional context
_No response_
### Checklist
- [X] I have searched Superset docs and Slack and didn't find a solution to
my problem.
- [X] I have searched the GitHub issue tracker and didn't find a similar bug
report.
- [X] I have checked Superset's logs for errors and if I found a relevant
Python stacktrace, I included it here as text in the "additional context"
section.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]