API Help Please

Is there an API? Looking at the documentation that the UI leads you to doesn’t have anything except sales order. Google search takes me here:
https://frappeframework.com/docs/user/en/guides/integration/rest_api/simple_authentication

But don’t know if that is supported in ERPNext or not because it keeps giving me a 404.

If those are the right pages (the latter), I would need to know if it should work on the save server, pointing to localhost? I just can’t get anything back that makes me believe there is an API endpoint.

Thanks in advance

Hi:

Check …
https://frappeframework.com/docs/user/en/api/rest

And this:

Or this:

Hope this helps.

Thanks, I’ve been trying to follow the info in the first link you provided. Getting 404. Should I be able to run on terminal on same server using localhost as the end point?

ubuntu@ubuntuerp:~$ curl -k  https://localhost/api/method/frappe.auth.get_logged_user -H "Authorization: token c0ba505a68c5ea8:1861a2f71278efc"
404 page not found
ubuntu@ubuntuerp:~$

Hi:

I don´t know about your environment. Your bench are serving app on some port, probably 8000, so try:

curl -k http://localhost:8000/api/method/frappe.auth.get_logged_user -H "Authorization: token c0ba505a68c5ea8:1861a2f71278efc"

Hope this helps.

Try to add -H "Host: {site.name}" in curl command.

You need to access api with site name or specify it as host header.

2 Likes

Thank you - that was it. I updated URL to site1.localhost and got a response. One step forward!