How to pass parameters to rest api methods

I am trying to send parameters to a whitelisted method in frappe but it gives 500 response, If I post the url without parameters it works fine but I need to pass parameters what is the proper syntax
I tried
data = “{‘employee’: ‘EMP-00001’}”
response = requests.post(‘http://localhost:8000/api/method/custom_app.custom_app.doctype.attendance.attendance.add_punch_attendance’, json = data, headers = headers)
print(response)

and in function definition
@frappe.whitelist()
def add_punch_attendance(employee):
res = frappe.get_all(‘Attendance’, filters={‘employee’: employee, ‘attendance_date’: now(), ‘status’: ‘Present’})

Also it works fine with api/resource/Attendance but not with a method

response = requests.post(‘http://localhost:8000/api/method/custom_app.custom_app.doctype.attendance.attendance.add_punch_attendance’, data = data, headers = headers)

should have been data not json

1 Like