Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- POST /services/data/v34.0/chatter/feed-elements HTTP/1.1
- Authorization: OAuth 00DRR0000000N0g!...
- User-Agent: Jakarta Commons-HttpClient/3.0.1
- Host: instance_name
- Content-Length: 845
- Content-Type: multipart/form-data; boundary=a7V4kRcFA8E79pivMuV2tukQ85cmNKeoEgJgq
- Accept: application/json
- --a7V4kRcFA8E79pivMuV2tukQ85cmNKeoEgJgq
- Content-Disposition: form-data; name="json"
- Content-Type: application/json; charset=UTF-8
- {
- "body":{
- "messageSegments":[
- {
- "type":"Text",
- "text":"Please accept this receipt."
- }
- ]
- },
- "capabilities":{
- "content":{
- "description":"Receipt for expenses",
- "title":"receipt.pdf"
- }
- },
- "feedElementType":"FeedItem",
- "subjectId":"005RR000000DmOb"
- }
- --a7V4kRcFA8E79pivMuV2tukQ85cmNKeoEgJgq
- Content-Disposition: form-data; name="feedElementFileUpload"; filename="receipt.pdf"
- Content-Type: application/octet-stream; charset=ISO-8859-1
- ...contents of receipt.pdf...
- --a7V4kRcFA8E79pivMuV2tukQ85cmNKeoEgJgq--
- var item =
- {
- "body":
- {
- "messageSegments" : segments
- },
- "feedElementType" : "FeedItem",
- "subjectId" : "me"
- };
- if(fileData)
- {
- item.capabilities =
- {
- "content" :
- {
- "description": "File attachment from Clienteling",
- "title": "Some File"
- }
- };
- var data = new FormData();
- data.append("json", JSON.stringify(item));
- data.append("feedElementFileUpload", fileData);
- var req = new XMLHttpRequest();
- req.addEventListener("load", function(event)
- {
- success(req);
- }, false);
- req.addEventListener("error", fail, false);
- req.open("POST", self.base + "/feed-elements", true);
- req.setRequestHeader("Authorization", self.bearer);
- req.send(data);
- }
- -----------------------------18721583984357993421560304724
- Content-Disposition: form-data; name="json"
- {"body":{"messageSegments":[{"type":"Text","text":"This is a file post."}]},"feedElementType":"FeedItem","subjectId":"me","capabilities":{"content":{"description":"File attachment","title":"Some File"}}}
- -----------------------------18721583984357993421560304724
- Content-Disposition: form-data; name="feedElementFileUpload"; filename="39191-ki1RNjpg-EdDM.jpg"
- Content-Type: image/jpeg
- ÿØÿàJFIFHHÿÛC
- SNIP
- -----------------------------18721583984357993421560304724--
- <?xml version="1.0" encoding="UTF-8"?><Errors><Error><errorCode>MISSING_ARGUMENT</errorCode><message>Missing required 'subjectId' parameter.</message></Error></Errors>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement