How to test API which is created through Server Script doctype


I have created an API for creating a new doc in ‘Attendance Form’ through server script but i want to test the same. I have also used the “api/method/POST” but it seems it won’t work. Shed some lights if you have any kind of solution. Thanks in Advance!.

@Deepu1117 you don’t have to write the function head (def POST…)
just start with the code . to get data from api call you use frappe.form_dict.example . and example is a json field in the api body .
to return something you use frappe.response[“example”]=“something”.

1 Like

Hi @Deepu1117:

Useful info here:

Hope this helps.

Thanks, actually it’s working now…
One thing I want to know, here i am passing the static values and for this a new document is created in the doctype.

If I pass the value through query string like
“api/method/POST?employee=Giri&employee_number=890&project=CRM” it is throwing error as employee is not defined

@Deepu1117 that’s not how you pass parameters , the data should be in the request body . so use postman not a browser .