Jump to content

Using API with Python


EduardFerrero

Recommended Posts

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!

 

 

Link to comment
Share on other sites

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 by Jay Rock
Link to comment
Share on other sites

Loyverse Point of Sale

 

 

 

 

×
×
  • Create New...