I spent all weekend trying to get the POST /v2/collections/{collection}/documents/content-and-metadata endpoint to work in the Push API. Even reading through the docs on this endpoint multiple times I’m still lost on what goes in the request, metadata and content fields. I keep getting a “Could not parse multipart servlet request” exception or a 500 error.
I’ve successfully been able to PUT, DELETE and commit new docs to the collection, but it would be nice to not have to manually create the metadata mappings before hand each time. I believe this endpoint will do create mappings automatically, correct?
Please note that metadata specified in this way still needs to be mapped using Funnelback metadata mappings. e.g. In my case, author and id metadata fields needs mapped to metadata classes before I am able to use them in Funnelback for things like faceting.
Hi @gtran, thanks for the response! I’ll try this curl response again soon. I’ll have to go through it closer at a later time to see what I was missing.
Follow up question, since metadata still needs to be mapped using the Funnelback mappings what’s the advantage to using this endpoint over the PUT /v2/collections/{collection}/documents endpoint? Just the fact that you can use files over inline metadata? Apparently my assumption that this was a magic endpoint that mapped whatever metadata you threw at it automatically was incorrect.
I think that defining the multipart body is not possible with that auto generated UI.
That is the only endpoint that lets you add metadata where each metadata has multiple values. The other end point for example wont let you define author as both ‘Jack’ and ‘Jill’. Other limitations also exist with the non multi part end point as it is limited to what is supported in HTTP headers. I think that some clunky way of allowing new lines in http header values exist but not all clients support that so the multipart request might end up being your safest choice.
Is automatically mapping metadata something you need? How will you make use of that metadata?
@LukeButters, I see the value of the endpoint now. Thanks for pointing out the multiple values point.
I do find it a slightly cumbersome to go in and map metadata through the UI, especially when I have 5+ fields. I think it would be a neat idea to have metadata mapped automatically on a push collection at a special endpoint. I know you can use the admin part of the api to map metadata, so I may use that for now.