Is there any difference between `POST ${TYPESENSE_...
# community-help
g
Is there any difference between
POST ${TYPESENSE_HOST}/collections/:collection/documents
and
POST ${TYPESENSE_HOST}/collections/:collection/documents/import
when being used for a single document? I'm wondering if I can simply use the import endpoint, so I can have a function in my code that handles both a single document and multiple documents (instead of one function for each case).
j
Yeah, you can just send a single document to
/import
as well
import will always return a 200 though (since it needs to support cases where some docs are successfully import and others are not), so you would have to parse the response body to watch out for any errors
Whereas the single document create/update/upsert endpoint will return different HTTP codes based on the operation’s result
g
Got it, thanks for the tip
👍 1