Andrew Irwin Andrew Irwin - 9 days ago 7
JSON Question

How do I get couchdb attachment name

How do I get the name of a couchdb attachment if I only know the document name.
Do I have to filter the return document json and extract the attachment name,
so I can then append it to the end of the url /db/doc/aboutme.jpg

requests.get('http://localhost:5984/test2/2')

Answer

You can either get your document with the attachments using the attachments query parameter.

Also, you can do as you described. You fetch the document. Then, you get your attachment by using the attachment name in the document.