SOLVED

Can I edit a Yammer message via the REST API?

%3CLINGO-SUB%20id%3D%22lingo-sub-84927%22%20slang%3D%22en-US%22%3ECan%20I%20edit%20a%20Yammer%20message%20via%20the%20REST%20API%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-84927%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20code%20that%20can%20post%20and%20delete%20messages%20via%20the%20rest%20API.%20%26nbsp%3BNow%20that%20Yammer%20allows%20editing%20of%20posts%2C%20I%20would%20like%20to%20update%20posts%20via%20the%20REST%20API%20as%20well.%20%26nbsp%3BIs%20this%20possible%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20haven't%20seen%20any%20documentation%20and%20I%20can't%20get%20it%20to%20work%20yet.%20I%20have%20seen%20via%20Fiddler%20that%20the%20UI%20does%20a%20REST%20call%20such%20as%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3EPATCH%20https%3A%2F%2Fwww.yammer.com%2Fapi%2Fv2%2Fmessages%2F%26lt%3Bmessageid%26gt%3B%0AAuthorization%3A%20Bearer%20%26lt%3Btoken%26gt%3B%0AAccept%3A%20application%2Fjson%2C%20text%2Fjavascript%2C%20*%2F*%3B%20q%3D0.01%0A(other%20headers)%0A%0A%7B%22body%22%3A%22%26lt%3Bsimple%20body%20text%26gt%3B%22%2C%22recipients%22%3A%5B%5D%2C%22references%22%3A%7B%22ogos%22%3A%5B%5D%7D%7D%3C%2FPRE%3E%3CP%3EIf%20I%20try%20this%20manually%20via%20Postman%20I%20get%20a%20404.%20%26nbsp%3BIs%20this%20because%20it%20isn't%20supported%20via%20the%20REST%20API%20or%20do%20I%20just%20need%20to%20work%20more%20on%20getting%20the%20headers%2Fbody%20correct%3F%20%26nbsp%3BI%20realize%20that%20the%20UI%20is%20providing%20several%20headers%20values%20in%20addition%20to%20Authorization%20that%20may%20%22authorize%22%20the%20request%20like%20cookies%2C%20browser-token%2C%20oauth_token%2C%20and%20_session%2C%20but%20I%20know%20that%20my%20simple%20POST%2FDELETE%20calls%20can%20get%20by%20with%20just%20the%20Authorization%20header.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-84927%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%3CLINGO-SUB%20id%3D%22lingo-sub-252615%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20I%20edit%20a%20Yammer%20message%20via%20the%20REST%20API%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-252615%22%20slang%3D%22en-US%22%3EThank%20you%20very%20much%20for%20the%20code%20!!!%20How%20do%20you%20manage%20the%20login%20%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-252303%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20I%20edit%20a%20Yammer%20message%20via%20the%20REST%20API%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-252303%22%20slang%3D%22en-US%22%3E%3CP%3EThere%20you%20go%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETo%20add%20a%20comment%20%3A%3C%2FP%3E%3CPRE%3Efunction%20addComment()%20%7B%3CBR%20%2F%3E%20%20%20yam.platform.request(%7B%3CBR%20%2F%3E%20%20%20%20%20%20url%3A%20%22https%3A%2F%2Fapi.yammer.com%2Fapi%2Fv1%2Fmessages.json%22%2C%3CBR%20%2F%3E%20%20%20%20%20%20method%3A%20%22POST%22%2C%3CBR%20%2F%3E%20%20%20%20%20%20data%3A%20%7B%3CBR%20%2F%3E%20%20%20%20%20%20%20%20%20%22body%22%20%3A%20%22Commment%20Content%22%2C%3CBR%20%2F%3E%20%20%20%20%20%20%20%20%20%22group_id%22%3A%20%22GroupID%22%2C%3CBR%20%2F%3E%20%20%20%20%20%20%20%20%20%22replied_to_id%22%3A%20%22commentID%22%2C%3CBR%20%2F%3E%20%20%20%20%20%20%20%20%20%22og_url%22%3A%20%22URL%20of%20current%20page%22%2C%3CBR%20%2F%3E%20%20%20%20%20%20%20%20%20%22og_title%22%3A%20%22Title%20of%20the%20Open-Graph%20Object%22%2C%3CBR%20%2F%3E%20%20%20%20%20%20%20%20%20%22og_description%22%3A%20%22OGO%20description%22%2C%3CBR%20%2F%3E%20%20%20%20%20%20%20%20%20%22og_private%22%3A%20%22true%22%3CBR%20%2F%3E%20%20%20%20%20%20%7D%2C%3CBR%20%2F%3E%20%20%20%20%20%20success%3A%20function%20(res)%20%7B%20%2F%2Fprint%20message%20response%20information%20to%20the%20console%3CBR%20%2F%3E%20%20%20%20%20%20%20%20%20alert(%22The%20request%20was%20successful.%22)%3B%3CBR%20%2F%3E%20%20%20%20%20%20%20%20%20console.dir(res)%3B%3CBR%20%2F%3E%20%20%20%20%20%20%7D%2C%3CBR%20%2F%3E%20%20%20%20%20%20error%3A%20function%20(res)%20%7B%3CBR%20%2F%3E%20%20%20%20%20%20%20%20%20alert(%22There%20was%20an%20error%20with%20the%20request.%22)%3B%3CBR%20%2F%3E%20%20%20%20%20%20%20%20%20console.log(res)%3CBR%20%2F%3E%20%20%20%20%20%20%7D%3CBR%20%2F%3E%20%20%20%7D)%3CBR%20%2F%3E%7D%3C%2FPRE%3E%3CP%3EAll%20the%20parameters%20starting%20with%22og_%22%20are%20to%20create%20an%20open%20graph%20object%20which%20links%20the%20comment%20with%20a%20page.%20If%20you%20don't%20want%20one%2C%20just%20don't%20use%20any%20of%20the%20%22og_%22%20fields.%20Also%2C%20you%20can%20post%20directly%20to%20a%20group%20by%20using%20%22group_id%22.%20If%20the%20group%20is%20set%20to%20private%20and%20you%20want%20the%20OGO%20to%20also%20be%20private%2C%20set%20true%20to%20%22og_private%22.%3C%2FP%3E%3CP%3EAnd%20if%20your%20comment%20is%20a%20reply%20to%20an%20other%20comment%2C%20get%20that%20first%20comment%20id%2C%20then%20use%20%22replied_to_id%22.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETo%20delete%20comments%20%3A%3C%2FP%3E%3CPRE%3Efunction%20deleteComment(id)%7B%3CBR%20%2F%3E%20%20%20yam.platform.request(%7B%3CBR%20%2F%3E%20%20%20%20%20%20url%3A%20%22https%3A%2F%2Fapi.yammer.com%2Fapi%2Fv1%2Fmessages%2F%22%2Bid%2C%3CBR%20%2F%3E%20%20%20%20%20%20method%3A%20%22DELETE%22%2C%3CBR%20%2F%3E%20%20%20%20%20%20success%3A%20function%20(res)%20%7B%20%2F%2Fprint%20message%20response%20information%20to%20the%20console%3CBR%20%2F%3E%20%20%20%20%20%20%20%20%20alert(%22The%20request%20was%20successful.%22)%3B%3CBR%20%2F%3E%20%20%20%20%20%20%20%20%20console.dir(res)%3B%3CBR%20%2F%3E%20%20%20%20%20%20%7D%2C%3CBR%20%2F%3E%20%20%20%20%20%20error%3A%20function%20(res)%20%7B%3CBR%20%2F%3E%20%20%20%20%20%20%20%20%20alert(%22There%20was%20an%20error%20with%20the%20request.%22)%3B%3CBR%20%2F%3E%20%20%20%20%20%20%20%20%20console.log(res)%3CBR%20%2F%3E%20%20%20%20%20%20%7D%3CBR%20%2F%3E%20%20%20%7D)%3CBR%20%2F%3E%7D%3C%2FPRE%3E%3CP%3EIt%20is%20very%20straightforward.%20Pass%20the%20id%20of%20the%20comment%20you%20want%20to%20delete%20and%20there%20you%20go!%20In%20case%20of%20success%2C%20the%20%22console.dir(res)%3B%22%20command%20should%20return%20nothing%2C%20because%20the%20object%20would%20be%20deleted.%20But%20you%20can%20do%20w%2Fe%20you%20want%20in%20the%20success%20and%20error%20sections.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-251893%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20I%20edit%20a%20Yammer%20message%20via%20the%20REST%20API%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-251893%22%20slang%3D%22en-US%22%3EDo%20you%20succeed%20in%20posting%20and%20deleting%20messages%20via%20API%20%3F%20If%20yes%20would%20it%20be%20possible%20to%20share%20the%20code%20%3F%3CBR%20%2F%3Ethanks%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-251875%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20I%20edit%20a%20Yammer%20message%20via%20the%20REST%20API%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-251875%22%20slang%3D%22en-US%22%3E%3CP%3EI%20would%20also%20really%20like%20to%20know%20how%20you%20implemented%20your%20edit%20solution.%3C%2FP%3E%3CPRE%3E%26nbsp%3Bfunction%20editComment(id)%20%7B%3CBR%20%2F%3E%20%20%20%20yam.platform.request(%7B%3CBR%20%2F%3E%20%20%20%20%20%20%20url%3A%20%22https%3A%2F%2Fapi.yammer.com%2Fapi%2Fv2%2Fmessages%2F%22%2Bid%2C%3CBR%20%2F%3E%20%20%20%20%20%20%20method%3A%20%22PATCH%22%2C%3CBR%20%2F%3E%20%20%20%20%20%20%20data%3A%20%7B%3CBR%20%2F%3E%20%20%20%20%20%20%20%20%20%20%22body%22%20%3A%20%22Edited%20comment%22%3CBR%20%2F%3E%20%20%20%20%20%20%20%7D%2C%3CBR%20%2F%3E%20%20%20%20%20%20%20success%3A%20function%20(res)%20%7B%20%2F%2Fprint%20message%20response%20information%20to%20the%20console%3CBR%20%2F%3E%20%20%20%20%20%20%20%20%20%20alert(%22The%20request%20was%20successful.%22)%3B%3CBR%20%2F%3E%20%20%20%20%20%20%20%20%20%20console.dir(res)%3B%3CBR%20%2F%3E%20%20%20%20%20%20%20%7D%2C%3CBR%20%2F%3E%20%20%20%20%20%20%20error%3A%20function%20(res)%20%7B%3CBR%20%2F%3E%20%20%20%20%20%20%20%20%20%20alert(%22There%20was%20an%20error%20with%20the%20request.%22)%3B%3CBR%20%2F%3E%20%20%20%20%20%20%20%20%20%20console.log(res)%3CBR%20%2F%3E%20%20%20%20%20%20%20%7D%3CBR%20%2F%3E%20%20%20%20%7D)%3CBR%20%2F%3E%7D%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20using%20%22%3CA%20href%3D%22https%3A%2F%2Fapi.yammer.com%2Fapi%2Fv2%2Fmessages%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fapi.yammer.com%2Fapi%2Fv2%2Fmessages%2F%3C%2FA%3E%22%2C%20I%20get%202%20errors.%20First%2C%20503%20(Service%20Unavailable)%20and%20a%20%22Response%20to%20preflight%20request%20doesn't%20pass%20access%20control%20check%3A%20No%20'Access-Control-Allow-Origin'%20header%20is%20present%20on%20the%20requested%20resource.%22%20error.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBut%20when%20I%20use%20%22%3CA%20href%3D%22https%3A%2F%2Fwww.yammer.com%2Fapi%2Fv2%2Fmessages%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.yammer.com%2Fapi%2Fv2%2Fmessages%2F%3C%2FA%3E%22%2C%20I%20don't%20get%20the%20503%20error%2C%20only%20the%20cross%20domain%20one.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20is%20strange%2C%20because%20I%20can%20get%20messages%20from%20Open%20Graph%20Objects%20(OGO)%2C%20post%20comments%20and%20replies%20and%20create%20OGO%20at%20the%20same%20time.%20I%20don't%20know%20why%20I%20get%20this%20cross%20domain%20error%20only%20with%20this%20endpoint.%3CBR%20%2F%3E%3CBR%20%2F%3EAm%20I%20doing%20it%20all%20wrong%3F%20Because%20it%20works%20for%20everything%20else.%26nbsp%3B%3C%2FP%3E%3CP%3EI%20also%20know%20that%20officially%2C%20there%20is%20no%20endpoint%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-251590%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20I%20edit%20a%20Yammer%20message%20via%20the%20REST%20API%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-251590%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3EI%20am%20evaluating%20Yammer%20for%20my%20company%20need%2C%20any%20chance%20to%20share%20the%20code%20you've%20developed%20to%20post%20and%20delete%20via%20API%20%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ethanks%3C%2FP%3E%3CP%3EAlberto%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-203171%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20I%20edit%20a%20Yammer%20message%20via%20the%20REST%20API%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-203171%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%26nbsp%3B%3C%2FP%3E%3CP%3EBy%20any%20chance%2C%20is%20there%20any%20information%20about%20REST%20api%20for%20edit%20comments%20functionality%20%3F.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%2C%3C%2FP%3E%3CP%3EGuru%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-98304%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20I%20edit%20a%20Yammer%20message%20via%20the%20REST%20API%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-98304%22%20slang%3D%22en-US%22%3EThe%20edit%20REST%20API%20call%20through%20PATCH%20works%20even%20now%3F%2C%20I%20tried%20PATCH%20for%20edit%20post%2C%20i%20am%20getting%20404.%3CBR%20%2F%3E%3CBR%20%2F%3EPATCH%20%3CA%20href%3D%22https%3A%2F%2Fapi.yammer.com%2Fapi%2Fv1%2Fmessages%2F939539391%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fapi.yammer.com%2Fapi%2Fv1%2Fmessages%2F939539391%3C%2FA%3E%20404%20(Not%20Found)%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-86809%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20I%20edit%20a%20Yammer%20message%20via%20the%20REST%20API%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-86809%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%3EDocumented%20in%20a%20dev%20blog%20post%20%5B1%5D%2C%20there%20isn't%20a%20supported%20endpoint%20for%20editing%20posts.%20The%20endpoint%20you%20found%20is%20undocumented%2C%26nbsp%3Band%20therefore%20might%20change%20at%20any%20point%20without%20notice.%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E1-%26nbsp%3B%3C%2FSPAN%3E%3CA%20class%3D%22linkified%22%20title%3D%22https%3A%2F%2Fdeveloper.yammer.com%2Fblog%2Fedit-posts-whats-changing-whats-staying-the-same%22%20href%3D%22https%3A%2F%2Fdeveloper.yammer.com%2Fblog%2Fedit-posts-whats-changing-whats-staying-the-same%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdeveloper.yammer.com%2Fblog%2Fedit-posts-whats-changing-whats-staying-the-same%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-84932%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20I%20edit%20a%20Yammer%20message%20via%20the%20REST%20API%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-84932%22%20slang%3D%22en-US%22%3E%3CP%3EWell%2C%20I%20posted%20too%20soon.%20%26nbsp%3BI%20figured%20it%20out.%20%26nbsp%3BI%20somehow%20had%20a%20typo%20in%20the%20URL%20and%20was%20posting%20to%20v1%2Fmessages%20instead%20of%20v2%2Fmessages.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-844146%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20I%20edit%20a%20Yammer%20message%20via%20the%20REST%20API%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-844146%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F191599%22%20target%3D%22_blank%22%3E%40Charles%20Pauze-Robert%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESame%20issue%20here%2C%20about%20almost%20an%20year%2C%20and%20the%20same%20error%20persists%2C%20did%20you%20figured%20out%20any%20solution%20to%20editing%20a%20message%20via%20API%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAnalising%20the%20Yammer%20with%20the%20fiddler%20i%20saw%20that%20yammer%20uses%20an%20version%202%20of%20the%20api%3C%2FP%3E%3CP%20class%3D%22p1%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20class%3D%22p1%22%3EPUT%20%3CA%20href%3D%22https%3A%2F%2Fwww.yammer.com%2Fapi%2Fv2%2Fmessages%2F315992380751872%2520HTTP%2F1.1%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.yammer.com%2Fapi%2Fv2%2Fmessages%2F%20HTTP%2F1.1%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eand%20send%20the%20data%20in%20JSON%20format%20as%20follows%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-javascript%22%3E%3CCODE%3E%7B%22content_state%22%3A%7B%22blocks%22%3A%5B%7B%22key%22%3A%220%22%2C%22text%22%3A%22reply%20reply%22%2C%22type%22%3A%22unstyled%22%2C%22depth%22%3A0%2C%22inlineStyleRanges%22%3A%5B%5D%2C%22entityRanges%22%3A%5B%5D%2C%22data%22%3A%7B%7D%7D%5D%2C%22entityMap%22%3A%7B%7D%7D%2C%22recipients%22%3A%5B%5D%2C%22references%22%3A%7B%22ogos%22%3A%5B%5D%7D%7D%0A%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EBut%20i%20cannot%20replicate%20this%20behavior%20on%20my%20WebPart%20(yes%2C%20I%20using%20SPFx%20framework%20to%20implement%20a%20webpart%20that%20perform%20some%20integration%20with%20Yammer)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBest%20Regards%3C%2FP%3E%3CP%3ESergio.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1406120%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20I%20edit%20a%20Yammer%20message%20via%20the%20REST%20API%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1406120%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F191599%22%20target%3D%22_blank%22%3E%40Charles%20Pauze-Robert%3C%2FA%3E%26nbsp%3B%26nbsp%3B%3CSPAN%3EI%20tried%20your%20code%20using%20%22PATCH%22%20but%20its%20not%20working%20for%20me%20and%20giving%20the%20same%20error%20which%20you%20were%20facing%20.%26nbsp%3BDo%20you%20succeed%20in%20editing%20messages%20via%20API%20%3F%20If%20yes%20would%20it%20be%20possible%20to%20share%20the%20code%20or%20some%20more%20hints%20%3F%20%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3Ethanks%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

