mongodbmeteorrocket.chat

REST-API users.list with the eppn


Since we have some integrations with Rocket.Chat, we do use the API to create, query and subscribe User of a System to the Rocket.Chat. We use the SAML authentication and we work with the eppn parameter.

Before it was easy to search for a user in rocket chat with the eppn, since you could query the eppn with the API users.list.

api/v1/users.list?query={"eppn":"eppn-of-user"}

After I upgraded the Rocket.Chat to the 3.9 Version, I saw that it is not possible to query the eppn with the users.list API.

The structure of User is changed and now the eppn parameter is a child of services.saml. I can query the eppn in the MongoDB like this:

coll.find({'services.saml.eppn': "user-eepn"})

But no way to query the eppn with the API:

api/v1/users.list?query={'services.saml.eppn': "user-eppn"}

{
  "success": false,
  "error": "Invalid query parameter provided: \"{'services.saml.eppn': \"user-eppn\"}\" [error-invalid-query]",
  "errorType": "error-invalid-query",
  "details": {
    "helperMethod": "parseJsonQuery" 
  }
}

Does anyone have an idea about it?

Thank you!


Solution

  • So everyone, I just got the solution to my problem, if any one will have the same problem.

    First of all for the EJSON parse function the query must be written like this:

    api/v1/users.list?query={"services.saml.eppn": "user-eppn"}
    

    But the second problem is that Rocket.Chat doesn't allow a query on the services parameter. It is a problem of permissions, so to query the services parameter and then the eppn parameter, there must be permission given to the User.