Wazuh4.3 API发送了一个修改角色的POST请求时出现错误。

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

Wazuh4.3 Api sent a post request to modify the role error

问题

使用Wazuh4.3 API进行POST请求修改用户角色时返回缺失的查询参数'role to me_ Ids,请问你能告诉我如何解决吗?

我已经查看了官方的最新文档,但没有找到解决方案。在搜索引擎上关于最新版本的信息非常有限。

英文:

I am using the Wazuh4.3 API to modify the user role using a post request, but return the Missing query parameter 'role to me_ Ids, could you please tell me how to solve it

I have checked the official latest documentation, but I have not found a solution. There is very little information on the latest version on the search engine.

答案1

得分: 1

以下是已经翻译好的部分:

你可以通过以下方式切换用户所属的角色:

例如:
你可以按照以下方式列出当前用户(ID、名称和角色)和角色:这是最新版本的完整API参考,如果你觉得有用的话:

英文:

You should be able to switch the role a user belongs to in this way:

# Unassign previous role (optional)
curl -k -X DELETE "https://localhost:55000/security/users/<USER_ID>/roles?role_ids=<ROLE_ID>" -H  "Authorization: Bearer $TOKEN"

# Assign new role
curl -k -X POST "https://localhost:55000/security/users/<USER_ID>/roles?role_ids=<NEW_ROLE_ID>" -H  "Authorization: Bearer $TOKEN"

For example:

# Unassign previous role (optional)
curl -k -X DELETE "https://localhost:55000/security/users/100/roles?role_ids=100" -H  "Authorization: Bearer $TOKEN"

# Assign new role
curl -k -X POST "https://localhost:55000/security/users/100/roles?role_ids=101" -H  "Authorization: Bearer $TOKEN"

You can list the current users (id, name and roles) and roles like this:

# List users
curl -k -X GET "https://localhost:55000/security/users?pretty=True" -H  "Authorization: Bearer $TOKEN"
# List roles
curl -k -X GET "https://localhost:55000/security/roles?pretty=True" -H  "Authorization: Bearer $TOKEN"

Here is the full API reference for the latest version, in case you find it useful:

huangapple
  • 本文由 发表于 2023年3月23日 12:06:23
  • 转载请务必保留本文链接:https://go.coder-hub.com/75819173.html
匿名

发表评论

匿名网友

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

确定