Thanks, you were right. This works:
wget -S \
--header "Content-type:application/json" \
-O - \
--post-data '{"xyz":"Hello World",
"_attachments":{"foo.txt":{"content_type":"text\/plain","data":
"'$(base64 < xyz.txt | tr -d " \t\n\r")'"}}}' \
http://zurv3aqzm.iriscouch.com/zzz
curl -X POST http://zurv3aqzm.iriscouch.com/zzz -d
'{"hello":"1232zzz",
"_attachments":{"foo.txt":{"content_type":"text\/plain","data":
"'$(base64 < xyz.txt | tr -d " \t\n\r")'"}}}' -H "Content-Type:
application/json"
On Fri, Nov 1, 2013 at 9:06 AM, Robert Newson <[email protected]> wrote:
> Surely it's the newlines in the base64 output.
>
> B.
>
>
> On 1 November 2013 11:58, Hank Knight <[email protected]> wrote:
>> I am trying to add an inline attachment using either cURL or wget.
>>
>> My method works if the attachment is only a few words long however if
>> it is larger it fails. I have attached the file to this email.
>>
>> I get multiple errors like this:
>> curl: (6) Couldn't resolve host
>> 'bCwgdmVzdGlidWx1bSB2aXRhZSBlZ2VzdGFzIHNpdCBhbWV0LCBpbXBlcmRpZXQg'
>>
>> curl -X POST http://zurv3aqzm.iriscouch.com/zzz -d '{"xyz":"Hello
>> World", "_attachments":{"foo.txt":{"content_type":"text\/plain","data":
>> "'$(openssl base64 < xyz.txt)'"}}}' --data-binary -H "Content-Type:
>> application/json"
>>
>> wget -S \
>> --header "Content-type:application/json" \
>> -O - \
>> --post-data '{"xyz":"Hello World",
>> "_attachments":{"foo.txt":{"content_type":"text\/plain","data":
>> "'$(base64 < zzz.txt)'"}}}' \
>> http://pbgimages.iriscouch.com/zzz
>>
>> Any idea what I should do?
>>
>> Thanks.