Adding a custom API Method

  • lorna guttormson
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
9 months 3 weeks ago #164713 by lorna guttormson
Adding a custom API Method was created by lorna guttormson
Hello
We have tested the API for get subscription details and it works well.  Thank you.  We would need to create one more  API- get details of all subscriptions new or changed since a given date .  However, I cannot find a 'last-update-date' in the subscription table?  Is there anything that can be queried to determine which subscriptions have been changed recently?
Lorna

Please Log in or Create an account to join the conversation.

More
9 months 3 weeks ago #164719 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Adding a custom API Method
Hi Lorna

We do not store modified date of a subscription record at the moment, so that data is not available for query, sorry

Tuan

Please Log in or Create an account to join the conversation.

More
4 months 3 weeks ago #168017 by Alex P
Replied by Alex P on topic Adding a custom API Method
You can play around with Joomla's Action Logs. It stores all events.
Attachments:

Please Log in or Create an account to join the conversation.

  • lorna guttormson
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 months 4 days ago #168776 by lorna guttormson
Replied by lorna guttormson on topic Adding a custom API Method
Thank you Tuan for directing me to your API documentation
and thank you Alex P for your suggestion of using the action_logs table. I think this should work. Now - wome 6 months later, I am trying to learn about API,s reading your documentation and working with Postman to see if I can get something going. I have copied model/subscriptions into model/override and entered the query to get a list from actions_log. I would then call api::get from there for each id found. (public function get()). (It seems it is valid to call an api from within another api . Though maybe not too efficient, it would be a start!)
I am confused though about what controller I would copy into the controller/override. Subscriber is all about inserting/updating. I want to be selecting. What should I use here?
Also, when I looked for the examples of overrides, ( github.com/joomdonation/osmembership-ove...verride/register.php ) I get 404's. Do you have any such examples.

Please Log in or Create an account to join the conversation.

  • lorna guttormson
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
2 months 4 weeks ago #168884 by lorna guttormson
Replied by lorna guttormson on topic Adding a custom API Method
Problem solved. In case anyone else is trying this, the problem was two-fold a) not following the instructions VERY carefully and b) not realizing that the code for the final json submission was at last function in the Controller api.php.

Please Log in or Create an account to join the conversation.