Yammer API 问题 - 获取显示错误的组 [英] Yammer API issue - get groups showing error

查看:56
本文介绍了Yammer API 问题 - 获取显示错误的组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在我们的应用程序中集成 yammer 功能(网络前端堆栈和使用 Yammer JS SDK).所以,我想获取登录用户的所有组.

I am integrating yammer features in our app (web-front-end stack and using Yammer JS SDK). So, I want get all the groups of a login-ed user.

为了得到所有的组,我尝试通过两种方式调用端点,/groups.json=mine 使用 SDK> - resposne 显示方法未经授权www.yammer.com/api/v1/groups.json=mine=1 使用普通 ajax GET 请求-抛出访问控制源问题.

Inorder to get all the groups, I have tried to call the end points in two ways, /groups.json=mine using SDK - resposne showing method not authorised and www.yammer.com/api/v1/groups.json=mine=1 using normal ajax GET request- throwing access control origin issue.

API 完美运行,同时使用谷歌浏览器进行测试 - 通过禁用网络安全.

API is perfectly working, while tested using google chrome browser - by disabling web security.

我的问题是如何使用 在没有跨域问题的情况下调用 www.yammer.com/api/v1/API_END_POINTSyammer JS SDK 或任何其他技术?

My question is how I can call www.yammer.com/api/v1/API_END_POINTS without cross origin issue using yammer JS SDK or any other technique?

我在这个 Q & 中找到了相关的答案;A ,但仍然对我显示错误.

I found an related answer in this Q & A , but still showing error for me.

错误:

XMLHttpRequest 无法加载https://www.yammer.com/api/v1/groups.json?mine=1.回应预检请求未通过访问控制检查:否请求中存在Access-Control-Allow-Origin"标头资源.因此不允许来源https://xxx.dev.com"访问.

XMLHttpRequest cannot load https://www.yammer.com/api/v1/groups.json?mine=1. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://xxx.dev.com' is therefore not allowed access.

我在登录代码后尝试的代码:

1# GET 请求 - return $http.get('https://www.yammer.com/api/v1/groups.json?mine=1')

1# GET Request - return $http.get('https://www.yammer.com/api/v1/groups.json?mine=1')

2# yammer JS SDK -

2# yammer JS SDK -

yam.platform.request({
        url: "groups.json?mine=1",
        method: "GET",
        success: function (group) {
          console.log(group);
        },

        error: function (group) {
          console.error("There was an error with the request.", group);
        }
      });

我已经评论了不同的Q&至于意见,但没有运气,没有人回复.

I have already commented different Q&As for the opinion, but no luck, no one replied.

PS - 我的所有其他 yammer API 都在工作(登录、发布、消息等),在 Yammer REST API 文档中列出,只有我遇到了 www.yammer.com/api/v1 中托管的 API 的问题不是 api.yammer.com

PS - My all other yammer APIs are working(login, post, message etc), which listed in Yammer REST API Docs, only I am facing problem with APIs hosted in wwww.yammer.com/api/v1, Not api.yammer.com

提前致谢

推荐答案

您应该在 Yammer 开发控制台中注册一个应用程序,指定允许的来源,获取 API 密钥并将其与请求一起发送.

You should register an App in Yammer dev console, specify allowed origins, get an API key and send it along with request.

参见 https://developer.yammer.com/docs/api-requests 了解更多信息.

See https://developer.yammer.com/docs/api-requests for more info.

这篇关于Yammer API 问题 - 获取显示错误的组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