-
Notifications
You must be signed in to change notification settings - Fork 8
Closed
Description
While trying to use a member of the ColumnTypes class in a dict object, we get a TypeError: Object of type ColumnTypes is not JSON serializable.
This is quite counterintuitive as most of the columns functions require a ColumnTypes member instead of a simple string such as 'text' or 'number', whereas you can't provide such a member in an API request such as:
import requests
from seatable_api import Base, context
from seatable_api.constants import ColumnTypes
base = Base(context.api_token, context.server_url)
base.auth()
url = f"https://cloud.seatable.io/api-gateway/api/v2/dtables/{base.dtable_uuid}/columns"
payload = {
"op_type": "modify_column_type",
"column_data": {
"table": "Table1",
"other_table": "Table2"
},
"table_name": "Table1",
"column": "aa",
"new_column_type": ColumnTypes.IMAGE # for now, you have to write 'image'
}
headers = {
"accept": "application/json",
"content-type": "application/json",
"authorization": f"Bearer {base.jwt_token}"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)
Metadata
Metadata
Assignees
Labels
No labels