I'm writing an extension that utilizes web services and I need a way for those web services to send information back to the extension over the internet.
Would I just use a controller like every other action? The URL would have to be fully public (no admin key in URL). Or would I trigger an event via an observer. I couldn't find an observer event that waits for the callback URL to be hit.
So far I've tried creating a folder with a file inside (myCompany/myModule/Notify/Notifications.php).
<?php
//Notifications.php
namespace myCompany\myModule\Notify;
class Notifications
{
/**
* Constructor
*/
public function __construct(
\myCompany\myModule\Api\Data\EntityInterface $entityModel
) {
file_put_contents('/home/username/Desktop/test/log.txt', 'endpoint' . "\n", FILE_APPEND);
$this->_entityModel = $entityModel;
}
}
Then I tried going to http://myMagento.com/myCompany/myModule/notify/notifications.php and my test doesn't print out.
As an example, here's how it's done in Drupal 8.
myCompany.notify:
path: '/myCompany/notify'
defaults:
_controller: '\Drupal\myCompany\Controller\NotificationController::endpoint'
_title: 'Notification Receiver'
requirements:
_access: 'TRUE'