Trying to setup a Postman connection to my system but I don’t seem to get it right. Trying to make a POST call to:
It does work if I call https://mysite.erpnext.com/api/method/login and pass usr and pwd as parameter
It also works from the browser.
Can anybody enlighten me here?
Responding my own question: immediately after I posted it I found the doc below:
I should be using GET instead of POST
Although I was able to call it from postman, when I call it from my application I am getting a permission error when I call it from my application:
item: [“Traceback (most recent call last):\n File “/home/frappe/benches/bench-2017-01-10/apps/frappe/frappe/app.py”, line 60, in application\n response = frappe.api.handle()\n File “/home/frappe/benches/bench-2017-01-10/apps/frappe/frappe/api.py”, line 112, in handle\n doctype, **frappe.local.form_dict)})\n File “/home/frappe/benches/bench-2017-01-10/apps/frappe/frappe/init.py”, line 897, in call\n return fn(*args, **newargs)\n File “/home/frappe/benches/bench-2017-01-10/apps/frappe/frappe/client.py”, line 29, in get_list\n limit_start=limit_start, limit_page_length=limit_page_length, ignore_permissions=False)\n File “/home/frappe/benches/bench-2017-01-10/apps/frappe/frappe/init.py”, line 1076, in get_list\n return frappe.model.db_query.DatabaseQuery(doctype).execute(None, *args, **kwargs)\n File “/home/frappe/benches/bench-2017-01-10/apps/frappe/frappe/model/db_query.py”, line 35, in execute\n raise frappe.PermissionError, self.doctype\nPermissionError: Production Order\n”]
Looking at the cookies it seems that it is trying to log in as Guest:
You need to pass the cookies you receive after logging in to the server with your other GET/POST messages.
My API invocations were working till a few days ago where I make a login POST call to https://gps.erpnext.com/api/method/login, capturing all the cookies, and then passing them back to GET calls like https://gps.erpnext.com/api/resource/Customer/Foo. However now I have started getting 500 Internal Server Error.
I am using the hosted version. Is there a way to check server side logs? What else could be going wrong?
“Is there a way to check server side logs?”
Not that I am aware - I believe your only recourse is to email firstname.lastname@example.org with your request?
I figured it out. I was setting Content-Type: application/json on the request which was resulting in the following error:
“ValueError: No JSON object could be decoded[\n]”
Commenting out that line fixed it.
hi @EwertonMoreira even i’m facing same problem can you please text how u resolved that error step by step i’m not getting it. Thank you