EduardFerrero Posted October 6, 2023 Posted October 6, 2023 Hi, I use Python to access loyverse data using loyverse API and the "requests" Python package. I successfully get items, customers, receipts, and so on and convert them into dataframes for further analysis. However, I struggle with the POST method when trying to update information. I try to set the points balance to 10 (for example) for a particular customer that already exists and I know its id. my code is: urlheaders = {"Authorization": "Bearer {mytoken}", "Content-Type": "application/json"} url = "https://api.loyverse.com/v1.0/customers" params = {"id": 'cf2b73d4-db71-45cf-9c28-11609d52c24b', "total_points": 10} response = requests.put(url, headers=urlheaders, params=params) But I always get response 405 and no update is done. Can someone help? Thanks!
Jay Rock Posted October 9, 2023 Posted October 9, 2023 (edited) For updating all fields obligated, please send complete object. { "id": "string", "name": "string", "email": "string", "phone_number": "string", "address": "string", "city": "string", "region": "string", "postal_code": "string", "country_code": "string", "customer_code": "string", "note": "string", "total_points": 0 } Edited October 9, 2023 by Jay Rock
Recommended Posts