Hi, everybody. I'm trying to add a document to my ...
# community-help
l
Hi, everybody. I'm trying to add a document to my collection using N8N and the http request node and I'm banging my head against the wall because I just cant figure it out. So I'm sending a POST to https://whatever.typesense.net/collections/mycollection/documents/import?action=create and I've used Javascript to stringify my json and another code node to turn it into a binary file. I'm not 100% sure that I did everything right, but I'm struggling with the http POST request the most. I usually get an error similar to this one: {"code":400,"document":"{\"documents\":\"documents\"}","error":"Field
myFieldName
has been declared in the schema, but is not found in the document.","success":false} But the field name is most definitely contained in my data. I suspect the error lies elsewhere, like me not actually sending the file. So how do I configure the POST request in N8N? Do I send raw JSON and just include the document name? Do I send n8n binary file File? I'm pretty confused and would appreciate any guidance.
j
Are you able to get n8n to print the exact payload itโ€™s sending Typesense? Could you also try replicating it with a small collection with a minimal set of fields and share that schema and document here?
l
Wow - thanks for the blitz-reply ๐Ÿ™‚. It was around 2am in my timezone, thus sleep delayed my answer. But here's what I did: 1. I used the default collection "companies".
While I was typing out everything I did, I discovered your Postman collection, with which I finally managed to get it to work ๐Ÿ™‚. I suggest you add the link to Postman in the "Add documents" section of the documentation :-).
j
We mention the postman collection in the "API Clients" section of the API Reference section