Skip to main content

how to make rest api in laravel

In this world of coding, the data is the most important part and more important than the transfer of data and its extracting useful information from it. APIs are built so that your backend logic can be easily integrated with any system and can be given to anyone without giving business logic. There different platforms like website, different mobile platforms but basically all are doing the same thing but in different logic. So lets take an example if you have list of candidates in your database and different platforms have to show these data's, so you would give a url and some credentials and ask them to request to this url and you will get data. So this is basic introduction to API.

So now API are also built in many languages. Here we will take talk about APIs in php language and with help of php framework Laravel. You can go through the detail of introduction of laravel in our previous post
https://unboxknowledge.blogspot.com/2017/11/which-framework-is-the-best-for-php.html

and its installation
https://unboxknowledge.blogspot.com/2017/11/how-to-install-laravel-in-ubuntu.html

After successful installation, you have to make one controller, one model and declaration of model in the controller and mentioning the controller method in routes.php

The first step would be deciding your input parameters or the request parameters and method type (post or get .etc) Mention method type in routes.php. Then in controller use input validators to make necessary parameters or else written with a message. Also use middlewares for authentication purpose. Once request passes through input validators. Then comes your logic , where you can interact with models and fetch data from it and perform necessary actions and pass it in response as required by client.

The database credentials can be stored in .env file and can be fetched in config/database.php

Now use postman to test your API. Enter your URL and select the type of your method and add necessary authentication parameters in header and request parameters in your body part. So your basic API is ready.



Hope you understand the basic of APIs and please share such kind of knowledge and let us know if you want to write in our blog.

Few points about our Unbox Knowledge.We at Unbox Knowledge make account advertisement analysis and go through apps available at each store or knowledge bank with best interface and userfriendly. We don't black marketing where things are written wrong and spread viral all around the world. We are into making world a better place. Example can be given of booking budget and in whichever field we are, we will have great knowledge of all things.. We also available on pinterest, so play plus post or rather posts in each pradesh of India. Now in december, we posted many useful resources from east to west and north to south. You can connect with email facebook or whatever the online platform we have. We also give mobile launched or before it launches like redmi 5a. So share our link and make market a medium of message. We will provide info on latest mobile. you can know us with info of latest mobile.We are like wikipedia for short description, we can be searched as redbus wikipedia. So you can join knowledge sharing revolution with us. make everyone read this. We gave all operators detail too like mtnl mumbai or whatever need.  Example can be given of booking budget and in whichever field we are, we will have great knowledge of all things. latest mobile info are always available with us. you can write if you buy latest mobile or any of your friend buys latest mobile. We will let know user about the cashback or any ofer going on in the market. We will let you know user how to claim the profit. When true color comes in front of all of us. You can give comment or rather comments to improve us and yourself also. So facts feature or rather features about any framework, you know or your friends, let user world also know. You play game at google like great india or indian so we posted on game in january.  We also given blog on games like counter stike which will create a world of game lovers and currently custom daily games are available that can be played again and again. A stripe of post of talking about tata technology, time twitter, and our unique word unbox for user and a variant version. Please visit official website of vivo in west world and xiaomi. We will give the specification of mobiles like built camera etc of any mobiles and other features too. . So you can join knowledge sharing revolution with us. make everyone read this. You will get ideas about recharge or bus booking operator like redbus or india's No. 1 brand redmi or shut down of reliance.  So keep share and soon source will start knowing you and you step ahead each day. We gave all operators detail too like mtnl mumbai or whatever need. And please play militia mini on your mobile. You will get ideas about recharge or bus booking operator like redbus or india's No. 1 brand redmi or shut down of reliance.  So keep share and soon source will start knowing you and you step ahead each day. We will be ready to write on latest mobile. Please let us know your latest mobile and if we write your on latest mobile and by getting your latest mobile data from other resources, asking friends and a whole new post would be written on latest mobile. We are like wikipedia for short description, we can be searched as redbus wikipedia. redbus wikipedia can be other name of this post. Data will be saved on google blogger server. We are like prepaid and price of knowledge will be free. Rather we want to create a profile and You can get knowledge by writing on google redbus wikipedia or something related to redbus wikipedia. In november we gave post about offers, online operators and then mobile brands like oppo or regarding page of payments through phone using phonepe and phones are very much useful Technology parts comes with laravel a framework of php, we gave on that also.

