I’m struggling with an API call to use Put to attach a file to a Confluence page. I can perform the task successfully in Postman, but I am struggling with the httpClient in UiPath.
This is how it looks in Curl:
curl -X PUT \ https://ACMECLIENT.atlassian.net/wiki/rest/api/content/382632184/child/attachment \ -H 'Accept: */*' \ -H 'Accept-Encoding: gzip, deflate' \ -H 'Authorization: Basic am9obi5tY2ludHlyZUBp' \ -H 'Cache-Control: no-cache' \ -H 'Connection: keep-alive' \ -H 'Content-Length: 78417' \ -H 'Content-Type: multipart/form-data; boundary=--------------------------562098307277662912467153' \ -H 'Host: investorsinpeople.atlassian.net' \ -H 'Postman-Token: 34-6dd0a85a81c4,9659abf6-22b9-4a13-b2dd-2a5297df43a2' \ -H 'User-Agent: PostmanRuntime/7.20.1' \ -H 'X-Atlassian-Token: nocheck' \ -H 'cache-control: no-cache' \ -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \ -F 'file=@/C:/Users/john/Documents/ACMEClient/Timelines/Database encryption.png' \ -F minorEdit=true \ -F 'comment=Example attachment comment'
Whenever I try building it out in the httpClient, I receive an error after adding the attachment: “There is already a parameter named Database encryption.png”
This error is mentioned in the documentation, but it is with respect to parameters rather than attachements, and the guidance on how to deal with it is unclear. I am not sure what should be placed in the body text to add the attachent successfully. I am trying -F “file=@/C:/filepath/filename.png” but this does not seem to work as the server returns a 400 error: “At least one attachment file must be included”.
Does anyone have any suggestions? I’m a little bit stumped.