List webservice plugin filter

Status
Not open for further replies.

jo-ka

Member
Hello.
I'm working on a project where I've been given a REST API to get data from.

For the API method to work, the URI must have a season filter at beggining, or the API call will fail:

upload_2020-10-10_18-11-54.png

So, when I use 2020/2021 on the plugin filter, I'm able to get the data.

upload_2020-10-10_18-13-27.png

The question is, for the next season, I' must come to the list plugin and change the season to 2021/2022.

I have other fabrik list, let's say fab_seasons where one of the fields is inactive/active (0/1).

So, I would like to have the chance to use a SQL query on the filter value, something like:

Code:
SELECT season WHERE active = 1;

So I don't have to change the filter every since a new season begins. I though I could use a Query on the filter type, as available in other Fabrik places, but it looks like it's not available.

upload_2020-10-10_18-20-40.png

Is there other way to achieve this, or perhaps an update to the plugin if simple?

Thanks in advance.
 
New filter types like Query or eval etc. would go to ...components\com_fabrik\models\webservice.php (so not the plugin but Fabrik core...)

You can (be careful) add a scheduled task to modify this list's plugin params directly.

(But in a similar case I just added it to my calendar to do it manually once a year;))
 
Thanks troester.
Well, I understand your suggestion of changing it manually, but I' need to deliver this to a customer, and I would prefer to make this automatic.

I'm not sure I've understand this:
New filter types like Query or eval etc. would go to ...components\com_fabrik\models\webservice.php (so not the plugin but Fabrik core...)

Can you please explain better? This means I can add those filters to the plugin?

Thanks in advance.
 
I tried to find the code and found it in...components\com_fabrik\models\webservice.php, function get Filter Value()

So it would be "hacking" this core file (resp. modify/test it and do a GitHub pull request)
I think something like (code from validation_rule.php)
Code:
        FabrikWorker::clearEval();
        $res = @eval($condition);
        FabrikWorker::logEval($res, 'Caught exception on eval in validation condition : %s');

If you want to try...
 
Thanks troester.
I've found the files, I've found the getFilterValue() function in webservice.php file.

But I wasn't able to put the code on the file, and get it working. Is there a way for you to show me how you used it?

Thanks in advance.
 
Friednly bump.

Dear troester, sorry to get back to this. You already now my programming skills are realy low.:):)

Can you please lead me to change the code in order to try to change it, and check if I'm lucky to put the SQL query filter working?

Thanks once again.
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top