How can I find a user's username by searching with their email address using the Confluence API?

huangapple go评论55阅读模式
英文:

How can I find a user's username by searching with their email address using the Confluence API?

问题

I have a user's email address. I am trying to find their Confluence username.

我有用户的电子邮件地址。我正在尝试找到他们的Confluence用户名。

I have tried https://confluence.example.com/rest/api/user?username=someone@example.com but it returns an error.

我尝试过https://confluence.example.com/rest/api/user?username=someone@example.com,但返回错误。

If it matters, we have an internally hosted Data Center instance.

如果有关系的话,我们有一个内部托管的Data Center实例。

{"statusCode":404,"data":{"authorized":false,"valid":true,"allowedInReadOnlyMode":true,"errors":[],"successful":false},"message":"No user found with key : null","reason":"Not Found"}
{"statusCode":404,"data":{"authorized":false,"valid":true,"allowedInReadOnlyMode":true,"errors":[],"successful":false},"message":"找不到具有键值:null的用户","reason":"未找到"}
英文:

I have a user's email address. I am trying to find their Confluence username.

I have tried https://confluence.example.com/rest/api/user?username=someone@example.com but it returns an error.

If it matters, we have an internally hosted Data Center instance.

{"statusCode":404,"data":{"authorized":false,"valid":true,"allowedInReadOnlyMode":true,"errors":[],"successful":false},"message":"No user found with key : null","reason":"Not Found"}

答案1

得分: 1

通过REST API,只能通过键(key)或用户名(username)来查找用户,无法通过电子邮件查找用户:

  • 通过用户名查找用户的示例链接:http://example.com/confluence/rest/api/user?username=jblogs
  • 通过键查找用户的示例链接:http://example.com/confluence/rest/api/user?key=402880824ff933a4014ff9345d7c0002

因此,如果您有用户名或键,可以使用这些端点获取数据。如果您有电子邮件地址,可以通过迭代端点来获取这些用户并检索所需的数据。

英文:

It is not possible to look for a user by mail via REST API, only by key or username:

http://example.com/confluence/rest/api/user?username=jblogs
http://example.com/confluence/rest/api/user?key=402880824ff933a4014ff9345d7c0002

So if you have user name or key you can use this endpoint and then get data from this, or if you have emails, you can get these users and retrieve necessary data by ierating the endpoint

huangapple
  • 本文由 发表于 2023年4月20日 10:44:34
  • 转载请务必保留本文链接:https://go.coder-hub.com/76060146.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定