[#754] Can we have order identifier in categories, services, providers and locations?

Migrated from Redmine #754 | Author: Kishor Maharjan
Status: Closed | Priority: High, I’m very impatient | Created: 2021-08-06


Hi there,

I have a requirements where manager wants to handle the displaying order of categories, services, providers and location. Can we have one more attribute in API to display in order so that I can present them accordingly in a frontend?

Thank You

Regards,
Kishor

Redmine Admin wrote:

which API method you are using?

Kishor Maharjan wrote:

Hi Redmine

These are endpoints.
https://user-api-v2.simplybook.me/admin/services/
https://user-api-v2.simplybook.me/admin/locations
https://user-api-v2.simplybook.me/admin/categories
https://user-api-v2.simplybook.me/admin/providers

Thank you

Redmine Admin wrote:

array of such objects is ordered according to company settings already

Kishor Maharjan wrote:

Yep.. but you cannot rely on array order.

API response is giving in according to company settings, but when I filtered out data, I’m getting data in random order. I have attached an image for example. If I would have an order identifier, I can sort back again as company settings.

Redmine Admin wrote:

your programmers should be able to add param to object from array order.

Kishor Maharjan wrote:

I didn’t get your point. I would really appreciate if can you please explain bit more so that I can fix it.

Redmine Admin wrote:

e.g.

$i = 0;
foreach($providers as &$provider) {
$provider->order = $i;
$i++;
}