SlideShare a Scribd company logo
1 of 11
RESTfulAPI Basics
using Laravel 5+
/me
● John Dave Decano aka Dave
● Juwai Team
● Doing freelance since 2009
● No Formal Education on CS or IT
● Self Taught Programmer
● http://github.com/johndavedecano
● http://odesk.com/odeskfreelancer
● http://johndavedecano.me
What is restfulAPI?
● REST - Representational State Transfer
● REST is an architecture style for designing networked applications.
● In many ways, the World Wide Web itself, based on HTTP, can be viewed as a REST-
based architecture.
● RESTful API uses versioning. e.g POST /V1/todos/
● RESTful API explicitly take advantage of HTTP methodologies defined by the RFC 2616
protocol. They simply use "PUT" to change the state of or update a resource, which can be
an object, file or block; "GET" to retrieve a resource; POST" to create that resource; and
"DELETE" to remove it.
● Restful API uses HTTP Headers add information about the request and the response.
● Restful API uses HTTP Status Codes Correctly.
● Restful API is stateless.
● Restful API commonly use JSON or XML as a form of response.
● Each API request returns a subsequent API response.
What is restfulAPI?
● REST - Representational State Transfer
● REST is an architecture style for designing networked applications.
● In many ways, the World Wide Web itself, based on HTTP, can be
viewed as a REST-based architecture.
● RESTful API uses HTTP for all four CRUD
(Create/Read/Update/Delete) operations.
● Each request returns a subsequent response.
● HTTP Verbs – POST, GET, UPDATE, PUT, PATCH, DELETE
● HTTP Headers – Content-Type, Content-Length etc.
● Commonly used by Mobile Applications and Single Paged Apps.
● Commonly use JSON or XML as a form of response.
A stateless protocol does not require the server to retain information or
status about each user for the duration of multiple requests.
Requests are made up of a verb (POST, in this example), headers that describe the
message, and a body (Hello World, in this example).
The request is a message that describes what you want the server to accomplish.
Likewise, the response consists of three pieces: a status code (200), headers
describing the response and the body itself.
HTTP Verbs describe the type of operation:
GET: Retrieve a resource
POST: Create a resource
PUT: Update a resource
DELETE: Delete a resource
On the Web, the most common verb is GET. This is because the main purpose of a
Web page's function is to request different resources that make up a page. In REST-
based APIs, we leverage these verbs to describe the types of operations we want.
Hello Laravel
● Taylor Otwell
● Open Source
● Well Documented
● Active Community
● Lots of Jobs
● Easy Grasp
How about the security?
● REST api can be exposed to the public. They usually call it as Public APIs
● You can use OAUTH, HTTP Basic or JWT.
● OAuth is an open standard for authorization, commonly used as a way for Internet
users to log in to third party websites using their Google, Facebook, Microsoft,
Twitter, One Network, etc. accounts without exposing their password.
● HTTP Basic - In the context of an HTTP transaction basic access authentication is a
method for an HTTP user agent to provide a user name and password when making
a request.
● JSON Web Tokens are an open, industry standard RFC 7519 method for
representing claims securely between two parties.
TALK IS CHEAP
SHOW ME THE CODE
You will learn how to:
● Install LARAVEL
● Create URL Routes
● Create Migrations
● Create Seeder
● Create Models
● Create Controllers
● Create Requests Classes
● Create Validate Data
Questions?

More Related Content

What's hot

Laravel Restful API and AngularJS
Laravel Restful API and AngularJSLaravel Restful API and AngularJS
Laravel Restful API and AngularJS
Blake Newman
 
Consuming RESTful services in PHP
Consuming RESTful services in PHPConsuming RESTful services in PHP
Consuming RESTful services in PHP
Zoran Jeremic
 
Cwinters Intro To Rest And JerREST and Jersey Introductionsey
Cwinters Intro To Rest And JerREST and Jersey IntroductionseyCwinters Intro To Rest And JerREST and Jersey Introductionsey
Cwinters Intro To Rest And JerREST and Jersey Introductionsey
elliando dias
 

What's hot (20)

Laravel 5 Annotations: RESTful API routing
Laravel 5 Annotations: RESTful API routingLaravel 5 Annotations: RESTful API routing
Laravel 5 Annotations: RESTful API routing
 
Laravel Restful API and AngularJS
Laravel Restful API and AngularJSLaravel Restful API and AngularJS
Laravel Restful API and AngularJS
 
ACL in CodeIgniter
ACL in CodeIgniterACL in CodeIgniter
ACL in CodeIgniter
 
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswani
Creating REST Applications with the Slim Micro-Framework by Vikram VaswaniCreating REST Applications with the Slim Micro-Framework by Vikram Vaswani
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswani
 
JSON REST API for WordPress
JSON REST API for WordPressJSON REST API for WordPress
JSON REST API for WordPress
 
Web develop in flask
Web develop in flaskWeb develop in flask
Web develop in flask
 
httpie
httpiehttpie
httpie
 
