Orit
Active member
Hello,
I've added a new API endpoint to an addon we use (Snogs Advanced forms).
It seems to fetch the items (forms) but the api result returns an array of objects sorted alphabetically.
The code for returning the data is:
The JSON example:
Is there a way to re-order the results differently?
for some reason the posid column is returned by default. The other columns were called by the
setupApiResultData function in the entity.
I currently renamed them with a z_ prefix but hope for a better way...
Thanks!!
I've added a new API endpoint to an addon we use (Snogs Advanced forms).
It seems to fetch the items (forms) but the api result returns an array of objects sorted alphabetically.
The code for returning the data is:
PHP:
return $this->apiResult([
'forms' => $forms->toApiResults(),
'pagination' => $this->getPaginationData($forms, $page, $perPage, $total)
]);
The JSON example:
JSON:
{
"posid": 1,
"z_connectedThread": 0,
"z_description": "testing form",
"z_email": "email@example.com",
"z_node_id": 123
}
Is there a way to re-order the results differently?
for some reason the posid column is returned by default. The other columns were called by the
setupApiResultData function in the entity.
I currently renamed them with a z_ prefix but hope for a better way...
Thanks!!