Create attachment document with properties using REST API

Hi,

I want to create an attachment document using REST API. I am able to create it, but I am not able to create a document containing some custom properties also within the document. I tried multipart/formdata as well but it did not added properties to created document.
Could you help me?

you can add _attachment properties in your json document with base64 encode data.
FYI

for example.

curl -X PUT  "http://localhost:4984/sgdb/doc1" -H "accept: application/json" -H "content-type: application/json" -d '{
  "_attachments": {
    "attachment_name": {
      "content_type": "text/plain",
      "data": "eW91ciB0ZXh0IGRhdGEgaGVyZQ=="
    }
  },
  "yourcustomprop": "your value"
}'

@atom_yang Thanks a lot :slight_smile: