Manoj K J
Manoj K J

Reputation: 69

Loading csv converting each entry into separate JSON document using transformer & REST API in Marklogic

I am trying to load a csv document into MarkLogic using the RESTAPI. I want to save each row into a separate JSON document with custom URI. Should I go for REST API extension with/without tranformer or is it possible to use PUT "/v1/document" with a transformer function. I am not planning to use MLCP . What is the best way to do it?

Thanks

Upvotes: 0

Views: 113

Answers (1)

grtjn
grtjn

Reputation: 20414

Splitting the CSV outside of MarkLogic, and then submitting each record separately would scale the best. That is how MLCP delimited_text feature works, but it can also be done with other tools.

If you insist on sending the entire CSV to a REST endpoint, I'd use a REST extension. It would probably work with a transform on a PUT against /v1/documents, but you'd not gain much with that. The transform itself must return a document, and only one. And such transforms are not supposed to have side-effects.

HTH!

Upvotes: 3

Related Questions