Looking for help with Form Data Body API example

Have an API that can be used to attach files (into ClickUp) and trying to implement into my EPF code. Trying with the basics I ended up using POSTMAN and got it to work but unable to duplicate it in EPF. I am 99% sure its the formdata part I am not getting the format or details right

In POSTMAN I wish Sensetalk was in there for a code snippet but it is not. I am showing the CURL snippet but not sure if this is of any help

The documentation from ClickUp isnt helping me much
https://www.postman.com/clickup-api/clickup-public-api/request/uch46ml/create-task-attachment?tab=overview

I know this isn’t right but in short showing what I have been trying to do

Was able to do outside and API script using the post multipart command. I might still play with moving this to an API script if anyone has ideas on how this might copy over?
image

1 Like

Hello,

To upload a file to ClickUp via EPF (SenseTalk), structure a multipart/form-data POST with headers and file content like this:

put “your_api_key” into apiKey
put “your_task_id” into taskID
put “C:/Path/To/Your/File.txt” into filePath

put “–boundary123” & return into body
put ‘Content-Disposition: form-data; name=“attachment”; filename="’ & filePath’s short name & ‘"’ & return into body
put “Content-Type: application/octet-stream” & return & return into body
put file filePath into fileContents
put body & fileContents & return & “–boundary123–” & return into body

put [
method:“POST”,
headers:[
“Authorization”: apiKey,
“Content-Type”: “multipart/form-data; boundary=boundary123”
],
body:body
] into request

put post & taskID & “/attachment” with request into result
put result.

File path is correct

Boundary matches in body and header

File is read correctly

Best Regard,
Helen

Hey @GTPWilks,

here is a version I have used in the past next to the multipart (which is much simpler from my perspective).


set user to "admin"
set id to "123"
set myheader to {
	"name":"id",
	"contents":id
}
set myBody to {
	name:"id",
	contents:user
}


set myURL to "https://postman-echo.com/post"
put APostRequest(httpmethod:"POST",Url:myURL,requestbody:myBody, requestheaders:myHeaders) into ApiResults

log jsonformat(ApiREsults)