当用户名包含句点时,无法从yammer API获取用户详细信息 [英] Unable to get user details from yammer API when user name contains period

查看:102
本文介绍了当用户名包含句点时,无法从yammer API获取用户详细信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我在使用Yammer REST API访问用户详细信息时遇到了一个特殊问题。



我正在使用以下端点来访问用户详细信息



https://api.yammer.com/api/v1/oauth/tokens。 json?user_id = USERNAME& consumer_key = CONSUMERTOKEN



问题是用户名不包含句点。 (像johns)API工作正常并且没有给出任何错误,但是当用户名包含句点(john.s)时,API会给出错误的HTTP 400错误请求。



我发送请求如



https://api.yammer.com/api/v1/oauth/tokens.json?user_id=john .s& consumer_key = CONSUMERTOKEN



我错过了什么。我正在使用邮递员来测试API并尝试使用C#代码来获得结果,但结果却出现了同样的问题(HTTP 400 Bad request)。



< b>我尝试了什么:



我用postman来测试API端点。当用户名不包含句点(。)但当用户名包含句点(。)时,一切都很好。端点响应是HTTP 400 Bad Request

Hi All,

I'm facing a peculiar problem while accessing user details using Yammer REST API.

I'm using the following endpoint to access the user details

https://api.yammer.com/api/v1/oauth/tokens.json?user_id=USERNAME&consumer_key=CONSUMERTOKEN

The problem is when the user name does not contains a period "." (like johns) the API is working fine and not giving any error, but when the user name contains a period (john.s) the API is giving error HTTP 400 bad request.

I'm sending the request like

https://api.yammer.com/api/v1/oauth/tokens.json?user_id=john.s&consumer_key=CONSUMERTOKEN

Am I missing something. I'm using postman to test the API and also tried with C# code to get the result, but ended with a same problem (HTTP 400 Bad request).

What I have tried:

I've used postman to test the API endpoint. Everything is fine when the user name does not contains a period (".") but when the user name contains period (".") the endpoint response is HTTP 400 Bad Request

推荐答案

这个问题应该由Yammer提出,而不是一些不支持它的第三方网站。
This question should be brought up with Yammer, not some 3rd party website that doesn't support it.


引用:

我发送请求如



https://api.yammer.com/api/v1/oauth/tokens.json ?user_id = john.s& consumer_key = CONSUMERTOKEN

I'm sending the request like

https://api.yammer.com/api/v1/oauth/tokens.json?user_id=john.s&consumer_key=CONSUMERTOKEN



您需要对QueryString进行URL编码。请阅读: WebUtility.UrlEncode Method(String) (System.Net) [ ^ ]



更新:查看Yammer API文档,OAuth 1.0 a不受支持。您需要使用OAuth 2.0。 REF: OAuth 2:Server&客户端流程·Yammer开发人员网站 [ ^ ]




You need to URL encode your QueryString. Please read this: WebUtility.UrlEncode Method (String) (System.Net)[^]

UPDATE: Looking at the Yammer API documentation, OAuth 1.0a is not supported. You need to use OAuth 2.0. REF: OAuth 2: Server & Client-Side Flow · Yammer Developer Site[^]

Quote:

https://www.yammer.com/oauth2/authorize?client_id= [:CLIENT_ID]&安培; response_type = code& redirect_uri = [:redirect_uri] [ ^ ]


这篇关于当用户名包含句点时,无法从yammer API获取用户详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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