I’m at my wits end here. This api has been so frustrating with adding files I’m close to quitting. It’s bee one issue after another. I’ve been unable to add a file using the multi part method for months now. I’m out of ideas.
My current code is this:
<cfset storedFileName = "test.png">
<cffile action="read" file="f:\TempFiles\#storedFileName#" variable="TempFile">
<cfset thisData = "">
<cfsavecontent variable="thisData">
--xxxxxxxxxx
Content-Disposition: form-data; name="query"
mutation ($file:File!) {add_file_to_column (item_id: ITEM_ID_HERE, column_id: "files", file: $file){id}}
--xxxxxxxxxx
Content-Disposition: form-data; name="variables[File]"; filename="f:\TempFiles\image1.png"
Content-Type:application/octet-stream
<cfoutput>#TempFile#</cfoutput>
--xxxxxxxxxx--
</cfsavecontent>
<cfhttp method="post" url="https://api.monday.com/v2/file" result="result">
<cfhttpparam type="Header" name="Authorization" value="MONDAYTOKEN">
<cfhttpparam type="Header" name="Content-Type" value="multipart/form-data; boundary=xxxxxxxxxx">
<cfhttpparam type="body" value="#thisData#">
</cfhttp>
This is my payload that’s being sent.
--xxxxxxxxxx
Content-Disposition: form-data; name="query"
mutation ($file:File!) {add_file_to_column (item_id: ITEM_ID_HERE, column_id: "files", file: $file){id}}
--xxxxxxxxxx
Content-Disposition: form-data; name="variables[File]"; filename="f:\TempFiles\image1.png"
Content-Type:application/octet-stream
PNG
IHDRàw=øsBIT|d pHYs¦¦Ý}ÿ8tEXtSoftwarewww.inkscape.orgî<BIDATHµOleEÆ3»]Û]o\R'¢©É%Tò V¨ Tª(HTP§"è¡ õöJ/ z!T $"ÔCEp q¤ªÄpNÇíØYïaãØÆñfö{û½÷fÞ{»BkMÇßzAXúu3ØÖкïë2hòå[IÇ/D¬fÕhh_|ºñÞa:¢í`ñÂ
¨Yqì«ÏeÑϧ[
ݧV=Y ú]µo÷o¯$íÚçKçps_½º~½¶é 8~é9%ÄÔËÒÖZfg4¯-pï£C]Êjª(£ÄCÀÔú¥äk_Åñ·u°BÏjö/°òÙÐn¦>È1Tºq!{±Ú*m"˽]~sM¯ +µ`<ô
Ö èe¬÷ ®µLÉÔåù;îµyôx9t½Ü+*uyþIJ±Ìªá\Fá8ÃcöÇ*8ÃP[ajÜËÄ2«~5*ÄÒ«ØGªT§4棨ªá6ñN-u y§ðÁZ«e,À>\#+a&Úw¥2&J¤½ðñÆøE_¢X¬#ìî¶Â;ó'þoú«a%eÝé(:ö.
Í÷¿cqoý/ Ñäÿ7uMÞDêY´8ÛɽÿÉ4?ýZ"wè÷^çP*×)×Y-×)ݯsôÑoNäBÂ׳&ZæÃÚr¡P¦ZÛ ZÛà÷?î?0Ð
Â}¡e^b3ßÉ
x h¶>1#,¢ÅÕNöÜé⮽«xܵ9wz¤ú
£ÅV¯s[ùþ¸ÃÅaab;qq"GÜé¤æÐW[~ÚsnæÌq¤1MÇèn6SßüÌ?.±p·uÖ=F?À³OÁ4»*ÝG9²7oow0ûüeÀµN'{\"ýÕaía¢ë£ßÊäcà=Ï¡WÛ·ÑÝÉÙ·!Ew ©®Ð¨
~aRÙNqË`+¾1d*ó÷PÜümi5¨Ìc3Nwø#3ú7ïÕIEND®B`
--xxxxxxxxxx--
This gives me this error:
I had what I though a working method when I posted this thread a while ago but upon checking and validating files further it wasn’t working. Here is that post (Problem adding files with ColdFusion via API)
That would give me a success message but in reality it would add a corrupted file.
If anyone can help I’d really appreciate it. I’ve looked at the following sources for help and can’t seem to get over this issue.
Announcement
Node JS example
Adding file to column via API