Unable to sync Field via Metabase API


I have a Python script to sync fields from all tables so I don’t have to update the table metadata manually. Currently I’m using PUT /api/field/:id call and included the metadata I want to update as json. It has worked for me before, but I’ve been getting status 500 when I make this call now.

Here’s an example of my script:

import requests

# test.
base_url = 'http://metabase.domain.com/'
headers = {'X-Metabase-Session': '<METABASE_SESSION_ID>'}

field_id = 12345
field_path = 'api/field/{}'.format(str(field_id))

r = requests.get(
    base_url + field_path,
print(r.status_code, r.reason) # 200 ok.

r = requests.put(
    base_url + field_path,
        'description': 'ID of an account.'
print(r.status_code, r.reason) # 500 server error.

Wasn’t sure if anyone had faced this issue as well.

Hi @rabbitramen
Try using " instead of ', and use body.
The best way to learn the API, is to just use Metabase while having your browser developer Network-tab open and looking at the request, and what data is being send/received.