Getting Started-with-Laravel
Getting Started-with-LaravelGetting Started-with-Laravel
Getting Started-with-Laravel
 
Consuming RESTful services in PHP
Consuming RESTful services in PHPConsuming RESTful services in PHP
Consuming RESTful services in PHP
 
REST API Best Practices & Implementing in Codeigniter
REST API Best Practices & Implementing in CodeigniterREST API Best Practices & Implementing in Codeigniter
REST API Best Practices & Implementing in Codeigniter
 
40+ tips to use Postman more efficiently
40+ tips to use Postman more efficiently40+ tips to use Postman more efficiently
40+ tips to use Postman more efficiently
 
DEVNET-1001 Coding 101: How to Call REST APIs from a REST Client and Python
DEVNET-1001 Coding 101: How to Call REST APIs from a REST Client and PythonDEVNET-1001 Coding 101: How to Call REST APIs from a REST Client and Python
DEVNET-1001 Coding 101: How to Call REST APIs from a REST Client and Python
 
Day01 api
Day01   apiDay01   api
Day01 api
 
Cwinters Intro To Rest And JerREST and Jersey Introductionsey
Cwinters Intro To Rest And JerREST and Jersey IntroductionseyCwinters Intro To Rest And JerREST and Jersey Introductionsey
Cwinters Intro To Rest And JerREST and Jersey Introductionsey
 
Designing CakePHP plugins for consuming APIs
Designing CakePHP plugins for consuming APIsDesigning CakePHP plugins for consuming APIs
Designing CakePHP plugins for consuming APIs
 
Understanding and testing restful web services
Understanding and testing restful web servicesUnderstanding and testing restful web services
Understanding and testing restful web services
 
Connecting Content Silos: One CMS, Many Sites With The WordPress REST API
 Connecting Content Silos: One CMS, Many Sites With The WordPress REST API Connecting Content Silos: One CMS, Many Sites With The WordPress REST API
Connecting Content Silos: One CMS, Many Sites With The WordPress REST API
 
Your First Scala Web Application using Play 2.1
Your First Scala Web Application using Play 2.1Your First Scala Web Application using Play 2.1
Your First Scala Web Application using Play 2.1
 
JWT - Sécurisez vos APIs
JWT - Sécurisez vos APIsJWT - Sécurisez vos APIs
JWT - Sécurisez vos APIs
 
Laravel 5 In Depth
Laravel 5 In DepthLaravel 5 In Depth
Laravel 5 In Depth
 

Similar to REST API Laravel

Similar to REST API Laravel (20)

Unerstanding and Using RESTful APIs
Unerstanding and Using RESTful APIsUnerstanding and Using RESTful APIs
Unerstanding and Using RESTful APIs
 
Understanding and Using Rest APIs (SocialDevCamp Chicago 2009)
Understanding and Using Rest APIs (SocialDevCamp Chicago 2009)Understanding and Using Rest APIs (SocialDevCamp Chicago 2009)
Understanding and Using Rest APIs (SocialDevCamp Chicago 2009)
 
Salesforce REST API
Salesforce  REST API Salesforce  REST API
Salesforce REST API
 
ASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiASP.NET Mvc 4 web api
ASP.NET Mvc 4 web api
 
RESTful application with Drupal 8
RESTful application with Drupal 8RESTful application with Drupal 8
RESTful application with Drupal 8
 
API
APIAPI
API
 
ReSTful API Final
ReSTful API FinalReSTful API Final
ReSTful API Final
 
Switch to Backend 2023 | Day 1 Part 1
Switch to Backend 2023 | Day 1 Part 1Switch to Backend 2023 | Day 1 Part 1
Switch to Backend 2023 | Day 1 Part 1
 
Introduction To REST
Introduction To RESTIntroduction To REST
Introduction To REST
 
Restful web services with java
Restful web services with javaRestful web services with java
Restful web services with java
 
API Testing Basics.pptx
API Testing Basics.pptxAPI Testing Basics.pptx
API Testing Basics.pptx
 
Restful web-services
Restful web-servicesRestful web-services
Restful web-services
 
Switch to Backend 2023
Switch to Backend 2023Switch to Backend 2023
Switch to Backend 2023
 
Advanced Web Development in PHP - Understanding REST API
Advanced Web Development in PHP - Understanding REST APIAdvanced Web Development in PHP - Understanding REST API
Advanced Web Development in PHP - Understanding REST API
 
PNWDS 2013- Restful development in Drupal 7/8
PNWDS 2013- Restful development in Drupal 7/8PNWDS 2013- Restful development in Drupal 7/8
PNWDS 2013- Restful development in Drupal 7/8
 
REST API and CRUD
REST API and CRUDREST API and CRUD
REST API and CRUD
 
Designing RESTful APIs
Designing RESTful APIsDesigning RESTful APIs
Designing RESTful APIs
 
JAX-RS. Developing RESTful APIs with Java
JAX-RS. Developing RESTful APIs with JavaJAX-RS. Developing RESTful APIs with Java
JAX-RS. Developing RESTful APIs with Java
 
