Request an action on a different action/service

23 views
Skip to first unread message

Louie Miranda

unread,
Aug 13, 2014, 1:18:06 AM8/13/14
to frapi-...@googlegroups.com
Hi,

Been thinking on how to do this properly. I mean, how to access a different action/service code inside an existing action/service.

I have the following API service:
  1. /signup - On Signup, it will create a user. And then the status field, if flagged will trigger the internal action on Frapi called /signup/activate
    POST
    username, password, status

    --pseudo code--
    $otherAction = $this->requestAction('/signup/activate', $params);
    --pseudo code--

  2. /signup/activate - Activate users on a different service
    POST
    username

It's like a request action on a different action class.

Regards,
Louie M.

Louie Miranda

unread,
Aug 13, 2014, 2:11:28 AM8/13/14
to frapi-...@googlegroups.com
Hi,

I made a quick hack inside the Action

// LM, HACK: ACTIVATE REQUEST
require_once 'Activate.php';
$subscription = new Action_Activate();
$params['username'] = 'test715';
$subscription->setActionParams($params);
$sa = $subscription->executePost();

This worked!
Reply all
Reply to author
Forward
0 new messages