Hi All, i am new to perl and i have problem in creating http request through perl, i am devloping one application for my client using quickbook api and trying to add feature which will upload attachment for invoice using api code
in api docs that to upload attachment we need to post http request body as follows
how will be the code for perl to post same body i tried to post it as followsContent-Type: multipart/form-data; boundary=WUlKV_AtI1-uGU0dtt-ebGl0zL +9pZudYnaI8t2g --WUlKV_AtI1-uGU0dtt-ebGl0zL9pZudYnaI8t2g Content-Disposition: form-data; name="file_metadata_0" Content-Type: application/xml; charset=UTF-8 Content-Transfer-Encoding: 8bit <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Attachable xmlns="http://schema.intuit.com/finance/v3"> <FileName>sammie_and_bubbles.jpg</FileName> <Size>278055</Size> <ContentType>image/jpeg</ContentType> <Category>Contact Photo</Category> <Lat>37.120394837</Lat> <Long>-37.12398043298</Long> <PlaceName>Fake Place</PlaceName> <Note>This is a picture of Yujung's dog eating bubbles</Note> <Tag>Sammie</Tag> </Attachable> --WUlKV_AtI1-uGU0dtt-ebGl0zL9pZudYnaI8t2g Content-Disposition: form-data; name="file_content_0"; filename="sammi +e_and_bubbles.JPG" Content-Type: image/jpeg Content-Transfer-Encoding: binary ...binary data ... --WUlKV_AtI1-uGU0dtt-ebGl0zL9pZudYnaI8t2g Content-Disposition: form-data; name="file_content_1"; filename="hello +.txt" Content-Type: text/plain Content-Transfer-Encoding: binary ...binary data ... --WUlKV_AtI1-uGU0dtt-ebGl0zL9pZudYnaI8t2g Content-Disposition: form-data; name="file_metadata_2" Content-Type: application/xml; charset=UTF-8 Content-Transfer-Encoding: 8bit <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Attachable xmlns="http://schema.intuit.com/finance/v3"> <FileName>intuit.png</FileName> <Size>7169</Size> <ContentType>image/png</ContentType> <Category>Image</Category> <Note>This file is Intuit logo from insight</Note> <Tag>intuit_logo</Tag> </Attachable> --WUlKV_AtI1-uGU0dtt-ebGl0zL9pZudYnaI8t2g Content-Disposition: form-data; name="file_content_2"; filename="intui +t.png" Content-Type: image/png Content-Transfer-Encoding: binary ...binary data... --WUlKV_AtI1-uGU0dtt-ebGl0zL9pZudYnaI8t2g--
here i have provided code for just one file upload with xml post which is first file sammie_and_bubbles.JPG but this approach if failing and how can i post ...binary data... of the file from request , please helpmy $r = $ua->post( $url, Content_Type => 'form-data', Content => [ file_metadata_0 => $xml, file_content_0 => $filename ] ); my $res_xml = $r->decoded_content;
In reply to complex http request by dhiraj121083
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |