Create an api for public

my scenario is to create an API and share it in public. the public should access the information without any authentication required.

Like,

  1. I shall create a doctype in Frappe
  2. create a short url and share the same in QR code
  3. QR code can be printed and shared in public.
  4. Scan the QR code and redirect to that URL without any authentication and display the page

I am new and I need guidance.

Thanks in advance.

@frappe.whitelist(allow_guest=True)
def your_api():
   """ code goes here """

@khushal_t , Thank you. Let me try this and update you.

Note that whitelisted methods are a common cause of security issues. You are responsible for making sure that you sanitize malicious input, check permissions, etc. For example, don’t inject user input into a SQL query, etc.

2 Likes

Thank you guys. I shall try the same and keep the key points and security in consideration.