Developer forum

Forum » CMS - Standard features » Filter users through Management API

Filter users through Management API

Claus Kølbæk
Claus Kølbæk
Reply

Hi

I am trying to get all users created after a certain date through the mangement API, but I cannot get the filter working correctly.

My request URL: Admin/Api/UsersByGroup?GroupId=24&Filter=createdOn%7C%3E%3D%7C2025-08-27T00%3A00&SortColumnName=createdOn&SortDirection=Descending

I tried to see if I could reuse the command DW uses through the backend UI and noticed it is doing it on CreatedFrom instead of CreatedOn, but changing that didn't really achieve anything: (from console: /admin/UI/Users/UserList?GroupId=24&Type=UsersByGroup&Filter=CreatedFrom%7C%3E%3D%7C2025-08-27T00%3A00)

If I try to filter on something else, it is also none responding. I have it working for other things like orders.

 


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

It should be like this:
GroupId=1227&Filter=CreatedFrom%7C>%3D%7C2025-08-20T09%3A54

Check your casing. You have createdOn in your screenshot - shuould be CreatedFrom

The model is called CreatedOn but for some reason that has been mapped to CreatedFrom - which is odd, agreed. So you need to use CreatedFrom.

 
Claus Kølbæk
Claus Kølbæk
Reply

Hi Nicolai

As I wrote I had also already tried CreatedFrom, as I found that in the console, but it doesn't help;

 
Here is the request URL:
GroupId=24&Filter=CreatedFrom%7C%3E%3D%7C2025-08-20T00%3A00&SortColumnName=CreatedFrom&SortDirection=Descending
or decoded:
GroupId=24&Filter=CreatedFrom|>=|2025-08-20T00:00&SortColumnName=CreatedFrom&SortDirection=Descending
Trying with something else like equal on lastname or the like does not seem to work for me either. - I am sure I am doing something silly wrong, but it looks exactly like what I use for the ecom things :)

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

Hi all,

It seems there's a bug in the Swagger interface for the Management API. Executing the query here doesn't produce a result.

I've just tried to run this query using Postman, and it works as expected: /Admin/Api/UsersByGroup?GroupId=10&Filter=CreatedFrom|>=|2023-01-01T00:00

Can you confirm that it works in Postman for you?

Also, here's a little insider knowledge for reading and understanding the different kinds of /Admin urls:

  • /Admin/Api/[QueryName]?[Arg]=[Value]
    ​​The path references the query and all query arguments match the properties on the query class.
  • /Admin/UI/[Screen]?Type=[QueryName]&[Prefix.Arg]=...&[Arg]=[Value]
    The path references the screen that you're seeing, and the query deliver data to that screen.
    The query is determined by the Type query argument.
    All prefixed arguments are not mapped to the query, they are must likely mapped to the screen.
    The non-prefixed arguments are most likely mapped to the query. In other words, you should be able to safely take all non-prefixed arguments and use them as the query arguments for a /Admin/Api/[Query] url.

I hope that helps.

- Jeppe

 

You must be logged in to post in the forum