According to the documentation “clicking on json link will add the .json extension to the generated url” but this is not the behavior I see on this page: https://servicestack.net/ss_admin/autoquery/QueryPageStats
I expected the generated url to be: https://servicestack.net/query/pagestats?include=Total
It’s actually https://servicestack.net/html/reply/QueryPageStats?include=Total and clicking on the links will modify the “html” part.
Possible explanation: https://servicestack.net/autoquery/metadata does not expose the routes.
For comparison: http://github.servicestack.net/autoquery/metadata
The issue, if confirmed, is definitely a minor one and ServiceStack Studio replaces the Admin UI.
However, the AutoQuery Viewer is still a useful tool and perhaps deserves a fix, if small and feasible.
mythz
July 22, 2020, 10:49am
2
It’s HTML at the start, or when you click X to reset the query:
https://servicestack.net/html/reply/QueryPageStats?include=Total
But then clicking on json
sees the json link change the pre-defined route to:
https://servicestack.net/json/reply/QueryPageStats?include=Total
Which is how you change the response format for pre-defined routes .
You are right @mythz the behavior is correct in itself. But there is also a user defined route for “QueryPageStats”: https://servicestack.net/json/metadata?op=QueryPageStats
I thought the AutoQuery Viewer used it, as documented in the manual.
By the way, I noticed a possible problem while working on my project, I took your website as an example only for convenience.
mythz
July 22, 2020, 11:02am
4
The .json
extension can be used to change the format for “user-defined routes” , e.g:
http://techstacks.netcore.io/ss_admin/autoquery/FindTechnologies
When no user-defined route exists, it needs to fallback to use the pre-defined route which needs to change the format by changing the pre-defined URL as above.
But in fact the “/query/pagestats” user defined route does exist, as stated before.
So I expected a bevior similar to e.g. http://github.servicestack.net/ss_admin/autoquery/QueryRepos
Nevermind @mythz The problem is elusive, I will update the topic after collecting some more information.
Below is the crucial line, this.props.selected.requestType.routes
is always undefined
because the routes are no longer there.
}
clear() {
this.props.onChange({
searchField: null, searchType: null, searchText: '', format: '', orderBy: '', offset: 0,
fields: [], conditions: []
});
}
getAutoQueryUrl(format:string) {
const firstRoute = (this.props.selected.requestType.routes || []).filter(x => x.path.indexOf('{') === -1)[0];
const path = firstRoute
? firstRoute.path
: `/${format || 'html'}/reply/` + this.props.selected.requestType.name;
var url = combinePaths(this.props.config.servicebaseurl, path);
if (firstRoute && format)
url += "." + format;
mythz
July 22, 2020, 12:09pm
8
Yes, that ’s the expected behaviour (“X-Powered-By: ServiceStack/5.60 Net45/Windows” according to the response headers) in fact the routes are there: http://github.servicestack.net/autoquery/metadata
I quoted it to compare it with https://servicestack.net/ss_admin/autoquery/QueryPageStats (" X-Powered-By: ServiceStack/5.91 NetCore/Linux") which doesn’t behave the same way.
mythz
July 22, 2020, 5:47pm
10
ok this was due to the routes metadata info being moved, I’ve re-added the routes info back to AutoQuery Metadata in the latest v5.9.1 that’s now available on MyGet .
1 Like
Great! I confirm that the problem has been solved. Thanks @mythz
1 Like