仅对某些API调用出现Yammer CORS错误 [英] Yammer CORS error appears only for some API calls
问题描述
当我使用yammer API请求数据有时我得到hte数据,而有时我得到错误说
When I request the data using yammer API sometimes I get hte data while sometimes I get error saying
跨原始请求被阻止:同源策略不允许读取远程资源,网址为https://www.yammer.com/api/v1/topics/4990456.json?&_=1409122520954。这可以通过将资源移动到相同的域或启用CORS来修复。
当我尝试URL: https ://www.yammer.com/api/v1/topics/4990456.json
获取主题编号4990456的消息,我在控制台日志中得到上述错误。
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.
同样,当我尝试URL: https://www.yammer.com/api/v1/messages/about_topic/
时,我再次获得上面提到的控制台日志中的错误。
Similarly, when I try URL : https://www.yammer.com/api/v1/messages/about_topic/
, I again get the above mentioned error in console log.
但是,从同一个网页,相同的域,相同的代码,如果我请求 https:// api .yammer.com / api / v1 / messages / my_feed.json
,我得到回复。
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 ?
推荐答案
我认为答案在于域名。
www .yammer.com和 api .yammer.com被视为两个不同的网域!
www.yammer.com and api.yammer.com are treated as two different domains!
t尝试了,但我认为这是一个非常安全的猜测, api .yammer.com也将为您的前两个请求工作。
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.
这篇关于仅对某些API调用出现Yammer CORS错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!