Yammer CORS error appears only for some API calls

馋奶兔 提交于 2019-12-10 17:06:52

问题


When I request the data using yammer API sometimes I get hte data while sometimes I get error saying

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://www.yammer.com/api/v1/topics/4990456.json?&_=1409122520954. This can be fixed by moving the resource to the same domain or enabling CORS.

When I try URL : https://www.yammer.com/api/v1/topics/4990456.json to get messages for topic number 4990456, I get the above mentioned error in console log.

Similarly, when I try URL : https://www.yammer.com/api/v1/messages/about_topic/ , I again get the above mentioned error in console log.

However, from the same page, same domain, same code, if I request https://api.yammer.com/api/v1/messages/my_feed.json , I get response back.

Can someone please explain this discrepancy ? Is this the correct way to get the messages in a topic ?


回答1:


I think the answer is in the domain name.

www.yammer.com and api.yammer.com are treated as two different domains!

I haven't tried it but I think it is a pretty safe guess that api.yammer.com will work for your first two requests too.



来源:https://stackoverflow.com/questions/25520775/yammer-cors-error-appears-only-for-some-api-calls

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!