Advertisement
Guest User

Untitled

a guest
Aug 17th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. curl -s -u "username:password" -H "accept: application/json" -F "attachment=@file_path" -X PUT https://example.com/MailManagement/ws/v3/send/message/attachment
  2.  
  3. <cffunction name="uploadAttachment" access="remote" description="Upload An Attachment">
  4. <cfhttp url = "https://example.com/MailManagement/ws/v3/send/message/attachment" method="put" result="httpResp" username="username" password="password">
  5. <cfhttpparam type="header" name="Content-Type" value="multipart/form-data">
  6. <cfhttpparam type="file" file="C:temp1.txt" name="1.txt">
  7. </cfhttp>
  8. <cfset response_message = "#httpResp.tostring()#">
  9. <cfreturn response_message>
  10. </cffunction>
  11.  
  12. HttpResponse<JsonNode> response = Unirest.put("https://example.com/MailManagement/ws/v3/send/message/attachment")
  13. .header("accept", "application/json")
  14. .basicAuth("username", "password") // provide Direct address and password
  15. .field("attachment", new File("")) // provide file to upload
  16. .asJson();
  17. JsonNode json = response.getBody(); // json response
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement