Developer forum

Forum » Dynamicweb 10 » SortBy and SortOrder parameters ignored on /dwapi/query endpoint

SortBy and SortOrder parameters ignored on /dwapi/query endpoint

Arnór Halldórsson
Arnór Halldórsson
Reply

Hi all,

I seem to be hitting a bug with the /dwapi/query endpoint where SortBy and SortOrder are ignored entirely.

Setup

Custom Content repository query called "Article list", no default sort configured on the query itself. Calling with SortBy=PageUpdatedDate&SortOrder=DESC.

The problem

The results come back sorted by _score (relevance) instead of the requested field and direction. The response envelope always says "sortOrder": "asc" regardless of input, and SortBy has no effect.

Request:

/dwapi/query?QueryName=Article+list&RepositoryName=Content&ParentPageIds=6928&SortBy=PageUpdatedDate&SortOrder=DESC&PageSize=6

Response (trimmed):

{
  "sortOrder": "asc",
  "results": [
    { "PageId": 6931, "_score": 4.79, "PageSort": 1, "PageUpdatedDate": "2026-03-24T20:47:40" },
    { "PageId": 6932, "_score": 4.79, "PageSort": 2, "PageUpdatedDate": "2026-03-24T20:48:11" },
    { "PageId": 6933, "_score": 4.79, "PageSort": 3, "PageUpdatedDate": "2026-03-24T20:48:46" }
  ]
}

Results are ordered by _score / PageSort ASC, not by PageUpdatedDate DESC as requested.

Reproduction

Reproducible via Swagger UI with a clean query (no default sort set on the query definition).

Expected behavior

SortBy and SortOrder should override relevance scoring and sort by the specified field and direction.

We're on version 10.22.8

Best regards,
Arnór Geir


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply
This post has been marked as an answer

That is a bug. https://doc.dynamicweb.dev/documentation/fundamentals/dw10release/releasenotes/workiteminfo.html?workitemid=27752

Fix is made.

Sorry about the inconvenience.

Votes for this answer: 1
 
Arnór Halldórsson
Arnór Halldórsson
Reply

No problem, thanks for the quick reply Nicolai! 😁

 

You must be logged in to post in the forum