Postman is an API platform for developers to design, build, test and iterate their APIs. Often, postman has been an essential API tool for developers.
As a Laravel developer, it is advisable you know how to work in postman while building your projects.
In this content, I'm going to be listing simple clear steps on how to can communicate with your laravel project through postman.
Step 1
Own a Postman Free Account
Create a free postman account by visiting POSTMAN or click on signup for postman.
Step 2
Create a Workspace and Collection
You can choose any preferred name as your workspace name.
Create Collection
After you are done creating a workspace, it is advisable you create a Collection with any preferred name of your choose as indicated below.
Step 3
Download and Install Postman Agent
To download postman desktop agent, click DOWNLOAD, after downloading, don't forget to install it.
Step 4
Working with Laravel
If you've already setup your laravel project, follow the codes blocks to setup and test your connection.
Create a route on route
-> api.php
Route::post('test_data', [TestController::class, 'test_data'])->name('api.test_data');
Goto your controller and create a function according to your the name used in api.php
route.
public function test_data(Request $request)
{
return $request;
}
Next thing is to serve your project by running php artisan serve
on your terminal, copy the link and lets move to the next step.
Step 5
Testing the Connection
Add a request by clicking the add a request
as shown on the image above.
Now, you can now paste the copied link, after we served the project on terminal and click on "send".
If it return and empty array [] for you, it means you got it right.
We can decide to send a extra parameter as request and return the response from you controller.
If you got similar results as mine on the screenshot above, congratulation.
Top comments (0)