How get full name of supervisors for a given workspace (without admin credentials)?

TL;DR

I’d like to get the full name for supervisors who are working in a particular workspace.

If I’m reading the the API docs correctly this is:

  • Not possible with REST. The user endpoints only return the login.
  • Possible with GraphQL, but appears to require an admin account.

Did I miss anything? Is there a way to achieve what I want (without admin credentials)?

Cannot with REST

The GET /api/v1/supervisors endpoint returns the login name in UserName. See return values below.

The other user endpoints provide similar information.

{
  "Users": [
    {
      "IsLocked": true,
      "CreationDate": "2022-07-01T19:01:31.366Z",
      "Email": "string",
      "DeviceId": "string",
      "UserId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "UserName": "string"
    }
  ],
  "Order": "string",
  "Limit": 0,
  "TotalCount": 0,
  "Offset": 0
}

Cannot with GraphQL

There are three problems with the GraphQL endpoint:

  1. No workspace clause
  2. Not allowed to filter by workspace in where clause
  3. Only accessible to admin users

No workspace clause

From the current schema:

Not allowed to filter by workspace in where clause

From the schema:

While all filter inputs are not visible, rest assured that workspace is not part of it.

Only accessible to admin users

If one tries with a regular API user, one gets an error. See below.

Only if one makes a request with an admin user, who can see resources outside the scope of a workspace (like users), can one can one get a non-error return. See below.

Questions

  • Did I miss something? Is there a way to do what I want (without using an admin user’s credentials)?
  • Would it be easy to modify the GraphQL schema (and resolvers) to allow an API user to get details for users operating within a defined workspace scope?
  • (Bonus question: if we’re changing this endpoint, would it be possible to add a supervisorName field :wink: ?)

Your susoapi package’s get_supervisors function does just this. I returns all supervisor attributes including FullName. I am sure admin credentials aren’t involved.

D’oh! You’re exactly right.

Looking the REST API documentation, I didn’t see this is an attribute returned for supervisors. (Also, on my testing server, I don’t have the full name filled, and hence didn’t get this attribute returned during earlier testing.) However, if a supervisor has Fullname provided, that attribute will indeed be returned by the GET /api/v1/supervisors.

But that raises the question: is this a bug or a feature of this endpoint? If a bug, it’s a but I like. :wink: If it’s a feature, then it’s not documented.

Thanks, Sergiy.

I was mistaken earlier when I said that GET /api/v1/supervisors returns extra information. This indeed the endpoint that provides the full name of supervisors, among other details.