[{"data":1,"prerenderedAt":121},["ShallowReactive",2],{"blog-post-httpie-send-form-data":3,"recent-posts":77},{"id":4,"uid":5,"url":6,"type":7,"href":8,"tags":9,"first_publication_date":10,"last_publication_date":10,"slugs":11,"linked_documents":13,"lang":14,"alternate_languages":15,"data":16},"awME2RIAACsAGIi6","httpie-send-form-data",null,"blog_posts","https:\u002F\u002Fmarks-personal-website.cdn.prismic.io\u002Fapi\u002Fv2\u002Fdocuments\u002Fsearch?ref=aw38fRMAACoA0hep&q=%5B%5B%3Ad+%3D+at%28document.id%2C+%22awME2RIAACsAGIi6%22%29+%5D%5D",[],"2026-11-30T22:45:17+0000",[12],"httpie-how-to-send-form-data",[],"en-us",[],{"title":17,"date":23,"description":24,"image":29,"content":39},[18],{"type":19,"text":20,"spans":21,"direction":22},"heading1","HTTPie: How to Send Form Data",[],"ltr","2026-11-30",[25],{"type":26,"text":27,"spans":28,"direction":22},"heading2","Learn how to send form data and upload files using HTTPie",[],{"dimensions":30,"alt":20,"copyright":6,"url":33,"id":34,"edit":35},{"width":31,"height":32},1280,720,"https:\u002F\u002Fimages.prismic.io\u002Fmarks-personal-website\u002F7X04DUTJrHRMODNb_httpie-send-form-data.png?auto=format,compress","7X04DUTJrHRMODNb",{"x":36,"y":36,"zoom":37,"background":38},0,1,"transparent",[40,44,48,51,54,57,61,64,67,70,74],{"type":41,"text":42,"spans":43,"direction":22},"paragraph","Before we start, make sure you have \u003Ccode>HTTPie\u003C\u002Fcode> installed on your computer. If you don't have it yet, you can install it with Homebrew:",[],{"type":45,"text":46,"spans":47,"direction":22},"preformatted","brew install httpie",[],{"type":41,"text":49,"spans":50,"direction":22},"By default, HTTPie sends your data as JSON. To send it as a regular web form instead, open your terminal and add the \u003Ccode>-f\u003C\u002Fcode> flag:",[],{"type":45,"text":52,"spans":53,"direction":22},"http -f POST https:\u002F\u002Fexample.com\u002Flogin username=alice password=secret",[],{"type":41,"text":55,"spans":56,"direction":22},"Just replace the URL and the \u003Ccode>key=value\u003C\u002Fcode> fields with your own. The \u003Ccode>-f\u003C\u002Fcode> flag (or \u003Ccode>--form\u003C\u002Fcode>) switches the \u003Ccode>Content-Type\u003C\u002Fcode> to \u003Ccode>application\u002Fx-www-form-urlencoded\u003C\u002Fcode>. You can even leave out \u003Ccode>POST\u003C\u002Fcode>, because HTTPie switches to POST on its own when you send data.",[],{"type":58,"text":59,"spans":60,"direction":22},"heading3","Upload a File",[],{"type":41,"text":62,"spans":63,"direction":22},"To attach a file, use the \u003Ccode>field@path\u003C\u002Fcode> syntax. HTTPie then sends the request as \u003Ccode>multipart\u002Fform-data\u003C\u002Fcode>:",[],{"type":45,"text":65,"spans":66,"direction":22},"http -f POST https:\u002F\u002Fexample.com\u002Fupload name='My Report' report@report.pdf",[],{"type":41,"text":68,"spans":69,"direction":22},"If an endpoint wants multipart even without a file, use \u003Ccode>--multipart\u003C\u002Fcode> instead of \u003Ccode>-f\u003C\u002Fcode>. To check what was sent, add \u003Ccode>-v\u003C\u002Fcode> and look at the request headers.",[],{"type":71,"oembed":72},"embed",{"embed_url":73,"type":71},"",{"type":41,"text":75,"spans":76,"direction":22},"Two more tricks: \u003Ccode>'data@file.bin;type=application\u002Foctet-stream'\u003C\u002Fcode> overrides the file's MIME type, and \u003Ccode>bio=@bio.txt\u003C\u002Fcode> (with \u003Ccode>=@\u003C\u002Fcode>) reads the file's text into a normal form field instead of uploading it.",[],{"results":78,"page":37,"results_per_page":119,"results_size":119,"total_results_size":120,"total_pages":37},[79,98,100],{"id":80,"uid":81,"url":6,"type":7,"href":82,"tags":83,"first_publication_date":10,"last_publication_date":10,"slugs":84,"linked_documents":86,"lang":14,"alternate_languages":87,"data":88},"awME2xIAAC4AGIjI","httpie-call-api","https:\u002F\u002Fmarks-personal-website.cdn.prismic.io\u002Fapi\u002Fv2\u002Fdocuments\u002Fsearch?ref=aw38fRMAACoA0hep&q=%5B%5B%3Ad+%3D+at%28document.id%2C+%22awME2xIAAC4AGIjI%22%29+%5D%5D",[],[85],"httpie-how-to-call-an-api",[],[],{"image":89,"title":95},{"dimensions":90,"alt":91,"copyright":6,"url":92,"id":93,"edit":94},{"width":31,"height":32},"HTTPie: How to Call an API","https:\u002F\u002Fimages.prismic.io\u002Fmarks-personal-website\u002F7pbAxf65Suc2BEef_httpie-call-api.png?auto=format,compress","7pbAxf65Suc2BEef",{"x":36,"y":36,"zoom":37,"background":38},[96],{"type":19,"text":91,"spans":97,"direction":22},[],{"id":4,"uid":5,"url":6,"type":7,"href":8,"tags":9,"first_publication_date":10,"last_publication_date":10,"slugs":11,"linked_documents":13,"lang":14,"alternate_languages":15,"data":99},{"image":29,"title":17},{"id":101,"uid":102,"url":6,"type":7,"href":103,"tags":104,"first_publication_date":10,"last_publication_date":10,"slugs":105,"linked_documents":107,"lang":14,"alternate_languages":108,"data":109},"awME1xIAACcAGIiu","httpie-set-timeout","https:\u002F\u002Fmarks-personal-website.cdn.prismic.io\u002Fapi\u002Fv2\u002Fdocuments\u002Fsearch?ref=aw38fRMAACoA0hep&q=%5B%5B%3Ad+%3D+at%28document.id%2C+%22awME1xIAACcAGIiu%22%29+%5D%5D",[],[106],"httpie-how-to-set-a-timeout",[],[],{"image":110,"title":116},{"dimensions":111,"alt":112,"copyright":6,"url":113,"id":114,"edit":115},{"width":31,"height":32},"HTTPie: How to Set a Timeout","https:\u002F\u002Fimages.prismic.io\u002Fmarks-personal-website\u002FNJACEouTVfMOY7Tq_httpie-set-timeout.png?auto=format,compress","NJACEouTVfMOY7Tq",{"x":36,"y":36,"zoom":37,"background":38},[117],{"type":19,"text":112,"spans":118,"direction":22},[],3,109,1796078741473]