Skip to content

searchUsersByIds Badly formats the query, resulting in an error #91

@Antonhansel

Description

@Antonhansel

Hello,

It seems that SearchUsersByIds isn't implemented properly in the SDK, here is the implementation

  searchUsersByIds(ids: Array<string>): Promise<ClientResponse<SearchResponse>> {
    return this.start<SearchResponse, Errors>()
        .withUri('/api/user/search')
        .withParameter('ids', ids)
        .withMethod("GET")
        .go();
  }f

When called like this:

    const { response: { users } } = await fusionAuthClient.searchUsersByIds(localUsers.map((user) => String(user.id)));

The following error is returned:

{
  "statusCode": 400,
  "exception": {
    "fieldErrors": {
      "ids": [
        {
          "code": "[couldNotConvert]ids",
          "message": "Invalid"
        }
      ]
    },
    "generalErrors": [
      {
        "code": "[invalid]",
        "message": "You must specify either the [ids], [queryString], or [query] property. If you are continuing a search, you must include the [nextResults] property."
      }
    ]
  }
}

The expected format from the API is this (unconventionnal, but it is what it is)

localhost:9011/api/user/search?ids=id1&ids=id2

Is there a workaround with another method or should I use a direct API call ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions