import os, requests, pathlib for line in pathlib.Path(r'C:\Users\SJ\.minimax-agent\projects\Workflow\.env.local').read_text().splitlines(): if line.strip() and '=' in line and not line.startswith('#'): k, v = line.split('=', 1) os.environ.setdefault(k.strip(), v.strip()) token = os.environ['PB_TOKEN'] h = {'Authorization': f'Bearer {token}', 'Content-Type': 'application/json'} # Try creating a new field on a record r = requests.patch( 'https://pb.agent.apphub.co.za/api/collections/ysterbaard_SARS_EMP201_PAYE/records/zrduajho6xfpb3q', headers=h, json={'brand_new_field_test': 'hello'}, timeout=15, ) print(f'new field PATCH: status={r.status_code}') if r.status_code < 400: d = r.json() print(f' brand_new_field_test = {d.get("brand_new_field_test")!r}') # Read the record r = requests.get( 'https://pb.agent.apphub.co.za/api/collections/ysterbaard_SARS_EMP201_PAYE/records/zrduajho6xfpb3q', headers=h, timeout=15, ) d = r.json() print(f'\nRecord fields: {sorted(d.keys())}') print(f'last_updated stored value: {d.get("last_updated")!r}') print(f'brand_new_field_test stored: {d.get("brand_new_field_test")!r}')