Upload document API
Closed this issue · 3 comments
I'm trying to programmatically create a project and upload documents to it.
Question 1: /v1/projects/{project_id}/docs endpoint
I managed to create the project and upload documents using this endpoint
https://github.com/chakki-works/doccano/blob/master/app/api/urls.py#L27-L28
but the metadata is not uploaded.
From what I see here https://github.com/chakki-works/doccano/blob/master/app/api/views.py#L125 the meta
field is not supported by the API even though it's in the Serializer, which would explain that the metadata is not uploaded. Is my understanding correct ?
Question 2: /v1/projects/{project_id}/docs/upload endpoint
I tried to upload documents using this endpoint
https://github.com/chakki-works/doccano/blob/master/app/api/urls.py#L37-L38
What is the type of the file
argument here https://github.com/chakki-works/doccano/blob/master/app/api/views.py#L207 ?
I tried passing a JSONLine file as a string, and I get {"detail":"Unsupported media type \"application/json\" in request."}
This is discussed at #299.
Question 2 was figured out by @afparsons here https://github.com/afparsons/doccano_api_client/blob/master/doccano_api_client/__init__.py#L363-L401
Thanks you 🚀
Question 1 remains opened