In my application, the API ENDPOINT notify_burned
is notified when a voucher_id is used (“burned”).
The calling request is:
https://my-app-url/_/api/notify_burned/39b99819-5cec-444c-b510-a8ef5291804f?customer_name=NAME&customer_lastname=LASTNAME&customer_product=PROD%3AFirma%20Remota%2FDEV%3A7%2FBLINDENV%3A0%2FOTP%3A3
I get the error:
TypeError: notify_burned() got an unexpected keyword argument 'customer_name'
at /downlink/anvil/_server.py, line 1340
I can’t understand why, since customer_name
is passed in the querystring and my endpoint declaration is this:
@anvil.server.http_endpoint("/notify_burned/:voucher_id")
def notify_burned(voucher_id):
print("-NOTIFY-BURNED-----------------------------")
r = anvil.server.request
qp = r.query_params if r.query_params is not None else {}
fp = r.form_params if r.form_params is not None else {}
bj = r.body_json if r.body_json is not None else {}
origin = r.origin
params = {**querystring, **qp, **fp, **bj}
print(f"Params: {params}")
customer_name = params['customer_name'] if 'customer_name' in params else None
customer_lastname = params['customer_lastname'] if 'customer_lastname' in params else None
customer_product = params['customer_product'] if 'customer_product' in params else None
In the session log, I don’t even see the “-NOTIFY-BURNED-------------” print, so I guess I never get into the function and get stuck at the definition.
But I can’t see how the function gets the keyword argument ‘customer_name’
Where am I doing wrong?
Thanks