let Web.MultiPartPost = (url as text, parts as record) as binary => let unique = Text.NewGuid(), boundary = "--" & unique, crlf = "#(cr)#(lf)", item = (name, value) => let filename = Value.Metadata(value)[name]?, contentType = Value.Metadata(value)[type]?, line1 = "Content-Disposition: form-data; name=""" & name & """" & (if filename = null then "" else "; filename=""" & filename & """"), line2 = if contentType = null then {} else { "Content-Type: " & contentType }, lines = { boundary, line1 } & line2 & { "", value } in Text.Combine(lines, crlf) & crlf, body = Text.Combine(List.Transform(Record.FieldNames(parts), each item(_, Record.Field(parts, _)))) & boundary & "--" & crlf in Web.Contents(url, [ Headers=[#"Content-Type"="multipart/form-data; boundary=" & unique], Content=Text.ToBinary(body) ]), fileContents = "{""code"": ""15315""} {""code"": ""526133""} {""code"": ""43011""} {""code"": ""83988""} {""code"": ""182347""}", parts = [ id = "c9c43e63-9372-441c-9ab7-c5e66d7da371", file = fileContents meta [name="upload.txt", type="text/plain"], locale = "en-US" ], Result = Web.MultiPartPost("http://foo.com/bar/baz", parts) in Result