Include Attachments in Bulk Update API Call

Hello all,

I was wondering if there is a way to upload an attachment - specifically a jpeg file - for a submission using the V2 API Bulk Update endpoint? (a patch call to {kobo_server_url}/api/v2/assets/{asset_id}/data/bulk)

I have successfully used this endpoint to update other fields, but I have one question that prompts the user to upload an image file, and I haven’t been able to successfully update any of the data related to this specific field.

Thank you for your help!

Erin

Welcome back to the community, @ewilcox! Maybe this post discussed previously should help you solve your issue:

Hello @Kal_Lam!

Thanks for the tip! Unfortunately, the endpoint in the post looks to be only for media files or asset-wide files (although it’s possible I’m missing something?) I’m looking to add an individual jpeg file to an individual submission data record via the API.

Even so, I attempted to use the sample code in that post, as well as the example provided in the API documentation for the /assets/{asset_id}/files endpoint, but both ended up giving me responses indicating that “image/jpeg” is not an acceptable file type. From what I can tell, the only acceptable values are “media_file” and “map_layer”, neither of which seems to apply to an attachment file for an individual submission record.

Is there a Kobo Transfer option for this? Or is that library / tool still using the v1 endpoints for submissions?

Thanks!

Erin