Advertisement
Guest User

Untitled

a guest
Jul 3rd, 2015
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.53 KB | None | 0 0
  1. POST /services/data/v34.0/chatter/feed-elements HTTP/1.1
  2. Authorization: OAuth 00DRR0000000N0g!...
  3. User-Agent: Jakarta Commons-HttpClient/3.0.1
  4. Host: instance_name
  5. Content-Length: 845
  6. Content-Type: multipart/form-data; boundary=a7V4kRcFA8E79pivMuV2tukQ85cmNKeoEgJgq
  7. Accept: application/json
  8. --a7V4kRcFA8E79pivMuV2tukQ85cmNKeoEgJgq
  9. Content-Disposition: form-data; name="json"
  10. Content-Type: application/json; charset=UTF-8
  11. {
  12. "body":{
  13. "messageSegments":[
  14. {
  15. "type":"Text",
  16. "text":"Please accept this receipt."
  17. }
  18. ]
  19. },
  20. "capabilities":{
  21. "content":{
  22. "description":"Receipt for expenses",
  23. "title":"receipt.pdf"
  24. }
  25. },
  26. "feedElementType":"FeedItem",
  27. "subjectId":"005RR000000DmOb"
  28. }
  29.  
  30. --a7V4kRcFA8E79pivMuV2tukQ85cmNKeoEgJgq
  31. Content-Disposition: form-data; name="feedElementFileUpload"; filename="receipt.pdf"
  32. Content-Type: application/octet-stream; charset=ISO-8859-1
  33.  
  34. ...contents of receipt.pdf...
  35.  
  36. --a7V4kRcFA8E79pivMuV2tukQ85cmNKeoEgJgq--
  37.  
  38. var item =
  39. {
  40. "body":
  41. {
  42. "messageSegments" : segments
  43. },
  44. "feedElementType" : "FeedItem",
  45. "subjectId" : "me"
  46. };
  47.  
  48. if(fileData)
  49. {
  50. item.capabilities =
  51. {
  52. "content" :
  53. {
  54. "description": "File attachment from Clienteling",
  55. "title": "Some File"
  56. }
  57. };
  58.  
  59. var data = new FormData();
  60. data.append("json", JSON.stringify(item));
  61. data.append("feedElementFileUpload", fileData);
  62.  
  63. var req = new XMLHttpRequest();
  64.  
  65. req.addEventListener("load", function(event)
  66. {
  67. success(req);
  68. }, false);
  69. req.addEventListener("error", fail, false);
  70.  
  71. req.open("POST", self.base + "/feed-elements", true);
  72. req.setRequestHeader("Authorization", self.bearer);
  73. req.send(data);
  74. }
  75.  
  76. -----------------------------18721583984357993421560304724
  77. Content-Disposition: form-data; name="json"
  78.  
  79. {"body":{"messageSegments":[{"type":"Text","text":"This is a file post."}]},"feedElementType":"FeedItem","subjectId":"me","capabilities":{"content":{"description":"File attachment","title":"Some File"}}}
  80. -----------------------------18721583984357993421560304724
  81. Content-Disposition: form-data; name="feedElementFileUpload"; filename="39191-ki1RNjpg-EdDM.jpg"
  82. Content-Type: image/jpeg
  83.  
  84. ÿØÿàJFIFHHÿÛC
  85. SNIP
  86. -----------------------------18721583984357993421560304724--
  87.  
  88. <?xml version="1.0" encoding="UTF-8"?><Errors><Error><errorCode>MISSING_ARGUMENT</errorCode><message>Missing required &apos;subjectId&apos; parameter.</message></Error></Errors>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement