I'm planning a series of APIs to execute in a Joomla instance to provide data to other sites. Experiments ongoing to understand how to implement. Considering com_ajax, com_api or new component. Initially working with com_api from TechJoomla.com. Using their 'articles' plugin to provide response data.
Tests to retrieve an article using the browser command line request of 'http://127.0.0.1/site/index.php?option=com_api&app=articles&resource=article&format=raw&id=394' successful. The article's data is received in json format as expected.
Tests using cURL to initiate the request fail. Using the new Windows 10 cURL so I have to submit using POST request. Command is 'curl -d option=com_api -d app=articles -d resource=article -d format=raw -d id=394 http://127.0.0.1/site/index.php?'. The com_api returns the often seen '404 - Controller Not Found' error.
Tracing has found several facts:
- Correct Query parameters are received by Joomla in both tests. The browser request places them in the PHP REQUEST array. The cURL request places them in the POST array in addition to REQUEST.
- Query parameters (in the APP->input object) available at the beginning of com_api/api.php are modified. The view=article and itemid=nnn (nnn = index of home page menu) parameters are added.
- Failure is at line ~50 of com_api/api.php due to the 'view' parameter being set. Code then attempts to access 'C:\Users\joesboat\websites\USPSd5/components/com_api/controllers/article.php'. File does not exist.
Please help. Why is Joomla adding query parameters. All documents found indicate the routing is supposed to pass parameters as received to the components. Thanks in advance..