Comments

  1. It is a beautiful post as always. Thank you so much for sharing this information.
    digital marketing services in delhi

    ReplyDelete
  2. Nutra Trials defines personal characteristics of different health products including skincare, weight loss, muscle and male enhancement. The study presented here is briefly described for reader convenience and to deliver them assurance with health standards. The best possible answers are given here regarding the selection of an ideal supplement or cream or serum that possibly remains to be safe for health and do not cause any side effects.

    ReplyDelete
  3. I think this is a real great article post.Really looking forward to read more. Visit at
    Crazy Video Hub

    ReplyDelete
  4. It is a great job, I like your posts and wish you all the best. and I hope you continue this job well.
    NutraT line

    ReplyDelete
  5. Hi,

    Providing Laravel Web Developmentl shopping cart, Website Designing and Payment gateway integration.

    Ecommerce Website Development
    Online Business Website Development
    Ecommerce Portal Development

    For more details about my Web Development and Laravel Web Development Services.

    ReplyDelete
  6. Hello, I am thomus jons thank you for this informative post. That is a great job. Wish you more success.Thank you so much and for you all the best. Takes Down
    123movies

    ReplyDelete
  7. We are here to give you a complete review on the Parallel Profit project by Steve Clayton and Aidan Booth. If you are someone from the field you would already be familiar with these two names, for those of who are new. Parallel Profits Review

    ReplyDelete
  8. There are many Storymate app reviews online that help us in knowing the advantages of using this tool for creating Instagram stories of your business. But I personally downloaded the Storymate app on my desktop and I used it before writing my Storymate review. The Storymate by Luke Maguire is a wonderful start for your e-commerce or affiliate business. It has a funnel that helps in creating beautiful stories with the help of templates that has access to unlimited renders. This marketing tool can be a great start to getting direct clients through Instagram and Facebook. The Storymate results that are delivered are really appreciating as it has helped business owners in getting a direct lead or web traffic.Storymate Review

    ReplyDelete
  9. Best softwares for Internet Marketers and legitimate make money online opportunities cxyrc

    ReplyDelete
  10. WiredReach.org is dedicated to bring you the best in Internet Marketing, Blogging and the entire Make Money Online spectrum. We are your finest source of info.

    ReplyDelete
  11. People looking to find the best job can apply for this academy as it offers many perks that a regular 9 to 5 job would not provide. Quit 9 to 5 Academy Review offers motivation to students, advise them on how to do the right thing in this marketing business, coach students, support create a goal, direction and helps the students succeed.

    ReplyDelete
  12. Eat Stop Eat PDF program was one of the foremost and is not actually counted as one of the fads. It is your crucial guide but using the latest science for intermittent fasting to attain simple yet effective weight loss results.

    ReplyDelete
  13. The Probiotic supplement helps to balance good bacteria and in this regard, Zenith Labs Probiotic t-50 review is creating buzz. How far is the supplement reliable and worth considering, you will come to know about it here.

    ReplyDelete
  14. Abundance Manifestor Review is an online program aimed at those who want to change their lives. It is one of the latest guides that revolves around the law of attraction.

    ReplyDelete
  15. I read this Blog very nice.....               
    https://www.drozus.com

    ReplyDelete
  16. continuously i used to read smaller content that also clear their motive, and that is also happening with this paragraph which I am reading here.               
    https://www.drozus.com

    ReplyDelete
  17. TimesForEducation.com - Everyday News Portal Of Education

    TimesForEducation
    https://timesforeducation.com/

    TimesForEducation. We Regularly Update Education's News From All Over The Worlds. Our Mission Not Only Provide Education's News But Also People Get Become Educated. Visit also this website: https://timesforeducation.com/

    ===========================================================

    normal comment. TimesForEducation. We Regularly Update Education's News From All Over The Worlds. Our Mission Not Only Provide Education's News But Also People Get Become Educated. Visit also this website: https://timesforeducation.com/

    normal comment. TimesForEducation. We Regularly Update Education's News From All Over The Worlds. Our Mission Not Only Provide Education's News But Also People Get Become Educated. Visit also this website: https://timesforeducation.com/

    ReplyDelete
  18. Pretty post, a lot of resource in one place, Thanks for sharing an innovative idea, It is useful information for beginners.your Blog is very useful. great Blog.
    Keto BodyTone

    ReplyDelete
  19. It's not my first time to pay a quick visit this web site, i am browsing this website dailly and get nice data from here everyday.               
    https://www.drozus.com

    ReplyDelete
  20. There are many online courses, which promise you the earth, if only you finish them. Online learning has become very popular and people take advantage of the distance between the tutor and the student to put online courses, which do not have a good content, lack online interactions and may not offer videos to support the material being taught. Online marketing courses are very popular, they claim that after you finish the course you will be able to earn revenue consistently, if you keep on improving, it may become a source of your primary income. One article on the internet gives details of the Overnight Freedom Review, and says if you persist, you may be able to earn enough money online to give up your regular job.

    ReplyDelete
  21. There are various ways to invest, regardless of the sum of cash on hand.
    Internet marketing is one way to make money online. You can write blogs, create
    advertisements or can even participate in marketing ventures initiated by
    companies by taking surveys and writing Overnight Freedom reviews.
    Besides, you can also trade securities in the stock market which will
    definitely get you results.

    ReplyDelete

  22. Thanks for share this valuable post TimesForEducation. We Regularly Update Education's News From All Over The Worlds. Our Mission Not Only Provide Education's News But Also People Get Become Educated. Visit also this website: https://timesforeducation.com/

    ReplyDelete
  23. ExpressTech Software Solutions is one of the best Laravel Development Company in India specialized in providing on demand striking web application development. Contact us : +91-9806724185 or Contact@expresstechsoftwares.com

    ReplyDelete
  24. Just like you will find in most of the 28 Day Keto Challenge Review on the internet, this guide narrows down to the precise understanding of everything that goes into eliminating carbs from your diet.

    ReplyDelete

