API Scripts
Creating API Scripts
Configurations
-
Allow Guest: When checked, the API will be publicly accessible without any authentication.
-
Enable Rate Limit: Enable to apply rate limits to this particular API. For example: “only allow 10 requests per minute”
Script Examples
1. Simple response
2. Using data from the database
3. Using data that came with the request
The request data (JSON and Form) is available in frappe.form_dict
as a dictionary of key-value pairs. The below simple API receives first_name
and last_name
and returns the full_name
after joining the two.
4. Updating data in the database
Here is an example of simple API to increment a value in our database: