Question about using the FileUpload API via Zapier Webhooks

Hey, I have a question about using Zapier to index a file to Vectara. I’m trying to automate a workflow where files I save in a Dropbox folder automatically get indexed to a corpus. The request works, but I also want to add my custom metadata (in this case, ‘{“Filename”: “Test Document”}’) doesn’t seem to be getting added. Would love help in figuring out where I’m getting it wrong.

Here’s my POST request (Headers not shown)

I get the usual 200 response, but get this as metadata in Zapier:

metadataJson {"CreationDate":"D:20161118045429Z00'00'""Producer"
OS X 10.12.1 Quartz PDFContext" "Title" ("API
book" "Creator":"Pages" "ModDate":"D:20161118045429}

Based on this response, it doesn’t look like my metadata is getting added.

Appreciate any insight into this!

Hi Chris,

Welcome to Vectara forums! I like the usecase you are exploring.

Can you please confirm that the request you are sending to the backend matches the example given here for attaching custom/additional document metadata? API Definition | Vectara Docs
From your UI, I’m unable to see the exact request that eventually gets sent to the Vectara platform.

Thanks.

1 Like

Thanks for responding. I’m not entirely sure if I’m formatting the request right. This is the entirety of the POST Request via the Webhook by Zapier action:

From the docs:

You can attach additional metadata to the file by specifying an additional doc_metadata form field, which can contain a JSON string:

doc_metadata='{ "filesize": 1234 }'

I’ve added this in the ‘Data’ field as seen in the screenshot above. Zapier returns this response (can’t attach another screenshot so am copy pasting the response here):

response
  status
  quotaConsumed
    numChars 66699
    numMetadataChars 38739
document
documentld IntrotoAPIs.pdf
title API book
metadataJson {"CreationDate":"D:20161118045429Z00'00'","Producer":"Mac OS X 10.12.1
             Quartz PDFContext", "Title": "API book", "Creator":"Pages","ModDate" 
             "D:20161118045429Z00'00'"}
section
    1
       text An Introduction to APIs
    2
       id 1
       text by Brian Cooksey
    3
       id 2
       text Edited by Bryan Landers and Danny Schreiber.
                     Cover art by Stephanie Briones.
                        Clipart images from FCIT.

I can also see that the file has been indexed in Vectara, so I know I at least got that part right. Maybe it’s not supposed to appear in the response, but still the metadata got added? If that’s the case would still love some way to verify if it did.

Hi Chris,

As per File Upload API Definition | Vectara Docs, the doc_metadata has to be attached as a form field (-F or --form with curl). From your screenshot, it looks like you are adding it as data field (-d or --data with curl). From the screenshot you shared, I cannot pinpoint how you would add another form field. Would it possible to check with the Zapier documentation for this?

I can also see that the file has been indexed in Vectara, so I know I at least got that part right. Maybe it’s not supposed to appear in the response, but still the metadata got added? If that’s the case would still love some way to verify if it did.

The metadataJson you shared above is the one that was indexed. Another way to check the metadata of the document is to query (you can use the Vectara Web Console) for data in the document. In the search results, you will get the document metadata too for each result.

1 Like

Hey,

Thanks for the info. I’ve checked Zapier’s documentation, and, as you said, it seems there isn’t any way to add another form field. So, instead of using webhooks, I just used the Code by Zapier action step to do the indexing, and that worked for me.

I appreciate the help!

Glad to hear that you were able to resolve the issue. Please feel free to use our forums for any issues you may face in future.