Post a Comment

Popular posts from this blog

Redbus launches prepaid mobile recharge

Now you will be able to recharge your mobile phones through Redbus App. Redbus was currently providing bus, hotel bookings. But it has now step into the market of prepaid mobile recharges. So the cashback you get by booking on Redbus wallet can be used now for recharge of your prepaid mobile operators. This feature is currently available on mobile apps only. Recharge is available for most of all operators: Airtel, Vodafone, Idea, Aircel, Tata Docomo, Tata Indicom, Reliance CDMA, Reliance GSM, Videocon, Uninor, MTS, BSNL, MTNL Mumbai, MTNL Delhi, T24, Jio.
Available on states: Andhra Pradesh, Assam, Bihar, Chennai, Delhi, Gujarat, Haryana, Himachal Pradesh, Jammu and Kashmir, Karnataka, Kerala, Kolkata, Madhya Pradesh, Maharashtra, Mumbai, North East, Orissa, Punjab, Rajasthan, Tamil Nadu, UP East, UP West, West Bengal. Currently no offers have been declared by Redbus on mobile recharge. But there will soon great offers on mobile recharge as they provide great offers on bus and hotel b…

PhonePe launches bus booking as phonepe recharge

Now India's Payments App will give you a platform for bus booking. PhonePe provides payment through UPI (Unified Payments Interface) under NPCI (National Payments Corporation of India). Its parent organization is Flipkart and it was founded in December 2015. Then it partnered with Yes Bank in August 2016 as you see it is written Powered by Yes Bank. Unbox knowledge is one of the best blog sites known for latest mobile information and also called as wikipedia (ex: redbus wikipedia, phone wikipedia, latest mobile info, latest mobile features, latest mobile news).
So it would be competition to all bus booking leaders in India (Redbus). All registered PhonePe users started receiving mail regarding this on 18th January 2018. User can book bus through the app. PhonePe said they would provide the convenience of superfast bookings. It will cover over 80,000 routes across the nation. 24x7 customer service would be provided.
As Launch Offer, User will get 15% cashback. Maximum cashback wou…

PUBG - The Sensational Game Of The Era

What made pubg to gain such a popularity? Everyone around knows what is all about Pubg. But have you ever thought what made it stand out of all games that were came previous of it. Like we had famous game like "Temple Run", "Candy Crush" and many more. Even we had action game like "Counter Strike" too. But what made pubg, what are the key features behind the success of great game PUBG. So lets start what we think made it so popular is its team building activity, communication through voice chat without any interruption. Its low consumption of internet. Have you checked how much of internet goes while playing pubg, check it. It does not lag from server side. i.e not considering your mobile ram. We are talking, whenever you click on start, it goes for matching and a hundred player are ready. Have you imagined how much such group of hundred player are going on simultaneously.

Now talking about the concept. it has map, which all you know but somewhat you may…