I am using membershipPro which provides the ability to get subscription information via an API from the database. I am continually getting 404 errors. I have tried many things. I have followed the instructions in membershipPro to create an override directory in each of, the controller and model directories. Because the errors are 404's it seems the routing is somehow not correct. MembershipPro provides a basic API which selects the subscription information of a single subscription.(https://docs.joomdonation.com/membershi ... /api-basic) Using POST in Postman, this works.
My API is simply to query the Joomla action log and return a set of recently changed subscriptions. For simplicity to test the routing I am setting an integer variable within the code and trying to return it to Postman. I have instantiated the api with the following in the model/override/ with
JLoader::register('OSMembershipModelOverrideSubscriptionids', JPATH_ADMINISTRATOR . '/components/com_osmembership/model/override/subscriptionids.php');
and
JLoader::register('OSMembershipControllerOverrideSubscription', JPATH_ADMINISTRATOR . '/components/com_osmembership/controller/override/subscriptionids.php');
My api key has been tested with the MP basic API - here is the Postman call (I have blocked the key for security)
https://ottawaotest.ca/oocmp/index.php? ... i_key=xxxx
I have asked ChatGPI for help and it suggested:
"If you're not seeing task=overrideSubscriptionIds.post in the routing, Joomla might be defaulting to the GET method or is not correctly routing the request. "
But the MP basic API I have had success with does not add the .post and in any case that didn't help.
I have also inserted this basic code for the controller code and still get a 404.
class OSMembershipControllerOverrideSubscriptionIds extends OSMembershipControllerAPI
{
public function post()
{
// Example minimal code for testing routing
echo json_encode(['success' => 'POST method is working']);
exit;
}
} MembershipPro has been very helpful on their standard extension but unfortunately do not support these custom changes. I feel I can get on with this once I can get the routing problem sorted. If anyone can offer something else I might look into, that would be much appreciated.
My API is simply to query the Joomla action log and return a set of recently changed subscriptions. For simplicity to test the routing I am setting an integer variable within the code and trying to return it to Postman. I have instantiated the api with the following in the model/override/ with
JLoader::register('OSMembershipModelOverrideSubscriptionids', JPATH_ADMINISTRATOR . '/components/com_osmembership/model/override/subscriptionids.php');
and
JLoader::register('OSMembershipControllerOverrideSubscription', JPATH_ADMINISTRATOR . '/components/com_osmembership/controller/override/subscriptionids.php');
My api key has been tested with the MP basic API - here is the Postman call (I have blocked the key for security)
https://ottawaotest.ca/oocmp/index.php? ... i_key=xxxx
I have asked ChatGPI for help and it suggested:
"If you're not seeing task=overrideSubscriptionIds.post in the routing, Joomla might be defaulting to the GET method or is not correctly routing the request. "
But the MP basic API I have had success with does not add the .post and in any case that didn't help.
I have also inserted this basic code for the controller code and still get a 404.
class OSMembershipControllerOverrideSubscriptionIds extends OSMembershipControllerAPI
{
public function post()
{
// Example minimal code for testing routing
echo json_encode(['success' => 'POST method is working']);
exit;
}
} MembershipPro has been very helpful on their standard extension but unfortunately do not support these custom changes. I feel I can get on with this once I can get the routing problem sorted. If anyone can offer something else I might look into, that would be much appreciated.
Statistics: Posted by Lxg — Tue Sep 17, 2024 5:09 pm