This document discusses Guzzle, a PHP HTTP client library, and creating RESTful APIs with PHP. It explains what Guzzle is, how to install it using Composer, and how to make asynchronous and concurrent requests with Guzzle. It then covers REST API concepts like HTTP verbs, request and response structures, status codes, and building a basic RESTful API in PHP. Code examples are provided to demonstrate creating a RESTful API using PHP.
Simple REST-API overview for developers. An newer version is here: https://www.slideshare.net/patricksavalle/super-simple-introduction-to-restapis-2nd-version-127968966
Simple REST-API overview for developers. An newer version is here: https://www.slideshare.net/patricksavalle/super-simple-introduction-to-restapis-2nd-version-127968966
This presentation walks through essential points for developing and working with REST APIs or web services to communicate through various platforms. This also explains HTTP methods.
What is REST API? REST API Concepts and Examples | EdurekaEdureka!
YouTube Link: https://youtu.be/rtWH70_MMHM
** Node.js Certification Training: https://www.edureka.co/nodejs-certification-training **
This Edureka PPT on 'What is REST API?' will help you understand the concept of RESTful APIs and show you the implementation of REST APIs'. Following topics are covered in this REST API tutorial for beginners:
Need for REST API
What is REST API?
Features of REST API
Principles of REST API
Methods of REST API
How to implement REST API?
Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
Castbox: https://castbox.fm/networks/505?country=in
This presentation walks through essential points for developing and working with REST APIs or web services to communicate through various platforms. This also explains HTTP methods.
What is REST API? REST API Concepts and Examples | EdurekaEdureka!
YouTube Link: https://youtu.be/rtWH70_MMHM
** Node.js Certification Training: https://www.edureka.co/nodejs-certification-training **
This Edureka PPT on 'What is REST API?' will help you understand the concept of RESTful APIs and show you the implementation of REST APIs'. Following topics are covered in this REST API tutorial for beginners:
Need for REST API
What is REST API?
Features of REST API
Principles of REST API
Methods of REST API
How to implement REST API?
Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
Castbox: https://castbox.fm/networks/505?country=in
WordCamp Raleigh 2016 - WP API, What is it good for? Absolutely Everything!Evan Mullins
See the Power of the WP API. Now that every WordPress website has (or will have) an API built-in, what can you do with it? It allows us to further separate the data from the code. Use WordPress to manage our data and then via the API easily access or update that data to power whatever we like. We’ll touch how to set it up and a handful of examples and then explore an iOS app pulling all it’s data and assets from a WordPress site via this API.
This will be geared for developers with some “how to” but also for everyone interested in the power of WordPress and where things are heading.
Learn how to spell WP-API
Learn about the power and flexibility it brings to WordPress
See it working in a live app
Super simple introduction to REST-APIs (2nd version)Patrick Savalle
See also: https://hersengarage.nl/rest-api-design-as-a-craft-not-an-art-a3fd97ed3ef4
An API in an interface or client-server-contract and REST is an HTTP design pattern. A REST-API is the de facto standard in web interface. It maps server resources onto URLs and allows CRUD-like manipulations of those (Create-Read-Update-Delete).
In this presentation we cover the basics of:
- The HTTP protocol
- The REST design pattern
- The API
This session will provide attendees with hands-on experience and in-depth knowledge of using Node.js as a runtime environment and Express.js as a web framework to build scalable and fast backend systems. Additionally, attendees will learn about Passport.js, a popular authentication middleware for Node.js, and how to use Prisma ORM to handle database operations in a type-safe and efficient manner.
The session will be conducted by experienced developers who have worked with these technologies and will be able to provide valuable insights and best practices. The session will be interactive and include plenty of opportunities for attendees to ask questions and work on real-world projects.
- Agile values and manifesto
- Scrum in details
- Themes, epics, and user stories
- Combining and splitting user stories.
- What could go wrong in Scrum and why?
- Overview in Other Agile methodologies:
- XP Agile Methodology
- KanBan Agile Methodology.
Search engine optimization course :
- Google ranking signals (overview)
- Spam types
- Google algorithms
- Panda
- Penguin
- Google tools
- Google web Master
- Google speed insights
- Google analytics
- Google disavow tool
- Other famous SEO tools
- Google penalty indicators
- Understanding website traffic sources
- Crawling and indexing
- On page SEO checklist
- Metadata famous errors
- How to optimize a blog article
- Yoast plugin
- Sitemaps file
- Robots files
- Off page SEO
- Links types
- Good link building strategy
- Bad link building strategy
This presentation was given to some fresh graduate developers to help them understand how to protect their web apps against some famous attacks like XSS . the presentation was a part of a bigger course that was designed to asset them
تلخيص مختصر لكتاب التوحيد و التوكل للامام الغزالى من سلسلة احياء علوم الدينABDEL RAHMAN KARIM
تلخيص مختصر لكتاب التوحيد و التوكل للامام الغزالى من سلسلة احياء علوم الدين
يشرح فيه الامام فنون التوكل على الله لجلب النفع او استبقاؤه او دفع الضر او قطعه و يوضح احوال المتوكلين على الله
Francesca Gottschalk - How can education support child empowerment.pptxEduSkills OECD
Francesca Gottschalk from the OECD’s Centre for Educational Research and Innovation presents at the Ask an Expert Webinar: How can education support child empowerment?
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
Synthetic Fiber Construction in lab .pptxPavel ( NSTU)
Synthetic fiber production is a fascinating and complex field that blends chemistry, engineering, and environmental science. By understanding these aspects, students can gain a comprehensive view of synthetic fiber production, its impact on society and the environment, and the potential for future innovations. Synthetic fibers play a crucial role in modern society, impacting various aspects of daily life, industry, and the environment. ynthetic fibers are integral to modern life, offering a range of benefits from cost-effectiveness and versatility to innovative applications and performance characteristics. While they pose environmental challenges, ongoing research and development aim to create more sustainable and eco-friendly alternatives. Understanding the importance of synthetic fibers helps in appreciating their role in the economy, industry, and daily life, while also emphasizing the need for sustainable practices and innovation.
Macroeconomics- Movie Location
This will be used as part of your Personal Professional Portfolio once graded.
Objective:
Prepare a presentation or a paper using research, basic comparative analysis, data organization and application of economic information. You will make an informed assessment of an economic climate outside of the United States to accomplish an entertainment industry objective.
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Dr. Vinod Kumar Kanvaria
Exploiting Artificial Intelligence for Empowering Researchers and Faculty,
International FDP on Fundamentals of Research in Social Sciences
at Integral University, Lucknow, 06.06.2024
By Dr. Vinod Kumar Kanvaria
A Strategic Approach: GenAI in EducationPeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
Embracing GenAI - A Strategic ImperativePeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...Levi Shapiro
Letter from the Congress of the United States regarding Anti-Semitism sent June 3rd to MIT President Sally Kornbluth, MIT Corp Chair, Mark Gorenberg
Dear Dr. Kornbluth and Mr. Gorenberg,
The US House of Representatives is deeply concerned by ongoing and pervasive acts of antisemitic
harassment and intimidation at the Massachusetts Institute of Technology (MIT). Failing to act decisively to ensure a safe learning environment for all students would be a grave dereliction of your responsibilities as President of MIT and Chair of the MIT Corporation.
This Congress will not stand idly by and allow an environment hostile to Jewish students to persist. The House believes that your institution is in violation of Title VI of the Civil Rights Act, and the inability or
unwillingness to rectify this violation through action requires accountability.
Postsecondary education is a unique opportunity for students to learn and have their ideas and beliefs challenged. However, universities receiving hundreds of millions of federal funds annually have denied
students that opportunity and have been hijacked to become venues for the promotion of terrorism, antisemitic harassment and intimidation, unlawful encampments, and in some cases, assaults and riots.
The House of Representatives will not countenance the use of federal funds to indoctrinate students into hateful, antisemitic, anti-American supporters of terrorism. Investigations into campus antisemitism by the Committee on Education and the Workforce and the Committee on Ways and Means have been expanded into a Congress-wide probe across all relevant jurisdictions to address this national crisis. The undersigned Committees will conduct oversight into the use of federal funds at MIT and its learning environment under authorities granted to each Committee.
• The Committee on Education and the Workforce has been investigating your institution since December 7, 2023. The Committee has broad jurisdiction over postsecondary education, including its compliance with Title VI of the Civil Rights Act, campus safety concerns over disruptions to the learning environment, and the awarding of federal student aid under the Higher Education Act.
• The Committee on Oversight and Accountability is investigating the sources of funding and other support flowing to groups espousing pro-Hamas propaganda and engaged in antisemitic harassment and intimidation of students. The Committee on Oversight and Accountability is the principal oversight committee of the US House of Representatives and has broad authority to investigate “any matter” at “any time” under House Rule X.
• The Committee on Ways and Means has been investigating several universities since November 15, 2023, when the Committee held a hearing entitled From Ivory Towers to Dark Corners: Investigating the Nexus Between Antisemitism, Tax-Exempt Universities, and Terror Financing. The Committee followed the hearing with letters to those institutions on January 10, 202
3. WHAT IS GUZZLE ?
Guzzle is a PHP HTTP client that makes it easy to
send HTTP requests and trivial to integrate with
web services.
Secondly, Guzzle provides a very clean API to work
with. Documentation is very important when
working with a library.Guzzle has done a very good
job by providing a comprehensive documentation
5. OVERVIEW OF COMPOSER
● It's a dependancy manager tool it is used
everywhere in the PHP World. All large
and well-known website components in
other ward it will help you do the
following :
● 1- Install 3rd party php tools and
framewords
● 2- Update version of the tools you use
● 3- Auto load your own code (so in the
future you will only use composer‘s
autoloader!!! Cool ?
●
● Composer has two separate elements :
✔ The first is Composer itself which is a
command line tool for grabbing and installing
what you want to install.
✔ The second is Packagist - the main composer
repository. This is where the packages you
may want to use are stored.
✔ Every thing Composer installs does that in a
directory names vendor which shouldn‘t has
any of your code
6. WORKING WITH COMPOSER
Working with composer will has only 3 task types :
1- Define what you want to install (frame work or tool) in json format file
2- Define where your classes files and configuration file or in the future name
spaces which you want to load in json file
3- Some command files to make composer run the settings you define
4- Require the autoloader of composer in your code
7. WORK SEQUENCE
1
•First Step
•Prepare composer.JSON File to tell composer what you want to install
2
•Second Step
•Prepare composer.json file about your autoload options
3
•Third step
•Run composer install command
8. 1 & 2 COMPOSER.JSON FILE
PREPARATION
The Composer.JSON has
two sections :
Require : The tools that you
want Composer to install
Autoload : where are your
classes and configuration files
for composer to load , in the
future that will be using name
space not classmap.
9. COMMAND LINE
Composer selfupdate
Composer install
Composer dump-autoload
Note :
When call composer install composer
will add some files and a directory with
name vendor in which all 3rd party tools
are
23. I) HTTP VERBS
HTTP Verb: the action counterpart to the
noun-based resource. The primary or most-
commonly-used HTTP verbs (or methods, as
they are properly called) are POST, GET, PUT,
PATCH, and DELETE.
24. GET /addresses.php?id=1
Retrieve the address which number is 1
POST : causes changes in the server
(most cases in create, so it shouldn’t be
repeated, it has a body $_POST
POST /addresses.php
Create new address with the data stored
in the post body
Are there other HTTP verbs ???
25. PUT : The PUT method replaces all current representations of the target resource with the
request payload..
Access PUT using PHP
$_PUT= json_decode(file_get_contents("php://input"),true);
Delete /addresses.php?id=1
update the address which number is 1 with current payload
$_SERVER[“REQUEST_METHOD”] : gives which verb was used GET OR POST,
Delete
26. Delete : Request that a resource be removed; however, the resource
does not have to be removed immediately. It could be an
asynchronous or long-running request.
Delete /addresses.php?id=1
delete the address which number is 1
$_SERVER[“REQUEST_METHOD”] : gives which verb was
used GET OR POST, Delete
28. HTTP STATUS CODES
2xx (Successful): The request was
successfully received, understood, and
accepted (200)
201 Created successfully
202 Deleted successfully
204 Updated successfully
200 request fulfilled
3xx (Redirection): Further action needs to be
taken in order to complete the request (301)
Setting a response code
http_response_code(500)
4xx (Client Error): The request contains bad
syntax or cannot be fulfilled (403 & 404)
403 No access right Forbidden
404 resource not found
405 method not found
402 payment required
401 bad authentication
400 bad request
406 resource not accesptable
5xx (Server Error): The server failed to fulfill
an apparently valid request (500)
500 internal server error
29. REST 101
REPRESENTATIONAL STATE TRANSFER
(transferring representation of resources)
SET OF PRINCIPALES ON HOW DATA
COULD BE TRANSFER ELEGANTLY VIA
HTTP
Each resource has at least one URL
The focus of a RESTful service is on
resources and how to provide access to
these resources.
A resource can easily be thought of as an
object as in OOP. A resource can consist
of other resources. While designing a
system, the first thing to do is identify
the resources and determine how they
are related to each other. This is similar
to the first step of designing a database:
Identify entities and relations.
A RESTful service uses a directory
hierarchy like human readable URIs to
address its resources
http://MyService/Persons/1
This URL has following format:
Protocol://ServiceName/ResourceType/R
esourceID
REST SET OF PRETY URLs
30. REST 101
Avoid verbs for your resource unless the resource is a process such as search
DON’T USE : http://MyService/DeletePerson/1. For Delete a person
RESTful systems should have a uniform interface. HTTP 1.1 provides a set of HTTP Verbs
(GET, POST, DELETE and PUT)
Examples
: Delete http://MyService/Persons/1
Get: http://MyService/Persons/1
Update: http://MyService/Persons/1
POST http://MyService/Persons/
You should use these methods only for the purpose for which they are intended.
For instance, never use GET to create or delete a resource on the server.
Use plural nouns for naming your resources.
Avoid using spaces
31. http://MyService/Persons?id=1
OR http://MyService/Persons/1
The query parameter approach works just fine and REST does not stop you from using
query parameters. However, this approach has a few disadvantages.
Increased complexity and reduced readability, which will increase if you have more
parameters
Use http://localhost/rest01.php/items/10
Not http://localhost/rest01.php?Resources=items&&id=10
$url_piecies = explode("/",$_SERVER["REQUEST_URI"]);
$resource = (isset($url_piecies[2]))? $url_piecies[2] : "" ;
$resource_id =(isset($url_piecies[3]) && is_numeric($url_piecies[3]) ) ?$url_piecies[3] : 0;
32. EXAMPLE OF A REST SERVICE
Resource Methods URI Description
Person GET,POST,PUT,
DELETE
http://MyService/Persons/{PersonID}Contains information about a person, can
create new person, update and delete
persons.
{PersonID} is optional
Format: text/JSON
Club GET,POST,PUT http://MyService/Clubs/{ClubID} Contains information about a club.
can create new club & update existing
clubs.
{ClubID} is optional
Format: text/JSON
Search GET http://MyService/Search? Search a person or a club
Format: text/xml
Query Parameters:
Name: String, Name of a person or a club
Country: String, optional, Name of the
country of a person or a club
33. REST SERVICE STEPS
Receiving the request & identifying it’s parameters ( VERB, RESOURCE, RESOURCE ID,
PARAMETERS)
Logging the request (why?)
Validating the request
If not valid request , send appropriate code and message
If valid request , start dispatching (initialize data access and business logic objects which will
handle the request)
Prepare the response based on the verb (Handler for GET, POST, PUT and DELETE)
If you have a valid response send it with appropriate response after logging it, why?
If you don’t have a valid response response is not of valid, send response code and error after
logging it
Try drawing a flow chart for it
35. REMEMBER BEFORE SEE THE WHOLE
THING THAT
$method = $_SERVER['REQUEST_METHOD’];
Use http://localhost/rest01.php/items/10
Not http://localhost/rest01.php?Resources=items&&id=10
$url_piecies = explode("/",$_SERVER["REQUEST_URI"]);
$resource = (isset($url_piecies[2]))? $url_piecies[2] : "" ;
$resource_id =(isset($url_piecies[3]) && is_numeric($url_piecies[3]) ) ?$url_piecies[3] : 0;
header (“Content-Type: application/json”);
$input = json_decode(file_get_contents('php://input'),true);
http_response_code(404)
36. QUIZ
1) A status code for an http method
not supported
a. 404
b. 400
c. 405
d. 204
2) If the error is because the
database connection failed, the
response code should be like
a. 5xx
b. 2xx
c. 4xx
d. 3xx
37. QUIZ
3- When you connect ASYNC-
------ is returned
a. promises
b. Handler
c. Endpoint
d. SDK
4- When you use curl_init() ---
-------- is returned
a. Promise
b. Handler
c. Endpoint
d. SDK
38. 5- Using Guzzle you can
a. Connect to multiple webservices
concurrently
b. Connect to a webservice
Asynchrounsoly
c. Send GET, POST or any other
HTTP requests
d. All the above
6- if parameter validation failes
because the user sends wrong email
address formats then appropriate
response code is
A. 403
B. 404
C. 400
D. 401
39. 7) HTTP Method that is Read
Only
GET
GET & DELETE
PUT
POST
8) HTTP Method that if
repeated can create many
new resources
PUT
POST
GET
DELETE
40. 9) REST has
a. Representational URLS
b. A single endpoint
c. Only JSON formats for communications
d. HTTP and other protocols such as SMTP
10) Attributes of a RESTFUL Request includes all
these except
a. Requested Resource
b. Request Method
c. Status code
d. Request Header
e. Resource ID
f. Parameters
g. Body
41. 11) There are 5 issues in the following code, what are
they ?
42. 12) There are 3 enhancement issues in the
following code what are they ?