Page 2 of 2

Re: writing a query in plain text

PostPosted: Wed Mar 10, 2021 1:02 pm
by JuiceyBrucey
Thank you for the info. Sorry did not realise that.
I have attached the XML file.
Please let me know if I have done this correctly.
Cheers

Re: writing a query in plain text

PostPosted: Wed Mar 10, 2021 4:19 pm
by Mike.Sheen
I got a 404, too after importing the plugin and restarting my REST API Service.

Then I looked at the plugin and saw why - Your plugin is not enabled. Enable it, save and restart your service.
EnablePlugin.png

Re: writing a query in plain text  Topic is solved

PostPosted: Wed Mar 10, 2021 4:42 pm
by Mike.Sheen
I've mentioned this before, but you might want to consider using AutoQuery.

Out of the box, we have a route which lets the consumer get the same data as your custom route - for example:

https://api.jiwa.com.au/Queries/IN_Main ... 10&Take=20

This is getting just the same fields as your custom route, in the same order, filtering on Status (I used Status of 0 because the 2 you want has no data in our demo database), and it paginates the result (note the Include=Total will return the total number of rows as metadata in the response so the client can make good decisions on paging).

Don't get put off by the HTML representation of the above - if your request doesn't have HTML as the accept content type like a web browser does, you'll just get json back (compressed if the request has gzip or deflate in the accept headers).

If you want to see it as json inside a browser just append &format=json at the end of the URL to override the content type requested - like this https://api.jiwa.com.au/Queries/IN_Main ... ormat=json

Re: writing a query in plain text

PostPosted: Wed Mar 10, 2021 5:22 pm
by JuiceyBrucey
Thank you. Yes that works perfectly.
Sorry went to find info about autoquery days ago, but ended up on servicestack autoquery somehow and lost the plot I think.
Cheers