REST API result sorting
This topic contains 15 replies, has 3 voices, and was last updated by D.D 8 years, 9 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support TicketTagged: REST API GET result sort
-
AuthorPosts
-
January 19, 2017 at 10:23 am #345596
Hi,
How do I get the results from the GET method for the REST API to be sorted by the endpoint orderby”: {
“required”: false,
“default”: “overall_rating_desc”,
“enum”: [
“overall_rating_desc”,
“rating_count_desc”,
“post_title_asc”,
“post_title_desc”
].I’ve tried a few options but none seem to work.
Thanks.
January 19, 2017 at 6:53 pm #345853Hi,
I flagged your request for the developer of the API add-on. He’ll let you know asap.
Thanks
January 24, 2017 at 10:22 am #348421Hi,
The sorting problem has been fixed, please download most recent addon from here https://github.com/GeoDirectory/geodir_api
Use orderby parameter to sorting listings for specific order.
Ex: wp-json/geodir/v1/places/&orderby=overall_rating_descParameter orderby should contains option from orderby schema.
Thanks,
KiranJanuary 25, 2017 at 4:35 am #348868Thanks for the update, I’ll test out the call and let you know, however my search calls no longer work after the updating the plugin.
January 25, 2017 at 4:38 am #348870Please provide your site api url in private reply, so i can look into.
January 25, 2017 at 4:39 am #348871This reply has been marked as private.January 25, 2017 at 6:29 am #348898Hi,
Please overwrite file https://raw.githubusercontent.com/kprajapatii/geodir_api/5c5853fc9808e59434305c868d00d19df1c195da/includes/geodir-rest-listings-functions.php
at path plugins/geodir_api/includes/geodir-rest-listings-functions.php
Let us know.
Thanks
January 25, 2017 at 7:50 am #348907The search function is works now but the orderby endpoint no longer has the options that I referenced in the first post. It’s now “orderby”: {
“required”: false,
“default”: “date”,
“enum”: [
“date”,
“relevance”,
“id”,
“include”,
“title”,
“slug”
],
“description”: “Sort collection by object attribute.”,
“type”: “string”so I can’t get results by overall rating.
January 25, 2017 at 10:38 am #349052Let us provide FTP details to look into. I can’t re-create it in my test site.
Thanks
January 25, 2017 at 10:54 am #349060This reply has been marked as private.January 26, 2017 at 1:51 pm #349808Hi There,
Please check now.
FYI: The WP REST API plugin is no longer need now, because since WP has included built in REST API endpoints since 4.7.
Thanks,
KiranJanuary 26, 2017 at 3:22 pm #349853yeah it works now with the http://www.domain.com/wp-json/geodir/v1/places?gd_placecategory=96&orderby=overall_rating_desc&per_page=10
however my search calls are not sorting by overall rating using
The search results are not sorted properly or am I doing something wrong?
Cheers.
January 27, 2017 at 5:06 am #350168For the search results, the first priority for sorting is best matching criteria and then it applies your sorting as a second priority.
Thanks,
KiranJanuary 27, 2017 at 7:02 am #350206Ok great! I’ve just noticed a change in my search results. Results used to include matches with place tags before just like the website but now doesn’t return those results. How do I fix that?
Thanks.
January 27, 2017 at 7:09 am #350207The current searching functionality extended to standard WP REST API, i mean our plugin uses WP standard search criteria that WP REST API uses.
I have already added to-do to use our own search criteria just we have used in website search.
Kiran
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket