Cleaner way to submit/cancel documents via REST
See original GitHub issueRefer: https://github.com/frappe/frappe_docs/pull/221
Often in the community, this is recommended for cancelling/submitting:
PUT /api/resource/doctype/name
{"docstatus": 2}
If you read document.py
this isn’t really equivalent to cancelling the document. IMO the current best method is to supply run_method
(both submit/cancel are whitelisted).
Current method that works well is:
POST /api/resource/:doctype/:name
# body
{ "run_method": "submit" }
That’s ugly and returns null
💩
Proposals
- Fix document.py so just sending PUT request with new docstatus works. (this we should do regardless of # 2)
- Provide a cleaner API for submit/cancel (or all methods that work with
run_method
)?
I suggested something like this in docs PR:
POST /api/resource/doctype/name/cancel
cc: @gavindsouza @surajshetty3416 @netchampfaris @sagarvora @barredterra
Issue Analytics
- State:
- Created 2 years ago
- Reactions:8
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Working with folders and files with REST - Microsoft Learn
Perform basic create, read, update, and delete (CRUD) operations on folders and files with the SharePoint REST interface.
Read more >How to upload attachments via REST API - Jama Community
1. How to upload attachments via REST API -- a step-by-step python script. ; 'content-type': "application/json" ; "https://" + company_name + " ...
Read more >Proper way to implement RESTful large file upload
I've found the procedure works very well for handling large file uploads in REST APIs and facilitates the handling of the many edge...
Read more >hyperx cancel order
We can use the Set-VMDVDDrive PowerShell command to attach an ISO file to a virtual ... The best way to access combo boxes...
Read more >Using REST Services to upload and download files
On the top of that, we will show how to build a JUnit Test to test files uploading using RESTEasy Client API. Uploading...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sadly lots of users do use naming series with
/
in them.Maybe name part of URL should be urlencoded (
/
->%2F
) @surajshetty3416 ?Proposal of
POST /api/resource/doctype/name/cancel
will have to be scrapped because I can’t think of any decent way to split URL that will respect naming series containing/
🥲We can hardcode few methods like cancel/submit maybe? split URL and check if last part matches one of the supported method?
Sent PR for fixing rest of the issues.