Taking the difference between REST and RPC calls into account and applying them to apigility I want to implement the register action as a RPC call, which adds a user via POST /user, trigger an actication email submission and separate the data to add some specific information to a second endpoint.
Now my question is: What is the most efficient way and how to actually do trigger a REST request in a RPC request in apigility.
The flow should look like this:
POST /register -> create user (POST /user), send activation email, call another API via curl, add data to this user profile -> return user data
Do I need to curl my own api or can I just pass the request along in apigility? The /user endpoint is a simple database connected REST resource and is tested and functional.
Also important is that I want to add authorization to POST /user since we store some data like timestamps of verification and other restricted information in there which should be accessible once authenticated or via (filtered and processed) RPC calls.
You just have to call the service using the corresponding alias present your api configuration in :
Here, the alias is
DBConnectedResource
...$this->getServiceLocator()->get('DBConnectedResource')
will do the work ;)