Erpnext attendance integration

/api/method/erpnext.hr.doctype.employee_checkin.employee_checkin.add_log_based_on_employee_field

how can I implement this api. Is there any developer guide available. please let me know.

@megha007 just add a header with authorization fields . and add the function fields to the body .
for exemple

"employee_fieldname" : "name" ,
"employee_field_value" : employee_id ,
"timestamp" : {{timestamp}},
"log_type":"IN"

if you have know idea about api integration , check this documentation.

okay Thank you so much.

I m getting permission denied error.

@megha007 share some screenshots

I’m testing it by postman.

@megha007 have you set the header tag correctly ?

I think no. Actually I don’t know which fields is set to be in header. Please tell me.

@megha007 easy . click on header next to body . add a new field called (Authorization) and the value must be : “token api_key:api_secret” .exemple (token ggs56df4g6s5:6s5df65qsd).
to get your key and token . open your profile (better be admin). scroll down to last section and click generate key .

however I think you already did it but your user has no permissions to execute that command

Hmm. you are right. and thank you so much… It really helps me a lot.

@megha007 did it work ?

Yes, Now I’m able to call API, but it is giving some validation error. I’m trying to solve it.

@megha007 share it .

POST data :

employee_fieldname:name
employee_field_value:HR-ATT-2022-00002
timestamp:{{timestamp}}
log_type:IN

and response is :

{
“exc_type”: “ValidationError”,
“exception”: “frappe.exceptions.ValidationError: No Employee found for the given employee field value. ‘name’: HR-ATT-2022-00002”,
“exc”: “["Traceback (most recent call last):\n File \"apps/frappe/frappe/app.py\", line 68, in application\n response = frappe.api.handle()\n File \"apps/frappe/frappe/api.py\", line 55, in handle\n return frappe.handler.handle()\n File \"apps/frappe/frappe/handler.py\", line 31, in handle\n data = execute_cmd(cmd)\n File \"apps/frappe/frappe/handler.py\", line 68, in execute_cmd\n return frappe.call(method, **frappe.form_dict)\n File \"apps/frappe/frappe/init.py\", line 1213, in call\n return fn(*args, **newargs)\n File \"apps/erpnext/erpnext/hr/doctype/employee_checkin/employee_checkin.py\", line 65, in add_log_based_on_employee_field\n frappe.throw(_(\"No Employee found for the given employee field value. ‘{}’: {}\").format(employee_fieldname,employee_field_value))\n File \"apps/frappe/frappe/init.py\", line 444, in throw\n msgprint(msg, raise_exception=exc, title=title, indicator=‘red’, is_minimizable=is_minimizable, wide=wide, as_list=as_list)\n File \"apps/frappe/frappe/init.py\", line 423, in msgprint\n _raise_exception()\n File \"apps/frappe/frappe/init.py\", line 378, in _raise_exception\n raise raise_exception(msg)\nfrappe.exceptions.ValidationError: No Employee found for the given employee field value. ‘name’: HR-ATT-2022-00002\n"]”,
“_server_messages”: “["{\"message\": \"No Employee found for the given employee field value. ‘name’: HR-ATT-2022-00002\", \"title\": \"Message\", \"indicator\": \"red\", \"raise_exception\": 1}"]”
}

@megha007 employee (HR-ATT-2022-00002) not found . open employee list on website and copy an existing employee id . it should be something like this (HR-EMP-00001)

okay… it works :slightly_smiling_face:

@megha007 nice . select one of the replies as solution please :slight_smile:

One more question, I can see this data in website. right??