# Adding form data to urlConnection POST request

**URL:** <https://forum.xojo.com/t/adding-form-data-to-urlconnection-post-request/81626>\
**Category:** General\
**Created:** [September 2, 2024, 9:50am UTC](https://forum.xojo.com/t/adding-form-data-to-urlconnection-post-request/81626 "2024-09-02T09:50:29Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Ian\_Piper](https://forum.xojo.com/letter_avatar_proxy/v4/letter/i/ba8739/32.png) [@Ian\_Piper](https://forum.xojo.com/u/Ian_Piper)\
**Post date:** [September 2, 2024, 11:24am UTC](https://forum.xojo.com/t/adding-form-data-to-urlconnection-post-request/81626/3 "2024-09-02T11:24:18Z")

</div>

Thanks for the response. I am really looking for a worked example where the request is built. I’ve tried doing this (authentication blanked):

```auto
ucExtractConceptsFromFile.ClearRequestHeaders
// Use basic authentication
ucExtractConceptsFromFile.RequestHeader ("Authorization") = "Basic " + EncodeBase64(" ***" + ":" + "***")
ucExtractConceptsFromFile.RequestHeader("Content-Type") = "text/plain"
ucExtractConceptsFromFile.RequestHeader("Accept") = "text/plain"

// Put together the multipart package
requestPackage = "--------------------------830792918371557810383557"
requestPackage = requestPackage + EndOfLine.CRLF + "Content-Disposition: form-data; name=" + """file""" + "; filename="+f.NativePath
requestPackage = requestPackage + EndOfLine.CRLF + "<" + f.Name + ">"
requestPackage = requestPackage + EndOfLine.CRLF + "Content-Type: text/plain"
requestPackage = requestPackage + EndOfLine.CRLF + "--------------------------830792918371557810383557--"
// note the extra two dashes at the end of the line above; Postman adds these so I've reproduced that here

ucExtractConceptsFromFile.SetRequestContent(f.NativePath, "multipart/form-data; boundary=" + requestPackage)

requestURI = "https://[myuri]"

// get the response back into taRawTagJson
taRawTagJson.text = ucExtractConceptsFromFile.SendSync("POST", requestURI)

```

From reading Björn’s posting ([URLConnection form data](https://forum.xojo.com/t/urlconnection-form-data/54859)) I thought this might work. But I get a terse message back saying “Could not find acceptable representation”

I’m pretty sure there is a simple fix for this - I’m sending a plain text file and expecting plain text back (though it will end up as JSON). It works with Postman and I’m just trying to reproduce that.  
Has anyone done this?

---

_[View the full topic](https://forum.xojo.com/t/adding-form-data-to-urlconnection-post-request/81626)._