I have code that can post and delete messages via the rest API.  Now that Yammer allows editing of posts, I would like to update posts via the REST API as well.  Is this possible?

 

I haven't seen any documentation and I can't get it to work yet. I have seen via Fiddler that the UI does a REST call such as:

 

 

PATCH https://www.yammer.com/api/v2/messages/<messageid>
Authorization: Bearer <token>
Accept: application/json, text/javascript, */*; q=0.01
(other headers)

{"body":"<simple body text>","recipients":[],"references":{"ogos":[]}}

If I try this manually via Postman I get a 404.  Is this because it isn't supported via the REST API or do I just need to work more on getting the headers/body correct?  I realize that the UI is providing several headers values in addition to Authorization that may "authorize" the request like cookies, browser-token, oauth_token, and _session, but I know that my simple POST/DELETE calls can get by with just the Authorization header.

11 Replies

Well, I posted too soon.  I figured it out.  I somehow had a typo in the URL and was posting to v1/messages instead of v2/messages.

Documented in a dev blog post [1], there isn't a supported endpoint for editing posts. The endpoint you found is undocumented, and therefore might change at any point without notice.
1- https://developer.yammer.com/blog/edit-posts-whats-changing-whats-staying-the-same

The edit REST API call through PATCH works even now?, I tried PATCH for edit post, i am getting 404.

PATCH https://api.yammer.com/api/v1/messages/939539391 404 (Not Found)

Hi, 

By any chance, is there any information about REST api for edit comments functionality ?.

 

Thanks,

Guru

Hi,

I am evaluating Yammer for my company need, any chance to share the code you've developed to post and delete via API ?

 

thanks

Alberto

I would also really like to know how you implemented your edit solution.

 function editComment(id) {
yam.platform.request({
url: "https://api.yammer.com/api/v2/messages/"+id,
method: "PATCH",
data: {
"body" : "Edited comment"
},
success: function (res) { //print message response information to the console
alert("The request was successful.");
console.dir(res);
},
error: function (res) {
alert("There was an error with the request.");
console.log(res)
}
})
}

 

When using "https://api.yammer.com/api/v2/messages/", I get 2 errors. First, 503 (Service Unavailable) and a "Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource." error.

 

But when I use "https://www.yammer.com/api/v2/messages/", I don't get the 503 error, only the cross domain one.

 

This is strange, because I can get messages from Open Graph Objects (OGO), post comments and replies and create OGO at the same time. I don't know why I get this cross domain error only with this endpoint.

Am I doing it all wrong? Because it works for everything else. 

I also know that officially, there is no endpoint

Do you succeed in posting and deleting messages via API ? If yes would it be possible to share the code ?
thanks
Best Response confirmed by Kirk Liemohn (Occasional Contributor)
Solution

There you go

 

To add a comment :

function addComment() {
yam.platform.request({
url: "https://api.yammer.com/api/v1/messages.json",
method: "POST",
data: {
"body" : "Commment Content",
"group_id": "GroupID",
"replied_to_id": "commentID",
"og_url": "URL of current page",
"og_title": "Title of the Open-Graph Object",
"og_description": "OGO description",
"og_private": "true"
},
success: function (res) { //print message response information to the console
alert("The request was successful.");
console.dir(res);
},
error: function (res) {
alert("There was an error with the request.");
console.log(res)
}
})
}

All the parameters starting with"og_" are to create an open graph object which links the comment with a page. If you don't want one, just don't use any of the "og_" fields. Also, you can post directly to a group by using "group_id". If the group is set to private and you want the OGO to also be private, set true to "og_private".

And if your comment is a reply to an other comment, get that first comment id, then use "replied_to_id".

 

 

To delete comments :

function deleteComment(id){
yam.platform.request({
url: "https://api.yammer.com/api/v1/messages/"+id,
method: "DELETE",
success: function (res) { //print message response information to the console
alert("The request was successful.");
console.dir(res);
},
error: function (res) {
alert("There was an error with the request.");
console.log(res)
}
})
}

It is very straightforward. Pass the id of the comment you want to delete and there you go! In case of success, the "console.dir(res);" command should return nothing, because the object would be deleted. But you can do w/e you want in the success and error sections.

Thank you very much for the code !!! How do you manage the login ?

@Charles Pauze-Robert 

 

Same issue here, about almost an year, and the same error persists, did you figured out any solution to editing a message via API?

 

Analising the Yammer with the fiddler i saw that yammer uses an version 2 of the api

 

PUT https://www.yammer.com/api/v2/messages/ HTTP/1.1

 

and send the data in JSON format as follows:

 

{"content_state":{"blocks":[{"key":"0","text":"reply reply","type":"unstyled","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}}],"entityMap":{}},"recipients":[],"references":{"ogos":[]}}

But i cannot replicate this behavior on my WebPart (yes, I using SPFx framework to implement a webpart that perform some integration with Yammer)

 

Best Regards

Sergio.

@Charles Pauze-Robert  I tried your code using "PATCH" but its not working for me and giving the same error which you were facing . Do you succeed in editing messages via API ? If yes would it be possible to share the code or some more hints ?
thanks