Converting multipart/form-data to body
Hi,
I am trying to use the File Upload API ( https://developer.box.com/reference/post-files-content/ ) in my application to upload files to Box folders.
However I need to convert the multipart/form-data inputs into a body in order to be able to use the API in my application.
Has anyone done this before? Any guidance would be appreciated on what the syntax of such a body would be based on the multipart/form-data syntax.
Thanks, Nick
-
正式なコメント
Hey Nick,
Can you tell me what SDK you are using?
Thanks,
Alex, Box Developer Advocate
コメントアクション -
Hi,
I am proxying the Box API in an API Management system.
This is the form data (below) being passed to https://upload.box.com/api/2.0/files/content
Can the Box API handle this?
Thanks, Nick----------------------------745808781080616645084499
Content-Disposition: form-data; name="attributes"{"name":"Nick1.pdf","parent":{"id":"138473599584"}}
----------------------------745808781080616645084499
Content-Disposition: form-data; name="file"; filename="Example.pdf"
Content-Type: application/pdf%PDF-1.3
%���������
3 0 obj
<< /Filter /FlateDecode /Length 208 >>
stream
x�����0�{?��5?��$@Z�5tH�T�(�R����z�:dY��߮�#n(�C@7��:)y�|O"D��Ƶ]���N9�즮��)�#��?З�ʻ
4Q@��&*�[+5�GE��)�(�
��*q�Uh�L�YjA�#o������������}�G�"d���B�~��,��~Y��4�6�n��u��p�g|�_3�x�:M�
endstream
endobj
1 0 obj
<< /Type /Page /Parent 2 0 R /Resources 4 0 R /Contents 3 0 R /MediaBox [0 0 595 842]
>>
endobj
4 0 obj
<< /ProcSet [ /PDF /Text ] /ColorSpace << /Cs1 5 0 R >> /Font << /TT2 7 0 R
>> >>
endobj
8 0 obj
<< /N 3 /Alternate /DeviceRGB /Length 2612 /Filter /FlateDecode >>
stream
x��wTS��Ͻ7��" %�z �;HQ�I�P��&vDF)VdT�G�"cE��b� �P��QDE�k �5�ޚ��Y�����g�}P���tX�4�X���\���X��ffG�D���=���HƳ��.�d��,�P&s���"7C$
E�6<~&��S��2����)2�12� ��"�įl���+�ɘ�&�Y��4���Pޚ%ᣌ�\�%�g�|e�TI���(����L0�_��&�l�2E����9�r��9h�x�g��Ib�טi���f��S�b1+��M�xL����0��o�E%Ym�h�����Y��h����~S�=�z�U�&�ϞA��Y�l�/��$Z����U�m@��O� ��ޜ��l^���'���ls�k.+�7���oʿ�9�����V;�?�#I3eE妧�KD����d�����9i���,�����UQ� ��h��<�X�.d
���6'~�khu_}�9P�I�o=C#$n?z}�[1
Ⱦ�h���s�2z���\�n�LA"S���dr%�,�߄l��t�
4�.0,`
�3p� ��H�.Hi@�A>�
A1�v�jpԁz�N�6p\W�
p�G@
��K0ށi���A����B�ZyCAP8�C���@��&�*���CP=�#t�]���� 4�}���a
���ٰ;G���Dx����J�>����,�_@��FX�DB�X$!k�"��E�����H�q���a���Y��bVa�bJ0c�VL�6f3����bձ�X'�?v 6��-�V`�`[����a�;���p~�\2n5������
�&�x�*���s�b|!�
ߏƿ'� Zk�!� $l$T����4Q��Ot"�y�\b)���A�I&N�I�$R$)���TIj"]&=&�!��:dGrY@^O�$� _%�?P�(&OJEB�N9J�@y@yC�R
�n�X����ZO�D}J}/G�3���ɭ���k��{%O�חw�_.�'_!J����Q�@�S���V�F��=�IE���b�b�b�b��5�Q%�����O�@��%�!BӥyҸ�M�:�e�0G7��ӓ����� e%e[�(����R�0`�3R��������4�����6�i^��)��*n*|�"�f����LUo�՝�m�O�0j&jaj�j��.��ϧ�w�ϝ_4����갺�z��j���=���U�4�5�n�ɚ��4ǴhZ�Z�Z�^0����Tf%��9�����-�>�ݫ=�c��Xg�N��]�.[7A�\�SwBOK/X/_�Q�>Q�����G�[��� �`�A�������a�a��c#����*�Z�;�8c�q��>�[&���I�I��MS���T`�ϴ�k�h&4�5�Ǣ��YY�F֠9�<�|�y��+=�X���_,�,S-�,Y)YXm�����Ěk]c}džj�c�Φ�浭�-�v��};�]���N����"�&�1=�x����tv(��}�������'{'��I�ߝY�)�
Σ��-r�q�r�.d.�_xp��Uە�Z���M�v�m���=����+K�G�ǔ����^���W�W����b�j�>:>�>�>�v��}/�a��v���������O8� �
�FV>2 u�����/�_$\�B�Cv�< 5]�s.,4�&�y�Ux~xw-bEDCĻH����G��KwF�G�E�GME{E�EK�X,Y��F�Z� �={$vr����K����
��.3\����r���Ϯ�_�Yq*���©�L��_�w�ד������+��]�e�������D��]�cI�II�OA��u�_�䩔���)3�ѩ�i�����B%a��+]3='�/�4�0C��i��U�@ёL(sYf����L�H�$�%�Y�j��gGe��Q�����n�����~5f5wug�v����5�k��֮\۹Nw]������m mH���Fˍe�n���Q�Q��`h����B�BQ�-�[l�ll��f��jۗ"^��b���O%ܒ��Y}W�����������w�vw����X�bY^�Ю�]�����W�Va[q`i�d��2���J�jGէ������{������m���>���Pk�Am�a�����꺿g_D�H��G�G��u�;��7�7�6�Ʊ�q�o���C{��P3���8!9�����<�y�}��'�����Z�Z���։��6i{L{��ӝ�-?��|������gKϑ���9�w~�Bƅ��:Wt>���ҝ����ˁ��^�r�۽��U��g�9];}�}��������_�~i��m��p���㭎�}��]�/���}������.�{�^�=�}����^?�z8�h�c��'
O*��?�����f�����`ϳ�g���C/����O�ϩ�+F�F�G�Gό���z����ˌ��ㅿ)����ѫ�~w��gb���k��?Jި�9���m�d���wi獵�ޫ�?�����c�Ǒ��O�O���?w| ��x&mf������
endstream
endobj
5 0 obj
[ /ICCBased 8 0 R ]
endobj
2 0 obj
<< /Type /Pages /MediaBox [0 0 595 842] /Count 1 /Kids [ 1 0 R ] >>
endobj
9 0 obj
<< /Type /Catalog /Pages 2 0 R >>
endobj
7 0 obj
<< /Type /Font /Subtype /TrueType /BaseFont /AAAAAC+Calibri /FontDescriptor
10 0 R /ToUnicode 11 0 R /FirstChar 33 /LastChar 51 /Widths [ 488 433 479
799 525 229 498 226 615 527 423 525 525 335 305 349 525 229 471 ] >>
endobj
11 0 obj
<< /Length 340 /Filter /FlateDecode >>
stream
x]��j�0E��
-�E�l� �PR^�A�~�-������,�����)tqGwF�FΎ�s�l��{�tKQ֙@�t �dOg�D^Hcu�YZ�c�E��v�#��&YUB��-s�|x2SO��������ئ����7��T����۽t��If�u��6.+t�U|.�$�����dh���й3�J��:�jA����õ�n�E^W�R�M-����v{�
���k(��
�X�n��f�A4�����T|�����
P<��P-Y5࠴����)AҴ�H�HK̂AZ��R..qWz`�]�.��wN<I~���Kx��[�w�������<�?�ְ�W
endstream
endobj
10 0 obj
<< /Type /FontDescriptor /FontName /AAAAAC+Calibri /Flags 4 /FontBBox [-503 -313 1240 1026]
/ItalicAngle 0 /Ascent 952 /Descent -269 /CapHeight 632 /StemV 0 /XHeight
464 /AvgWidth 521 /MaxWidth 1328 /FontFile2 12 0 R >>
endobj
12 0 obj
<< /Length1 21256 /Length 10992 /Filter /FlateDecode >>
stream
x�{wxSG���{%�[�m� [2�6F���b7�,��;%�wBq��� �dSIe�IȆY@0�$K�nʦn�&�B
)��l�w�c�����{��ٟ��s�ޙw�)�J^�vC73�^��������*�*�ܸ�M�
ƴ��^�� �wI`K��O1?�������p�RDPX*�Y�b�f
�
�:���#<nE�����;�W�����Q?s�^�N��Q�'�v��n�Ά�$ ��1�+3�a1U(OPcxzD~��7�Yl��KЫ�}���\�vm_��ߝ�5|�/D��d5Y�Ww˙�3����>U�NT)�ߠL�#?#?Ŋ�K~:��"�-����c�_����W�/��~�(�����4�۬h�aՅ���������$fBy���O�
�X\
h��Q�ݎ%��1�K��y����@�^!v
�C��Bl�|!�
�E��Blb��X/�:!��Z�UB�b�!�b�˄X*�!z���K�N!:�h�M��B,�U��B,b�-B41O��B��hb���h�A�YB�b��B� Q+D��BL�J�J!*�(�L�iB��(�D��BLb���(�H��B
1A�!�/D��B��-D��Bx�'D�c�H"M�T!��b�)B��p �,D���p
�(D��B� +�C�!����.�M��BX�0a�(�A�:!"��
�BBB���4$Ġg��A���N�o��F��_ �/!�)�?��R�/��\�τ8-ħB|"��B|$�)!>��B�M��
�!�,�B�/ğ�xO�w�xG���xK�7���o�� ����%!^�!���B�N��xV�g�xZ���xR��B�V�'�x\�B<&ģB<"��B<$ăBb@�cB< �Q!�qX���B��_����W�{�8$��B�F���8(ĝB�!��B�Z�ۄ����U�[��Y����Q���/��B\'ĵB\#��B\%�/��R�+��\�_�O�˄�T�>!.�b!.b�
�G��B��!z��)�!��M���*�!6�I��Blb��X+�!V�J��B�" �yB,b�K�X"D��Bt �)D��B� �X�EB�
�P�B��E�f!� 1W�MB�b�
B�b��B� Q+D��BL�J�J!*�(?�O��Pr�g�P���B��'!�K��D;B�fDn��6��m %MC�͡�r�&��D(m=�����5��2XM��h%eYA :/4�9�-#ZJ���'4�Y�)�E�I�A�N�F��h�k��B�D�Z�����%�5�!�M�H�@4�h&��z�:�ڐ�}�!�9k�NTr�!Trփ*�ʉ�(m���R���DS(�d�IT����h"Q!����(�jO�G�K��eS�,�L"/�8���D�TuQ*�9��C4��N!rS9Q2Q�("'Qb(q&��@J��PQ,E:�b(2�(��Ni6"+EFY�̔f"2(MO�#�%4���PB#HC�P�L!���$
�Y�3���{��(�[
}C�o����
�7������I�}I��}N�ψN}Ji�}L��"�����o�+��B�?}@�>����=�|�����ޢ,oR�Do���+����^#z�"_!z��D/Q��^���~O�;��(˳D�P��DO=It�跔�
=Nt��1J{���|��!���
P�cz��(��á�Rt:�]�'
�OtѽD�"�;�U_�
�r�AJ����ۉ~Mtѯ��J��B��Lt��Ht�~���u�����)�*��DWR�D���h�e��R
�]Bt1�ED{C�v�����hw�у�.�B?B�!6ig�Q�A���o�r�m
9��e�L��h#���D��T|
�ꐣ����VR�D��-�rK��P�z�x7Q��$� j'j#ZL��:�J-[H��:=��n�5ͣ�Υ���&�9D��C1>t�!��:+�'��P�nЌPL����Նbp��j(TM4�"�B1;�V��T�� *���BQU�iD>�R��P��T
M �[�L4)d�(d���Đ�T��M�����=��)g^��;���)�(��g�2��T�8��l,Q:QQj�έ4��Cu��:S�27��"J�rID���D�D ![+����B�ŠX"QQ4Q�SEZ�"�,Df�i��F�4�tD�SK95��D�
Y;\��N�k�����o�
��
|
|������/���8��O�O��1�����G.q�-r���_�? �}���w~�6��&�G�y�7,y����Y�W-i�W����`�^^^@����e��w��A?��e��i�2�S���'-K\'Q���� �q�7t�����6�u=d^�zм�u�!��(Ҏ �0�B@?�7mq�g��״�u�i��i��n�7�]�A�N�S��v��P�W���\�B�}3p��Եu]���k�k�����_�ܕ��
�L���Y�_����p]f<�PIu�Q�\��"�.���C���������M�%�v�����o?�������6�V�������7�7��P��z�}S�m�k6�lX�A�����b���A����żֿ��Z?[۰�wmp�frp��ke�V2�8�֙\�m[k�U���>�ʿ�g�9��h��%���.��.gQ����Ϳ��տ�P�a�|��C��-E��y�?����?��S��}��?�h�&�g�����k���5���Ӌ����<e���xf�BK�S*�u���;�pj�3�<�T����D9Ú ��J�V%�L�<A�ƿ/��32��q/��)��8M�/.#����bݱ���-vF�����
� j_]���*�C�:\��s���)�[��d)z�9"9\U�#�eL��`M=�]�7,JS��O_��`��A柿��_�~��/��M������p�>�TVL��RH*k��r��z�k�,-�E�6��6��2���/��1ۋ6�j���!�쳢��HW��?�"_d��*��e��ǐE��Y�M�nnh���\&�_j�e�}���*�)+��'�<��IW��_���ޫ�j�6� ^H�{�z��a�S~�Eِo�:��j���/� E�_����&�3L��iC�|���\�;��v`p>��l6�
�z`�X
�V+�p�X,�=@7�t@;�,��B`0h��y�\�4s��@#��f3�z��j�j`:PT@9PL|@)PL���I@1PL
� @���\ ���L��2��@:��c0H܀H��Q�H�x �@
Dv�X�H��`����L§Ȁ0�%!N�?�����������%��9�p����8|���W�/������?���ooo�^^^^^����<����,��4��$p�-��8pxxxxxx8ǀ����0�� p?pp/pp��
pp����5p�+�p+pp3pp#p�������
�%p%pp9�`pp)�\\\�.d]�z�=P��]�@/��l��[�-�f`����k�5�j`�X����2`)����.��ځ6`1�h��@���~� ���Y�L��j���T�@Pκ�˗������7�}�ˆf����O�[�j��X[�ֱ^��e��U�1�6�`�����N�d��g���nѮ`f��`ь
}7tz�N`@9"�*��5�1C���~���UC����(fT�Z�Q�?�3C�aˍ`��B�/���W�Rw������@kd������Wh��[ʖ�2�[�V���H[݃�b���곹V��l[�ֳ
l#�VC��x�5��m��f��me�ml{�s��
)[���H��vbd.`�T%�bv�=�B��E�bv F��C���c���0ο`������I��]��d��?\ͮaײ��7��~{����
��%�A̭���]�fO���>v?{@�e'lKv�Q-�6؆>��b��ak�5x�������Qbc؎�z���[�/<����a�+�3�g��m��p�9�%�o����N7�^�2�f�"Ď�1R_�n��>�U��
�ԭ��p�jگ�����Aƕ`��q�]��w�C����#����UG.��Y�fG0��cl@���������2��u��k9�d�Ce'��<�?��ǞTsQ� �[vR��S��o=��9�;�{�"{���gz���^aoH�?���y����+�d�p�� F�&��_�D�`���4�R�z�& ��(a����ʳ��\̨�3~{d�ke!x왷�Ko��7��]�z����/[�����c�օ�4����nl�5sF}]mM���ʊ�i�Ғ�S&O*.�X8!';+slZ��hW|��f����.B�Qp>Ϭ�T���imAM���:��=�h�t#���<A7/�sr����G9}��7�S����)Y��J�;�|��= �ol��W�iqO�z��5ij��@J
J�+�V��R��2X�qi_e[EV��o2�{ʻ�Y���h�4A�zV�KcK$U�c+'��Lo�
*���]�����
gJJ���պ��A�Z�{Ymf���3O�]6`cm^s���}asPiG�>������T3��5�fz**�^V7{�RP�j���bh����h����pLD��+�y���څfhZ�����\:�c{�)�f���x[�rO9!R~��+R���y`�JOe[��qi|��Ý���UߩAM*��A%���s)���>Oz[��栯��6fen˸��9���OY�$�rٜf��Vcʃ��3\*�S��p��>>0���.Oc�q�?�~��y8��ގ`l9%�����'�jsv�?{��Δ���k�4w��Q���rxa�R�ۏr���vP��w7�N���"�U��MA�-AA>�eS�͒��l�J8W�ԃ��Z^��`-�v�������$'u��ۤA#�g�D��٦Qnޠwewň�S)jõ��v��ac� z>�ռY�2�����~�Q|��A��n�t{Z<�!_C3nku|��x��Uu��^�tN�ҋ(-�RꚚE�?y
Vy�q�ê�����`���kD2������ϔT���~I��K[���-�`�ד�ۙ�ٯg攦�r��*����v����k�������VW�-��y������i���U��έ�-Q�N�k*CU2+��H7������o>nc�}qSsHƳ液��1Hk>�f̧��<�G�,n�5�F@��w�1֫�j�5�9 15�2!Nb�2���|�i�|�߉�
��D
��)��r�
��#��Sd�H��m�= ��>���3�&�CB̃�k��a�d����=@4���7���՚(�A�9y\/jg��6�"\�:��{���|��P���e��%$~)|M����߶��}m-|�`��U����)aA�S�G��FOwY��)��<���#x��S�b%�ݾ6b̩f|������-������S�w�nI��_�o��贩��7��
�Ӄ����̏��/=5�-��Bd� P�!\rT�e�|C�N�R-ߋ@��%���m^�[�vۂ��3)�Fuj���rZ��<���E֠1�"N���i�'��v�#�-�� ���
��G�`.�fa�~��n����nFg8��n)�&�1h�F�xsm�F�x�Z`�y5tQ8�m�Т���u�T�ۂ�Eh<��8��q���l����^J��%����7!�S$
�.}*��u��X�vǒ00tг�/q╕���?�<���Z�~\�����8֢F���-���Kof^:�ɷ50w8��ܕ|�����3�,��W���&�rࠣ`����Zx.4�A]�<?� Ug�۴Zy�m2?����x���\:�Br��ـ�N���u�3�g"Y��G���y&y���`6m��i����I���n�<Um}U}����Ÿ��\�=�J� ��V�6��Z�m8�J��))N�F���=����ǻ[����8k�E�A6���nO
6ĵ�vU�W�iÜ}}����T!3�Oô���j�����q=w{�Z�
�U�����`.w��������u���>jkm�����>wq��V���ιmت���V��݉�Z�C-��2RyF��5+����Գ1|.Wy)�^�-��l����s���"$��Ai6V6؟�S0�6��������;(c{��Q���Xh��b�MD�b�$�n#���N��g�&�1<�g�O�=�)�5�P�`�5�M����kX�r�M�����]l?��k��<����~�>�����M,[��l�s�\p
�[)�1V�_�9d�SjY�0;��#���H���c��U�N�Q�4�i�"�">�M���_1�5�����7�Df-�ЭS^��,��l&�.x���a�e�Y,�$=ꨨ�g���qQ7�U��5v�Ϫ�-�K=�&D�S�5R֑R�>|Sz�3/�y�tTq�i)����������^� ���$Z�Pt��X`��/��Kyy�!P�u��$�ԛ�����^T���k��)v1��N��-OHO+��_"O(Hո�%J��dYAN�)�yXR^�a�2�L���S:7_��h��Dh�Q�QYSRms�N�N�)�E��X6�.P9�-�=����G%�:��3ok#���6��rM������K�(���&"b 9>a�䔚��h��m���uQv�؊�g�:F�:F9Tי0�=��a�(�b�s���JS��x�4#�f�G�Qf|ě��<��8t�0r$}q�TF>��8�p>u�����x��ltHi��&Vz�c��H�U���Vgd��d>�l���bJU�s3��N�`/(�O�uٲ�c�v�\>��/��,.##NJ���͍GVݽ���mw�-�o���;f��5��]�~}j���{j���>�Eϕm�y&����?1�����R���R�ѫ���3���nt.q@��,�i҉4�4)--"�Y�A��_8P뚵�vNTqqN���=�؟�V`
�4)VAi/~$`i����A5���n��[áFعaFHe��hџ��F��[�Z->#���b�h�3eIo1j�G9��d$}�3&�i�.7�FEG%�t�yz���S�VJ��X>���UOq[�\e9e��W`ư�`��&6�M�/���d��V&��&6��Y��#��(��/3i@��b�qO�[�<�D��
����i�$����hi�hM��ٵS�1�а�Mܺ�����
�:�]�Z�����E�N��'�=���V+�
��R�uf'}Ȯ5O}'�����9��۪Z>�>-m�Θ�����3O�
���q���/����F9]���l���1�d�]˶���,��^�g֛
��lnOA��Mi���*s�4L[55�l��0��V�V�L�_]�ZU�0���I��� I����L����qY�Us�*���1Fn�Y6�=���(�4����
>u�f�3����9��C�pv�ϒ)E&|��-ծ1�|$�V�$����`����"�
3���=�~H9���'1��̮�TA4��X �6O�$�+9�+1�ZBTwG1�������'G8h����JƢJ�▵��)u�9��vO��f���bB�!B��Xӧ�'mڙ�k�R<��k�u�m��%!5)�w��
>�u�-qt|dt|T�+elʱ���n���z��I��6X�&|�����a��]��%����{�V+�����Ë��?����!��������Bj<r��F�1:��T���D�/���ZL����zV��x\q�VM��pj�(�K ��F�XIy��RՑQ�lI��H�g�~̽�-Yv�r��>*����/�l���W.��ۧ�q�'��w�o�(m���(�;-e��*=Ao�i4:�~ӌ�3v�w�h���r٤��Z|���3oJ�6_Ů�Q���`�VXw?�/k}�Zw\Nai�B%�
�F��.��i��2�u3��3�>���
��^��ENo�&��`գ�0��i��p{��d>ݫ�B#��H/i$�fT�;i���E���#
�Rݹ5���k�������k�5���hM�Ӂ�ji9��j#�?�H~ߦD�2|@]ܧ��)�*.��SFx0V�~.;�ձ�)��΄��V7��jr�:S�"+:S��5�U�N���@��kڲ�T�l���d�,��)u��f;�Ȅ(K��lJ��.�:�u��*+�������������o�j7�)�bn�P��/����
SsV�fu#��;��oC��R�^�E��R}��t��Ĵӹ��z[5���x��{O��������|1�O�37�t �~Z�v���z�C�K��cg);�`��~���j���#9ÙZ��|Vo2h��������h�N�M�7�wz�W�z�Ƙ����5�����:t���1�>ћ�
>�{Lt�]袹�9���&^�\�<�JpB],Ū��ʚ�g�t=�s��-�O�/��/�`u����'��fA�,�(�~�Sc�U�u:�X<`�>DV�����gi�8�
ฬ�_��mC��q�>8՚�S�j�2�9�p�)M��.{��v���Y�+��T�O�~:*�c��<�8?r�vDڞ���|d��z͵o�ǜS^�������@Q�{��\"|&)EE�����+�jOl�z���E:6..Y��1'b� ��ውK+��Y�0K�肴��H��Y"+�D[/����;sb�3*nZ�'�gg�w��;2m)y�1/�Ϙ�lv��`wk�����y�9qs7~�Έ7��X�]�T�{\c����<'3)6*;ٓ-唩-�KV��R}-)%E� ��S��R[�flm�2�S�\��]T3���5��̢I��>!+c�cZyRn ?]8��Ԩ��w_)� ��c��Y�U%�O�#�:}�p�V�a�O�x�w�C�c�4���_�X�t`�����.|?�/9�`�Q7��O{�E�t��R� <����l{j�(�2�;@4�^��``�}�;3H��L�z��Μ<�ˑ0<W�`�Ǭ1��I�2��*�a��آ�,7+nU��VW��'��'��0}:b�U� ������(�z�&6�柶s�y�"L|�<�2�Vi_�N� %���e�����4��,է���ճ���p�j�_�i�2,V�G�h�/99Û�<���F�=�FeT�(#V�c
>�4���+��#NYj��{��~#8��p"���q)�g�V[R�UT�U�P�Z���#壘_��;nsIx��@�e���ΆJ��j���Eέ���j}t���a�[�e8Bwv�UϺ�D���B�L�G7��K��L�>&�"�x]%_��R�u������+�gED���M���/�)j�ȵe5�M3oc�kxeO�1��3�
��i��K��L�M�Y�9���U����sI=��r�>�
��n�Q�C_Z ��#��(�ա�=#�L6����&>�&>�&x�1�C�%sc��Y���Ԉ���1���C����?K-b
�(���~4M2�ߡ �G��krK�����͘~}�Y�Zg�ȼ�Fl���xV�f��YՎ�J3��QR�]J�Hif)M/��q��!K��h0X�k�z�V�dj:��̏b�9F�ß8�p���S_���� ~xˆN���1��=�B�Z�!��8��OZ�f�p|�r�[y�#k���8v�Q�v��s��-Y��Pޛ����XYX��u���9K�ϪYV��,]>�zy�[����{��vY�o���Q\�x�]���vq���Zy
�Ǧ�~n����RJ!�mE�5��k<�����a�����r�x�I���&��
��30��pB�F����i��۬bȰipS7� ����K���ԋJjy�a�@&6�H��!}�2 ���<v��ci�~-���VL�1�c�(]F��Ƭ��yc�s����Kp�P����eb���ƇwO��.���U[�洢`voW���s�����Dg��
ހ/����º�l/����4kؤ`Ւ`2-|7�r�F16b�g�m�a�T��[�fu�k��K]f�~'����]W�W�h�͉�ʳ?�
�`G���-B>(G����1��� �<#,�.���&'YR�$�5��t�&�
�>&�~♠X
���݅�VEo4"��I����
ͽl�D�I�{�x�1�TFo��ہ�٪2<+���g�:��N�������d��&��|˧���ϟTo�Q������,�q�:^ @ ���h{^,c���ON�c�9_u!���+�6wFv\U�/i�5�?��.�"�'Q�'N�3*F�5h5�F�"
�u�fʑt�]�\�Y�:����
F�626����+�.��t����e=][��{x:�-�<���W\a'��N\.��O�AD|Aҷ>CtVM�I�P�MX{�枻�����wqu�v������[z^f�aH�����e�����G%9��3�U�]���T疜_�{z����;�&��)K.�G���̿f-.Om��D����N��s���ӎ�<���a�n�ln���R<�dA��?��Q���7Ɍ��¤"�Th�Ln�ٺ1&S^nF��dO����?��(�n�Yk�����o|x�>��촗��bc��]��D*�i^�D �m�Ǘ�h����F�$�\��J�8L�?��19F�JJ�K)~��z):ݝ�1j�Ic���I�Q�a����h�7�:�{�F��5GGJǤ����a�
�K�@��c�_�Ix��_��oT�4�*����u�]�0���
endstream
endobj
13 0 obj
<< /Title (Microsoft Word - Example.docx) /Producer (macOS Version 11.3.1 \(Build 20E241\) Quartz PDFContext)
/Creator (Word) /CreationDate (D:20210610081923Z00'00') /ModDate (D:20210610081923Z00'00')
>>
endobj
xref
0 14
0000000000 65535 f
0000000302 00000 n
0000003250 00000 n
0000000022 00000 n
0000000406 00000 n
0000003215 00000 n
0000000000 00000 n
0000003382 00000 n
0000000503 00000 n
0000003333 00000 n
0000004029 00000 n
0000003616 00000 n
0000004265 00000 n
0000015347 00000 n
trailer
<< /Size 14 /Root 9 0 R /Info 13 0 R /ID [ <7312bd41ba08afcb4d7a129ae133915f>
<7312bd41ba08afcb4d7a129ae133915f> ] >>
startxref
15567
%%EOF----------------------------745808781080616645084499--
-
@nick, i am also looking for same usecase, glad i found this topic.
@alex, can you please let us know if BOX API can handle this kind or request which @nick has provided. i am trying similar request since yesterday but not getting any luck.
curl -L -X POST 'https://upload.box.com/api/2.0/files/content' \
-H 'Authorization: Bearer <<BearerToken>>' \
-H 'Content-Type: application/json' \
--data-raw '----------------------------abc123
Content-Disposition: form-data; name="attributes"
{"name": "test.json","parent": {"id": "0"}}
----------------------------abc123
Content-Disposition: form-data; name="file"; filename="test.json"
"ewANAAoAIAAgACAAIgBtAHMAZwAiADoAIAAiAHQAaABpAHMAIABpAHMAIAB0AGUAcwB0ACAAZgBpAGwAZQAiAA0ACgB9AA=="
----------------------------abc123--' -
Hey Nick and Danish,
Based on the docs here, there are a few request examples of what will work. Below I have put the syntax from the Node example and a curl example.
var stream = fs.createReadStream('/path/to/My File.pdf');
curl --location --request POST 'https://upload.box.com/api/2.0/files/content' \
--header 'Content-Type: multipart/form-data' \
--header 'Authorization: Bearer <dev_token>' \
--form 'attributes="{
\"name\": \"schedule.pdf\",
\"parent\": {
\"id\": \"123864949669\"
}
}"' \
--form 'file=@"/Users/<username>/Downloads/Schedule.pdf"'I would recommend using one of these vs manually building out a multipart/form-data. If you can't reference a file at a specific location, you can use the example under request format here to help you piece together what the form-data should look like.
Are you all getting a specific error?
-
Thank you Alex, i am able to use the specifications as per BOX API documentation and it works totally fine with Postman or CURL.
The issue is I need to integration BOX API with Alteryx, and somehow Alteryx is NOT able to utilize multipart/form-data feature (submitted SR with Alteryx Support) and giving below error:
{"code":"bad_request","help_url":"http://developers.box.com/docs/#errors","status":400,"message":"the request was rejected because no multipart boundary was found","type":"error"}
So I thought to mimic the multipart/form-data as data-raw and POST to BOX Upload File API, in order to make it work. I had used this solution with another API and it worked so thought it will work with BOX too.
Is there any way we can send the data as simple POST which BOX Upload File API can consume?
Thank you
Danish
-
Yes I get the same error:
{"code":"bad_request","help_url":"http://developers.box.com/docs/#errors","status":400,"message":"the request was rejected because no multipart boundary was found","type":"error"}
I can call the Box API with cURL using the syntax from the Box API Reference no problem (and also from Postman).
However when my API Mgmt tool handles the form-data I pass to it (via cURL or Postman), the form-data is detailed in the format I showed above and errors out:{"code":"bad_request","help_url":"http://developers.box.com/docs/#errors","status":400,"message":"the request was rejected because no multipart boundary was found","type":"error"}
Looks to me like the Box API does not like the format shown above....
-
Hi Everyone!
We finally found something that worked. Can you try syntax similar to this and report back?
curl -v -L -X POST "https://upload.app.box.com/api/2.1/files/content" -H "Authorization: Bearer <token>" -H "Content-Type: multipart/form-data; boundary=9d5297abcceec4bbe730970a1a420d5e" -d $'--9d5297abcceec4bbe730970a1a420d5e\r\nContent-Disposition: form-data; name="attributes"\r\n\r\n{"name":"upload3.txt","parent":{"id":"0"}}\r\n--9d5297abcceec4bbe730970a1a420d5e\r\nContent-Disposition: form-data; name="file"; filename="upload3.txt"\r\nContent-Type: application/octet-stream\r\n\r\nabcd12345\r\n--9d5297abcceec4bbe730970a1a420d5e--\r\n'
Thanks,
Alex, Box Developer Advocate
-
Hello Alex,
I am using Alteryx Designer (an analytical application) to call Box REST API, and using Fiddler to capture the request/response of API. Below is the screenshot of request/response to Box Upload API and its still not accepting the request.
Thank you for looking into this issue.
Danish
-
Hi Alex,
So I changed my API to use the different Content-Type (within the API management tool) and passed the data/body syntax you suggested, with a link to a PDF document on my laptop etc.
This time there is no error returned by Box and a file is created in the Box Folder. However the file is only 9 bytes in size which does not reflect the file I referenced.
Did you test your findings using PDFs? Maybe there is a different body/data needed for PDFs or maybe that syntax just doesn't pick up the PDF file itself?
My cURL command (I could not get Postman to even acknowledge the file referenced "API upload did not contain file part"):curl --location --request POST 'https://XXXXXXXXXXXXXXX/sandbox/box-api-test/upload-file' --header 'X-IBM-Client-Id: XXXXXXXXX' --header 'X-IBM-Client-Secret: XXXXXXXXXX' --data-raw $'--9d5297abcceec4bbe730970a1a420d5e\r\nContent-Disposition: form-data; name="attributes"\r\n\r\n{"name":"Example.pdf","parent":{"id":"138473599584"}}\r\n--9d5297abcceec4bbe730970a1a420d5e\r\nContent-Disposition: form-data; name="file"; filename="/Users/XXXXXX/Downloads/Nick.pdf"\r\nContent-Type: application/octet-stream\r\n\r\nabcd12345\r\n--9d5297abcceec4bbe730970a1a420d5e--\r\n'
Maybe this syntax for picking up the file is wrong?
filename="/Users/XXXXXX/Downloads/Nick.pdf"
Thanks, Nick -
Danish - it may not be possible for this to work in Alteryx. What we are attempting to do is manually build the form that curl builds itself when you input a file path. I'm curious, does it work in Alteryx if you input a file path?
Nick - the file name should just be the Nick.pdf portion... you don't need the file path there unless you want it in the name. You could try using a different content type in the body portion. I believe its application/pdf...
-
Hello Alex,
I understand that we are trying work around to make this upload API work which is not the right way, but was giving a shot if we can make it work.
In Alteryx we need to read the file and convert content in base64 encoding before we can call Box upload api. There is no option in Alteryx to provide the file path in REST API call.
I have opened a SR with Alteryx to troubleshoot this issue, hope they will come back with resolution.
Thank you for your support.
Danish
-
Got this to work today - I had a set of steps in "my API" that generated the bearer token and then uploaded the file.
I took out the token generation and passed the token to the API and it worked as intended.
Just need to figure out why the token generation messed up the calls....but at least file upload works.
サインインしてコメントを残してください。
コメント
17件のコメント