REST Api create not working

Hello, I am trying to create new Job Applicant via REST Api, I send

POST to
https://***.erpnext.com/api/resource/Job%20Applicant
with data
{data:{name: “test”, “applicant_name”: “test”, “email_id”: “test@at.at”}}

And I get error page with no content in it. Can you please check?

Thank you

Hi @vojtas,

can you share the error ?
Also, In order to create new Job Applicant through API you will first need to login.
Please check login api from Frappe Rest API

Thanks, Makarand

Hi, yes, I am logged in… Error description is empty, or if I try the same via curl post I get
Traceback (innermost last):
File “/home/frappe/press/benches/1606030839/apps/frappe/frappe/app.py”, line 60, in application
response = frappe.api.handle()
File “/home/frappe/press/benches/1606030839/apps/frappe/frappe/api.py”, line 111, in handle
data = json.loads(frappe.local.form_dict.data)
File “/usr/lib64/python2.7/json/init.py”, line 338, in loads
return _default_decoder.decode(s)
File “/usr/lib64/python2.7/json/decoder.py”, line 365, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
TypeError: expected string or buffer

Hi @vojtas,

may be json string is invalid, please check your JSON.

name should be in quotes.

Thanks, Makarand

I already got to this error - it should be data= not data:

data={name: “test”, “applicant_name”: “test”, “email_id”: “test@at.at”}

so it works via curl. But it still does not work via other method - I try to post data from different web site javascript exactly the same and I get empty error

      		<div class="page-header-block" data-html-block="header">

Server Error

      		</div>
            </div>
  		
        </div>

Do I need to enable cross side script or something on the erpnext.com? Thank you

Check your logs also share your script if you want someone to help you to debug

Can you please help me where I can find the logs on erpnext.com?

@vojtas try setting this up on your local machine for testing, so it will be easy to debug