REST 查询以从解析服务器获取特定用户的所有角色 [英] REST query to get all roles for particular user from parse server

查看:48
本文介绍了REST 查询以从解析服务器获取特定用户的所有角色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何创建 REST 查询以获取分配给用户的所有角色?

How to create a REST query to get all roles assigned to a user?

由于这是相反方向的多对多关系,常规的 $relatedTo 运算符似乎还不够......

As this is many to many relation in the opposite direction the regular $relatedTo operator seems to be not enough...

推荐答案

最后我找到了似乎比我害怕的要容易得多的解决方案 :) 因为我在 SO 和 github 上发现了类似的问题,我希望它能帮助别人.

finally I found the solution which seems to be much easier than I was afraid of :) As I found similar questions on SO and github I hope it will help others.

用于获取直接分配给用户的所有角色的 curl 查询是:

the curl query to get all the roles directly assigned to a user is:

curl -X GET \
  -H "X-Parse-Application-Id: ${APPLICATION_ID}" \
  -H "X-Parse-REST-API-Key: ${REST_API_KEY}" \
  https://parseapi.back4app.com/roles \
  --data-urlencode \
  'where={"users":{"__type":"Pointer","className":"_User","objectId":"<objectId>"}}'

这篇关于REST 查询以从解析服务器获取特定用户的所有角色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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