Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Solved - $_GET[’action’] Request in API (or modules)
 
NikP
Jr. Member
 
Total Posts:  2
Joined:  2008-08-09
 

I try to implement a custom API for a REP Software.

This software sends simple Get- and Post-requests to a (Magento-API-) URL.

The Software starts a session through a GET-Request:
$_GET[’action’] = version <-- Problem
$_GET[’user’] = Username
$_GET[’pass’]=Passwort

and needs a return of a xml-file.

My problem is that Magento already uses the $_GET[’action’] - parameter and I can’t change it in REP-software.

When I try to load .../api/myApi?action=version I get a 404. (I always get a 404 when i try to load any Magento-URL with ?action=somedata.)
After the session is started all data is posted through a $_POST-Request.
The identifier then is the $_POST[’action’] - parameter (e.g. $_POST[’action’] = ‘update_product’) an should be passed (didn’t test it).

Where is the handling of the $_GET[’action’] - parameter defined in Magento and what is it for? Is it possible to deactivate/overwrite/cancel it for custom APIs? I searched a lot but can’t find any help or class for that.

I could pass the request through an outside-Magento-file and send a modificated request to Magento-API. In this case I don’t even need a custom API but it is very slow to pass a request to a server, then send it to Magento-API and do it the same way back. I also tried url-rewrite but without success. (Could both be quick and dirty solutions.)

Any ideas or help would be great. Thanks!
Niko

 
Magento Community Magento Community
Magento Community
Magento Community
 
NikP
Jr. Member
 
Total Posts:  2
Joined:  2008-08-09
 

I found it at

/lib/Zend/Controller/Request/Abstract.php

In line 69:
Variable $_actionKey=’action’

and in line 134:
function getActionName()

I changed this function. It now returns $this->_action = ‘’ when my custom API-script is called and I don’t get 404-errors any more.

btw:
Is it possible to overwrite lib-classes (Zend- or Varien-classes) by rewrite-rules in the config.xml of a custom module? I didn’t manage it to get work.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top