September 2017
Intermediate to advanced
244 pages
6h 44m
English
We are mostly making an API to be accessed as a web service from the outside by an external client, not from the same application. However, sometimes, we are in a situation where we need to make internal requests within the same application and want data in the same format as it is being returned to external clients.
Let's say now you want comments data in PostController from the API as it returns a response instead of an internal function call. We want the same data that the /api/posts/{postId}/comments endpoint returns when hit from Postman or another client. In that case, the Dingo API package helps us. Here is how simple it is:
use Illuminate\Http\Request;use Illuminate\Http\Response;use Illuminate\Http\JsonResponse; ...
Read now
Unlock full access