Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Antonhansel opened this issue Dec 21, 2023 · 1 comment
Open

Comments

@Antonhansel
Copy link

Antonhansel commented Dec 21, 2023

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 ?

@mooreds
Copy link
Contributor

mooreds commented Dec 21, 2023

I believe this is the same as #58 correct?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants