.put('/api/dashboard/{dash_id}/cards) not having an effect

Hi, I've been working with Metabase API for quite a while now. I am working on v47 (client hosted, can't upgrade).

I am attempting to update the cards in the dashboard, simply changing their size, but no effect is taking place. The request is failing. This is the payload I'm using as per the documentation:

{
  "ordered_tabs": [],
  "cards": [
    {
      "size_x": 24,
      "dashboard_tab_id": null,
      "series": [],
      "action_id": null,
      "col": 0,
      "id": 1057,
      "parameter_mappings": [],
      "card_id": 9,
      "visualization_settings": {},
      "size_y": 4,
      "row": 0
    },
    {
      "id": 1058,
      "card_id": 792,
      "dashboard_tab_id": null,
      "action_id": null,
      "row": 4,
      "col": 0,
      "size_x": 24,
      "size_y": 2,
      "series": [],
      "visualization_settings": {},
      "parameter_mappings": []
    }
  ]
}

This is copied exactly from inspecting the network tab in the payload, however, when I attempt it with the API, the logs return this error

[e0713e2f-a7ba-450b-8de4-e1b4364e5b59] 2024-08-22T12:07:46+02:00 DEBUG metabase.server.middleware.log PUT /api/dashboard/162/cards 400 4.5 ms (0 DB calls) 
{:errors {:cards "value must be seq of maps in which ids are unique"},
 :specific-errors {:cards ["invalid type, received: nil"]}}

The card IDs are unique, and I am not providing any nil values, so where is this error coming from?

Did you try doing this action on the UI monitoring the network tab than simply try to replicate that payload?

Yes, the payload I quoted is copied exactly from the network tab, but it is still not going through

Can you share the whole request please? Are you specifying a PUT or a POST?

Thanks for the follow up. I've created a simple example here where I am trying to change the content inside a text box. (The dashboard only contains this textbox)

source_metabase = Metabase_API(
        domain=dest_instance_url,
        email=dest_instance_user,
        password=dest_instance_password,
    )

    cards_payload = {
            "cards": [
            {
                "id": 1285,
                "row": 0,
                "col": 0,
                "size_x": 24,
                "size_y": 3,
                "series": [],
                "visualization_settings": {
                "virtual_card": {
                    "display": "text",
                    "visualization_settings": {},
                    "dataset_query": {},
                    "archived": False
                },
                "text": "text updated via api"
                },
                "parameter_mappings": []
            }
            ],
            "ordered_tabs": []
        }
    source_metabase.put('/api/dashboard/162/cards', cards_payload)

Response from logs:

[f75f3988-f28c-4641-97ca-191d283c4f48] 2024-08-23T12:40:18+02:00 DEBUG metabase.server.middleware.log PUT /api/dashboard/162/cards 400 5.4 ms (0 DB calls) 
{:errors {:cards "value must be seq of maps in which ids are unique"},
 :specific-errors {:cards ["invalid type, received: nil"]}}

Note that I am using a python wrapper for the API. It's been functional for every other request I'm doing. Do you still think this could be the potential cause?

Did you try using the request library or just using curl for a test to see if it works outside of that Python library?