fusionauth-typescript-client
fusionauth-typescript-client copied to clipboard
searchUsersByIds Badly formats the query, resulting in an error
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 ?