Trying to post message on yammer with API using javascript but getting error

%3CLINGO-SUB%20id%3D%22lingo-sub-207931%22%20slang%3D%22en-US%22%3ETrying%20to%20post%20message%20on%20yammer%20with%20API%20using%20javascript%20but%20getting%20error%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-207931%22%20slang%3D%22en-US%22%3E%3CP%3EDear%2C%3C%2FP%3E%3CP%3EI%20am%20using%20below%20code%20to%20post%20message%20in%20yammer%20feed%20for%20specific%20group.But%20getting%20readystatus%20as%200%20error%20in%20my%20Rest%20call%20response.Please%20suggest.%3C%2FP%3E%3CP%3E%3CSTRONG%3E%26nbsp%3B%7B%E2%80%9CreadyState%E2%80%9D%3A0%2C%E2%80%9CresponseText%E2%80%9D%3A%E2%80%9C%E2%80%9D%2C%E2%80%9Cstatus%E2%80%9D%3A0%2C%E2%80%9CstatusText%E2%80%9D%3A%E2%80%9Cerror%E2%80%9D%7D%20.%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3ECode%3A%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSCRIPT%20src%3D%22%26quot%3B%26lt%3BA%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fjquery%2F1.11.0%2Fjquery.min.js%26amp%3Bamp%3Bamp%3Bamp%3Bquot%3B%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3B%2Fscript%26amp%3Bamp%3Bamp%3Blt%3B%2FA%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3BBR%20%2F%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3Bscript%20type%3D%26amp%3Bamp%3Bamp%3Bamp%3Bquot%3Btext%2Fjavascript%26amp%3Bamp%3Bamp%3Bamp%3Bquot%3B%20src%3D%26amp%3Bamp%3Bamp%3Bamp%3Bquot%3B%26amp%3Bamp%3Bamp%3Blt%3BA%20target%3D%22_blank%22%26amp%3Bamp%3Bamp%3Bgt%3Bhttps%3A%2F%2Fs0.assets-yammer.com%2Fassets%2Fplatform_embed.js%26amp%3Bamp%3Bamp%3Bamp%3Bquot%3B%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3B%2Fscript%26amp%3Bamp%3Bamp%3Blt%3B%2FA%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3BBR%20%2F%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3Bscript%20type%3D%26amp%3Bamp%3Bamp%3Bamp%3Bquot%3Btext%2Fjavascript%26amp%3Bamp%3Bamp%3Bamp%3Bquot%3B%20src%3D%26amp%3Bamp%3Bamp%3Bamp%3Bquot%3B%26amp%3Bamp%3Bamp%3Blt%3BA%20target%3D%22_blank%22%26amp%3Bamp%3Bamp%3Bgt%3Bhttps%3A%2F%2Fc64.assets-yammer.com%2Fassets%2Fplatform_js_sdk.js%26amp%3Bamp%3Bamp%3Bamp%3Bquot%3B%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3B%2Fscript%26amp%3Bamp%3Bamp%3Blt%3B%2FA%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3BBR%20%2F%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3Bscript%20type%3D%26amp%3Bamp%3Bamp%3Bamp%3Bquot%3Btext%2Fjavascript%26amp%3Bamp%3Bamp%3Bamp%3Bquot%3B%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3BBR%20%2F%26amp%3Bamp%3Bamp%3Bgt%3Bfunction%20PostYammerWithNotification(group_id%2C%20message)%20%7B%26amp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bgt%3Bvar%20yammerData%3B%26amp%3Bamp%3Bamp%3Blt%3BBR%20%2F%26amp%3Bamp%3Bamp%3Bgt%3ByammerData%20%3D%20%7B%26amp%3Bamp%3Bamp%3Blt%3BBR%20%2F%26amp%3Bamp%3Bamp%3Bgt%3Bgroup_id%3A%20group_id%2C%26amp%3Bamp%3Bamp%3Blt%3BBR%20%2F%26amp%3Bamp%3Bamp%3Bgt%3Bbody%3A%20message%26amp%3Bamp%3Bamp%3Blt%3BBR%20%2F%26amp%3Bamp%3Bamp%3Bgt%3B%7D%3B%26amp%3Bamp%3Bamp%3Blt%3BBR%20%2F%26amp%3Bamp%3Bamp%3Bgt%3B%2F%2F%20yammerData.cc%20%3D%20%26amp%3Bamp%3Bamp%3Bamp%3Bquot%3B%5B%5Buser%3A%26amp%3Bamp%3Bamp%3Bamp%3Bquot%3B%20%2B%20userCC%20%2B%20%26amp%3Bamp%3Bamp%3Bamp%3Bquot%3B%5D%5D%26amp%3Bamp%3Bamp%3Bamp%3Bquot%3B%3B%26amp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3BP%26amp%3Bamp%3Bamp%3Bgt%3Byam.platform.request(%7B%26amp%3Bamp%3Bamp%3Blt%3BBR%20%2F%26amp%3Bamp%3Bamp%3Bgt%3Burl%3A%20%26amp%3Bamp%3Bamp%3Bamp%3Bquot%3B%26amp%3Bamp%3Bamp%3Blt%3BA%20href%3D%22https%3A%2F%2Fwww.yammer.com%2Fapi%2Fv1%2Fmessages.json%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%26amp%3Bamp%3Bamp%3Bgt%3Bhttps%3A%2F%2Fwww.yammer.com%2Fapi%2Fv1%2Fmessages.json%26amp%3Bamp%3Bamp%3Blt%3B%2FA%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bquot%3B%2C%26amp%3Bamp%3Bamp%3Blt%3BBR%20%2F%26amp%3Bamp%3Bamp%3Bgt%3Bmethod%3A%20%26amp%3Bamp%3Bamp%3Bamp%3Bquot%3BPOST%26amp%3Bamp%3Bamp%3Bamp%3Bquot%3B%2C%26amp%3Bamp%3Bamp%3Blt%3BBR%20%2F%26amp%3Bamp%3Bamp%3Bgt%3Bdata%3A%20yammerData%2C%26amp%3Bamp%3Bamp%3Blt%3BBR%20%2F%26amp%3Bamp%3Bamp%3Bgt%3Bsuccess%3A%20function(msg)%20%7B%26amp%3Bamp%3Bamp%3Blt%3BBR%20%2F%26amp%3Bamp%3Bamp%3Bgt%3Balert(%26amp%3Bamp%3Bamp%3Bamp%3Bquot%3BPost%20was%20Successful!%26amp%3Bamp%3Bamp%3Bamp%3Bquot%3B)%3B%26amp%3Bamp%3Bamp%3Blt%3BBR%20%2F%26amp%3Bamp%3Bamp%3Bgt%3B%7D%2C%26amp%3Bamp%3Bamp%3Blt%3BBR%20%2F%26amp%3Bamp%3Bamp%3Bgt%3Berror%3A%20function(msg)%20%7B%26amp%3Bamp%3Bamp%3Blt%3BBR%20%2F%26amp%3Bamp%3Bamp%3Bgt%3Balert(JSON.stringify(msg))%3B%26amp%3Bamp%3Bamp%3Blt%3BBR%20%2F%26amp%3Bamp%3Bamp%3Bgt%3B%7D%26amp%3Bamp%3Bamp%3Blt%3BBR%20%2F%26amp%3Bamp%3Bamp%3Bgt%3B%7D)%3B%26amp%3Bamp%3Bamp%3Blt%3BBR%20%2F%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3BBR%20%2F%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3BBR%20%2F%26amp%3Bamp%3Bamp%3Bgt%3B%7D%26amp%3Bamp%3Bamp%3Blt%3BBR%20%2F%26amp%3Bamp%3Bamp%3Bgt%3Bfunction%20post()%26amp%3Bamp%3Bamp%3Blt%3BBR%20%2F%26amp%3Bamp%3Bamp%3Bgt%3B%7B%26amp%3Bamp%3Bamp%3Blt%3BBR%20%2F%26amp%3Bamp%3Bamp%3Bgt%3Balert(%26amp%3Bamp%3Bamp%3Bamp%3Bquot%3Bhi%26amp%3Bamp%3Bamp%3Bamp%3Bquot%3B)%3B%26amp%3Bamp%3Bamp%3Blt%3BBR%20%2F%26amp%3Bamp%3Bamp%3Bgt%3BPostYammerWithNotification(%26amp%3Bamp%3Bamp%3Bamp%3Bquot%3B15317929%26amp%3Bamp%3Bamp%3Bamp%3Bquot%3B%2C%26amp%3Bamp%3Bamp%3Bamp%3Bquot%3Btest%20msg%26amp%3Bamp%3Bamp%3Bamp%3Bquot%3B)%3B%26amp%3Bamp%3Bamp%3Blt%3BBR%20%2F%26amp%3Bamp%3Bamp%3Bgt%3B%7D%26amp%3Bamp%3Bamp%3Blt%3BBR%20%2F%26amp%3Bamp%3Bamp%3Bgt%3B%3C%2FSCRIPT%3E%3CBR%20%2F%3E%3C%2FP%3E%3CDIV%3E%3CBR%20%2F%3E%3CB%3EShare%20an%20Update.%3C%2FB%3E%3CBR%20%2F%3E%3C%2FDIV%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CDIV%3E%26amp%3Bnbsp%3B%3C%2FDIV%3E%3CBR%20%2F%3E%3CDIV%3E%3CBR%20%2F%3E%3CBUTTON%20onclick%3D%22'post()'%22%3EPost%20on%20Yammer!%3C%2FBUTTON%3E%3CBR%20%2F%3E%3C%2FDIV%3E%3CP%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-207931%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EREST%20API%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EYammer%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Occasional Contributor

Dear,

I am using below code to post message in yammer feed for specific group.But getting readystatus as 0 error in my Rest call response.Please suggest.

 {“readyState”:0,“responseText”:“”,“status”:0,“statusText”:“error”} .

 

Code:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script type="text/javascript" src="https://s0.assets-yammer.com/assets/platform_embed.js"></script>
<script type="text/javascript" src="https://c64.assets-yammer.com/assets/platform_js_sdk.js"></script>
<script type="text/javascript">
function PostYammerWithNotification(group_id, message) {

var yammerData;
yammerData = {
group_id: group_id,
body: message
};
// yammerData.cc = "[[user:" + userCC + "]]";

yam.platform.request({
url: "https://www.yammer.com/api/v1/messages.json",
method: "POST",
data: yammerData,
success: function(msg) {
alert("Post was Successful!");
},
error: function(msg) {
alert(JSON.stringify(msg));
}
});


}
function post()
{
alert("hi");
PostYammerWithNotification("15317929","test msg");
}
</script>
<div>
<b>Share an Update.</b>
</div>

<div>&nbsp;</div>
<div>
<button onclick='post()'>Post on Yammer!</button>
</div>

0 Replies