Rest service in mule
Rest service in mule Rest service in mule
Rest service in mule
 
REST library.pptx
REST library.pptxREST library.pptx
REST library.pptx
 

Recently uploaded

Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 

Recently uploaded (20)

WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
WSO2CON 2024 - Architecting AI in the Enterprise: APIs and Applications
WSO2CON 2024 - Architecting AI in the Enterprise: APIs and ApplicationsWSO2CON 2024 - Architecting AI in the Enterprise: APIs and Applications
WSO2CON 2024 - Architecting AI in the Enterprise: APIs and Applications
 
WSO2Con2024 - Organization Management: The Revolution in B2B CIAM
WSO2Con2024 - Organization Management: The Revolution in B2B CIAMWSO2Con2024 - Organization Management: The Revolution in B2B CIAM
WSO2Con2024 - Organization Management: The Revolution in B2B CIAM
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
WSO2CON 2024 - Building a Digital Government in Uganda
WSO2CON 2024 - Building a Digital Government in UgandaWSO2CON 2024 - Building a Digital Government in Uganda
WSO2CON 2024 - Building a Digital Government in Uganda
 
WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...
WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...
WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
WSO2Con2024 - Facilitating Broadband Switching Services for UK Telecoms Provi...
WSO2Con2024 - Facilitating Broadband Switching Services for UK Telecoms Provi...WSO2Con2024 - Facilitating Broadband Switching Services for UK Telecoms Provi...
WSO2Con2024 - Facilitating Broadband Switching Services for UK Telecoms Provi...
 
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
 
WSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AIWSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AI
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 

REST API Laravel

  • 2. /me ● John Dave Decano aka Dave ● Juwai Team ● Doing freelance since 2009 ● No Formal Education on CS or IT ● Self Taught Programmer ● http://github.com/johndavedecano ● http://odesk.com/odeskfreelancer ● http://johndavedecano.me
  • 3. What is restfulAPI? ● REST - Representational State Transfer ● REST is an architecture style for designing networked applications. ● In many ways, the World Wide Web itself, based on HTTP, can be viewed as a REST- based architecture. ● RESTful API uses versioning. e.g POST /V1/todos/ ● RESTful API explicitly take advantage of HTTP methodologies defined by the RFC 2616 protocol. They simply use "PUT" to change the state of or update a resource, which can be an object, file or block; "GET" to retrieve a resource; POST" to create that resource; and "DELETE" to remove it. ● Restful API uses HTTP Headers add information about the request and the response. ● Restful API uses HTTP Status Codes Correctly. ● Restful API is stateless. ● Restful API commonly use JSON or XML as a form of response. ● Each API request returns a subsequent API response.
  • 4. What is restfulAPI? ● REST - Representational State Transfer ● REST is an architecture style for designing networked applications. ● In many ways, the World Wide Web itself, based on HTTP, can be viewed as a REST-based architecture. ● RESTful API uses HTTP for all four CRUD (Create/Read/Update/Delete) operations. ● Each request returns a subsequent response. ● HTTP Verbs – POST, GET, UPDATE, PUT, PATCH, DELETE ● HTTP Headers – Content-Type, Content-Length etc. ● Commonly used by Mobile Applications and Single Paged Apps. ● Commonly use JSON or XML as a form of response.
  • 5. A stateless protocol does not require the server to retain information or status about each user for the duration of multiple requests.
  • 6. Requests are made up of a verb (POST, in this example), headers that describe the message, and a body (Hello World, in this example). The request is a message that describes what you want the server to accomplish. Likewise, the response consists of three pieces: a status code (200), headers describing the response and the body itself. HTTP Verbs describe the type of operation: GET: Retrieve a resource POST: Create a resource PUT: Update a resource DELETE: Delete a resource On the Web, the most common verb is GET. This is because the main purpose of a Web page's function is to request different resources that make up a page. In REST- based APIs, we leverage these verbs to describe the types of operations we want.
  • 7. Hello Laravel ● Taylor Otwell ● Open Source ● Well Documented ● Active Community ● Lots of Jobs ● Easy Grasp
  • 8. How about the security? ● REST api can be exposed to the public. They usually call it as Public APIs ● You can use OAUTH, HTTP Basic or JWT. ● OAuth is an open standard for authorization, commonly used as a way for Internet users to log in to third party websites using their Google, Facebook, Microsoft, Twitter, One Network, etc. accounts without exposing their password. ● HTTP Basic - In the context of an HTTP transaction basic access authentication is a method for an HTTP user agent to provide a user name and password when making a request. ● JSON Web Tokens are an open, industry standard RFC 7519 method for representing claims securely between two parties.
  • 9. TALK IS CHEAP SHOW ME THE CODE
  • 10. You will learn how to: ● Install LARAVEL ● Create URL Routes ● Create Migrations ● Create Seeder ● Create Models ● Create Controllers ● Create Requests Classes ● Create Validate Data