I am using the following code to get all users. It works with the Java client but is giving the following error
{ code: '[invalid]', api_1 | message: 'You must specify either the [ids], [queryString], [email] or [username] property for a GET request.' }
What I am trying
let requestJSON = {}
requestJSON.queryString = "*";
client.searchUsersByQueryString(requestJSON).then(handleResponse).catch(handleResponse);
function handleResponse (clientResponse) {
console.log(clientResponse.errorResponse.generalErrors[0]);
}
Also for some reason, it is assuming this to be a GET Request.
I have already tried doing the same using Postman and it doesn't work. I am using FusionAuth 1.5.0 everywhere.
The client library uses a POST
request with a JSON body to perform the search. See the POST /api/user/search
API documentation here https://fusionauth.io/docs/v1/tech/apis/users#search-for-users
Try this instead:
let requestJSON = {
search: {
queryString: "*"
}
};
client.searchUsersByQueryString(requestJSON).then(handleResponse).catch(handleResponse);
function handleResponse (clientResponse) {
console.log(clientResponse.errorResponse.generalErrors[0]);
}