Now if I remove the "docstatus":"1"-part the data gets inserted but only as a draft. The only thing that’s not working is the “docstatus”-part. The docstatus = 1 part submits the document, and that is what I need.
The immediate problem is that you’re using a string for docstatus, but you should be using an integer. Change your post fields to "docstatus": 1 and it should work.
The larger problem is that the exception messages are misleading. The docstatus transition method in document.py isn’t properly checking for invalid docstatus, so when it gets an invalid doc status it just assumes that you’re trying to make an illegal transition (hence the misleading message).