Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- curl -s -u "username:password" -H "accept: application/json" -F "attachment=@file_path" -X PUT https://example.com/MailManagement/ws/v3/send/message/attachment
- <cffunction name="uploadAttachment" access="remote" description="Upload An Attachment">
- <cfhttp url = "https://example.com/MailManagement/ws/v3/send/message/attachment" method="put" result="httpResp" username="username" password="password">
- <cfhttpparam type="header" name="Content-Type" value="multipart/form-data">
- <cfhttpparam type="file" file="C:temp1.txt" name="1.txt">
- </cfhttp>
- <cfset response_message = "#httpResp.tostring()#">
- <cfreturn response_message>
- </cffunction>
- HttpResponse<JsonNode> response = Unirest.put("https://example.com/MailManagement/ws/v3/send/message/attachment")
- .header("accept", "application/json")
- .basicAuth("username", "password") // provide Direct address and password
- .field("attachment", new File("")) // provide file to upload
- .asJson();
- JsonNode json = response.getBody(); // json response
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement