-
- res = requests.get("https://api.fortnox.se/3/customers?filter=active", headers=headers)
- for customer in res.json()['Customers']:
+ if customer_id: #We already have id, use that to update info in local db
+ res = requests.get(f"https://api.fortnox.se/3/customers/{customer_id}?filter=active", headers=headers)
+ res = res.json()
+ res['Customer'] = [res['Customer']]
+ else:
+ res = requests.get("https://api.fortnox.se/3/customers?filter=active", headers=headers)
+
+ for customer in res['Customer']: